Handle disable and enable actions

This commit is contained in:
Lukas Hirt
2020-09-06 21:40:15 +02:00
parent 45c170729e
commit 3fd44de84f
2 changed files with 76 additions and 7 deletions
+7 -6
View File
@@ -1,9 +1,7 @@
<template>
<div>
<div class="uk-container uk-padding">
<h1>
Accounts
</h1>
<h1 v-text="$gettext('Accounts')" />
<oc-grid v-if="selectedAccountsAmount > 0" key="selected-accounts-info" gutter="small" class="uk-flex-middle">
<span v-text="selectionInfoText" />
<div>
@@ -20,6 +18,7 @@
role="menuitem"
:class="{ 'uk-margin-small-bottom': index + 1 !== actions.length }"
class="uk-width-1-1 uk-flex-left"
@click="action.handler"
>
{{ action.label }}
</oc-button>
@@ -66,13 +65,15 @@ export default {
if (isAnyAccountDisabled) {
actions.push({
label: this.$gettext('Enable')
label: this.$gettext('Enable'),
handler: this.enableAccounts
})
}
if (isAnyAccountEnabled) {
actions.push({
label: this.$gettext('Disable')
label: this.$gettext('Disable'),
handler: this.disableAccounts
})
}
@@ -80,7 +81,7 @@ export default {
}
},
methods: {
...mapActions('Accounts', ['initialize'])
...mapActions('Accounts', ['initialize', 'enableAccounts', 'disableAccounts'])
},
created () {
this.initialize()