2018-01-28 07:48:37 +00:00
|
|
|
|
{% template "common/header" . %}
|
2017-04-28 03:54:46 +00:00
|
|
|
|
<div class="ui grid">
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{%template "manage/menu" .%}
|
2017-04-28 03:54:46 +00:00
|
|
|
|
<div class="twelve wide column">
|
|
|
|
|
<div class="pageHeader">
|
|
|
|
|
<div class="segment">
|
|
|
|
|
<h3 class="ui dividing header">
|
|
|
|
|
<div class="content">
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{%.Title%}
|
2017-04-28 03:54:46 +00:00
|
|
|
|
</div>
|
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<form class="ui form fluid vertical segment">
|
2017-04-30 17:12:07 +00:00
|
|
|
|
|
2017-04-28 03:54:46 +00:00
|
|
|
|
<div class="field">
|
|
|
|
|
<label>
|
|
|
|
|
<div class="content">Slack WebHook URL</div>
|
|
|
|
|
</label>
|
|
|
|
|
<div class="ui small input">
|
2018-01-28 07:48:37 +00:00
|
|
|
|
<input type="text" id="url" value="{%.Slack.Url%}">
|
2017-04-30 17:12:07 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui primary button" @click="updateUrl">保存</div>
|
|
|
|
|
|
|
|
|
|
<br><br><br>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="content">Slack Channel(配置任务通知时,可选择多Channel)</div><p></p>
|
|
|
|
|
<div class="fields">
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{%range $i, $v := .Slack.Channels%}
|
2017-04-30 17:12:07 +00:00
|
|
|
|
<div class="field">
|
|
|
|
|
<div class="ui segment">
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{%.Name%} <div class="ui blue button" @click="removeChannel({%.Id%})">删除</div>
|
2017-04-30 17:12:07 +00:00
|
|
|
|
</div>
|
2017-04-28 03:54:46 +00:00
|
|
|
|
</div>
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{%end%}
|
2017-04-28 03:54:46 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-30 17:12:07 +00:00
|
|
|
|
<div class="ui facebook button" @click="createChannel">新增Channel</div>
|
2017-04-28 03:54:46 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-30 17:12:07 +00:00
|
|
|
|
|
2017-04-28 03:54:46 +00:00
|
|
|
|
<script type="text/javascript">
|
2017-04-30 17:12:07 +00:00
|
|
|
|
new Vue({
|
|
|
|
|
el: '.ui.form',
|
|
|
|
|
methods: {
|
|
|
|
|
updateUrl: function() {
|
|
|
|
|
var url = $('#url').val();
|
2017-04-30 22:02:49 +00:00
|
|
|
|
util.post('/manage/slack/url', {"url": url}, function(code, message) {
|
2017-04-30 17:12:07 +00:00
|
|
|
|
util.alertSuccess();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
createChannel: function() {
|
|
|
|
|
swal({
|
|
|
|
|
title: "新增Channel",
|
|
|
|
|
type: "input",
|
|
|
|
|
showCancelButton: true,
|
|
|
|
|
closeOnConfirm: false,
|
|
|
|
|
animation: "slide-from-top"
|
|
|
|
|
},
|
|
|
|
|
function(inputValue){
|
|
|
|
|
if (inputValue === false) return false;
|
|
|
|
|
|
|
|
|
|
if (inputValue === "") {
|
|
|
|
|
swal.showInputError("请输入Channel");
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 22:02:49 +00:00
|
|
|
|
util.post('/manage/slack/channel',
|
2017-04-30 17:12:07 +00:00
|
|
|
|
{"channel": inputValue},
|
|
|
|
|
function(code, message) {
|
|
|
|
|
util.alertSuccess();
|
|
|
|
|
location.reload();
|
|
|
|
|
}
|
|
|
|
|
);
|
2017-04-28 03:54:46 +00:00
|
|
|
|
|
2017-04-30 17:12:07 +00:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
removeChannel: function(id) {
|
2017-04-30 22:02:49 +00:00
|
|
|
|
util.post('/manage/slack/channel/remove/' + id, {}, function(code, message) {
|
2017-04-30 17:12:07 +00:00
|
|
|
|
location.reload();
|
|
|
|
|
});
|
2017-04-28 03:54:46 +00:00
|
|
|
|
}
|
2017-04-30 17:12:07 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2017-04-28 03:54:46 +00:00
|
|
|
|
</script>
|
2018-01-28 07:48:37 +00:00
|
|
|
|
{% template "common/footer" . %}
|