mirror of
https://github.com/jumpserver/lina.git
synced 2025-04-27 11:10:51 +00:00
perf: Enhance account actions with organization root checks
This commit is contained in:
parent
e19c0090de
commit
025487a5eb
@ -6,7 +6,7 @@
|
||||
<i class="fa fa-check" />
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-for="item of iActions" :key="item.name" :command="item.name">
|
||||
<el-dropdown-item v-for="item of iActions" :key="item.name" :command="item.name" :disabled="item.disabled">
|
||||
{{ item.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
@ -123,17 +123,20 @@ export default {
|
||||
{
|
||||
name: 'delete_remote',
|
||||
label: this.$t('DeleteRemoteAccount'),
|
||||
has: this.row.remote_present
|
||||
has: this.row.remote_present,
|
||||
disabled: this.$store.getters.currentOrgIsRoot
|
||||
},
|
||||
{
|
||||
name: 'add_account',
|
||||
label: this.$t('AddAccount'),
|
||||
has: !this.row.present
|
||||
has: !this.row.present,
|
||||
disabled: this.$store.getters.currentOrgIsRoot
|
||||
},
|
||||
{
|
||||
name: 'change_password_add',
|
||||
label: this.$t('AddAccountAfterChangingPassword'),
|
||||
has: !this.row.present
|
||||
has: !this.row.present,
|
||||
disabled: this.$store.getters.currentOrgIsRoot
|
||||
}
|
||||
]
|
||||
return actions.filter(action => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { toSafeLocalDateStr } from '@/utils/time'
|
||||
import { ActionsFormatter, DetailFormatter, DiscoverConfirmFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export const statusMap = {
|
||||
pending: '0',
|
||||
confirmed: '1',
|
||||
@ -135,7 +136,7 @@ export const gatherAccountHeaderActions = (vm) => {
|
||||
type: 'primary',
|
||||
icon: 'fa fa-check',
|
||||
can: ({ selectedRows }) => {
|
||||
return selectedRows.length > 0 && vm.$hasPerm('accounts.add_account')
|
||||
return selectedRows.length > 0 && vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot
|
||||
},
|
||||
callback: function({ selectedRows }) {
|
||||
const ids = selectedRows.map(v => {
|
||||
@ -157,7 +158,7 @@ export const gatherAccountHeaderActions = (vm) => {
|
||||
type: 'primary',
|
||||
icon: 'fa fa-exchange',
|
||||
can: ({ selectedRows }) => {
|
||||
return selectedRows.length > 0 && vm.$hasPerm('accounts.remove_account')
|
||||
return selectedRows.length > 0 && vm.$hasPerm('accounts.remove_account') && !vm.$store.getters.currentOrgIsRoot
|
||||
},
|
||||
callback: function({ selectedRows }) {
|
||||
vm.gatherAccounts = selectedRows
|
||||
|
Loading…
Reference in New Issue
Block a user