perf: 优化has valid license 写法

This commit is contained in:
ibuler
2021-03-18 20:28:40 +08:00
committed by Orange
parent dd4aed9cf4
commit 4eb5155aed
2 changed files with 11 additions and 45 deletions

View File

@@ -4,7 +4,6 @@
<script>
import { GenericListPage } from '@/layout/components'
import { mapGetters } from 'vuex'
export default {
components: {
@@ -67,59 +66,35 @@ export default {
hasMoreActions: false,
createRoute: 'DatabaseAppCreate',
moreCreates: {
callback: (item) => {
vm.$router.push({ name: 'DatabaseAppCreate', query: { type: item.name.toLowerCase() }})
},
dropdown: [
{
name: 'MySQL',
title: 'MySQL',
type: 'primary',
has: true,
callback: this.createMysql.bind(this)
has: true
},
{
name: 'PostgreSQL',
title: 'PostgreSQL',
type: 'primary',
has: this.hasLicence,
callback: this.createPostgreSQL.bind(this)
has: this.$store.getters.hasValidLicense
},
{
name: 'MariaDB',
title: 'MariaDB',
type: 'primary',
has: this.hasLicence,
callback: this.createMariaDB.bind(this)
has: this.$store.getters.hasValidLicense
},
{
name: 'Oracle',
title: 'Oracle',
type: 'primary',
has: this.hasLicence,
callback: this.createOracle.bind(this)
has: this.$store.getters.hasValidLicense
}
]
}
}
}
},
computed: {
...mapGetters(['publicSettings', 'currentOrg', 'hasValidLicense'])
},
methods: {
createMysql() {
this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'mysql' }})
},
createPostgreSQL() {
this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'postgresql' }})
},
createMariaDB() {
this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'mariadb' }})
},
createOracle() {
this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'oracle' }})
},
hasLicense() {
return this.hasLicence
}
}
}
</script>

View File

@@ -4,7 +4,6 @@
<script>
import { GenericListPage } from '@/layout/components'
import { mapGetters } from 'vuex'
export default {
components: {
@@ -98,25 +97,25 @@ export default {
name: 'PostgreSQL',
title: 'PostgreSQL',
type: 'primary',
has: this.hasLicence
has: this.$store.getters.hasValidLicense
},
{
name: 'MariaDB',
title: 'MariaDB',
type: 'primary',
has: this.hasLicence
has: this.$store.getters.hasValidLicense
},
{
name: 'Oracle',
title: 'Oracle',
type: 'primary',
has: this.hasLicence
has: this.$store.getters.hasValidLicense
},
{
name: 'K8S',
title: 'K8S',
type: 'primary',
has: this.hasLicence,
has: this.$store.getters.hasValidLicense,
group: this.$t('assets.OtherProtocol')
}
]
@@ -124,14 +123,6 @@ export default {
},
helpMessage: this.$t('assets.SystemUserListHelpMessage')
}
},
computed: {
...mapGetters(['publicSettings', 'currentOrg', 'hasValidLicense'])
},
methods: {
hasLicence() {
return this.hasValidLicense
}
}
}
</script>