阶段性提交

This commit is contained in:
GoEdgeLab
2020-07-30 22:41:35 +08:00
parent 16d2dff57a
commit e6266b7dc3
28 changed files with 1879 additions and 153 deletions

View File

@@ -208,6 +208,9 @@ td .label.tiny {
padding: 2px;
font-size: 0.9em;
}
td .label.small {
margin-bottom: 0.6em;
}
/** Menu **/
.first-menu .menu.text {
margin-top: 0 !important;

View File

@@ -1 +1 @@
{"version":3,"sources":["@layout_popup.less"],"names":[],"mappings":";AACA;EACC,WAAA;;AAGD;EACC,aAAA;;AAGD;EACC,qBAAA;;AAGD,CAAC;AAAW,CAAC,SAAS;AAAQ,CAAC,SAAS;AAAS,IAAI;EACpD,sBAAA;;AAGD,CAAC;AAAU,IAAI;AAAU,IAAI;EAC5B,cAAA;;AAGD,IAAI;AAAO,KAAK;AAAO,CAAC;EACvB,sBAAA;;AAGD,CAAC;EACA,iBAAA;;AAGD,IAAI;AAAM,GAAG;EACZ,cAAA;;AAGD,GAAG,IAAI;EACN,mBAAmB,8CAAnB;;AAGD;EACC,uBAAA;;AAGD,MAAM;EACL,sBAAA;;AAGD,MAAM;EACL,sBAAA;;AAGD,MAAM;EACL,sBAAA;;AAGD,MAAO;AAAI,MAAO;EACjB,2BAAA;;AAGD,CAAC;AAAU,GAAG;EACb,yBAAA;EACA,kBAAA;;AAGD,CAAC,QAAS;AAAI,GAAG,QAAS;EACzB,6BAAA;;AAGD;EACC,mBAAA;EACA,2BAAA;EACA,gBAAA;EACA,uBAAA;;AAGD,GAAG;AAAS,CAAC;EACZ,eAAA;;;AAID,GAAG;EACF,UAAA;;AAGD,GAAG;EACF,YAAA;;AAGD,GAAG;EACF,UAAA;;AAGD,GAAG;EACF,WAAA;;;AAID,MAAM;EACL,aAAA;;;AAID;EACC,kBAAA;EACA,UAAA;EACA,UAAA;EACA,mBAAA;EACA,kBAAA;EACA,UAAA;;AASD,mBANqC;EACpC;IACC,SAAA;;;AAIF,KAAK;EACJ,SAAA;;AAGD,KAAK;EACJ,UAAA;;AASD,mBANq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AAKF,KAAK;EACJ,0BAAA;;AAGD,KAAK;EACJ,yBAAA;;AAGD,EAAG,OAAM;EACR,YAAA;EACA,gBAAA;;AAGD,EAAG,OAAM;EACR,oBAAA;;;AAID,WAAY,MAAK;EAChB,wBAAA;EACA,2BAAA;;AAGD,WAAY;EACX,wBAAA;EACA,2BAAA;;AAGD,YAAa,MAAK;EACjB,wBAAA;EACA,2BAAA;;AAGD,YAAa,MAAK,KAAM;EACvB,kBAAA;;AAGD,YAAa;EACZ,wBAAA;;AAGD,KAAM;EACL,aAAA;;;AAID,IAAI;AAAQ,GAAG;EACd,yBAAA;;AAGD,GAAG;EACF,8BAAA;;;AAID,QAAS;EACR,WAAA;EACA,kBAAA;;;AAID,SAAU,MAAM;AAAG,SAAU;EAC5B,2BAAA;;;AAID;EACC,eAAA;EAEA,2BAAA;;AAHD,KAKC;EACC,qBAAA;EACA,mBAAA;EACA,WAAA;EACA,iBAAA;EACA,SAAA;EACA,gBAAA;EACA,sBAAA;EACA,cAAA;;AAbF,KAgBC,EAAC;EACA,8BAAA;EACA,YAAA;;AAlBF,KAqBC,EAAC;EACA,gBAAA;;;AAKF;EACC,kBAAA;;AAGD,cAAc;AAAQ,aAAa;AAAQ,YAAY;EACtD,iCAAA;;AAGD;AAAgB;AAAe;EAC9B,iCAAA;;AAGD;EACC,2BAAA","file":"@layout_popup.css"}

View File

@@ -254,6 +254,10 @@ td .label.tiny {
font-size: 0.9em;
}
td .label.small {
margin-bottom: 0.6em;
}
/** Menu **/
.first-menu .menu.text {
margin-top: 0 !important;

View File

@@ -2,6 +2,7 @@
{$template "menu"}
<div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="grantId" :value="grantId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">节点名称 *</td>
@@ -18,9 +19,26 @@
</td>
</tr>
<tr>
<td>SSH登录授权</td>
<td>SSH主机地址</td>
<td>
<input type="text" name="sshHost" maxlength="64"/>
<p class="comment">比如192.168.1.100</p>
</td>
</tr>
<tr>
<td>SSH主机端口</td>
<td>
<input type="text" name="sshPort" maxlength="5"/>
<p class="comment">比如22。</p>
</td>
</tr>
<tr>
<td>SSH登录认证</td>
<td>
<div class="ui label small" v-if="grant != null">{{grant.name}}<span class="small">{{grant.methodName}}</span> <a href="" title="删除" @click.prevent="removeGrant()"><i class="icon remove"></i></a> </div>
<div v-if="grant == null">
<a href="" @click.prevent="selectGrant()">[选择已有认证]</a> &nbsp; &nbsp; <a href="" @click.prevent="createGrant()">[添加新认证]</a>
</div>
</td>
</tr>
</table>

View File

@@ -1,3 +1,36 @@
Tea.context(function () {
this.grantId = 0;
this.grant = null;
this.success = NotifySuccess("保存成功", "/nodes");
this.selectGrant = function () {
var that = this;
teaweb.popup("/nodes/grants/selectPopup", {
callback: function (resp) {
that.grantId = resp.data.grant.id;
if (that.grantId > 0) {
that.grant = resp.data.grant;
}
}
});
};
this.createGrant = function () {
var that = this;
teaweb.popup("/nodes/grants/createPopup", {
height: "31em",
callback: function (resp) {
that.grantId = resp.data.grant.id;
if (that.grantId > 0) {
that.grant = resp.data.grant;
}
}
});
};
this.removeGrant = function () {
this.grant = null;
this.grantId = 0;
};
});

View File

@@ -0,0 +1,57 @@
{$layout "layout_popup"}
<h3>添加新认证</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<table class="ui table selectable definition">
<tr>
<td>名称 *</td>
<td>
<input type="text" name="name" maxlength="100" ref="focus"/>
</td>
</tr>
<tr>
<td class="title">认证方式</td>
<td>
<select class="ui dropdown" style="width:10em" name="method" v-model="method">
<option v-for="method in methods" :value="method.value">{{method.name}}</option>
</select>
</td>
</tr>
<!-- 用户名/密码 -->
<tbody v-if="method == 'user'">
<tr>
<td>SSH用户名 *</td>
<td>
<input type="text" name="username" maxlength="100"/>
<p class="comment">SSH登录用户名。</p>
</td>
</tr>
<tr>
<td>SSH密码</td>
<td><input type="password" name="password" maxlength="100"/>
<p class="comment">SSH登录用户密码。</p> </td>
</tr>
</tbody>
<!-- 私钥 -->
<tbody v-if="method == 'privateKey'">
<tr>
<td>RSA私钥 *</td>
<td>
<textarea name="privateKey"></textarea>
<p class="comment">用来生成登录SSH公钥的私钥</p>
</td>
</tr>
</tbody>
<tr>
<td>描述</td>
<td>
<textarea name="description" rows="3"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,5 @@
Tea.context(function () {
this.method = "user";
this.success = NotifyPopup;
});

View File

@@ -0,0 +1,18 @@
{$layout "layout_popup"}
<h3>选择认证</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="grantId" :value="grantId"/>
<table class="ui table selectable definition">
<tr>
<td class="title">选择认证</td>
<td>
<span v-if="grants.length == 0">暂时还没有可用的认证。</span>
<a class="ui label small" v-for="grant in grants" :class="{blue:grantId == grant.id}" @click.prevent="selectGrant(grant)">{{grant.name}} <span class="small">{{grant.methodName}}</span></a>
</td>
</tr>
</table>
<submit-btn>确定</submit-btn>
</form>

View File

@@ -0,0 +1,9 @@
Tea.context(function () {
this.grantId = 0;
this.selectGrant = function (grant) {
this.grantId = grant.id;
};
this.success = NotifyPopup;
});

View File

@@ -8,20 +8,30 @@
<tr>
<th>ID</th>
<th>节点名称</th>
<th>IP</th>
<th>所属集群</th>
<th>状态</th>
<th>CPU</th>
<th>内存</th>
<th>流量</th>
<th>连接数</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="node in nodes">
<td>{{node.id}}</td>
<td>{{node.name}}</td>
<td></td>
<td>{{node.cluster.name}}</td>
<td>
已安装|安装中|安装错误|运行中|失去连接
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<a href="">详情</a> &nbsp; <a href="">删除</a>
<a :href="'/nodes/node?nodeId=' + node.id">详情</a> &nbsp; <a href="" @click.prevent="deleteNode(node.id)">删除</a>
</td>
</tr>
</table>

View File

@@ -0,0 +1,11 @@
Tea.context(function () {
this.deleteNode = function (nodeId) {
teaweb.confirm("确定要删除这个节点吗?", function () {
this.$post(".delete")
.params({
nodeId: nodeId
})
.refresh();
});
};
});

View File

@@ -0,0 +1,57 @@
{$layout}
<second-menu>
<menu-item :href="'/nodes/node?nodeId=' + nodeId" active="true">详情</menu-item>
<menu-item :href="'/nodes/update?nodeId=' + nodeId">修改</menu-item>
</second-menu>
<table class="ui table definition selectable">
<tr>
<td class="title">节点名称</td>
<td>{{node.name}}</td>
</tr>
<tr>
<td>所属集群</td>
<td>
<span v-if="node.cluster == null">还没有设置集群。</span>
<div v-if="node.cluster != null">
{{node.cluster.name}}
</div>
</td>
</tr>
<tr>
<td>SSH主机地址</td>
<td>
<div v-if="node.login != null && node.login.params != null && node.login.params.host != null">
<span v-if="node.login.params.host.length > 0">{{node.login.params.host}}</span>
<span v-if="node.login.params.host.length == 0">尚未设置</span>
</div>
<div v-if="!(node.login != null && node.login.params != null && node.login.params.host != null)">
尚未设置
</div>
</td>
</tr>
<tr>
<td>SSH主机端口</td>
<td>
<div v-if="node.login != null && node.login.params != null && node.login.params.host != null">
<span v-if="node.login.params.port > 0">{{node.login.params.port}}</span>
<span v-if="node.login.params.port <= 0">尚未设置</span>
</div>
<div v-if="!(node.login != null && node.login.params != null && node.login.params.port != null)">
尚未设置
</div>
</td>
</tr>
<tr>
<td>SSH登录认证</td>
<td>
<div v-if="node.login != null && node.login.grant != null && node.login.grant.id > 0">
{{node.login.grant.name}}<span class="small">{{node.login.grant.methodName}}</span>
</div>
<div v-if="!(node.login != null && node.login.grant != null && node.login.grant.id > 0)">
尚未设置
</div>
</td>
</tr>
</table>

View File

@@ -0,0 +1,54 @@
{$layout}
{$template "menu"}
<second-menu>
<menu-item :href="'/nodes/node?nodeId=' + nodeId">详情</menu-item>
<menu-item :href="'/nodes/update?nodeId=' + nodeId" active="true">修改</menu-item>
</second-menu>
<div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="nodeId" :value="node.id"/>
<input type="hidden" name="loginId" :value="loginId"/>
<input type="hidden" name="grantId" :value="grantId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">节点名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus" v-model="node.name"/>
</td>
</tr>
<tr>
<td>所属集群</td>
<td>
<select class="ui dropdown" name="clusterId" style="width:10em" v-model="clusterId">
<option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
</select>
</td>
</tr>
<tr>
<td>SSH主机地址</td>
<td>
<input type="text" name="sshHost" maxlength="64" v-model="sshHost"/>
<p class="comment">比如192.168.1.100</p>
</td>
</tr>
<tr>
<td>SSH主机端口</td>
<td>
<input type="text" name="sshPort" maxlength="5" v-model="sshPort"/>
<p class="comment">比如22。</p>
</td>
</tr>
<tr>
<td>SSH登录认证</td>
<td>
<div class="ui label small" v-if="grant != null">{{grant.name}}<span class="small">{{grant.methodName}}</span> <a href="" title="删除" @click.prevent="removeGrant()"><i class="icon remove"></i></a> </div>
<div v-if="grant == null">
<a href="" @click.prevent="selectGrant()">[选择已有认证]</a> &nbsp; &nbsp; <a href="" @click.prevent="createGrant()">[添加新认证]</a>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,64 @@
Tea.context(function () {
this.grantId = 0;
this.grant = null;
this.clusterId = 0;
if (this.node.cluster != null && this.node.cluster.id > 0) {
this.clusterId = this.node.cluster.id;
}
this.sshHost = "";
this.sshPort = "";
this.loginId = 0;
if (this.node.login != null) {
this.loginId = this.node.login.id;
if (this.node.login.params != null) {
this.sshHost = this.node.login.params.host;
this.sshPort = this.node.login.params.port;
}
if (this.node.login.grant != null) {
this.grantId = this.node.login.grant.id;
this.grant = {
id: this.node.login.grant.id,
name: this.node.login.grant.name,
method: this.node.login.grant.method,
methodName: this.node.login.grant.methodName
};
}
}
this.success = NotifySuccess("保存成功", "/nodes/node?nodeId=" + this.node.id);
this.selectGrant = function () {
var that = this;
teaweb.popup("/nodes/grants/selectPopup", {
callback: function (resp) {
that.grantId = resp.data.grant.id;
if (that.grantId > 0) {
that.grant = resp.data.grant;
}
}
});
};
this.createGrant = function () {
var that = this;
teaweb.popup("/nodes/grants/createPopup", {
height: "31em",
callback: function (resp) {
that.grantId = resp.data.grant.id;
if (that.grantId > 0) {
that.grant = resp.data.grant;
}
}
});
};
this.removeGrant = function () {
this.grant = null;
this.grantId = 0;
};
});