mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
perf: using checkbox replace switch
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import ObjectSelect2 from '@/components/Form/FormFields/NestedObjectSelect2.vue'
|
||||
import NestedField from '@/components/Form/AutoDataForm/components/NestedField.vue'
|
||||
import Switcher from '@/components/Form/FormFields/Switcher.vue'
|
||||
import rules from '@/components/Form/DataForm/rules'
|
||||
import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
|
||||
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
|
||||
@@ -65,8 +64,9 @@ export class FormFieldGenerator {
|
||||
}
|
||||
break
|
||||
case 'boolean':
|
||||
type = ''
|
||||
field.component = Switcher
|
||||
type = 'checkbox'
|
||||
// field.component = Switcher
|
||||
// field.type = 'checkbox'
|
||||
break
|
||||
case 'list':
|
||||
type = 'input'
|
||||
|
||||
@@ -54,22 +54,22 @@ export default {
|
||||
{
|
||||
id: 'uppercase',
|
||||
label: this.$t('Uppercase'),
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
id: 'lowercase',
|
||||
label: this.$t('Lowercase'),
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
id: 'digit',
|
||||
label: this.$t('Digit'),
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
id: 'symbol',
|
||||
label: this.$t('SpecialSymbol'),
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
id: 'exclude_symbols',
|
||||
|
||||
@@ -15,7 +15,7 @@ export default {
|
||||
return {
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'nodes', 'assets']],
|
||||
[this.$t('发现配置'), ['is_sync_account', 'recipients']],
|
||||
[this.$t('DiscoverConfig'), ['is_sync_account', 'check_risk', 'recipients']],
|
||||
[this.$t('Periodic'), ['is_periodic', 'crontab', 'interval']],
|
||||
[this.$t('Other'), ['is_active', 'comment']]
|
||||
],
|
||||
@@ -23,10 +23,10 @@ export default {
|
||||
hasDetailInMsg: false,
|
||||
fieldsMeta: {
|
||||
is_sync_account: {
|
||||
type: 'switch',
|
||||
label: this.$t('IsSyncAccountLabel'),
|
||||
helpText: this.$t('IsSyncAccountHelpText')
|
||||
},
|
||||
check_risk: {},
|
||||
is_periodic,
|
||||
crontab,
|
||||
interval,
|
||||
|
||||
@@ -38,7 +38,7 @@ export const interval = {
|
||||
}
|
||||
|
||||
export const is_periodic = {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
hidden: (formValue) => {
|
||||
return !store.getters.hasValidLicense
|
||||
}
|
||||
|
||||
@@ -214,12 +214,12 @@ export default {
|
||||
helpTip: this.$t('HostnameStrategy')
|
||||
},
|
||||
is_always_update: {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
label: this.$t('IsAlwaysUpdate'),
|
||||
helpTip: this.$t('IsAlwaysUpdateHelpTip')
|
||||
},
|
||||
fully_synchronous: {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
label: this.$t('FullySynchronous'),
|
||||
helpTip: this.$t('FullySynchronousHelpTip')
|
||||
},
|
||||
@@ -238,7 +238,7 @@ export default {
|
||||
}
|
||||
},
|
||||
is_periodic: {
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
crontab: {
|
||||
component: CronTab,
|
||||
|
||||
@@ -59,12 +59,12 @@ export default {
|
||||
helpTips: this.$t('xpack.Cloud.HostnameStrategy')
|
||||
},
|
||||
is_always_update: {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
label: this.$t('xpack.Cloud.IsAlwaysUpdate'),
|
||||
helpTips: this.$t('xpack.Cloud.IsAlwaysUpdateHelpTips')
|
||||
},
|
||||
fully_synchronous: {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
label: this.$t('xpack.Cloud.FullySynchronous'),
|
||||
helpTips: this.$t('xpack.Cloud.FullySynchronousHelpTips')
|
||||
},
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
}
|
||||
},
|
||||
is_periodic: {
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
crontab: {
|
||||
component: CronTab,
|
||||
@@ -125,7 +125,9 @@ export default {
|
||||
if (!Array.isArray(ipNetworkSegments)) {
|
||||
value.ip_network_segment_group = ipNetworkSegments ? ipNetworkSegments.split(',') : []
|
||||
}
|
||||
value.strategy = strategy.map(item => { return item.id })
|
||||
value.strategy = strategy.map(item => {
|
||||
return item.id
|
||||
})
|
||||
return value
|
||||
},
|
||||
onPerformError(error, method, vm) {
|
||||
@@ -155,8 +157,7 @@ export default {
|
||||
this.fieldsMeta.regions.el.ajax.url = form.account?.id ? `/api/v1/xpack/cloud/regions/?account_id=${form.account.id}` : `/api/v1/xpack/cloud/regions/`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
methods: {}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -153,6 +153,7 @@ export default {
|
||||
break
|
||||
case 'boolean':
|
||||
component = Switcher
|
||||
// component = 'checkbox'
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ export const assetFieldsMeta = (vm) => {
|
||||
}
|
||||
},
|
||||
is_active: {
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
cluster: {
|
||||
label: i18n.t('Cluster')
|
||||
|
||||
@@ -145,7 +145,7 @@ export default {
|
||||
}
|
||||
},
|
||||
is_periodic: {
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
hidden: () => {
|
||||
return this.instantTask
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields'
|
||||
import { AssetSelect } from '@/components'
|
||||
import { crontab, interval, is_periodic } from '@/views/accounts/const'
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
export default {
|
||||
name: 'AccountPushCreateUpdate',
|
||||
@@ -32,7 +33,7 @@ export default {
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name']],
|
||||
[this.$t('Asset'), ['assets', 'nodes']],
|
||||
[this.$t('Engine'), ['engines']],
|
||||
[this.$t('Check config'), ['engines', 'recipients']],
|
||||
[this.$t('Periodic'), ['is_periodic', 'interval', 'crontab']],
|
||||
[this.$t('Other'), ['is_active', 'comment']]
|
||||
],
|
||||
@@ -70,6 +71,19 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
recipients: {
|
||||
label: i18n.t('Recipients'),
|
||||
helpText: i18n.t('OnlyMailSend'),
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/users/users/?fields_size=mini',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name + '(' + item.username + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
nodes: {
|
||||
el: {
|
||||
multiple: true,
|
||||
|
||||
@@ -22,14 +22,15 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfig: {
|
||||
url: '/api/v1/accounts/push-account-executions/?' + `${this.object.id ? 'automation_id=' + this.object.id : ''}`,
|
||||
url: '/api/v1/accounts/check-account-executions/',
|
||||
columns: [
|
||||
'automation', 'push_user_name', 'asset_amount', 'node_amount', 'status',
|
||||
'trigger', 'date_start', 'date_finished', 'actions'
|
||||
'task_name', 'asset_amount',
|
||||
'node_amount', 'status', 'trigger',
|
||||
'date_start', 'date_finished', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
default: [
|
||||
'automation', 'push_user_name', 'status',
|
||||
'automation', 'task_name', 'status',
|
||||
'date_start', 'date_finished', 'actions'
|
||||
]
|
||||
},
|
||||
@@ -40,7 +41,7 @@ export default {
|
||||
return <span>{row.automation}</span>
|
||||
}
|
||||
},
|
||||
push_user_name: {
|
||||
task_name: {
|
||||
label: this.$t('DisplayName'),
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
@@ -96,6 +97,15 @@ export default {
|
||||
callback: function({ row }) {
|
||||
return this.$router.push({ name: 'AccountCheckExecutionDetail', params: { id: row.id }})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'report',
|
||||
title: this.$t('Report'),
|
||||
type: 'success',
|
||||
can: this.$hasPerm('accounts.view_pushaccountexecution'),
|
||||
callback: function({ row }) {
|
||||
window.open(`/api/v1/accounts/check-account-executions/${row.id}/report/`)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
title: this.$t('执行历史'),
|
||||
name: 'AccountCheckExecution',
|
||||
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
|
||||
component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue')
|
||||
component: () => import('./AccountCheckExecutionList.vue')
|
||||
},
|
||||
{
|
||||
title: this.$t('检查引擎'),
|
||||
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
quickActions: [
|
||||
{
|
||||
title: this.$t('Active'),
|
||||
type: 'switch',
|
||||
type: 'checkbox',
|
||||
attrs: {
|
||||
model: this.object.is_active,
|
||||
disabled: !this.$hasPerm('perms.change_assetpermission')
|
||||
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
}
|
||||
},
|
||||
AUTH_LDAP_HA_SYNC_IS_PERIODIC: {
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
AUTH_LDAP_HA_SYNC_CRONTAB: {
|
||||
component: CronTab,
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
}
|
||||
},
|
||||
AUTH_LDAP_SYNC_IS_PERIODIC: {
|
||||
type: 'switch'
|
||||
type: 'checkbox'
|
||||
},
|
||||
AUTH_LDAP_SYNC_CRONTAB: {
|
||||
component: CronTab,
|
||||
|
||||
Reference in New Issue
Block a user