🐛 SSH 配置未启用还可以连接.
This commit is contained in:
@@ -17,8 +17,8 @@ export interface AuthorizedHostQueryResponse {
|
||||
/**
|
||||
* 查询当前用户已授权的主机
|
||||
*/
|
||||
export function getCurrentAuthorizedHost() {
|
||||
return axios.get<AuthorizedHostQueryResponse>('/asset/authorized-data/current-host');
|
||||
export function getCurrentAuthorizedHost(type: string) {
|
||||
return axios.get<AuthorizedHostQueryResponse>('/asset/authorized-data/current-host', { params: { type } });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,7 +128,7 @@ export default defineStore('terminal', {
|
||||
if (this.hosts.hostList?.length) {
|
||||
return;
|
||||
}
|
||||
const { data } = await getCurrentAuthorizedHost();
|
||||
const { data } = await getCurrentAuthorizedHost('ssh');
|
||||
Object.keys(data).forEach(k => {
|
||||
this.hosts[k as keyof AuthorizedHostQueryResponse] = data[k as keyof AuthorizedHostQueryResponse] as any;
|
||||
});
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
unchecked-text="使用原密码" />
|
||||
</a-form-item>
|
||||
<!-- 秘钥id -->
|
||||
<a-form-item field="keyId" label="主机秘钥">
|
||||
<a-form-item field="keyId"
|
||||
label="主机秘钥"
|
||||
extra="密码和秘钥二选一 优先使用秘钥">
|
||||
<host-key-selector v-model="formModel.keyId" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
setLoading(false);
|
||||
Message.success('修改成功');
|
||||
// 回调 props
|
||||
emits('submitted', { ...props.content, config: { ...formModel.value } });
|
||||
emits('submitted', { ...props.content, ...config, config: { ...formModel.value } });
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<!-- 主机列表 -->
|
||||
<host-list-view class="host-list"
|
||||
:hostList="hostList"
|
||||
empty-value="当前分组内无授权主机!" />
|
||||
empty-value="当前分组内无授权主机/主机未启用 SSH 配置!" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!-- 列表视图 -->
|
||||
<host-list-view v-if="NewConnectionType.LIST === newConnectionType"
|
||||
:hostList="hostList"
|
||||
empty-value="无授权主机!" />
|
||||
empty-value="无授权主机/主机未启用 SSH 配置!" />
|
||||
<!-- 我的收藏 -->
|
||||
<host-list-view v-if="NewConnectionType.FAVORITE === newConnectionType"
|
||||
class="list-view-container"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
<!-- 已关闭-右侧操作 -->
|
||||
<div v-if="isClose" class="sftp-table-header-right">
|
||||
<span class="close-message">{{ closeMessage }}</span>
|
||||
<span class="close-message" :title="closeMessage">{{ closeMessage }}</span>
|
||||
</div>
|
||||
<!-- 路径编辑模式-右侧操作 -->
|
||||
<a-space v-else-if="pathEditable" class="sftp-table-header-right">
|
||||
|
||||
@@ -190,10 +190,10 @@
|
||||
|
||||
// 关闭回调
|
||||
const onClose = (forceClose: string, msg: string) => {
|
||||
console.log(forceClose);
|
||||
console.log(msg);
|
||||
closed.value = true;
|
||||
closeMessage.value = msg;
|
||||
setTableLoading(false);
|
||||
setEditorLoading(false);
|
||||
};
|
||||
|
||||
// 接收列表回调
|
||||
|
||||
@@ -47,6 +47,7 @@ export default class TerminalOutputProcessor implements ITerminalOutputProcessor
|
||||
});
|
||||
} else {
|
||||
// 未成功提示错误信息
|
||||
session.resolver?.onClose('0', msg);
|
||||
Message.error(msg || '建立 SFTP 失败');
|
||||
}
|
||||
}
|
||||
@@ -75,6 +76,7 @@ export default class TerminalOutputProcessor implements ITerminalOutputProcessor
|
||||
session.connect();
|
||||
} else {
|
||||
// 未成功提示错误信息
|
||||
session.resolver?.onClose('0', msg);
|
||||
Message.error(msg || '打开 SFTP 失败');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user