fix: 修复Dropdown Menu的回调异常 (#642)

* fix: 修复Dropdown Menu的回调异常

* perf: 优化创建

Co-authored-by: Orange <orangemtony@gmail.com>
Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
fit2bot 2021-03-09 12:35:44 +08:00 committed by GitHub
parent 1d008330a1
commit 5d973944ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 21 deletions

View File

@ -5,7 +5,9 @@ export function cleanActions(actions, canDefaults, { selectedRows, reloadTable }
cloneActions.forEach((action) => {
action.has = cleanBoolean(action, 'has', true, { selectedRows, reloadTable })
action.can = cleanBoolean(action, 'can', true, { selectedRows, reloadTable })
action.callback = cleanCallback(action, { selectedRows, reloadTable })
if (!action.dropdown) {
action.callback = cleanCallback(action, { selectedRows, reloadTable })
}
cleanedActions.push(action)
})
return cleanedActions

View File

@ -56,7 +56,7 @@ export default {
createRoute: 'SystemUserCreate',
moreCreates: {
callback: (option) => {
vm.$router.push({ name: 'SystemUserCreate', query: { protocol: option.type }})
vm.$router.push({ name: 'SystemUserCreate', query: { protocol: option.title.toLowerCase() }})
},
dropdown: [
{

View File

@ -1,5 +1,4 @@
import i18n from '@/i18n/i18n'
import router from '@/router'
import store from '@/store'
export const CHROME = 'chrome'
export const MYSQL_WORKBENCH = 'mysql_workbench'
@ -20,29 +19,25 @@ export const REMOTE_APP = [
title: i18n.t(`applications.applicationsType.${CHROME}`),
type: 'primary',
group: i18n.t('applications.RemoteApp'),
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CHROME, category: REMOTEAPP_CATEGORY }}) }
has: hasValidLicense
},
{
name: MYSQL_WORKBENCH,
title: i18n.t(`applications.applicationsType.${MYSQL_WORKBENCH}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL_WORKBENCH, category: REMOTEAPP_CATEGORY }}) }
has: hasValidLicense
},
{
name: VMWARE_CLIENT,
title: i18n.t(`applications.applicationsType.${VMWARE_CLIENT}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: VMWARE_CLIENT, category: REMOTEAPP_CATEGORY }}) }
has: hasValidLicense
},
{
name: CUSTOM,
title: i18n.t(`applications.applicationsType.${CUSTOM}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CUSTOM, category: REMOTEAPP_CATEGORY }}) }
has: hasValidLicense
}
]
@ -58,29 +53,25 @@ export const DATABASE = [
title: i18n.t(`applications.applicationsType.${MYSQL}`),
type: 'primary',
has: true,
group: i18n.t('applications.Database'),
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL, category: DATABASE_CATEGORY }}) }
group: i18n.t('applications.Database')
},
{
name: ORACLE,
title: i18n.t(`applications.applicationsType.${ORACLE}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: ORACLE, category: DATABASE_CATEGORY }}) }
has: hasValidLicense
},
{
name: POSTGRESQL,
title: i18n.t(`applications.applicationsType.${POSTGRESQL}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: POSTGRESQL, category: DATABASE_CATEGORY }}) }
has: hasValidLicense
},
{
name: MARIADB,
title: i18n.t(`applications.applicationsType.${MARIADB}`),
type: 'primary',
has: hasValidLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MARIADB, category: DATABASE_CATEGORY }}) }
has: hasValidLicense
}
]
@ -93,8 +84,7 @@ export const CLOUD = [
title: i18n.t(`applications.applicationsType.${KUBERNETES}`),
group: i18n.t('applications.Cloud'),
type: 'primary',
has: true,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: KUBERNETES, category: CLOUD_CATEGORY }}) }
has: true
}
]