阶段性提交

This commit is contained in:
GoEdgeLab
2020-09-13 20:37:07 +08:00
parent 124cbd3302
commit e3501a5a68
155 changed files with 1317 additions and 13193 deletions

View 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>`
})

View File

@@ -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> &nbsp; {{teaName}}管理员系统 &nbsp;
<i class="ui icon leaf"></i> &nbsp; {{teaName}}管理员系统 &nbsp;
</a>
<div class="right menu">

View 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>

View File

@@ -1,4 +1,7 @@
.table .label {
margin-bottom: 0.5em;
}
a .red {
border-bottom: 1px #db2828 dashed;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -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"}

View File

@@ -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> &nbsp; <a href="" @click.prevent="deleteNode(node.id)">删除</a>

View File

@@ -1,3 +1,9 @@
.table .label {
margin-bottom: 0.5em;
}
a {
.red {
border-bottom: 1px #db2828 dashed;
}
}

View File

@@ -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"/>

View File

@@ -0,0 +1,7 @@
.installing-box {
line-height: 1.8;
}
.installing-box .blue {
color: #2185d0;
}
/*# sourceMappingURL=install.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["install.less"],"names":[],"mappings":"AAAA;EACC,gBAAA;;AADD,eAGC;EACC,cAAA","file":"install.css"}

View File

@@ -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>

View File

@@ -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)
});
}
})

View File

@@ -0,0 +1,7 @@
.installing-box {
line-height: 1.8;
.blue {
color: #2185d0;
}
}

View File

@@ -0,0 +1,3 @@
{$layout}
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -0,0 +1,3 @@
{$layout}
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -0,0 +1,3 @@
{$layout}
<p class="ui message">此功能暂未开放,敬请期待。</p>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -1,3 +1,6 @@
{$layout}
{$template "/left_menu"}
<p class="ui message">此功能暂未开放,敬请期待。</p>
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -0,0 +1,6 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
<p class="ui message">此功能暂未开放敬请期待。</p>
</div>

View File

@@ -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>

View File

@@ -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) {

View File

@@ -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>

View File

@@ -0,0 +1,5 @@
.right-box {
text-align: center;
margin-top: 1em;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -1 +1 @@
undefined
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA;EACC,kBAAA;EACA,eAAA","file":"index.css"}

View File

@@ -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>

View 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")
})
})
}
})

View File

@@ -0,0 +1,4 @@
.right-box {
text-align: center;
margin-top: 1em;
}

View File

@@ -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>

View File

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

View File

@@ -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>

View File

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