From 653e24773fa1e8492ef2e4fab845555725253630 Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Thu, 15 Aug 2024 10:59:13 +0800 Subject: [PATCH] fixed: Fixed the issue that the shortcut command could not get the account --- src/components/Form/FormFields/CodeEditor.vue | 1 + src/views/ops/Adhoc/QuickJob.vue | 32 +++++++++++-------- .../AssetPermission/AssetPermissionList.vue | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/components/Form/FormFields/CodeEditor.vue b/src/components/Form/FormFields/CodeEditor.vue index bef146b21..16508546f 100644 --- a/src/components/Form/FormFields/CodeEditor.vue +++ b/src/components/Form/FormFields/CodeEditor.vue @@ -32,6 +32,7 @@ :placeholder="item.placeholder" class="inline-input" size="mini" + clearable @change="handleInputChange(item)" @select="handleInputChange(item)" /> diff --git a/src/views/ops/Adhoc/QuickJob.vue b/src/views/ops/Adhoc/QuickJob.vue index d91876ecb..6c93c038f 100644 --- a/src/views/ops/Adhoc/QuickJob.vue +++ b/src/views/ops/Adhoc/QuickJob.vue @@ -120,20 +120,26 @@ export default { autoComplete: true, query: (query, cb) => { const { hosts, nodes } = this.getSelectedNodesAndHosts() - if (hosts.length > 0 && nodes.length > 0) { - this.$axios.post('/api/v1/ops/username-hints/', { - nodes: nodes, - assets: hosts, - query: query - }).then(data => { - const ns = data.map(item => { - return { value: item.username } - }) - cb(ns) - }) - } else { - cb([]) + + if (hosts.length === 0) { + this.$message.warning(`${this.$t('RequiredAssetOrNode')}`) + return cb([]) } + + this.$axios.post('/api/v1/ops/username-hints/', { + nodes: nodes, + assets: hosts, + query: query + }).then(data => { + if (Array.isArray(data) && data.length === 0) { + this.$message.info(`${this.$t('NoAccountFound')}`) + return cb([]) + } + const ns = data.map(item => { + return { value: item.username } + }) + cb(ns) + }) } }, options: [], diff --git a/src/views/perms/AssetPermission/AssetPermissionList.vue b/src/views/perms/AssetPermission/AssetPermissionList.vue index 6ff798e34..6db384fd7 100644 --- a/src/views/perms/AssetPermission/AssetPermissionList.vue +++ b/src/views/perms/AssetPermission/AssetPermissionList.vue @@ -105,7 +105,7 @@ export default { activated() { setTimeout(() => { this.$refs.AssetTreeTable.$refs.TreeList.reloadTable() - }, 300) + }, 500) }, methods: { handlePermBulkUpdate() {