修改SSH时自动填入SSH主机地址/节点设置--SSH设置增加连接测试

This commit is contained in:
刘祥超
2022-04-09 21:44:34 +08:00
parent 2d8224fd12
commit 75b2b2bdb2
6 changed files with 114 additions and 7 deletions

View File

@@ -30,6 +30,11 @@
</td>
</tr>
</table>
<div class="ui message" v-if="isTesting">正在测试是否连接 ...</div>
<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></submit-btn>
</form>
</div>

View File

@@ -27,4 +27,27 @@ Tea.context(function () {
}
}
}
// 测试相关
this.resp = null
this.isTesting = false
if (this.grant != null && this.grant.id > 0 && this.sshHost.length > 0 && this.sshPort.toString().length > 0) {
this.isTesting = true
this.$delay(function () {
this.$post(".test")
.params({
grantId: this.grant.id,
host: this.sshHost,
port: this.sshPort
})
.success(function (resp) {
this.resp = resp.data
})
.done(function () {
this.isTesting = false
})
}, 1000)
}
})