diff --git a/src/components/Form/DataForm/index.vue b/src/components/Form/DataForm/index.vue
index 9580e88cb..e0ca366b1 100644
--- a/src/components/Form/DataForm/index.vue
+++ b/src/components/Form/DataForm/index.vue
@@ -38,11 +38,11 @@
v-if="defaultButton"
:disabled="!canSubmit"
:loading="isSubmitting"
- size="small"
+ :size="submitBtnSize"
type="primary"
@click="submitForm('form')"
>
- {{ $t('common.Submit') }}
+ {{ submitBtnText }}
@@ -73,6 +73,16 @@ export default {
type: Boolean,
default: true
},
+ submitBtnSize: {
+ type: String,
+ default: 'small'
+ },
+ submitBtnText: {
+ type: String,
+ default() {
+ return this.$t('common.Submit')
+ }
+ },
hasSaveContinue: {
type: Boolean,
default: true
diff --git a/src/components/Form/FormFields/AttrInput.vue b/src/components/Form/FormFields/AttrInput.vue
new file mode 100644
index 000000000..7799f54ee
--- /dev/null
+++ b/src/components/Form/FormFields/AttrInput.vue
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Form/FormFields/JSONManyToManySelect/AttrFormDialog.vue b/src/components/Form/FormFields/JSONManyToManySelect/AttrFormDialog.vue
index d33f4e842..73d516ae0 100644
--- a/src/components/Form/FormFields/JSONManyToManySelect/AttrFormDialog.vue
+++ b/src/components/Form/FormFields/JSONManyToManySelect/AttrFormDialog.vue
@@ -21,7 +21,7 @@
import DataForm from '@/components/Form/DataForm/index.vue'
import Dialog from '@/components/Dialog/index.vue'
import ValueField from '@/components/Form/FormFields/JSONManyToManySelect/ValueField.vue'
-import { attrMatchOptions, typeMatchMapper } from './const'
+import { attrMatchOptions, typeMatchMapper } from '@/components/const'
export default {
name: 'AttrFormDialog',
diff --git a/src/components/Form/FormFields/JSONManyToManySelect/const.js b/src/components/Form/FormFields/JSONManyToManySelect/const.js
index 498c850c7..e69de29bb 100644
--- a/src/components/Form/FormFields/JSONManyToManySelect/const.js
+++ b/src/components/Form/FormFields/JSONManyToManySelect/const.js
@@ -1,25 +0,0 @@
-import i18n from '@/i18n/i18n'
-
-export const strMatchValues = ['exact', 'not', 'in', 'contains', 'startswith', 'endswith', 'regex']
-export const typeMatchMapper = {
- str: strMatchValues,
- bool: ['exact', 'not'],
- m2m: ['m2m'],
- ip: [...strMatchValues, 'ip_in'],
- int: [...strMatchValues, 'gte', 'lte'],
- select: ['in']
-}
-
-export const attrMatchOptions = [
- { label: i18n.t('common.Equal'), value: 'exact' },
- { label: i18n.t('common.NotEqual'), value: 'not' },
- { label: i18n.t('common.MatchIn'), value: 'in' },
- { label: i18n.t('common.Contains'), value: 'contains' },
- { label: i18n.t('common.Startswith'), value: 'startswith' },
- { label: i18n.t('common.Endswith'), value: 'endswith' },
- { label: i18n.t('common.Regex'), value: 'regex' },
- { label: i18n.t('common.BelongTo'), value: 'm2m' },
- { label: i18n.t('common.IPMatch'), value: 'ip_in' },
- { label: i18n.t('common.GreatEqualThan'), value: 'gte' },
- { label: i18n.t('common.LessEqualThan'), value: 'lte' }
-]
diff --git a/src/components/Form/FormFields/JSONManyToManySelect/index.vue b/src/components/Form/FormFields/JSONManyToManySelect/index.vue
index d38edcd35..6e9dc3a44 100644
--- a/src/components/Form/FormFields/JSONManyToManySelect/index.vue
+++ b/src/components/Form/FormFields/JSONManyToManySelect/index.vue
@@ -43,7 +43,7 @@ import ValueFormatter from './ValueFormatter.vue'
import AttrFormDialog from './AttrFormDialog.vue'
import AttrMatchResultDialog from './AttrMatchResultDialog.vue'
import { setUrlParam } from '@/utils/common'
-import { attrMatchOptions } from './const'
+import { attrMatchOptions } from '@/components/const'
import { toM2MJsonParams } from '@/utils/jms'
export default {
diff --git a/src/components/Form/FormFields/ProtocolSelector/index.vue b/src/components/Form/FormFields/ProtocolSelector/index.vue
index 4fe2447bd..e1c7e735b 100644
--- a/src/components/Form/FormFields/ProtocolSelector/index.vue
+++ b/src/components/Form/FormFields/ProtocolSelector/index.vue
@@ -305,7 +305,7 @@ export default {
items = protocols.filter(item => allProtocolNames.indexOf(item.name) !== -1)
} else {
const defaults = choices.filter(item => (item.required || item.primary || item.default))
- if (defaults.length === 0) {
+ if (defaults.length === 0 && choices.length !== 0) {
defaults.push(choices[0])
}
items = defaults
diff --git a/src/components/Form/FormFields/index.js b/src/components/Form/FormFields/index.js
index 66ba1dda2..27ffee7a1 100644
--- a/src/components/Form/FormFields/index.js
+++ b/src/components/Form/FormFields/index.js
@@ -3,6 +3,7 @@ import Text from './Text.vue'
import Select2 from './Select2.vue'
import TagInput from './TagInput.vue'
import Switcher from './Switcher.vue'
+import AttrInput from './AttrInput.vue'
import UploadKey from './UploadKey.vue'
import JsonEditor from './JsonEditor.vue'
import PhoneInput from './PhoneInput.vue'
@@ -23,6 +24,7 @@ export default {
Switcher,
Select2,
TagInput,
+ AttrInput,
UploadKey,
JsonEditor,
UpdateToken,
@@ -44,6 +46,7 @@ export {
Switcher,
Select2,
TagInput,
+ AttrInput,
UploadKey,
JsonEditor,
UpdateToken,
diff --git a/src/components/const.js b/src/components/const.js
new file mode 100644
index 000000000..498c850c7
--- /dev/null
+++ b/src/components/const.js
@@ -0,0 +1,25 @@
+import i18n from '@/i18n/i18n'
+
+export const strMatchValues = ['exact', 'not', 'in', 'contains', 'startswith', 'endswith', 'regex']
+export const typeMatchMapper = {
+ str: strMatchValues,
+ bool: ['exact', 'not'],
+ m2m: ['m2m'],
+ ip: [...strMatchValues, 'ip_in'],
+ int: [...strMatchValues, 'gte', 'lte'],
+ select: ['in']
+}
+
+export const attrMatchOptions = [
+ { label: i18n.t('common.Equal'), value: 'exact' },
+ { label: i18n.t('common.NotEqual'), value: 'not' },
+ { label: i18n.t('common.MatchIn'), value: 'in' },
+ { label: i18n.t('common.Contains'), value: 'contains' },
+ { label: i18n.t('common.Startswith'), value: 'startswith' },
+ { label: i18n.t('common.Endswith'), value: 'endswith' },
+ { label: i18n.t('common.Regex'), value: 'regex' },
+ { label: i18n.t('common.BelongTo'), value: 'm2m' },
+ { label: i18n.t('common.IPMatch'), value: 'ip_in' },
+ { label: i18n.t('common.GreatEqualThan'), value: 'gte' },
+ { label: i18n.t('common.LessEqualThan'), value: 'lte' }
+]
diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json
index e3fde6909..69f7516dc 100644
--- a/src/i18n/langs/en.json
+++ b/src/i18n/langs/en.json
@@ -486,6 +486,20 @@
"ReLoginErr": "Login time has exceeded 5 minutes, please login again"
},
"common": {
+ "SyncTask": "Synchronization task",
+ "New": "New",
+ "Strategy": "Strategy",
+ "StrategyList": "Strategy list",
+ "StrategyCreate": "Create strategy",
+ "StrategyUpdate": "Update strategy",
+ "StrategyDetail": "Strategy detail",
+ "Rule": "Rule",
+ "RuleCount": "Number of conditions",
+ "ActionCount": "Number of actions",
+ "PolicyName": "Policy name",
+ "BasicSetting": "Basic setting",
+ "RuleSetting": "Rule setting",
+ "ActionSetting": "Action setting",
"Proxy": "Proxy",
"PublicKey": "Public key",
"PrivateKey": "Private key",
@@ -595,6 +609,7 @@
"CrontabHelpTips": "eg: Every Sunday 03:05 run <5 3 * * 0>
Tips:Using 5 digits linux crontab expressions (Online tools)
Note:If both Regularly perform and Cycle perform are set, give priority to Regularly perform",
"DateEnd": "End date",
"Resource": "Resource",
+ "ResourceType": "Resource type",
"DateLast24Hours": "Last 24 hours",
"DateLast3Months": "Last 3 months",
"DateLastHarfYear": "Last half year",
@@ -2056,6 +2071,11 @@
"Reason": "Reason"
},
"Cloud": {
+ "UniqueError": "Only one of the following properties can be set",
+ "ExistError": "This element already exists",
+ "InstanceName": "Instance name",
+ "InstancePlatformName": "Instance platform name",
+ "InstanceAddress": "Instance address",
"CloudSync": "Cloud sync",
"ServerAccountKey": "Server Account Key",
"IPNetworkSegment": "Ip Network Segment",
@@ -2084,11 +2104,12 @@
"CloudCenter": "Cloud Center",
"Provider": "Provider",
"Validity": "Validity",
+ "SyncStrategy": "Synchronisation strategy",
"IsAlwaysUpdateHelpTips": "Whether the asset information, including Hostname, IP, Platform, and AdminUser, is updated synchronously each time a synchronization task is performed",
- "SyncInstanceTaskCreate": "Create sync instance task",
- "SyncInstanceTaskList": "Sync instance task list",
- "SyncInstanceTaskDetail": "Sync instance task detail",
- "SyncInstanceTaskUpdate": "Update sync instance task",
+ "SyncInstanceTaskCreate": "Create sync task",
+ "SyncInstanceTaskList": "Sync task list",
+ "SyncInstanceTaskDetail": "Sync task detail",
+ "SyncInstanceTaskUpdate": "Update sync task",
"SyncInstanceTaskHistoryList": "Sync task history",
"SyncInstanceTaskHistoryAssetList": "Sync instance list",
"CloudSource": "Cloud source",
diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json
index 72fdb8792..ea0478d28 100644
--- a/src/i18n/langs/ja.json
+++ b/src/i18n/langs/ja.json
@@ -486,6 +486,20 @@
"ReLoginErr": "ログイン時間が 5 分を超えました。もう一度ログインしてください"
},
"common": {
+ "SyncTask": "同期任務です",
+ "New": "新筑",
+ "Strategy": "せんりゃく",
+ "StrategyList": "ポリシーリストです",
+ "StrategyCreate": "戦略を作ります",
+ "StrategyUpdate": "ポリシーを更新します",
+ "StrategyDetail": "戦略の詳細です",
+ "Rule": "ルール",
+ "RuleCount": "条件数です",
+ "ActionCount": "アクション数",
+ "PolicyName": "ポリシーの名前です",
+ "BasicSetting": "基本設定",
+ "RuleSetting": "条件設定です",
+ "ActionSetting": "動作設定です",
"Proxy": "プロキシ",
"PublicKey": "公開鍵です",
"PrivateKey": "秘密鍵です",
@@ -594,6 +608,7 @@
"CrontabHelpTips": "Eg: 毎週日曜日03:05に <5 3 * * 0>
ヒント: 5ビットLinux crontab式 <時分割日月曜日> ( オンラインツール )
注意: 定期実行とサイクル実行の両方が設定されている場合は、定期実行を優先します",
"DateEnd": "終了日",
"Resource": "リソース",
+ "ResourceType": "リソースタイプです",
"DateLast24Hours": "最近の日",
"DateLast3Months": "直近3月",
"DateLastHarfYear": "ここ半年です",
@@ -2049,6 +2064,11 @@
"Reason": "原因"
},
"Cloud": {
+ "UniqueError": "以下の属性は1つしか設定できません",
+ "ExistError": "この元素は既に存在します",
+ "InstanceName": "インスタンス名です",
+ "InstancePlatformName": "インスタンスのプラットフォーム名です",
+ "InstanceAddress": "インスタンスアドレスです",
"CloudSync": "クラウド同期",
"ServerAccountKey": "サービスアカウントキー",
"IPNetworkSegment": "IPネットワークセグメント",
@@ -2081,11 +2101,12 @@
"CloudCenter": "クラウド管理センター",
"Provider": "クラウドサービス業者",
"Validity": "有効",
+ "SyncStrategy": "同調戦略です",
"IsAlwaysUpdateHelpTips": "同期タスクを実行するたびに、ホスト名、IP、システムプラットフォーム、管理ユーザーなど、アセットの情報を同期更新しますか?",
- "SyncInstanceTaskCreate": "同期インスタンスタスクの作成",
- "SyncInstanceTaskList": "インスタンスのタスクリストの同期",
- "SyncInstanceTaskDetail": "インスタンスタスクの詳細の同期",
- "SyncInstanceTaskUpdate": "同期インスタンスタスクの更新",
+ "SyncInstanceTaskCreate": "同期タスクを作成します",
+ "SyncInstanceTaskList": "同期タスクリストです",
+ "SyncInstanceTaskDetail": "同期任務詳細です",
+ "SyncInstanceTaskUpdate": "同期タスクの更新です",
"SyncInstanceTaskHistoryList": "履歴リストの同期",
"SyncInstanceTaskHistoryAssetList": "インスタンスリストの同期",
"CloudSource": "同期ソース",
diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json
index f11aa600e..fc8460516 100644
--- a/src/i18n/langs/zh.json
+++ b/src/i18n/langs/zh.json
@@ -466,6 +466,20 @@
"ReLoginErr": "登录时长已超过 5 分钟,请重新登录"
},
"common": {
+ "SyncTask": "同步任务",
+ "New": "新建",
+ "Strategy": "策略",
+ "StrategyList": "策略列表",
+ "StrategyCreate": "创建策略",
+ "StrategyUpdate": "更新策略",
+ "StrategyDetail": "策略详情",
+ "Rule": "条件",
+ "RuleCount": "条件数量",
+ "ActionCount": "动作数量",
+ "PolicyName": "策略名称",
+ "BasicSetting": "基本设置",
+ "RuleSetting": "条件设置",
+ "ActionSetting": "动作设置",
"Proxy": "代理",
"PublicKey": "公钥",
"PrivateKey": "私钥",
@@ -623,6 +637,7 @@
"CrontabHelpTips": "eg:每周日 03:05 执行 <5 3 * * 0>
提示: 使用5位 Linux crontab 表达式 <分 时 日 月 星期> (在线工具)
注意: 如果同时设置了定期执行和周期执行,优先使用定期执行",
"DateEnd": "结束日期",
"Resource": "资源",
+ "ResourceType": "资源类型",
"DateLast24Hours": "最近一天",
"DateLast3Months": "最近三月",
"DateLastHarfYear": "最近半年",
@@ -1970,6 +1985,11 @@
"AssetCount": "资产数量",
"Auditor": "审计员",
"Cloud": {
+ "UniqueError": "以下属性只能设置一个",
+ "ExistError": "这个元素已经存在",
+ "InstanceName": "实例名称",
+ "InstancePlatformName": "实例平台名称",
+ "InstanceAddress": "实例地址",
"LAN": "局域网",
"CloudSync": "云同步",
"ServerAccountKey": "服务账号密钥",
@@ -2002,11 +2022,12 @@
"CloudCenter": "云管中心",
"Provider": "云服务商",
"Validity": "有效",
+ "SyncStrategy": "同步策略",
"IsAlwaysUpdateHelpTips": "每次执行同步任务时,是否同步更新资产的信息,包括主机名、IP、系统平台、管理用户",
- "SyncInstanceTaskCreate": "创建同步实例任务",
- "SyncInstanceTaskList": "同步实例任务列表",
- "SyncInstanceTaskDetail": "同步实例任务详情",
- "SyncInstanceTaskUpdate": "更新同步实例任务",
+ "SyncInstanceTaskCreate": "创建同步任务",
+ "SyncInstanceTaskList": "同步任务列表",
+ "SyncInstanceTaskDetail": "同步任务详情",
+ "SyncInstanceTaskUpdate": "更新同步任务",
"SyncInstanceTaskHistoryList": "同步历史列表",
"SyncInstanceTaskHistoryAssetList": "同步实例列表",
"CloudSource": "同步源",
diff --git a/src/router/console/xpack.js b/src/router/console/xpack.js
index c4df0ffeb..70c31e8d1 100644
--- a/src/router/console/xpack.js
+++ b/src/router/console/xpack.js
@@ -129,6 +129,58 @@ export default [
}
}
]
+ },
+ {
+ path: 'strategy',
+ component: empty,
+ hidden: true,
+ meta: {
+ title: i18n.t('xpack.Cloud.Strategy'),
+ permissions: ['xpack.view_strategy']
+ },
+ children: [
+ {
+ path: '',
+ name: 'CloudStrategyList',
+ hidden: true,
+ component: () => import('@/views/assets/Cloud/'),
+ meta: {
+ title: i18n.t('xpack.Cloud.StrategyList'),
+ permissions: ['xpack.view_strategy']
+ }
+ },
+ {
+ path: 'create',
+ component: () => import('@/views/assets/Cloud/Strategy/StrategyCreateUpdate'),
+ name: 'CloudStrategyCreate',
+ hidden: true,
+ meta: {
+ title: i18n.t('common.StrategyCreate'),
+ action: 'create',
+ permissions: ['xpack.add_strategy']
+ }
+ },
+ {
+ path: ':id/update',
+ component: () => import('@/views/assets/Cloud/Strategy/StrategyCreateUpdate'),
+ name: 'CloudStrategyUpdate',
+ hidden: true,
+ meta: {
+ title: i18n.t('common.StrategyUpdate'),
+ permissions: ['xpack.change_strategy']
+ }
+ },
+ {
+ path: ':id/',
+ component: () => import('@/views/assets/Cloud/Strategy/StrategyDetail/index'),
+ name: 'CloudStrategyDetail',
+ hidden: true,
+ meta: {
+ title: i18n.t('common.StrategyDetail'),
+ permissions: ['xpack.view_strategy']
+ }
+ }
+ ]
}
]
}
diff --git a/src/views/assets/Cloud/Account/AccountCreateUpdate.vue b/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
index 9aa59a8f4..5c95dcffd 100644
--- a/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
+++ b/src/views/assets/Cloud/Account/AccountCreateUpdate.vue
@@ -80,17 +80,6 @@ export default {
password: {
rules: this.$route.params.id ? [] : [RequiredChange]
},
- platform: {
- el: {
- multiple: false,
- ajax: {
- url: `/api/v1/assets/platforms/`,
- transformOption: (item) => {
- return { label: item.name, value: item.id }
- }
- }
- }
- },
public_key: {
label: this.$t('common.PublicKey'),
rules: this.$route.params.id ? [] : [RequiredChange]
diff --git a/src/views/assets/Cloud/Strategy/StrategyCreateUpdate.vue b/src/views/assets/Cloud/Strategy/StrategyCreateUpdate.vue
new file mode 100644
index 000000000..d3a480a2e
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/StrategyCreateUpdate.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/StrategyDetail/StrategyDetail.vue b/src/views/assets/Cloud/Strategy/StrategyDetail/StrategyDetail.vue
new file mode 100644
index 000000000..91a33c3da
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/StrategyDetail/StrategyDetail.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/StrategyDetail/index.vue b/src/views/assets/Cloud/Strategy/StrategyDetail/index.vue
new file mode 100644
index 000000000..92f2e0b3e
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/StrategyDetail/index.vue
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/StrategyList.vue b/src/views/assets/Cloud/Strategy/StrategyList.vue
new file mode 100644
index 000000000..f86f31731
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/StrategyList.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/components/ActionInput.vue b/src/views/assets/Cloud/Strategy/components/ActionInput.vue
new file mode 100644
index 000000000..b58df5c39
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/components/ActionInput.vue
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/components/RuleInput.vue b/src/views/assets/Cloud/Strategy/components/RuleInput.vue
new file mode 100644
index 000000000..e2e34f62d
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/components/RuleInput.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/Strategy/components/const.js b/src/views/assets/Cloud/Strategy/components/const.js
new file mode 100644
index 000000000..6a5192187
--- /dev/null
+++ b/src/views/assets/Cloud/Strategy/components/const.js
@@ -0,0 +1,44 @@
+import i18n from '@/i18n/i18n'
+import { attrMatchOptions } from '@/components/const'
+
+export const resourceTypeOptions = [
+ { label: i18n.t('assets.Platform'), value: 'platform' },
+ { label: i18n.t('assets.Node'), value: 'node' },
+ { label: i18n.t('assets.Domain'), value: 'domain' },
+ { label: i18n.t('accounts.AccountTemplate'), value: 'account_template' }
+]
+
+export const instanceAttrOptions = [
+ { label: i18n.t('xpack.Cloud.InstanceName'), value: 'instance_name' },
+ { label: i18n.t('xpack.Cloud.InstancePlatformName'), value: 'instance_platform' },
+ { label: i18n.t('xpack.Cloud.InstanceAddress'), value: 'instance_address' }
+]
+
+export const tableFormatter = (colName, getResourceLabel) => {
+ return (row, col, cellValue) => {
+ const globalResource = {}
+ const value = cellValue
+ if (value?.label) { return value.label }
+ switch (colName) {
+ case 'attr':
+ return instanceAttrOptions.find(attr => attr.value === value)?.label || value
+ case 'resource_type':
+ return resourceTypeOptions.find(attr => attr.value === value)?.label || value
+ case 'match':
+ return attrMatchOptions.find(opt => opt.value === value).label || value
+ case 'value':
+ return Array.isArray(value) ? value.join(', ') : value
+ case 'resource':
+ if (typeof getResourceLabel === 'function') {
+ Object.assign(globalResource, getResourceLabel())
+ }
+ return globalResource[value] || value
+ case 'protocols':
+ return Array.isArray(value) ? value.map(p => { return `${p.name}/${p.port}` }).join(', ') : ''
+ case 'count':
+ return value?.length || 0
+ default:
+ return value
+ }
+ }
+}
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate.vue b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate.vue
index cb17dd3ad..263adba94 100644
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate.vue
+++ b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskCreateUpdate.vue
@@ -6,7 +6,7 @@
import { GenericCreateUpdatePage } from '@/layout/components'
import { CronTab, Select2 } from '@/components'
import rules from '@/components/Form/DataForm/rules'
-import ProtocolSelector from '@/components/Form/FormFields/ProtocolSelector'
+import SyncInstanceTaskStrategy from './components/SyncInstanceTaskStrategy/index'
export default {
components: {
@@ -24,7 +24,8 @@ export default {
fields: [
[this.$t('common.Basic'), ['name']],
[this.$t('xpack.Cloud.CloudSource'), ['account', 'regions']],
- [this.$t('xpack.Cloud.SaveSetting'), ['hostname_strategy', 'node', 'protocols', 'ip_network_segment_group', 'sync_ip_type', 'is_always_update']],
+ [this.$t('xpack.Cloud.SaveSetting'), ['hostname_strategy', 'ip_network_segment_group', 'sync_ip_type', 'is_always_update']],
+ [this.$t('common.Strategy'), ['strategy']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('common.Other'), ['comment']]
],
@@ -49,31 +50,6 @@ export default {
rules: [rules.RequiredChange],
helpText: this.$t('xpack.Cloud.HostnameStrategy')
},
- node: {
- rules: [rules.RequiredChange],
- el: {
- multiple: false,
- value: [],
- ajax: {
- url: '/api/v1/assets/nodes/',
- transformOption: (item) => {
- return { label: item.full_value, value: item.id }
- }
- }
- }
- },
- protocols: {
- component: ProtocolSelector,
- el: {
- showSetting: () => { return false },
- choices: [
- { 'name': 'ssh', 'port': 22, 'primary': true, 'default': false, 'required': false },
- { 'name': 'telnet', 'port': 23, 'primary': false, 'default': false, 'required': false },
- { 'name': 'vnc', 'port': 5900, 'primary': false, 'default': false, 'required': false },
- { 'name': 'rdp', 'port': 3389, 'primary': false, 'default': false, 'required': false }
- ]
- }
- },
is_always_update: {
type: 'switch',
label: this.$t('xpack.Cloud.IsAlwaysUpdate'),
@@ -88,7 +64,7 @@ export default {
ajax: {
url: '/api/v1/xpack/cloud/regions/',
processResults(data) {
- const results = data.regions.map((item) => {
+ const results = data.regions?.map((item) => {
return { label: item.name, value: item.id }
})
const more = !!data.next
@@ -114,6 +90,10 @@ export default {
return formValue.is_periodic === false
},
helpText: this.$t('xpack.HelpText.IntervalOfCreateUpdatePage')
+ },
+ strategy: {
+ label: this.$t('common.Strategy'),
+ component: SyncInstanceTaskStrategy
}
},
updateSuccessNextRoute: { name: 'CloudCenter' },
@@ -123,20 +103,15 @@ export default {
const [name, port] = i.split('/')
return { name, port }
})
-
return formValue
},
cleanFormValue(value) {
- let protocols = ''
const ipNetworkSegments = value.ip_network_segment_group
+ const strategy = value?.strategy || []
if (!Array.isArray(ipNetworkSegments)) {
value.ip_network_segment_group = ipNetworkSegments ? ipNetworkSegments.split(',') : []
}
- if (value.protocols.length > 0) {
- protocols = value.protocols.map(i => (i.name + '/' + i.port)).join(' ')
- }
- value.protocols = protocols
-
+ value.strategy = strategy.map(item => { return item.id })
return value
},
onPerformError(error, method, vm) {
diff --git a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
index d6895d137..c59c10524 100644
--- a/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
+++ b/src/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskDetail/detail.vue
@@ -5,12 +5,20 @@
+
+
+
+
diff --git a/src/views/assets/Cloud/SyncInstanceTask/components/SyncInstanceTaskStrategy/index.vue b/src/views/assets/Cloud/SyncInstanceTask/components/SyncInstanceTaskStrategy/index.vue
new file mode 100644
index 000000000..dfe278c5e
--- /dev/null
+++ b/src/views/assets/Cloud/SyncInstanceTask/components/SyncInstanceTaskStrategy/index.vue
@@ -0,0 +1,126 @@
+
+
+
+
+
+
{{ this.$t('common.New') }}
+
+
+
+
+
+
diff --git a/src/views/assets/Cloud/const.js b/src/views/assets/Cloud/const.js
index 3cdfab960..f9fc928b1 100644
--- a/src/views/assets/Cloud/const.js
+++ b/src/views/assets/Cloud/const.js
@@ -127,6 +127,6 @@ export const ACCOUNT_PROVIDER_ATTRS_MAP = {
[lan]: {
name: lan,
title: i18n.t('xpack.Cloud.LAN'),
- attrs: ['ip_group', 'test_port', 'test_timeout', 'platform', 'hostname_prefix']
+ attrs: ['ip_group', 'test_port', 'test_timeout', 'hostname_prefix']
}
}
diff --git a/src/views/assets/Cloud/index.vue b/src/views/assets/Cloud/index.vue
index f8d122096..b6b7d7ef5 100644
--- a/src/views/assets/Cloud/index.vue
+++ b/src/views/assets/Cloud/index.vue
@@ -16,11 +16,17 @@ export default {
activeMenu: 'SyncInstanceTaskList',
submenu: [
{
- title: this.$t('xpack.Cloud.SyncInstanceTaskList'),
+ title: this.$t('common.SyncTask'),
name: 'SyncInstanceTaskList',
hidden: () => !this.$hasPerm('xpack.view_syncinstancetask'),
component: () => import('@/views/assets/Cloud/SyncInstanceTask/SyncInstanceTaskList.vue')
},
+ {
+ title: this.$t('xpack.Cloud.SyncStrategy'),
+ name: 'StrategyList',
+ hidden: () => !this.$hasPerm('xpack.view_strategy'),
+ component: () => import('@/views/assets/Cloud/Strategy/StrategyList.vue')
+ },
{
title: this.$t('xpack.Cloud.AccountList'),
name: 'AccountList',