Commit 34eee5d9 authored by Robert-K's avatar Robert-K
Browse files

FIX: Main Account is requested from the API now,

attempt at animating b-table added,
several other small QOL improvements
parent f806b081
Pipeline #64746 passed with stages
in 5 minutes and 53 seconds
......@@ -3,8 +3,10 @@ import TransactionService from './transaction.service'
export default {
list(config, login_name) {
let ta = [
{"name": "cntl.mgr.list", "old": {"login_name_list": [login_name]}},
{"name": "cntl.mgr.list", "old": {"parent_login_name": login_name}},
{"name": "cntl.wapi_auth.list", "join": {"0": "cntl.wapi_auth.fkey_cntl_wapi_auth_mgr"}},
{"name": "cntl.wapi_auth.list", "join": {"1": "cntl.wapi_auth.fkey_cntl_wapi_auth_mgr"}},
{"name": "cntl.mgr2role.list", "join": {"0": "cntl.wapi_auth.fkey_cntl_wapi_auth_mgr"}}
]
return TransactionService.execute(config, ta);
......
......@@ -72,10 +72,11 @@
<b-button variant="outline-secondary" @click="cancel">
Abbrechen
</b-button>
<b-button id="button-account-delete" v-if="new_account.parent_login_name !== null" variant="danger">
<b-button id="button-delete-account" variant="danger">
Löschen
</b-button>
<b-popover ref="popoverAccountDelete" target="button-account-delete" triggers="click" placement="bottom">
<b-popover ref="popoverAccountDelete" target="button-delete-account" triggers="click"
placement="bottom">
<template v-slot:title>Account wirklich löschen?</template>
<b-button variant="danger" @click="deleteAccount">
Löschen
......@@ -146,12 +147,14 @@
Kopiert.
</b-tooltip>
<b-input-group-append>
<b-button id="button-token-copy" variant="primary" @click="copyToken">
<b-button variant="primary" @click="copyToken">
<font-awesome-icon :icon="['fas', 'copy']"/>
</b-button>
</b-input-group-append>
</b-input-group>
<b-alert show variant="warning" class="mb-0 mt-3">Bewahren Sie das Token gut auf. Hier werden Sie es nicht mehr einsehen können!</b-alert>
<b-alert show variant="warning" class="mb-0 mt-3">Bewahren Sie das Token gut auf. Hier werden Sie es nicht
mehr einsehen können!
</b-alert>
<template v-slot:modal-footer="{ok}">
<b-button variant="success" @click="ok">
Ok
......@@ -201,10 +204,10 @@
<b-button variant="outline-secondary" @click="cancel">
Abbrechen
</b-button>
<b-button id="button-token-delete" variant="danger">
<b-button id="button-delete-token" variant="danger">
Löschen
</b-button>
<b-popover ref="popoverTokenDelete" target="button-token-delete" triggers="click" placement="bottom">
<b-popover ref="popoverTokenDelete" target="button-delete-token" triggers="click" placement="bottom">
<template v-slot:title>Token wirklich löschen?</template>
<b-button variant="danger" @click="deleteToken">
Löschen
......@@ -256,14 +259,17 @@
<p class="text-muted">Berechtigungen</p>
</b-col>
<b-col lg="1">
<b-button block variant="outline-primary" :id="'button-edit-account-' + account.login_name"
@click="showModalEditAccount(account)">
<font-awesome-icon :icon="['far', 'edit']"/>
</b-button>
<b-tooltip placement="bottom" :target="'button-edit-account-' + account.login_name"
triggers="hover" variant="primary">
Account bearbeiten
</b-tooltip>
<template v-if="account.parent_login_name !== null">
<b-button block variant="outline-primary"
:id="'button-edit-account-' + account.login_name"
@click="showModalEditAccount(account)">
<font-awesome-icon :icon="['far', 'edit']"/>
</b-button>
<b-tooltip placement="bottom" :target="'button-edit-account-' + account.login_name"
triggers="hover" variant="primary">
Account bearbeiten
</b-tooltip>
</template>
</b-col>
</b-row>
</template>
......@@ -271,17 +277,32 @@
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-up']"/>
</b-button>
<b-collapse :id="account.login_name + '-collapse'">
<b-table class="m-0" striped hover responsive :items="tokens_by_account[account.login_name]"
:fields="token_list_fields">
<b-table :items="tokens_by_account[account.login_name]"
:fields="token_list_fields"
class="m-0"
striped
responsive
:tbody-transition-props="leaving_transition_properties"
primary-key="description"> <!-- TODO: Get table animations to work -->
<template v-slot:head(buttons)>
<b-button block variant="outline-success" :id="'button-create-token-' + account.login_name"
@click="showModalCreateToken(account.login_name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-create-token-' + account.login_name" triggers="hover"
variant="success" placement="left">
Token erstellen
</b-tooltip>
<template v-if="account.parent_login_name !== null">
<b-button block variant="outline-success"
:id="'button-create-token-' + account.login_name"
@click="showModalCreateToken(account.login_name)">
<font-awesome-icon :icon="['fas', 'plus']"/>
</b-button>
<b-tooltip :target="'button-create-token-' + account.login_name" triggers="hover"
variant="success" placement="left">
Token erstellen
</b-tooltip>
</template>
</template>
<template v-slot:cell(expiration_date)="data">
<!-- TODO: Expired tokens should be red; might be ugly / difficult -->
{{formatDate(data.item.expiration_date)}}
<template v-if="data.item.is_expired">
(Expired)
</template>
</template>
<template v-slot:cell(buttons)="data">
<b-button block variant="outline-primary"
......@@ -343,7 +364,6 @@
{
key: 'expiration_date',
label: "Ablaufdatum",
formatter: this.formatDate, // TODO: show expired tokens in red
sortable: true
},
{
......@@ -367,7 +387,10 @@
show_modal_alert: false,
modal_alert_content: "",
token: "",
token_copied: false
token_copied: false,
leaving_transition_properties: { // TODO: Get table animations to work
name: 'flip-list'
}
}
},
computed: {
......@@ -380,7 +403,7 @@
}
return this.accounts.filter(account => {
return account.login_name.toLowerCase().includes(this.filter_text.toLowerCase())
|| account.description.toLowerCase().includes(this.filter_text.toLowerCase())
|| (account.description != null && account.description.toLowerCase().includes(this.filter_text.toLowerCase()))
})
}
},
......@@ -390,8 +413,8 @@
methods: {
fetchData() {
AccountTokenService.list(this.$store.state.netdb_axios_config, this.$store.state.user.login_name).then((response) => {
this.tokens_by_account = ApiUtil.dict_of_lists_by_value_of_array(response.data[1], 'login_name')
this.accounts = response.data[0]
this.tokens_by_account = ApiUtil.dict_of_lists_by_value_of_array(response.data[2].concat(response.data[3]), 'login_name')
this.accounts = response.data[0].concat(response.data[1])
})
},
showModalEditAccount(account) {
......@@ -436,7 +459,7 @@
}).then(() => {
this.$bvModal.hide('modal-create-account')
this.fetchData()
}).catch(error => { //TODO : maybe second parameter????????? hopefully
}).catch(error => { //TODO : return error message instead of code
this.modal_alert_content = error.message
this.show_modal_alert = true
})
......@@ -538,4 +561,8 @@
transform: rotate(-180deg);
}
table .flip-list-move { /* TODO: Get table animations to work */
transition: transform 1s;
}
</style>
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