| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- export default {
- computed: {
- commonMeta () {
- const rdsItem = this.params.rdsItem || this.data
- const isRunning = rdsItem.status === 'running'
- const isHuawei = rdsItem.brand === 'Huawei'
- const isAliyun = rdsItem.brand === 'Aliyun'
- const isGoogle = rdsItem.brand === 'Google'
- let tooltip = ''
- if (!isRunning) {
- tooltip = this.$t('db.text_198')
- }
- if (!isRunning) {
- tooltip = this.$t('db.text_198')
- }
- return {
- isRunning,
- isHuawei,
- isAliyun,
- isGoogle,
- tooltip,
- validate: isRunning,
- }
- },
- },
- created () {
- this.singleActions = [
- {
- label: this.$t('db.text_201'),
- permission: 'rds_dbinstanceaccounts_perform_reset_password',
- action: (obj) => {
- this.createDialog('RedisAccountLisResetPwdDialog', {
- data: [obj],
- name: this.$t('dictionary.dbinstances'),
- list: this.list,
- columns: this.columns,
- })
- },
- meta: () => {
- if (this.commonMeta.isHuawei) {
- return {
- validate: false,
- tooltip: this.$t('db.text_202'),
- }
- }
- return this.commonMeta
- },
- },
- {
- label: this.$t('db.text_203'),
- permission: 'rds_dbinstanceaccounts_perform_set_privileges',
- action: (obj) => {
- this.createDialog('RDSAccountUpdatePrivilegeDialog', {
- title: this.$t('db.text_203'),
- initialValues: {
- account_privilege: obj.account_privilege,
- host: obj.host,
- },
- data: [obj],
- list: this.list,
- columns: this.columns,
- rdsItem: this.data,
- })
- },
- meta: (obj) => {
- const { isHuawei, isGoogle } = this.commonMeta
- if (isHuawei && obj.name === 'root') {
- return {
- validate: false,
- tooltip: this.$t('db.text_204'),
- }
- }
- if (isGoogle) {
- return {
- validate: false,
- tooltip: this.$t('db.text_205'),
- }
- }
- return {
- validate: true,
- }
- },
- },
- {
- label: this.$t('db.text_42'),
- permission: 'rds_dbinstanceaccounts_delete',
- action: (obj) => {
- this.createDialog('DeleteResDialog', {
- title: this.$t('db.text_42'),
- name: this.$t('db.text_188'),
- data: [obj],
- onManager: this.onManager,
- columns: this.columns,
- refresh: this.refresh,
- })
- },
- meta: (obj) => {
- const { tooltip, isAliyun } = this.commonMeta
- return {
- validate: obj.name !== 'root' || (!tooltip && isAliyun),
- tooltip: obj.name === 'root' ? this.$t('db.text_350') : tooltip,
- }
- },
- },
- ]
- },
- }
|