perf: 优化同步

This commit is contained in:
ibuler
2023-08-29 16:14:35 +08:00
parent b6e955f4b7
commit a0dbb3d7b0
5 changed files with 26 additions and 14 deletions

View File

@@ -1,7 +1,5 @@
<template> <template>
<GenericCreateUpdatePage <GenericCreateUpdatePage v-bind="$data" />
v-bind="$data"
/>
</template> </template>
<script> <script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" /> <GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
</template> </template>
<script type="text/jsx"> <script type="text/jsx">
@@ -19,7 +19,10 @@ export default {
app: 'xpack', app: 'xpack',
resource: 'strategy' resource: 'strategy'
}, },
columns: ['name', 'priority', 'strategy_rules', 'strategy_actions', 'actions', 'user_actions'], columns: [
'name', 'priority', 'strategy_rules',
'strategy_actions', 'actions', 'user_actions'
],
columnsMeta: { columnsMeta: {
name: { name: {
formatter: DetailFormatter, formatter: DetailFormatter,

View File

@@ -24,8 +24,11 @@ export default {
fields: [ fields: [
[this.$t('common.Basic'), ['name']], [this.$t('common.Basic'), ['name']],
[this.$t('xpack.Cloud.CloudSource'), ['account', 'regions']], [this.$t('xpack.Cloud.CloudSource'), ['account', 'regions']],
[this.$t('xpack.Cloud.SaveSetting'), ['hostname_strategy', 'ip_network_segment_group', 'sync_ip_type', 'is_always_update']], [this.$t('xpack.Cloud.SaveSetting'), [
[this.$t('common.Strategy'), ['strategy']], 'hostname_strategy', 'ip_network_segment_group',
'sync_ip_type', 'is_always_update'
]],
[this.$t('common.Actions'), ['strategy']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']], [this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('common.Other'), ['comment']] [this.$t('common.Other'), ['comment']]
], ],

View File

@@ -1,14 +1,16 @@
<template> <template>
<Dialog <Dialog
:close-on-click-modal="false"
:destroy-on-close="true" :destroy-on-close="true"
:show-buttons="false" :show-buttons="false"
:close-on-click-modal="false"
:title="$tc('common.Strategy')" :title="$tc('common.Strategy')"
width="80%"
v-bind="$attrs" v-bind="$attrs"
width="80%"
v-on="$listeners" v-on="$listeners"
> >
<GenericCreateUpdateForm v-bind="$data" /> <IBox>
<GenericCreateUpdateForm v-bind="$data" />
</IBox>
</Dialog> </Dialog>
</template> </template>
@@ -17,10 +19,11 @@ import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm
import Dialog from '@/components/Dialog/index.vue' import Dialog from '@/components/Dialog/index.vue'
import RuleInput from '@/views/assets/Cloud/Strategy/components/RuleInput' import RuleInput from '@/views/assets/Cloud/Strategy/components/RuleInput'
import ActionInput from '@/views/assets/Cloud/Strategy/components/ActionInput' import ActionInput from '@/views/assets/Cloud/Strategy/components/ActionInput'
import IBox from '@/components/IBox/index.vue'
export default { export default {
name: 'AttrDialog', name: 'AttrDialog',
components: { Dialog, GenericCreateUpdateForm }, components: { Dialog, GenericCreateUpdateForm, IBox },
props: { props: {
value: { value: {
type: Object, type: Object,

View File

@@ -4,12 +4,14 @@
<DataTable :config="tableConfig" /> <DataTable :config="tableConfig" />
<AttrDialog <AttrDialog
v-if="visible" v-if="visible"
:table-config="tableConfig"
:value="attrValue" :value="attrValue"
:visible.sync="visible" :visible.sync="visible"
:table-config="tableConfig"
@confirm="onAttrDialogConfirm" @confirm="onAttrDialogConfirm"
/> />
<el-button type="primary" size="mini" @click="handleCreate">{{ this.$t('common.New') }}</el-button> <el-button size="mini" type="primary" @click="handleCreate">
{{ this.$t('common.New') }}
</el-button>
</div> </div>
</template> </template>
@@ -73,7 +75,10 @@ export default {
ajax: { ajax: {
transformOption: (item) => { transformOption: (item) => {
this.strategy[item.id] = { this.strategy[item.id] = {
name: item.name, priority: item.priority, strategy_rules: item.strategy_rules, strategy_actions: item.strategy_actions name: item.name,
priority: item.priority,
strategy_rules: item.strategy_rules,
strategy_actions: item.strategy_actions
} }
return { label: item.name, value: item.id } return { label: item.name, value: item.id }
} }