mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: 改密与推送保持一致
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
import { Dialog, AutoDataForm } from '@/components'
|
||||
|
||||
export default {
|
||||
componentName: 'AutomationParams',
|
||||
components: {
|
||||
Dialog,
|
||||
AutoDataForm
|
||||
@@ -57,6 +58,10 @@ export default {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
method: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: `/api/v1/assets/platform-automation-methods/`
|
||||
@@ -110,18 +115,17 @@ export default {
|
||||
this.remoteMeta = data.actions[this.config.method.toUpperCase()] || {}
|
||||
},
|
||||
async getFilterPlatforms() {
|
||||
const res = await this.$axios.post(
|
||||
return await this.$axios.post(
|
||||
'/api/v1/assets/platforms/filter-nodes-assets/',
|
||||
{
|
||||
'node_ids': this.node_ids,
|
||||
'asset_ids': this.asset_ids
|
||||
}
|
||||
)
|
||||
return res
|
||||
},
|
||||
async onFieldChangeHandle() {
|
||||
const platforms = await this.getFilterPlatforms()
|
||||
let pushAccountMethods = platforms.map(i => i.automation?.push_account_method)
|
||||
let pushAccountMethods = platforms.map(i => i.automation[this.method])
|
||||
pushAccountMethods = _.uniq(pushAccountMethods)
|
||||
// 检测是否有可设置的推送方式
|
||||
const hasCanSettingPushMethods = _.intersection(pushAccountMethods, Object.keys(this.remoteMeta))
|
||||
@@ -15,6 +15,7 @@ export { default as RelationCard } from './RelationCard'
|
||||
export { default as Select2 } from './FormFields/Select2'
|
||||
export { default as UploadKey } from './FormFields/UploadKey.vue'
|
||||
export { default as AssetSelect } from './AssetSelect'
|
||||
export { default as AutomationParams } from './AutomationParams'
|
||||
export { default as SvgIcon } from './SvgIcon'
|
||||
export { default as TreeTable } from './TreeTable'
|
||||
export { default as AssetTreeTable } from './AssetTreeTable'
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
},
|
||||
"AccountChangeSecret": {
|
||||
"Result": "Result",
|
||||
"ParamsHelpText": "The change secret parameter settings are currently only effective for assets with a platform type of host.",
|
||||
"ExecutionTimes": "Execution times",
|
||||
"TaskList": "Task record",
|
||||
"TimerPeriod": "Timed execution cycle",
|
||||
@@ -93,7 +94,7 @@
|
||||
"AccountPushExecutionList": "Execution list",
|
||||
"AccountPushCreate": "Account push create",
|
||||
"AccountPushUpdate": "Account push update",
|
||||
"AutoPushHelpText": "The push parameter settings are currently only effective for assets with a platform type of host.",
|
||||
"ParamsHelpText": "The push parameter settings are currently only effective for assets with a platform type of host.",
|
||||
"AccountPushList": "Account push list"
|
||||
},
|
||||
"AccountBackup": {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
},
|
||||
"AccountChangeSecret": {
|
||||
"Result": "結果",
|
||||
"ParamsHelpText": "改密パラメータの設定は、プラットフォームの種類がホストである資産に対してのみ有効です。",
|
||||
"ExecutionTimes": "実行時間",
|
||||
"TaskList": "タスク レコード",
|
||||
"TimerPeriod": "時限実行サイクル",
|
||||
@@ -93,7 +94,7 @@
|
||||
"AccountPushExecutionList": "実行リスト",
|
||||
"AccountPushCreate": "アカウントのプッシュ作成",
|
||||
"AccountPushUpdate": "アカウントプッシュ更新",
|
||||
"AutoPushHelpText": "Pushパラメータの設定は、プラットフォームの種類がホストである資産に対してのみ有効です。",
|
||||
"ParamsHelpText": "Pushパラメータの設定は、プラットフォームの種類がホストである資産に対してのみ有効です。",
|
||||
"AccountPushList": "アカウントプッシュ"
|
||||
},
|
||||
"AccountBackup": {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"AccountPushList": "账号推送",
|
||||
"AccountPushCreate": "账号推送创建",
|
||||
"AccountPushUpdate": "账号推送更新",
|
||||
"AutoPushHelpText": "推送参数设置,目前仅对平台种类为主机的资产生效。",
|
||||
"ParamsHelpText": "推送参数设置,目前仅对平台种类为主机的资产生效。",
|
||||
"AccountPushExecutionList": "执行列表"
|
||||
},
|
||||
"AccountBackup": {
|
||||
@@ -45,6 +45,7 @@
|
||||
"Reason": "原因"
|
||||
},
|
||||
"AccountChangeSecret": {
|
||||
"ParamsHelpText": "改密参数设置,目前仅对平台种类为主机的资产生效。",
|
||||
"ContainAttachment": "含附件",
|
||||
"AddAsset": "添加资产",
|
||||
"MailRecipient": "邮件收件人",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<script>
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields'
|
||||
import { AssetSelect, AutomationParams } from '@/components'
|
||||
|
||||
export default {
|
||||
name: 'AccountChangeSecretCreateUpdate',
|
||||
@@ -13,6 +14,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
node_ids: [],
|
||||
asset_ids: [],
|
||||
initial: {
|
||||
is_periodic: true,
|
||||
password_rules: {
|
||||
@@ -33,14 +36,57 @@ export default {
|
||||
[
|
||||
'secret_strategy', 'secret_type', 'secret',
|
||||
'password_rules', 'ssh_key_change_strategy',
|
||||
'ssh_key', 'passphrase'
|
||||
'ssh_key', 'passphrase', 'params'
|
||||
]
|
||||
],
|
||||
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
|
||||
[this.$t('common.Other'), ['is_active', 'recipients', 'comment']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
...getChangeSecretFields()
|
||||
...getChangeSecretFields(),
|
||||
assets: {
|
||||
label: this.$t('xpack.Asset'),
|
||||
type: 'assetSelect',
|
||||
component: AssetSelect,
|
||||
rules: [
|
||||
{ required: false }
|
||||
],
|
||||
el: {
|
||||
baseUrl: '/api/v1/assets/assets/?change_secret_enabled=true'
|
||||
},
|
||||
on: {
|
||||
input: ([value]) => {
|
||||
this.asset_ids = value
|
||||
}
|
||||
}
|
||||
},
|
||||
nodes: {
|
||||
label: this.$t('xpack.Node'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/assets/nodes/',
|
||||
transformOption: (item) => {
|
||||
return { label: item.full_value, value: item.id }
|
||||
}
|
||||
}
|
||||
},
|
||||
on: {
|
||||
input: ([value]) => {
|
||||
this.node_ids = value?.map(i => i.pk)
|
||||
}
|
||||
}
|
||||
},
|
||||
params: {
|
||||
component: AutomationParams,
|
||||
label: this.$t('assets.ChangeSecretParams'),
|
||||
el: {
|
||||
method: 'change_secret_method',
|
||||
assets: this.asset_ids,
|
||||
nodes: this.node_ids
|
||||
},
|
||||
helpText: this.$t('accounts.AccountChangeSecret.ParamsHelpText')
|
||||
}
|
||||
},
|
||||
createSuccessNextRoute: { name: 'AccountChangeSecretList' },
|
||||
updateSuccessNextRoute: { name: 'AccountChangeSecretList' },
|
||||
@@ -55,6 +101,20 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
node_ids: {
|
||||
handler(val) {
|
||||
this.fieldsMeta.params.el.nodes = val
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
asset_ids: {
|
||||
handler(val) {
|
||||
this.fieldsMeta.params.el.assets = val
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAfterGetRemoteMeta(meta) {
|
||||
const needSetOptionFields = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
import { AssetSelect, CronTab } from '@/components'
|
||||
import { CronTab } from '@/components'
|
||||
import { TagInput, UpdateToken } from '@/components/FormFields'
|
||||
import { Required } from '@/components/DataForm/rules'
|
||||
|
||||
@@ -46,29 +46,6 @@ function generatePasswordRulesItemsFields(obType) {
|
||||
|
||||
export const getChangeSecretFields = () => {
|
||||
return {
|
||||
assets: {
|
||||
type: 'assetSelect',
|
||||
component: AssetSelect,
|
||||
rules: [
|
||||
{ required: false }
|
||||
],
|
||||
el: {
|
||||
baseUrl: '/api/v1/assets/assets/?change_secret_enabled=true'
|
||||
},
|
||||
label: i18n.t('xpack.Asset')
|
||||
},
|
||||
nodes: {
|
||||
label: i18n.t('xpack.Node'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/assets/nodes/',
|
||||
transformOption: (item) => {
|
||||
return { label: item.full_value, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
secret_type: {
|
||||
type: 'radio-group',
|
||||
options: []
|
||||
@@ -149,7 +126,6 @@ export const getChangeSecretFields = () => {
|
||||
label: i18n.t('common.Username'),
|
||||
component: TagInput
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields'
|
||||
import { AssetSelect } from '@/components'
|
||||
import AccountAutoPush from './AccountAutoPush.vue'
|
||||
import { AssetSelect, AutomationParams } from '@/components'
|
||||
|
||||
export default {
|
||||
name: 'AccountPushCreateUpdate',
|
||||
@@ -96,13 +95,14 @@ export default {
|
||||
disabled: !this.$store.getters.hasValidLicense
|
||||
},
|
||||
params: {
|
||||
component: AccountAutoPush,
|
||||
component: AutomationParams,
|
||||
label: this.$t('assets.PushParams'),
|
||||
el: {
|
||||
method: 'push_account_method',
|
||||
assets: this.asset_ids,
|
||||
nodes: this.node_ids
|
||||
},
|
||||
helpText: this.$t('accounts.AccountPush.AutoPushHelpText')
|
||||
helpText: this.$t('accounts.AccountPush.ParamsHelpText')
|
||||
}
|
||||
},
|
||||
createSuccessNextRoute: { name: 'AccountPushList' },
|
||||
|
||||
Reference in New Issue
Block a user