perf: 优化创建storage,使用新的通用组件

perf: 优化工单创建使用新的组件
This commit is contained in:
ibuler 2021-03-16 14:18:27 +08:00 committed by Orange
parent 324db2fdae
commit 6fc8a43e34
7 changed files with 71 additions and 97 deletions

View File

@ -63,13 +63,17 @@ export default {
moreCreates: {
type: Object,
default: null
},
createTitle: {
type: String,
default: () => this.$t('common.Create')
}
},
data() {
const defaultActions = [
{
name: 'actionCreate',
title: this.$t('common.Create'),
title: this.createTitle,
type: 'primary',
has: this.hasCreate && !this.moreCreates,
can: this.canCreate,
@ -79,7 +83,7 @@ export default {
if (this.moreCreates) {
const defaultMoreCreate = {
name: 'actionMoreCreate',
title: this.$t('common.Create'),
title: this.createTitle,
type: 'primary',
has: true,
can: this.canCreate,

View File

@ -93,8 +93,6 @@ export default {
hasCreate: false,
hasMoreActions: false,
hasBulkDelete: false,
// createRoute: 'RemoteAppCreate',
moreActionsTitle: this.$t('common.Create'),
moreActionsType: 'primary',
moreCreates: {
callback: (option) => {

View File

@ -22,19 +22,18 @@ export default {
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
hasBulkUpdate: false,
hasCreate: false,
extraMoreActions: [
hasMoreActions: false,
moreCreates: {
callback: (item) => {
this.$router.push({ name: 'CreateCommandStorage', query: { type: item.name }})
},
dropdown: [
{
name: 'Elasticsearch',
title: 'Elasticsearch',
type: 'primary',
callback: this.createEs.bind(this)
name: 'es',
title: 'Elasticsearch'
}
]
}
],
moreActionsTitle: this.$t('common.Create'),
moreActionsType: 'primary'
},
commandTableConfig: {
title: 'command',

View File

@ -15,48 +15,34 @@ export default {
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
hasCreate: false,
moreActionsTitle: this.$t('common.Create'),
moreActionsType: 'primary',
extraMoreActions: [
hasMoreActions: false,
moreCreates: {
callback: (item) => {
this.$router.push({ name: 'CreateReplayStorage', query: { type: item.name.toLowerCase() }})
},
dropdown: [
{
name: 'S3',
title: 'S3',
type: 'primary',
can: true,
callback: this.createS3.bind(this)
title: 'S3'
},
{
name: 'Ceph',
title: 'Ceph',
type: 'primary',
can: true,
callback: this.createCeph.bind(this)
title: 'Ceph'
},
{
name: 'Swift',
title: 'Swift',
type: 'primary',
can: true,
callback: this.createSwift.bind(this)
name: 'swift',
title: 'Swift'
},
{
name: 'OSS',
title: 'OSS',
type: 'primary',
can: true,
callback: this.createOSS.bind(this)
title: 'OSS'
},
{
name: 'Azure',
title: 'Azure',
type: 'primary',
can: true,
callback: this.createAzure.bind(this)
title: 'Azure'
}
]
}
},
replayTableConfig: {
url: '/api/v1/terminal/replay-storages/',
@ -110,21 +96,6 @@ export default {
}
},
methods: {
createS3() {
this.$router.push({ name: 'CreateReplayStorage', query: { type: 's3' }})
},
createCeph() {
this.$router.push({ name: 'CreateReplayStorage', query: { type: 'ceph' }})
},
createSwift() {
this.$router.push({ name: 'CreateReplayStorage', query: { type: 'swift' }})
},
createOSS() {
this.$router.push({ name: 'CreateReplayStorage', query: { type: 'oss' }})
},
createAzure() {
this.$router.push({ name: 'CreateReplayStorage', query: { type: 'azure' }})
}
}
}
</script>

View File

@ -138,7 +138,9 @@ export default {
component: Select2,
el: {
multiple: false,
options: this.$store.state.users.profile.user_all_orgs
options: this.$store.state.users.profile.user_all_orgs.map((item) => {
return { label: item.name, value: item.id }
})
},
on: {
changeOptions: ([event], updateForm) => {

View File

@ -42,7 +42,10 @@ export default {
}
},
meta: {
fields: ['apply_ip_group', 'apply_hostname_group', 'apply_system_user_group', 'apply_actions', 'apply_date_start', 'apply_date_expired'],
fields: [
'apply_ip_group', 'apply_hostname_group', 'apply_system_user_group',
'apply_actions', 'apply_date_start', 'apply_date_expired'
],
fieldsMeta: {
apply_actions: {
label: this.$t('perms.Actions'),
@ -64,7 +67,9 @@ export default {
component: Select2,
el: {
multiple: false,
options: this.$store.state.users.profile.user_all_orgs
options: this.$store.state.users.profile.user_all_orgs.map((item) => {
return { label: item.name, value: item.id }
})
},
on: {
changeOptions: ([event], updateForm) => {

View File

@ -112,33 +112,28 @@ export default {
}
}
},
moreActionsTitle: this.$t('common.RequestTickets'),
moreActionsType: 'primary',
extraMoreActions: this.genExtraMoreActions()
}
}
},
methods: {
genExtraMoreActions() {
return [
createTitle: this.$t('common.RequestTickets'),
hasMoreActions: false,
moreCreates: {
dropdown: [
{
name: 'RequestAssetPerm',
title: this.$t('tickets.RequestAssetPerm'),
type: 'primary',
can: true,
callback: () => this.$router.push({ name: 'RequestAssetPermTicketCreateUpdate' })
},
{
name: 'RequestApplicationPerm',
title: this.$t('tickets.RequestApplicationPerm'),
type: 'primary',
can: true,
callback: () => this.$router.push({ name: 'RequestApplicationPermTicketCreateUpdate' })
}
]
}
}
}
},
methods: {
}
}
</script>
<style scoped>