diff --git a/src/router/common.js b/src/router/common.js index 2bd90d348..3b5576dfb 100644 --- a/src/router/common.js +++ b/src/router/common.js @@ -10,13 +10,19 @@ export default [ component: () => import('@/views/ops/CeleryTaskLog'), name: 'CeleryTaskLog', hidden: true, - meta: { title: i18n.t('route.CeleryTaskLog'), roles: ['SuperAdmin', 'Admin', 'Auditor', 'User'] } + meta: { + title: i18n.t('route.CeleryTaskLog'), + permissions: [] + } }, { path: '/ops/task/task/:id/log/', component: () => import('@/views/ops/CeleryTaskLog'), name: 'TaskLog', hidden: true, - meta: { title: i18n.t('route.CeleryTaskLog'), roles: ['SuperAdmin', 'Admin', 'Auditor', 'User'] } + meta: { + title: i18n.t('route.CeleryTaskLog'), + permissions: [] + } } ] diff --git a/src/utils/jms.js b/src/utils/jms.js index d23ae24cd..bfc57ff41 100644 --- a/src/utils/jms.js +++ b/src/utils/jms.js @@ -1,5 +1,6 @@ import store from '@/store' import Vue from 'vue' +import { constantRoutes } from '@/router' export function openTaskPage(taskId) { window.open(`/#/ops/celery/task/${taskId}/log/`, '', 'width=900,height=600') @@ -134,3 +135,18 @@ export function hasRouteViewPerm(route) { const perms = getViewRequirePerms(viewName) return hasPermission(perms) } + +export function getConstRouteName() { + const names = [] + const constRoutes = constantRoutes + const addRoutes = (all, routes) => { + for (const route of routes) { + names.push(route.name) + if (route.children) { + addRoutes(all, route.children) + } + } + } + addRoutes(names, constRoutes) + return names +} diff --git a/src/views/assets/Asset/AssetDetail/Detail.vue b/src/views/assets/Asset/AssetDetail/Detail.vue index 428d87ce8..7c44add1f 100644 --- a/src/views/assets/Asset/AssetDetail/Detail.vue +++ b/src/views/assets/Asset/AssetDetail/Detail.vue @@ -5,7 +5,7 @@ - + @@ -34,6 +34,7 @@ export default { } }, data() { + const vm = this return { quickActions: [ { @@ -41,7 +42,8 @@ export default { type: 'switcher', attrs: { label: this.$t('common.Test'), - model: this.object.is_active + model: this.object.is_active, + disabled: !vm.$hasPerm('assets.change_asset') }, callbacks: { change: function(val) { @@ -60,7 +62,8 @@ export default { title: this.$t('assets.RefreshHardware'), attrs: { type: 'primary', - label: this.$t('assets.Refresh') + label: this.$t('assets.Refresh'), + disabled: !vm.$hasPerm('assets.refresh_assethardwareinfo') }, callbacks: { click: function() { @@ -78,7 +81,8 @@ export default { title: this.$t('assets.TestAssetsConnective'), attrs: { type: 'primary', - label: this.$t('assets.Test') + label: this.$t('assets.Test'), + disabled: !vm.$hasPerm('assets.test_assetconnectivity') }, callbacks: { click: function() { @@ -215,13 +219,10 @@ export default { } ] } - }, mounted() { - }, methods: { - } }