perf: 优化全局组织下一些权限问题

This commit is contained in:
“huailei000” 2023-02-23 18:55:31 +08:00 committed by huailei
parent 55c6202c5e
commit d74e70893e
5 changed files with 26 additions and 6 deletions

View File

@ -268,7 +268,7 @@ export default {
title: this.$t('common.Add'),
type: 'primary',
can: () => {
return vm.$hasPerm('accounts.add_account')
return vm.$hasPerm('accounts.add_account') && !this.$store.getters.currentOrgIsRoot
},
callback: async() => {
await this.getAssetDetail()

View File

@ -119,7 +119,14 @@ export default {
},
mounted() {
const url = `/api/v1/accounts/account-secrets/${this.account.id}/histories/?limit=1`
this.$axios.get(url).then(resp => {
this.$axios.get(url,
{
validateStatus: (status) => {
if (status === 400) return 200
return status
}
}
).then(resp => {
this.versions = resp.count
})
},

View File

@ -83,7 +83,12 @@ export default {
attrs: {
type: 'primary',
label: this.$t('assets.Test'),
disabled: !vm.$hasPerm('accounts.verify_account')
disabled: (
!vm.$hasPerm('accounts.verify_account') ||
!vm.object.asset.auto_info?.ansible_enabled ||
!vm.object.asset.auto_info?.ping_enabled ||
this.$store.getters.currentOrgIsRoot
)
},
callbacks: Object.freeze({
click: () => {
@ -104,7 +109,11 @@ export default {
attrs: {
type: 'primary',
label: this.$t('assets.Push'),
disabled: !vm.$hasPerm('accounts.push_account')
disabled: (
!vm.$hasPerm('accounts.push_account') ||
!vm.object.asset.auto_info?.push_account_enabled ||
this.$store.getters.currentOrgIsRoot
)
},
callbacks: Object.freeze({
click: () => {

View File

@ -69,7 +69,7 @@ export default {
{
name: 'View',
title: this.$t('common.Sync'),
can: this.$hasPerm('accounts.add_gatheredaccount'),
can: this.$hasPerm('accounts.add_gatheredaccount') && !this.$store.getters.currentOrgIsRoot,
type: 'primary',
callback: ({ row }) => {
this.$axios.post(

View File

@ -54,7 +54,11 @@ export default {
{
name: 'Test',
title: this.$t('common.Test'),
can: this.$hasPerm('assets.test_assetconnectivity'),
can: ({ row }) =>
this.$hasPerm('assets.test_assetconnectivity') &&
!this.$store.getters.currentOrgIsRoot &&
row['auto_info'].ansible_enabled &&
row['auto_info'].ping_enabled,
callback: ({ row }) => {
if (row.platform.name === 'Gateway') {
this.GatewayVisible = true