可以在分组中设置一些全局配置选项

This commit is contained in:
刘祥超
2021-09-22 19:39:38 +08:00
parent 92777366ec
commit 4016296e0b
66 changed files with 1698 additions and 214 deletions

View File

@@ -0,0 +1,7 @@
<first-menu>
<menu-item href="/servers/groups">分组列表</menu-item>
<span class="item disabled">|</span>
<menu-item :href="'/servers/groups/group?groupId=' + group.id" code="group.index">"{{group.name}}"详情</menu-item>
<menu-item :href="'/servers/groups/group/settings?groupId=' + group.id" :active="!firstMenuItem.startsWith('group.')">全局设置 &nbsp;<tip-icon content="这里添加的设置将会自动应用到当前分组下的所有服务。"></tip-icon></menu-item>
<menu-item :href="'/servers/groups/group/update?groupId=' + group.id" code="group.update">修改</menu-item>
</first-menu>

View File

@@ -0,0 +1,84 @@
{$layout}
{$template "menu"}
<table class="ui table definition selectable">
<tr>
<td class="title">分组名称</td>
<td>
{{group.name}}
</td>
</tr>
</table>
<h3>服务</h3>
<p class="comment" v-if="servers.length == 0">暂时还没有服务。</p>
<table class="ui table selectable celled" v-if="servers.length > 0">
<thead>
<tr>
<th>服务名称</th>
<th>所属用户</th>
<th>部署集群</th>
<th>域名</th>
<th>端口</th>
<th class="two wide center">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="server in servers">
<td><a :href="'/servers/server?serverId=' + server.id"><keyword :v-word="keyword">{{server.name}}</keyword></a>
<div style="margin-top:0.4em">
<grey-label>{{server.serverTypeName}}</grey-label>
</div>
</td>
<td>
<span v-if="server.user != null">{{server.user.fullname}}<link-icon v-if="canVisitUser" :href="'/users/user?userId=' + server.user.id"></link-icon></span>
<span v-else>-</span>
</td>
<td>{{server.cluster.name}}</td>
<td>
<span v-if="server.serverNames.length > 0">
<span v-if="server.serverNames[0].subNames == null || server.serverNames[0].subNames.length == 0"><keyword :v-word="keyword">{{server.serverNames[0].name}}</keyword></span>
<span v-else><keyword :v-word="keyword">{{server.serverNames[0].subNames[0]}}</keyword></span>
<span v-if="server.countServerNames > 1">等{{server.countServerNames}}个域名 <popup-icon :href="'/servers/serverNamesPopup?serverId=' + server.id" height="20em"></popup-icon></span>
</span>
<span v-else class="disabled">-</span>
<!-- 审核中 -->
<div v-if="server.isAuditing" style="margin-top: 0.5em">
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核中 &nbsp;<i class="icon long arrow right alternate"></i></a>
</div>
<!-- 审核失败 -->
<div v-if="!server.auditingIsOk" style="margin-top: 0.5em">
<a class="ui label basic tiny red" title="点击跳到审核页面" :href="'/servers/server/settings/serverNames?serverId=' + server.id">审核不通过 &nbsp;<i class="icon long arrow right alternate"></i></a>
</div>
</td>
<td>
<span v-if="server.ports.length == 0">-</span>
<div v-for="port in server.ports">
<tiny-basic-label><keyword :v-word="keyword">{{port.portRange}}</keyword><span class="small">{{port.protocol}}</span></tiny-basic-label>
</div>
</td>
<td class="center">
<div v-if="!checkDNS">
<label-on :v-is-on="server.isOn"></label-on>
</div>
<div v-else>
<span v-if="!server.isOn" class="grey">停用中</span>
<span v-else-if="server.status.isOk" class="green">正常</span>
<span v-else-if="server.status.message.length == 0">检查中</span>
<span v-else class="red">{{server.status.message}}
<tip-icon :content="server.status.todo"></tip-icon>
</span>
</div>
</td>
<td>
<a :href="'/servers/server?serverId=' + server.id">详情</a> &nbsp;
<a :href="'/servers/server/settings?serverId=' + server.id">设置</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.checkDNS = false
})

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前代理服务没有开启,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

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

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前代理服务没有开启,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

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

View File

@@ -0,0 +1,5 @@
<second-menu>
<menu-item :href="Tea.url('.', {groupId: group.id})" code="index">源站列表</menu-item>
<menu-item :href="Tea.url('.scheduling', {groupId: group.id})" code="scheduling">调度算法</menu-item>
<menu-item :href="Tea.url('.setting', {groupId: group.id})" code="setting">更多设置</menu-item>
</second-menu>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div v-if="!reverseProxyRef.isPrior || !reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前代理服务没有开启,可以通过点击 <a :href="Tea.url('.setting', { groupId: group.id })">[更多设置]</a> 开启 。</warning-message>
</div>
<div :class="{'opacity-mask': !reverseProxyRef.isPrior || !reverseProxyRef.isOn}">
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyConfig.id + '&serverType=' + serverType"
:v-is-group="true"></origin-list-box>
</div>
</div>

View File

@@ -0,0 +1,9 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<origin-scheduling-view-box :v-scheduling="scheduling" :v-params="'type=group&groupId=' + group.id + '&reverseProxyId=' + reverseProxyId + '&family=' + family"></origin-scheduling-view-box>
</div>

View File

@@ -0,0 +1,15 @@
{$layout}
{$template "/servers/groups/group/menu"}
{$template "/left_menu_without_menu"}
<div class="right-box without-menu">
{$template "menu"}
<div class="margin"></div>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-reverse-proxy-config="reverseProxyConfig" :v-family="family" :v-is-group="true"></reverse-proxy-box>
<submit-btn></submit-btn>
</form>
</div>

View File

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

View File

@@ -1,6 +1,6 @@
{$layout "layout_popup"}
{$layout "layout"}
{$template "menu"}
<h3>修改分组</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="groupId" :value="group.id"/>
<table class="ui table definition selectable">

View File

@@ -0,0 +1,5 @@
Tea.context(function () {
this.success = NotifySuccess("保存成功", ".", {
groupId: this.group.id
})
})

View File

@@ -1,7 +1,7 @@
{$layout}
<first-menu>
<menu-item href="/servers/components/groups" active="true">列表</menu-item>
<menu-item href="/servers/groups" active="true">列表</menu-item>
<span class="item">|</span>
<a href="" class="item" @click.prevent="createGroup()">[创建]</a>
</first-menu>
@@ -21,13 +21,15 @@
<tbody v-for="group in groups" :data-group-id="group.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td>{{group.name}}</td>
<td>
<a :href="'/servers/groups/group?groupId=' + group.id">{{group.name}}</a>
</td>
<td class="center">
<a :href="'/servers?groupId=' + group.id" v-if="group.countServers > 0">{{group.countServers}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a href="" @click.prevent="updateGroup(group.id)">修改</a> &nbsp; <a href="" @click.prevent="deleteGroup(group.id)">删除</a>
<a :href="'/servers/groups/group?groupId=' + group.id">详情</a> &nbsp; <a href="" @click.prevent="deleteGroup(group.id)">删除</a>
</td>
</tr>
</tbody>

View File

@@ -6,7 +6,7 @@ Tea.context(function () {
document.querySelectorAll("*[data-group-id]").forEach(function (element) {
groupIds.push(element.getAttribute("data-group-id"))
})
that.$post("/servers/components/groups/sort")
that.$post("/servers/groups/sort")
.params({
groupIds: groupIds
})
@@ -17,17 +17,7 @@ Tea.context(function () {
})
this.createGroup = function () {
teaweb.popup("/servers/components/groups/createPopup", {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateGroup = function (groupId) {
teaweb.popup("/servers/components/groups/updatePopup?groupId=" + groupId, {
teaweb.popup("/servers/groups/createPopup", {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
@@ -39,7 +29,7 @@ Tea.context(function () {
this.deleteGroup = function (groupId) {
let that = this
teaweb.confirm("确定要删除这个分组吗?", function () {
that.$post("/servers/components/groups/delete")
that.$post("/servers/groups/group/delete")
.params({
groupId: groupId
})

View File

@@ -129,7 +129,8 @@
</div>
</td>
<td>
<a :href="'/servers/server?serverId=' + server.id">详情</a>
<a :href="'/servers/server?serverId=' + server.id">详情</a> &nbsp;
<a :href="'/servers/server/settings?serverId=' + server.id">设置</a>
</td>
</tr>
</table>

View File

@@ -4,12 +4,19 @@
<div class="right-box">
{$template "menu"}
<div v-if="!reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前代理服务没有开启,可以通过点击 <a :href="'/servers/server/settings/reverseProxy/setting?serverId=' + serverId">[更多设置]</a> 开启 </warning-message>
</div>
<div v-if="hasGroupConfig">
<div class="margin"></div>
<warning-message>由于已经在当前服务分组中进行了对应的配置,在这里的配置将不会生效</warning-message>
</div>
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyConfig.id"></origin-list-box>
<div :class="{'opacity-mask': hasGroupConfig}">
<div v-if="!reverseProxyRef.isOn">
<div class="margin"></div>
<warning-message>当前代理服务没有开启,可以通过点击 <a :href="'/servers/server/settings/reverseProxy/setting?serverId=' + serverId">[更多设置]</a> 开启 。</warning-message>
</div>
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-server-type="serverType"
:v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyConfig.id"></origin-list-box>
</div>
</div>