集群可以设置systemd系统服务

This commit is contained in:
GoEdgeLab
2021-01-11 18:15:53 +08:00
parent e954e57f3d
commit 18f0f13cd0
12 changed files with 247 additions and 4 deletions

View File

@@ -0,0 +1,4 @@
<first-menu>
<menu-item :href="'/clusters/cluster/settings/services?clusterId=' + clusterId" code="setting">设置</menu-item>
<menu-item :href="'/clusters/cluster/settings/services/status?clusterId=' + clusterId" code="status">状态</menu-item>
</first-menu>

View File

@@ -0,0 +1,23 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="clusterId" :value="clusterId"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">自动加入Systemd服务</td>
<td>
<checkbox name="systemdIsOn" v-model="systemdIsOn"></checkbox>
<p class="comment">加入后可以利用systemd对节点进程进行管理并可自动随开机启动。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,37 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "menu"}
<div v-if="isRequesting" class="ui message">正在节点服务检测中,请稍候...</div>
<div v-if="!isRequesting">
<div v-if="results.length == 0">暂时还没有节点。</div>
<div v-else>
<div class="margin"></div>
<table class="ui table selectable">
<thead>
<tr>
<th>节点名</th>
<th>是否已启用服务</th>
<th>提示消息</th>
</tr>
</thead>
<tr v-for="result in results">
<td>{{result.nodeName}}</td>
<td>
<span v-if="result.isOk" class="green">Y</span>
<span v-else class="red">N</span>
</td>
<td>
<span :class="{red: !result.isOk}">{{result.message}}</span>
</td>
</tr>
</table>
<p class="comment">
<a href="" @click.prevent="reload()">[刷新]</a>
</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,22 @@
Tea.context(function () {
this.isRequesting = true
this.results = []
this.$delay(function () {
this.reload()
}, 2000)
this.reload = function () {
this.isRequesting = true
this.$post("$")
.params({
clusterId: this.clusterId
})
.success(function (resp) {
this.results = resp.data.results
})
.done(function () {
this.isRequesting = false
})
}
})