| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import { getEnabledSwitchActions } from '@/utils/common/tableActions'
- import i18n from '@/locales'
- export default {
- created () {
- this.singleActions = [
- {
- label: i18n.t('system.text_479'),
- permission: 'users_update',
- action: row => {
- this.createDialog('UserUpdateDialog', {
- data: [row],
- columns: this.columns,
- onManager: this.onManager,
- })
- },
- },
- {
- label: i18n.t('system.text_153'),
- actions: row => {
- return [
- ...getEnabledSwitchActions(this, row, ['users_perform_enable', 'users_perform_disable'], {
- actions: [
- () => {
- this.onManager('performAction', {
- id: row.id,
- managerArgs: {
- action: 'enable',
- },
- })
- },
- () => {
- this.onManager('performAction', {
- id: row.id,
- managerArgs: {
- action: 'disable',
- },
- })
- },
- ],
- }),
- {
- label: i18n.t('compute.text_276'),
- permission: 'users_update',
- action: () => {
- this.createDialog('UserUpdatePasswordDialog', {
- data: [row],
- columns: this.columns,
- onManager: this.onManager,
- })
- },
- meta: () => {
- const { idps } = row
- if (idps && idps.length > 0) {
- const [{ idp_driver }] = idps
- if (idp_driver === 'ldap') {
- return {
- validate: false,
- tooltip: this.$t('common_603'),
- }
- }
- }
- if (!row.is_local) return { validate: false }
- return {
- validate: true,
- }
- },
- },
- {
- label: i18n.t('common_493'),
- action: () => {
- this.handleOpenSidepage(row, 'projects')
- },
- },
- {
- label: `${i18n.t('common.reset')} MFA`,
- action: () => {
- this.createDialog('ResetMFADialog', {
- data: [row],
- columns: this.columns,
- onManager: this.onManager,
- })
- },
- },
- {
- label: i18n.t('system.text_129'),
- permission: 'users_delete',
- action: () => {
- this.createDialog('DeleteResDialog', {
- vm: this,
- data: [row],
- columns: this.columns,
- title: i18n.t('system.text_480'),
- name: this.$t('dictionary.user'),
- onManager: this.onManager,
- alert: {
- message: i18n.t('system.text_513'),
- type: 'error',
- },
- refresh: this.refresh,
- })
- },
- meta: () => this.$getDeleteResult(row),
- },
- ]
- },
- },
- ]
- },
- }
|