Rename enable/disable to activate/block
This commit is contained in:
+3
-3
File diff suppressed because one or more lines are too long
@@ -59,16 +59,16 @@ export default {
|
||||
if (isAnyAccountDisabled) {
|
||||
actions.push({
|
||||
id: 'accounts-actions-dropdown-action-enable',
|
||||
label: this.$gettext('Enable'),
|
||||
handler: () => this.toggleAccountStatus(true)
|
||||
label: this.$gettext('Activate'),
|
||||
handler: () => this.setAccountActivated(true)
|
||||
})
|
||||
}
|
||||
|
||||
if (isAnyAccountEnabled) {
|
||||
actions.push({
|
||||
id: 'accounts-actions-dropdown-action-disable',
|
||||
label: this.$gettext('Disable'),
|
||||
handler: () => this.toggleAccountStatus(false)
|
||||
label: this.$gettext('Block'),
|
||||
handler: () => this.setAccountActivated(false)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('Accounts', ['toggleAccountStatus', 'deleteAccounts']),
|
||||
...mapActions('Accounts', ['setAccountActivated', 'deleteAccounts']),
|
||||
...mapMutations('Accounts', ['RESET_ACCOUNTS_SELECTION'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<oc-table-cell type="head" v-text="$gettext('Display name')" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Email')" />
|
||||
<oc-table-cell type="head" v-text="$gettext('Role')" />
|
||||
<oc-table-cell shrink type="head" v-text="$gettext('Enabled')" />
|
||||
<oc-table-cell shrink type="head" v-text="$gettext('Activated')" />
|
||||
</oc-table-row>
|
||||
</oc-table-group>
|
||||
<oc-table-group>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
key="account-icon-enabled"
|
||||
name="ready"
|
||||
variation="success"
|
||||
:aria-label="$gettext('Account is enabled')"
|
||||
:aria-label="$gettext('Account is activated')"
|
||||
class="accounts-status-indicator-enabled"
|
||||
/>
|
||||
<oc-icon
|
||||
@@ -53,7 +53,7 @@
|
||||
name="deprecated"
|
||||
key="account-icon-disabled"
|
||||
variation="danger"
|
||||
:aria-label="$gettext('Account is disabled')"
|
||||
:aria-label="$gettext('Account is blocked')"
|
||||
class="accounts-status-indicator-disabled"
|
||||
/>
|
||||
</oc-table-cell>
|
||||
|
||||
+8
-8
@@ -129,12 +129,12 @@ const actions = {
|
||||
getters.areAllAccountsSelected ? commit('RESET_ACCOUNTS_SELECTION') : commit('SET_SELECTED_ACCOUNTS', [...state.accounts])
|
||||
},
|
||||
|
||||
async toggleAccountStatus ({ commit, dispatch, state, rootGetters }, status) {
|
||||
async setAccountActivated ({ commit, dispatch, state, rootGetters }, activated) {
|
||||
const failedAccounts = []
|
||||
injectAuthToken(rootGetters.user.token)
|
||||
|
||||
for (const account of state.selectedAccounts) {
|
||||
if (account.accountEnabled === status) {
|
||||
if (account.accountEnabled === activated) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ const actions = {
|
||||
body: {
|
||||
account: {
|
||||
id: account.id,
|
||||
accountEnabled: status
|
||||
accountEnabled: activated
|
||||
},
|
||||
update_mask: {
|
||||
paths: ['AccountEnabled']
|
||||
@@ -152,14 +152,14 @@ const actions = {
|
||||
})
|
||||
|
||||
if (response.status === 201) {
|
||||
commit('UPDATE_ACCOUNT', { ...account, accountEnabled: status })
|
||||
commit('UPDATE_ACCOUNT', { ...account, accountEnabled: activated })
|
||||
} else {
|
||||
failedAccounts.push({ account: account.diisplayName, statusText: response.statusText })
|
||||
failedAccounts.push({ account: account.displayName, statusText: response.statusText })
|
||||
}
|
||||
}
|
||||
|
||||
if (failedAccounts.length === 1) {
|
||||
const failedMessageTitle = status ? 'Failed to enable account.' : 'Failed to disable account.'
|
||||
const failedMessageTitle = activated ? 'Failed to activate account.' : 'Failed to block account.'
|
||||
|
||||
dispatch('showMessage', {
|
||||
title: failedMessageTitle,
|
||||
@@ -169,8 +169,8 @@ const actions = {
|
||||
}
|
||||
|
||||
if (failedAccounts.length > 1) {
|
||||
const failedMessageTitle = status ? 'Failed to enable accounts.' : 'Failed to disable accounts.'
|
||||
const failedMessageDesc = status ? 'Could not enable multiple accounts.' : 'Could not disable multiple accounts.'
|
||||
const failedMessageTitle = activated ? 'Failed to activate accounts.' : 'Failed to block accounts.'
|
||||
const failedMessageDesc = activated ? 'Could not activate multiple accounts.' : 'Could not block multiple accounts.'
|
||||
|
||||
dispatch('showMessage', {
|
||||
title: failedMessageTitle,
|
||||
|
||||
Reference in New Issue
Block a user