mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-29 22:36:35 +08:00
增加SSH认证连接测试功能
This commit is contained in:
@@ -2,5 +2,6 @@
|
||||
<menu-item href="/clusters/grants">认证列表</menu-item>
|
||||
<span class="item">|</span>
|
||||
<menu-item :href="'/clusters/grants/grant?grantId=' + grant.id" code="index">{{grant.name}}详情</menu-item>
|
||||
<menu-item :href="'/clusters/grants/test?grantId=' + grant.id" code="test">测试</menu-item>
|
||||
<menu-item :href="'/clusters/grants/update?grantId=' + grant.id" code="update">修改</menu-item>
|
||||
</first-menu>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<td>名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus"/>
|
||||
<p class="comment">起一个容易识别的名称。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -52,7 +53,7 @@
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3"></textarea>
|
||||
</td>
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
|
||||
<tbody v-if="moreOptionsVisible">
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3"></textarea>
|
||||
</td>
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
<!-- 用户名/密码 -->
|
||||
<tbody v-if="grant.method == 'user'">
|
||||
<tr>
|
||||
<td>SSH用户名</td>
|
||||
<td>
|
||||
{{grant.username}}
|
||||
<p class="comment">SSH登录用户名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SSH用户名</td>
|
||||
<td>
|
||||
{{grant.username}}
|
||||
<p class="comment">SSH登录用户名。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SSH密码</td>
|
||||
<td>{{grant.password}}
|
||||
@@ -34,17 +34,17 @@
|
||||
|
||||
<!-- 私钥 -->
|
||||
<tbody v-if="grant.method == 'privateKey'">
|
||||
<tr>
|
||||
<td>RSA私钥</td>
|
||||
<td>
|
||||
{{grant.privateKey}}
|
||||
<p class="comment">用来生成登录SSH公钥的私钥</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RSA私钥</td>
|
||||
<td>
|
||||
{{grant.privateKey}}
|
||||
<p class="comment">用来生成登录SSH公钥的私钥</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<span v-if="grant.description.length > 0">{{grant.description}}</span>
|
||||
<span v-if="grant.description.length == 0">-</span>
|
||||
@@ -56,12 +56,12 @@
|
||||
<h3>使用此认证的集群</h3>
|
||||
<div>
|
||||
<p v-if="clusters.length == 0" class="comment">暂时还没有集群使用此认证。</p>
|
||||
<a :href="'/clusters/cluster?clusterId=' + cluster.id" class="ui label small" v-for="cluster in clusters">{{cluster.name}}</a>
|
||||
<a :href="'/clusters/cluster?clusterId=' + cluster.id" class="ui label small basic" v-for="cluster in clusters">{{cluster.name}}</a>
|
||||
</div>
|
||||
|
||||
<div class="ui divider"></div>
|
||||
<h3>使用此认证的节点</h3>
|
||||
<div>
|
||||
<p v-if="nodes.length == 0" class="comment">暂时还没有节点使用此认证。</p>
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + node.cluster.id + '&nodeId=' + node.id" class="ui label small" :class="{red:!node.isOn}" v-for="node in nodes">{{node.name}}<span class="small">({{node.cluster.name}})</span></a>
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + node.cluster.id + '&nodeId=' + node.id" class="ui label small basic" :class="{red:!node.isOn}" v-for="node in nodes">{{node.name}}<span class="small">({{node.cluster.name}})</span></a>
|
||||
</div>
|
||||
|
||||
59
web/views/@default/clusters/grants/test.html
Normal file
59
web/views/@default/clusters/grants/test.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{$layout}
|
||||
{$template "grant_menu"}
|
||||
|
||||
<div class="ui message">可以在这里测试SSH主机连接是否正常。</div>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-before="requestBefore" data-tea-done="requestDone">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="grantId" :value="grant.id"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">节点主机地址 *</td>
|
||||
<td>
|
||||
<input type="text" name="host" placeholder="x.x.x.x" style="width: 10em" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>节点主机端口 *</td>
|
||||
<td>
|
||||
<input type="text" name="port" style="width: 5em" size="5" maxlength="5"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">认证方式</td>
|
||||
<td>
|
||||
{{grant.methodName}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 用户名/密码 -->
|
||||
<tbody v-if="grant.method == 'user'">
|
||||
<tr>
|
||||
<td>SSH用户名</td>
|
||||
<td>
|
||||
{{grant.username}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SSH密码</td>
|
||||
<td>{{grant.password}}
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<!-- 私钥 -->
|
||||
<tbody v-if="grant.method == 'privateKey'">
|
||||
<tr>
|
||||
<td>RSA私钥</td>
|
||||
<td>
|
||||
{{grant.privateKey}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="ui message green" v-if="resp != null && resp.isOk">连接成功!</div>
|
||||
<div class="ui message red" v-if="resp != null && !resp.isOk">连接失败:{{resp.error}}</div>
|
||||
|
||||
<submit-btn v-if="!isRequesting">提交测试</submit-btn>
|
||||
<button class="ui button disabled" v-if="isRequesting">连接中...</button>
|
||||
</form>
|
||||
17
web/views/@default/clusters/grants/test.js
Normal file
17
web/views/@default/clusters/grants/test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
Tea.context(function () {
|
||||
this.isRequesting = false
|
||||
this.resp = null
|
||||
|
||||
this.success = function (resp) {
|
||||
this.resp = resp.data
|
||||
}
|
||||
|
||||
this.requestBefore = function () {
|
||||
this.isRequesting = true
|
||||
this.resp = null
|
||||
}
|
||||
|
||||
this.requestDone = function () {
|
||||
this.isRequesting = false
|
||||
}
|
||||
})
|
||||
@@ -9,6 +9,7 @@
|
||||
<td>名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus" v-model="grant.name"/>
|
||||
<p class="comment">起一个容易识别的名称。</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -49,7 +50,7 @@
|
||||
</tbody>
|
||||
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3" v-model="grant.description"></textarea>
|
||||
</td>
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
|
||||
<tbody v-if="moreOptionsVisible">
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>描述</td>
|
||||
<td>备注</td>
|
||||
<td>
|
||||
<textarea name="description" rows="3" v-model="grant.description"></textarea>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user