mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
阶段性提交
This commit is contained in:
46
web/public/js/components/common/network-addresses-box.js
Normal file
46
web/public/js/components/common/network-addresses-box.js
Normal file
@@ -0,0 +1,46 @@
|
||||
Vue.component("network-addresses-box", {
|
||||
props: ["vServerType", "vAddresses"],
|
||||
data: function () {
|
||||
let addresses = this.vAddresses
|
||||
if (addresses == null) {
|
||||
addresses = []
|
||||
}
|
||||
return {
|
||||
addresses: addresses
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"vServerType": function () {
|
||||
this.addresses = []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addAddr: function () {
|
||||
let that = this
|
||||
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType, {
|
||||
callback: function (resp) {
|
||||
var addr = resp.data.address;
|
||||
that.addresses.push(addr);
|
||||
if (["https", "https4", "https6"].$contains(addr.protocol)) {
|
||||
this.tlsProtocolName = "HTTPS";
|
||||
} else if (["tls", "tls4", "tls6"].$contains(addr.protocol)) {
|
||||
this.tlsProtocolName = "TLS";
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
removeAddr: function (index) {
|
||||
this.addresses.$remove(index);
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="addresses" :value="JSON.stringify(addresses)"/>
|
||||
<div v-if="addresses.length > 0">
|
||||
<div class="ui label small" v-for="(addr, index) in addresses">
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host}}</span><span v-if="addr.host.length == 0">*</span>:{{addr.portRange}}
|
||||
<a href="" @click.prevent="removeAddr(index)" title="删除"><i class="icon remove"></i></a> </div>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<a href="" @click.prevent="addAddr()">[添加端口绑定]</a>
|
||||
</div>`
|
||||
})
|
||||
@@ -21,7 +21,7 @@
|
||||
<!-- 顶部导航 -->
|
||||
<div class="ui menu top-nav blue inverted small borderless" v-cloak="">
|
||||
<a href="/" class="item">
|
||||
<i class="ui icon globe"></i> {{teaName}}管理员系统
|
||||
<i class="ui icon leaf"></i> {{teaName}}管理员系统
|
||||
</a>
|
||||
|
||||
<div class="right menu">
|
||||
|
||||
6
web/views/@default/clusters/cluster/@menu.html
Normal file
6
web/views/@default/clusters/cluster/@menu.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<second-menu>
|
||||
<menu-item :href="'/clusters/cluster?clusterId=' + clusterId" code="index">节点列表</menu-item>
|
||||
<menu-item :href="'/clusters/cluster/node/create?clusterId=' + clusterId" code="create">添加节点</menu-item>
|
||||
<!--<menu-item :href="'/clusters/cluster/node/import?clusterId=' + clusterId" code="import">批量导入</menu-item>-->
|
||||
<!--<menu-item :href="'/clusters/cluster/node/install?clusterId=' + clusterId" code="install">安装节点</menu-item>-->
|
||||
</second-menu>
|
||||
@@ -1,4 +1,7 @@
|
||||
.table .label {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
a .red {
|
||||
border-bottom: 1px #db2828 dashed;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,MAAO;EACN,oBAAA","file":"index.css"}
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,MAAO;EACN,oBAAA;;AAGD,CACC;EACC,iCAAA","file":"index.css"}
|
||||
@@ -2,36 +2,29 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<second-menu>
|
||||
<menu-item :href="'/clusters/cluster/node/create?clusterId=' + clusterId">添加节点</menu-item>
|
||||
<menu-item>安装节点</menu-item>
|
||||
</second-menu>
|
||||
{$template "menu"}
|
||||
|
||||
<h3>节点列表</h3>
|
||||
<form class="ui form segment" action="/clusters/cluster">
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
安装状态:
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" name="installedState" v-model="installState">
|
||||
<option value="0">[全部]</option>
|
||||
<option value="1">已安装</option>
|
||||
<option value="2">未安装</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button" type="submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>
|
||||
|
||||
<div v-show="nodes.length > 0">
|
||||
<form class="ui form segment" action="/clusters/cluster">
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
安装状态:
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" name="installedState">
|
||||
<option value="0">[全部]</option>
|
||||
<option value="1">已安装</option>
|
||||
<option value="2">未安装</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button" type="submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<table class="ui table selectable" v-if="nodes.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -74,7 +67,11 @@
|
||||
<span v-else-if="node.status.updatedAt > 0" class="red">已断开</span>
|
||||
<span v-else-if="node.status.updatedAt == 0" class="red">未连接</span>
|
||||
</div>
|
||||
<span v-else class="red">未安装</span>
|
||||
<div v-else>
|
||||
<span v-if="node.installStatus.isRunning" class="red">安装中</span>
|
||||
<a v-if="node.installStatus.isFinished && !node.installStatus.isOk" :href="'/clusters/cluster/node/install?clusterId=' + clusterId + '&nodeId=' + node.id" title="点击看安装错误"><span class="red">安装出错</span></a>
|
||||
<a v-else class="red" :href="'/clusters/cluster/node/install?clusterId=' + clusterId + '&nodeId=' + node.id" title="点击进安装界面"><span class="red">未安装</span></a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + node.id">详情</a> <a href="" @click.prevent="deleteNode(node.id)">删除</a>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
.table .label {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
.red {
|
||||
border-bottom: 1px #db2828 dashed;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<h3>添加节点</h3>
|
||||
{$template "/clusters/cluster/menu"}
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="clusterId" :value="clusterId"/>
|
||||
|
||||
7
web/views/@default/clusters/cluster/node/install.css
Normal file
7
web/views/@default/clusters/cluster/node/install.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.installing-box {
|
||||
line-height: 1.8;
|
||||
}
|
||||
.installing-box .blue {
|
||||
color: #2185d0;
|
||||
}
|
||||
/*# sourceMappingURL=install.css.map */
|
||||
1
web/views/@default/clusters/cluster/node/install.css.map
Normal file
1
web/views/@default/clusters/cluster/node/install.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["install.less"],"names":[],"mappings":"AAAA;EACC,gBAAA;;AADD,eAGC;EACC,cAAA","file":"install.css"}
|
||||
@@ -14,13 +14,28 @@
|
||||
<div v-if="!node.isInstalled">
|
||||
<h3>方法1:自动安装</h3>
|
||||
|
||||
<div v-if="installStatus != null && (installStatus.isRunning || installStatus.isFinished)"
|
||||
class="ui segment installing-box">
|
||||
<div v-if="installStatus.isRunning" class="blue">安装中...</div>
|
||||
<div v-if="installStatus.isFinished">
|
||||
<span v-if="installStatus.isOk" class="green">已安装成功</span>
|
||||
<span v-if="!installStatus.isOk" class="red">安装过程中发生错误:{{installStatus.error}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="installStatus != null && installStatus.isFinished">
|
||||
<button class="ui button small" type="button" @click.prevent="install()">重新安装</button>
|
||||
</div>
|
||||
<div v-if="installStatus == null || (!installStatus.isFinished && !installStatus.isRunning)">
|
||||
<button class="ui button small" type="button" @click.prevent="install()">开始安装</button>
|
||||
</div>
|
||||
|
||||
<h3>方法2:手动安装</h3>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>配置文件<em>(configs/api.yaml)</em></td>
|
||||
<td>
|
||||
<pre>rpc:
|
||||
endpoints: [ "${endpoint}" ]
|
||||
endpoints: [ {{apiEndpoints}} ]
|
||||
nodeId: "{{node.uniqueId}}"
|
||||
secret: "{{node.secret}}"</pre>
|
||||
</td>
|
||||
@@ -28,10 +43,14 @@ secret: "{{node.secret}}"</pre>
|
||||
<tr>
|
||||
<td class="title">安装目录</td>
|
||||
<td>
|
||||
<div v-if="node.installDir.length == 0">使用集群设置<span v-if="node.cluster != null && node.cluster.installDir.length > 0">({{node.cluster.installDir}})</span></div>
|
||||
<div v-if="node.installDir.length == 0">使用集群设置<span
|
||||
v-if="node.cluster != null && node.cluster.installDir.length > 0">({{node.cluster.installDir}})</span>
|
||||
</div>
|
||||
<span v-else>{{node.installDir}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a href="" @click.prevent="updateNodeIsInstalled(true)">[修改为已安装状态]</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,20 @@
|
||||
Tea.context(function () {
|
||||
this.$delay(function () {
|
||||
this.reloadStatus(this.nodeId)
|
||||
})
|
||||
|
||||
// 开始安装
|
||||
this.install = function () {
|
||||
this.$post("$")
|
||||
.params({
|
||||
nodeId: this.nodeId
|
||||
})
|
||||
.success(function () {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// 设置节点安装状态
|
||||
this.updateNodeIsInstalled = function (isInstalled) {
|
||||
teaweb.confirm("确定要将当前节点修改为未安装状态?", function () {
|
||||
this.$post("/clusters/cluster/node/updateInstallStatus")
|
||||
@@ -9,4 +25,21 @@ Tea.context(function () {
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新状态
|
||||
this.reloadStatus = function (nodeId) {
|
||||
this.$post("/clusters/cluster/node/status")
|
||||
.params({
|
||||
nodeId: nodeId
|
||||
})
|
||||
.success(function (resp) {
|
||||
this.installStatus = resp.data.installStatus
|
||||
this.node.isInstalled = resp.data.isInstalled
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.reloadStatus(nodeId)
|
||||
}, 1000)
|
||||
});
|
||||
}
|
||||
})
|
||||
7
web/views/@default/clusters/cluster/node/install.less
Normal file
7
web/views/@default/clusters/cluster/node/install.less
Normal file
@@ -0,0 +1,7 @@
|
||||
.installing-box {
|
||||
line-height: 1.8;
|
||||
|
||||
.blue {
|
||||
color: #2185d0;
|
||||
}
|
||||
}
|
||||
3
web/views/@default/db/index.html
Normal file
3
web/views/@default/db/index.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{$layout}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
3
web/views/@default/dns/index.html
Normal file
3
web/views/@default/dns/index.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{$layout}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
3
web/views/@default/log/index.html
Normal file
3
web/views/@default/log/index.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{$layout}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
6
web/views/@default/servers/components/cache/index.html
vendored
Normal file
6
web/views/@default/servers/components/cache/index.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
6
web/views/@default/servers/components/group/index.html
Normal file
6
web/views/@default/servers/components/group/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
@@ -1,3 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
6
web/views/@default/servers/components/log/index.html
Normal file
6
web/views/@default/servers/components/log/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
6
web/views/@default/servers/components/ssl/index.html
Normal file
6
web/views/@default/servers/components/ssl/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
6
web/views/@default/servers/components/waf/index.html
Normal file
6
web/views/@default/servers/components/waf/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{$layout}
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放敬请期待。</p>
|
||||
</div>
|
||||
@@ -30,14 +30,7 @@
|
||||
<tr>
|
||||
<td>绑定端口 *</td>
|
||||
<td>
|
||||
<input type="hidden" name="addresses" :value="JSON.stringify(addresses)"/>
|
||||
<div v-if="addresses.length > 0">
|
||||
<div class="ui label small" v-for="(addr, index) in addresses">
|
||||
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host}}</span><span v-if="addr.host.length == 0">*</span>:{{addr.portRange}}
|
||||
<a href="" @click.prevent="removeAddr(index)" title="删除"><i class="icon remove"></i></a> </div>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<a href="" @click.prevent="addPort()">[添加端口绑定]</a>
|
||||
<network-addresses-box :v-server-type="serverType"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Tea.context(function () {
|
||||
this.serverType = "httpProxy";
|
||||
this.addresses = [];
|
||||
this.tlsProtocolName = ""
|
||||
|
||||
this.serverNames = [];
|
||||
@@ -10,29 +9,10 @@ Tea.context(function () {
|
||||
this.success = NotifySuccess("保存成功", "/servers");
|
||||
|
||||
this.changeServerType = function () {
|
||||
this.addresses = [];
|
||||
this.origins = [];
|
||||
this.tlsProtocolName = "";
|
||||
};
|
||||
|
||||
this.addPort = function () {
|
||||
teaweb.popup("/servers/addPortPopup?serverType=" + this.serverType, {
|
||||
callback: function (resp) {
|
||||
var addr = resp.data.address;
|
||||
this.addresses.push(addr);
|
||||
if (["https", "https4", "https6"].$contains(addr.protocol)) {
|
||||
this.tlsProtocolName = "HTTPS";
|
||||
} else if (["tls", "tls4", "tls6"].$contains(addr.protocol)) {
|
||||
this.tlsProtocolName = "TLS";
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
this.removeAddr = function (index) {
|
||||
this.addresses.$remove(index);
|
||||
};
|
||||
|
||||
this.addServerName = function () {
|
||||
teaweb.popup("/servers/addServerNamePopup", {
|
||||
callback: function (resp) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<table class="ui table selectable" v-if="servers.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>服务名称</th>
|
||||
<th>服务类型</th>
|
||||
<th>部署集群</th>
|
||||
@@ -16,7 +15,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="server in servers">
|
||||
<td>{{server.id}}</td>
|
||||
<td>{{server.name}}</td>
|
||||
<td>{{server.serverTypeName}}</td>
|
||||
<td>{{server.cluster.name}}</td>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.right-box {
|
||||
text-align: center;
|
||||
margin-top: 1em;
|
||||
}
|
||||
/*# sourceMappingURL=index.css.map */
|
||||
@@ -1 +1 @@
|
||||
undefined
|
||||
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;EACA,eAAA","file":"index.css"}
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
<div class="ui message">此功能暂未开放,敬请期待。</div>
|
||||
<button class="ui button red" type="button" @click.prevent="deleteServer(serverId)">删除当前服务</button>
|
||||
</div>
|
||||
13
web/views/@default/servers/server/delete/index.js
Normal file
13
web/views/@default/servers/server/delete/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
Tea.context(function () {
|
||||
this.deleteServer = function (serverId) {
|
||||
teaweb.confirm("确定要删除当前服务吗?", function () {
|
||||
this.$post("$")
|
||||
.params({
|
||||
"serverId": serverId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successURL("删除成功", "/servers")
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
.right-box {
|
||||
text-align: center;
|
||||
margin-top: 1em;
|
||||
}
|
||||
@@ -2,5 +2,43 @@
|
||||
|
||||
{$template "/left_menu"}
|
||||
<div class="right-box">
|
||||
<div class="ui message">此功能暂未开放,敬请期待。</div>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="server.id"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">服务名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="60" ref="focus" v-model="server.name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>部署的集群 *</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="clusterId" v-model="server.clusterId">
|
||||
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>服务类型 *</td>
|
||||
<td>
|
||||
{{typeName}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3" v-model="server.description"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/index.js
Normal file
3
web/views/@default/servers/server/settings/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -3,5 +3,17 @@
|
||||
{$template "/left_menu"}
|
||||
|
||||
<div class="right-box">
|
||||
<p class="ui message">此功能暂未开放,敬请期待。</p>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="serverId" :value="serverId"/>
|
||||
<input type="hidden" name="serverType" :value="serverType"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">绑定端口 *</td>
|
||||
<td>
|
||||
<network-addresses-box :v-server-type="serverType" :v-addresses="addresses"></network-addresses-box>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
3
web/views/@default/servers/server/settings/tcp/index.js
Normal file
3
web/views/@default/servers/server/settings/tcp/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
Reference in New Issue
Block a user