From 1c39041de294ba60a086c2ae9fc2caa299f27335 Mon Sep 17 00:00:00 2001
From: jiangweidong <1053570670@qq.com>
Date: Mon, 13 May 2024 18:39:19 +0800
Subject: [PATCH] perf: cloud sync module adjustment (#3912)
* perf: cloud sync module adjustment
* perf: optimize interface settings
* fix: cloud edit - previous step and next step will failed
---
src/components/Form/FormFields/Checkbox.vue | 93 +++++
src/components/Form/FormFields/index.js | 3 +
.../TableFormatters/ActionsFormatter.vue | 4 +
src/components/Widgets/MarkDown/index.vue | 4 +-
src/components/index.js | 1 +
src/router/console/xpack.js | 60 +--
.../AccountGather/TaskDetail/index.vue | 2 +-
.../Cloud/Account/AccountCreateUpdate.vue | 351 +++++++++++++-----
.../Account/AccountDetail/AccountDetail.vue | 121 +++++-
.../AccountDetail/TaskHistoryList.vue} | 4 +-
.../AccountDetail/TaskSyncAssetList.vue} | 4 +-
.../Cloud/Account/AccountDetail/index.vue | 16 +-
.../assets/Cloud/Account/AccountList.vue | 280 ++++++++------
.../SyncInstanceTaskStrategy/AttrDialog.vue | 0
.../SyncInstanceTaskStrategy/index.vue | 0
.../SyncInstanceTaskCreateUpdate.vue | 163 --------
.../SyncInstanceTaskDetail/detail.vue | 143 -------
.../SyncInstanceTaskDetail/index.vue | 65 ----
.../SyncInstanceTask/SyncInstanceTaskList.vue | 116 ------
src/views/assets/Cloud/index.vue | 16 +-
src/views/settings/Interface.vue | 40 +-
21 files changed, 692 insertions(+), 794 deletions(-)
create mode 100644 src/components/Form/FormFields/Checkbox.vue
rename src/views/assets/Cloud/{SyncInstanceTask/SyncInstanceTaskDetail/HistoryList.vue => Account/AccountDetail/TaskHistoryList.vue} (98%)
rename src/views/assets/Cloud/{SyncInstanceTask/SyncInstanceTaskDetail/AssetList.vue => Account/AccountDetail/TaskSyncAssetList.vue} (97%)
rename src/views/assets/Cloud/{SyncInstanceTask => Account}/components/SyncInstanceTaskStrategy/AttrDialog.vue (100%)
rename src/views/assets/Cloud/{SyncInstanceTask => Account}/components/SyncInstanceTaskStrategy/index.vue (100%)
delete mode 100644 src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate.vue
delete mode 100644 src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
delete mode 100644 src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/index.vue
delete mode 100644 src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue
diff --git a/src/components/Form/FormFields/Checkbox.vue b/src/components/Form/FormFields/Checkbox.vue
new file mode 100644
index 000000000..b1128963a
--- /dev/null
+++ b/src/components/Form/FormFields/Checkbox.vue
@@ -0,0 +1,93 @@
+
+
+
+ {{ $tc('SelectAll') }}
+
+
+ {{ noOptionTip }}
+ {{ item.label }}
+
+
+
+
+
+
+
diff --git a/src/components/Form/FormFields/index.js b/src/components/Form/FormFields/index.js
index a652c19e9..450119a37 100644
--- a/src/components/Form/FormFields/index.js
+++ b/src/components/Form/FormFields/index.js
@@ -2,6 +2,7 @@ import Link from './Link.vue'
import Select2 from './Select2.vue'
import TagInput from './TagInput.vue'
import Switcher from './Switcher.vue'
+import Checkbox from './Checkbox.vue'
import AttrInput from './AttrInput.vue'
import UploadKey from './UploadKey.vue'
import JsonEditor from './JsonEditor.vue'
@@ -23,6 +24,7 @@ import PasswordRule from './PasswordRule.vue'
export default {
Link,
Switcher,
+ Checkbox,
Select2,
TagInput,
AttrInput,
@@ -47,6 +49,7 @@ export default {
export {
Link,
Switcher,
+ Checkbox,
Select2,
TagInput,
AttrInput,
diff --git a/src/components/Table/TableFormatters/ActionsFormatter.vue b/src/components/Table/TableFormatters/ActionsFormatter.vue
index 167fc8b11..68ad23742 100644
--- a/src/components/Table/TableFormatters/ActionsFormatter.vue
+++ b/src/components/Table/TableFormatters/ActionsFormatter.vue
@@ -60,6 +60,7 @@ const defaultDeleteCallback = function({ row, col, cellValue, reload }) {
msg += ' ?'
const title = this.$t('Info')
const performDelete = this.colActions.performDelete
+ const afterDelete = this.colActions.afterDelete
this.$alert(msg, title, {
type: 'warning',
confirmButtonClass: 'el-button--danger',
@@ -71,6 +72,9 @@ const defaultDeleteCallback = function({ row, col, cellValue, reload }) {
await performDelete.bind(this)({ row: row, col: col })
done()
reload()
+ if (afterDelete instanceof Function) {
+ afterDelete({ row: row, col: col })
+ }
this.$message.success(this.$tc('DeleteSuccessMsg'))
} finally {
instance.confirmButtonLoading = false
diff --git a/src/components/Widgets/MarkDown/index.vue b/src/components/Widgets/MarkDown/index.vue
index 7e392cfee..5ab0e8631 100644
--- a/src/components/Widgets/MarkDown/index.vue
+++ b/src/components/Widgets/MarkDown/index.vue
@@ -118,10 +118,10 @@ export default {
}
.action-bar {
position: relative;
- height: 30px;
- line-height: 30px;
+ height: 0;
border: 1px solid #dcdfe6;
border-bottom: none;
+ z-index: 999;
.action {
position: absolute;
right: 6px;
diff --git a/src/components/index.js b/src/components/index.js
index 6d78361cf..9b3fa37c7 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -13,6 +13,7 @@ export { default as Hamburger } from './Widgets/Hamburger'
export { default as ListTable } from './Table/ListTable'
export { default as RelationCard } from './Cards/RelationCard'
export { default as Select2 } from './Form/FormFields/Select2'
+export { default as Checkbox } from './Form/FormFields/Checkbox'
export { default as UploadKey } from './Form/FormFields/UploadKey.vue'
export { default as AssetSelect } from './Apps/AssetSelect'
export { default as AutomationParams } from './Apps/AutomationParams'
diff --git a/src/router/console/xpack.js b/src/router/console/xpack.js
index 2e29f9e5f..e8fa4cbbc 100644
--- a/src/router/console/xpack.js
+++ b/src/router/console/xpack.js
@@ -26,7 +26,7 @@ const clouds = {
component: empty,
hidden: true,
meta: {
- title: i18n.t('AccountList'),
+ title: i18n.t('CloudAccountList'),
permissions: ['xpack.view_account']
},
children: [
@@ -36,7 +36,7 @@ const clouds = {
hidden: true,
redirect: '/console/assets/cloud',
meta: {
- title: i18n.t('AccountList'),
+ title: i18n.t('CloudAccountList'),
permissions: ['xpack.view_account']
}
},
@@ -46,7 +46,7 @@ const clouds = {
name: 'AccountCreate',
hidden: true,
meta: {
- title: i18n.t('Create'),
+ title: i18n.t('CloudAccountCreate'),
action: 'create',
permissions: ['xpack.add_account']
}
@@ -57,7 +57,7 @@ const clouds = {
name: 'AccountUpdate',
hidden: true,
meta: {
- title: i18n.t('Update'),
+ title: i18n.t('CloudAccountUpdate'),
action: 'update',
permissions: ['xpack.change_account']
}
@@ -68,62 +68,12 @@ const clouds = {
name: 'AccountDetail',
hidden: true,
meta: {
- title: i18n.t('Detail'),
+ title: i18n.t('CloudAccountDetail'),
permissions: ['xpack.view_account']
}
}
]
},
- {
- path: 'sync-instance-tasks',
- component: empty,
- hidden: true,
- meta: {
- title: i18n.t('SyncInstanceTaskList'),
- permissions: ['xpack.view_syncinstancetask']
- },
- children: [
- {
- path: '',
- component: () => import('@/views/assets/Cloud/'),
- name: 'SyncInstanceTaskList',
- hidden: true,
- meta: {
- title: i18n.t('SyncInstanceTaskList'),
- permissions: ['xpack.view_syncinstancetask']
- }
- },
- {
- path: 'create',
- component: () => import('@/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate'),
- name: 'SyncInstanceTaskCreate',
- hidden: true,
- meta: {
- title: i18n.t('SyncInstanceTaskCreate'),
- permissions: ['xpack.add_syncinstancetask']
- }
- },
- {
- path: ':id/update',
- component: () => import('@/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate'),
- name: 'SyncInstanceTaskUpdate',
- hidden: true,
- meta: {
- title: i18n.t('SyncInstanceTaskUpdate'),
- permissions: ['xpack.change_syncinstancetask']
- }
- },
- {
- path: ':id',
- component: () => import('@/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/index'),
- name: 'SyncInstanceTaskDetail',
- hidden: true,
- meta: {
- title: i18n.t('SyncInstanceTaskDetail')
- }
- }
- ]
- },
{
path: 'strategy',
component: empty,
diff --git a/src/views/accounts/AccountGather/TaskDetail/index.vue b/src/views/accounts/AccountGather/TaskDetail/index.vue
index 47a759834..01b541c68 100644
--- a/src/views/accounts/AccountGather/TaskDetail/index.vue
+++ b/src/views/accounts/AccountGather/TaskDetail/index.vue
@@ -12,7 +12,7 @@ import Detail from './Detail'
import TaskExecutionList from './TaskExecutionList'
export default {
- name: 'SyncInstanceTaskDetail',
+ name: 'AccountGatherTaskDetail',
components: {
GenericDetailPage,
TabPage,
diff --git a/src/views/assets/Cloud/Account/AccountCreateUpdate.vue b/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
index d6cf7278e..3dfc0d53c 100644
--- a/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
+++ b/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
@@ -1,20 +1,50 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Account/AccountDetail/AccountDetail.vue b/src/views/assets/Cloud/Account/AccountDetail/AccountDetail.vue
index 8821c607e..ac61bff69 100644
--- a/src/views/assets/Cloud/Account/AccountDetail/AccountDetail.vue
+++ b/src/views/assets/Cloud/Account/AccountDetail/AccountDetail.vue
@@ -1,17 +1,33 @@
-
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/HistoryList.vue b/src/views/assets/Cloud/Account/AccountDetail/TaskHistoryList.vue
similarity index 98%
rename from src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/HistoryList.vue
rename to src/views/assets/Cloud/Account/AccountDetail/TaskHistoryList.vue
index 949514b81..50b77a39e 100644
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/HistoryList.vue
+++ b/src/views/assets/Cloud/Account/AccountDetail/TaskHistoryList.vue
@@ -8,7 +8,7 @@ import { ActionsFormatter, DateFormatter } from '@/components/Table/TableFormatt
import { openTaskPage } from '@/utils/jms'
export default {
- name: 'HistoryList',
+ name: 'TaskHistoryList',
components: { GenericListTable },
props: {
object: {
@@ -29,7 +29,7 @@ export default {
}
},
tableConfig: {
- url: `/api/v1/xpack/cloud/sync-instance-tasks/${this.object.id}/history/`,
+ url: `/api/v1/xpack/cloud/sync-instance-tasks/${this.object.task?.id}/history/`,
columns: [
{
prop: 'summary.new',
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/AssetList.vue b/src/views/assets/Cloud/Account/AccountDetail/TaskSyncAssetList.vue
similarity index 97%
rename from src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/AssetList.vue
rename to src/views/assets/Cloud/Account/AccountDetail/TaskSyncAssetList.vue
index 0f492cbb0..775e22db9 100644
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/AssetList.vue
+++ b/src/views/assets/Cloud/Account/AccountDetail/TaskSyncAssetList.vue
@@ -7,7 +7,7 @@ import GenericListTable from '@/layout/components/GenericListTable/index'
import { DateFormatter } from '@/components/Table/TableFormatters'
export default {
- name: 'AssetList',
+ name: 'TaskSyncAssetList',
components: { GenericListTable },
props: {
object: {
@@ -40,7 +40,7 @@ export default {
]
},
tableConfig: {
- url: `/api/v1/xpack/cloud/sync-instance-tasks/${this.object.id}/instances/`,
+ url: `/api/v1/xpack/cloud/sync-instance-tasks/${this.object.task?.id}/instances/`,
hasSelection: false,
columns: [
'instance_id',
diff --git a/src/views/assets/Cloud/Account/AccountDetail/index.vue b/src/views/assets/Cloud/Account/AccountDetail/index.vue
index 8512a39d8..81c10f4ad 100644
--- a/src/views/assets/Cloud/Account/AccountDetail/index.vue
+++ b/src/views/assets/Cloud/Account/AccountDetail/index.vue
@@ -8,11 +8,15 @@
-
-
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
deleted file mode 100644
index 1beb08dbb..000000000
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/index.vue b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/index.vue
deleted file mode 100644
index c0987e0f0..000000000
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/index.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue
deleted file mode 100644
index 2a730e7c5..000000000
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/views/assets/Cloud/index.vue b/src/views/assets/Cloud/index.vue
index 38119dd47..bb1a1c059 100644
--- a/src/views/assets/Cloud/index.vue
+++ b/src/views/assets/Cloud/index.vue
@@ -13,25 +13,19 @@ export default {
data() {
return {
config: {
- activeMenu: 'SyncInstanceTaskList',
+ activeMenu: 'CloudAccountList',
submenu: [
{
- title: this.$t('SyncTask'),
- name: 'SyncInstanceTaskList',
- hidden: () => !this.$hasPerm('xpack.view_syncinstancetask'),
- component: () => import('@/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue')
+ title: this.$t('CloudAccountList'),
+ name: 'CloudAccountList',
+ hidden: () => !this.$hasPerm('xpack.view_account'),
+ component: () => import('@/views/assets/Cloud/Account/AccountList.vue')
},
{
title: this.$t('SyncStrategy'),
name: 'StrategyList',
hidden: () => !this.$hasPerm('xpack.view_strategy'),
component: () => import('@/views/assets/Cloud/Strategy/StrategyList.vue')
- },
- {
- title: this.$t('CloudAccountList'),
- name: 'AccountList',
- hidden: () => !this.$hasPerm('xpack.view_account'),
- component: () => import('@/views/assets/Cloud/Account/AccountList.vue')
}
],
actions: {
diff --git a/src/views/settings/Interface.vue b/src/views/settings/Interface.vue
index 180838757..5c284531a 100644
--- a/src/views/settings/Interface.vue
+++ b/src/views/settings/Interface.vue
@@ -3,45 +3,50 @@
- {{ tp.toUpperCase() }}
+ {{ value }}
- {{ tp.toUpperCase() }}
+ {{ value }}
-
- {{ tp.toUpperCase() }}
+ {{ value }}
- 备选项1
- 备选项2
- 备选项3
+
-
-
-
-
-
+
+
+
+
+
@@ -77,8 +82,13 @@ export default {
data() {
return {
dz: {},
+ stepStatus: ['wait', 'success', 'finish', 'process', 'error'],
loading: true,
files: {},
+ examples: {
+ 'primary': this.$t('Primary'), 'info': this.$t('Info'), 'warning': this.$t('Warning'),
+ 'success': this.$t('Success'), 'danger': this.$t('Danger')
+ },
interfaceInfo: {},
hasSaveContinue: false,
successUrl: { name: 'Settings' },