Commit 6ed3ce62 authored by Janis Streib's avatar Janis Streib 🦉
Browse files

ADD: token delete

parent 0a2f7dae
Pipeline #117220 passed with stages
in 5 minutes and 4 seconds
......@@ -329,16 +329,26 @@
</template>
</template>
<template v-slot:cell(buttons)="data">
<b-button block variant="outline-primary" v-if="account.parent_login_name !== account.login_name"
:id="'button-edit-token-' + account.login_name+ '-' + data.index"
@click="showModalEditToken(data.item)">
<font-awesome-icon :icon="['far', 'edit']"/>
</b-button>
<b-tooltip :target="'button-edit-token-' + account.login_name+ '-' + data.index"
triggers="hover" variant="primary" placement="left"
v-if="account.parent_login_name !== account.login_name">
Token bearbeiten
</b-tooltip>
<b-button-group class="d-flex">
<b-button @click="deleteToken(data.item)" variant="outline-danger"
:id="'button-delete-token-' + data.item.pk">
<font-awesome-icon :icon="['far', 'trash-alt']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-delete-token-' + data.item.pk" triggers="hover"
variant="danger" placement="left">
Token löschen
</b-tooltip>
<b-button variant="outline-primary" v-if="account.parent_login_name !== account.login_name"
:id="'button-edit-token-' + account.login_name+ '-' + data.index"
@click="showModalEditToken(data.item)">
<font-awesome-icon :icon="['far', 'edit']"/>
</b-button>
<b-tooltip :target="'button-edit-token-' + account.login_name+ '-' + data.index"
triggers="hover" variant="primary" placement="left"
v-if="account.parent_login_name !== account.login_name">
Token bearbeiten
</b-tooltip>
</b-button-group>
</template>
</b-table>
</b-collapse>
......@@ -365,6 +375,7 @@ import RoleService from '@/api-services.gen/cntl.role'
import Loading from '../../components/Loading'
import CopyField from '../../components/CopyField'
import DBEditor from '@/components/DBEditor'
import transactionutil from '@/util/transactionutil'
export default {
name: 'tokens',
......@@ -523,7 +534,7 @@ export default {
},
showModalCreateToken(login_name) {
this.db_editor_old_data = {}
this.db_editor_presets = { login_name: login_name }
this.db_editor_presets = {login_name: login_name}
this.db_editor_function = 'create'
this.$bvModal.show('token_editor')
},
......@@ -640,19 +651,13 @@ export default {
this.waiting = false
})
},
deleteToken() {
this.waiting = true
TokenService.delete(this.$store.state.netdb_axios_config, {
pk_old: this.new_token.pk
}).then(() => {
this.$bvModal.hide('modal-edit-token')
this.fetchData()
this.waiting = false
}).catch(error => {
this.modal_alert_content = error.response.data.error.type.text_descr
this.show_modal_alert = true
this.waiting = false
})
deleteToken(item) {
const ta = transactionutil.generateDeleteElement('cntl.wapi_auth', TokenService.deleteParamsList(), item, 'Toekn aus Unterkonto ' + item.login_name)
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
if (!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
},
formatDate(value) {
if (value == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment