Commit f0dfebc7 authored by janis.streib's avatar janis.streib 🦉
Browse files

ADD: _basic_ groups interface

parent a239229f
Pipeline #112409 passed with stages
in 8 minutes and 40 seconds
import TransactionService from './transaction.service'
export default {
list (config, own) {
const ta = [
{ name: 'cntl.group.list', old: { is_own: own } },
{ name: 'cntl.mgr2group.list', join: { 0: 'api_fkey_cntl_mgr2group_grp'} },
{ name: 'nd.bcd2group.list', join: { 0: 'api_fkey_nd_bcd2group_grp'} },
{ name: 'dns.fqdn2group.list', join: { 0: 'api_fkey_dns_fqdn2group_grp'} },
{ name: 'dns.fqdn.list', join: { 3: 'api_fkey_dns_fqdn2group_fqdn' } },
{ name: 'cntl.mgr.list', join: { 1: 'api_fkey_cntl_mgr2group_mgr'} },
{ name: 'nd.bcd.list', join: { 2: 'api_fkey_nd_bcd2group_bcd'} }
]
return TransactionService.execute(config, ta)
}
}
......@@ -30,6 +30,16 @@ export default new Router({
}
}
},
{
path: '/cntl/groups',
name: 'groups',
component: () => import('./views/cntl/Groups'),
meta: {
resolveName: function () {
return 'Gruppen'
}
}
},
{
path: '/login',
name: 'login',
......
<template>
<div class="oe-overview">
<h1>Gruppen</h1>
<Loading :data="[groups]">
<template v-for="group in groups">
<b-card no-body :key="'card-group-' + group.name" class="mb-4 shadow">
<template v-slot:header>
<b-row>
<b-col lg="3">
<h4>
{{ group.name }}
</h4>
<p class="text-muted">Gruppenname</p>
</b-col>
</b-row>
</template>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-bcds'">
BCDs (Adressraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-bcds'">
<b-table :items="bcds2grp[group.name]">
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-domains'">
Domains (Namensraum)<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-domains'">
<b-table :items="fqdn2grp[group.name]">
</b-table>
</b-collapse>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-members'">
Gruppenmitglieder<br/>
<font-awesome-icon class="collapse-icon" :icon="['fas','chevron-down']"/>
</b-button>
<b-collapse :id="group.name + '-collapse-members'">
<b-table :items="mgrs2grp[group.name]" :fields="mgr_list_fields">
<template v-slot:cell(first_name)="data">
{{ mgrs[data.item.mgr_login_name].first_name }}
</template>
<template v-slot:cell(last_name)="data">
{{ mgrs[data.item.mgr_login_name].last_name }}
</template>
<template v-slot:cell(email)="data">
<b-link :href="'mailto:'+mgrs[data.item.mgr_login_name].email">
{{ mgrs[data.item.mgr_login_name].email }}
</b-link>
</template>
</b-table>
</b-collapse>
</b-card>
</template>
</Loading>
</div>
</template>
<script>
import GroupService from '@/api-services/groups.service'
import Loading from '@/components/Loading'
import apiutil from '@/util/apiutil'
export default {
name: 'Groups',
components: {Loading},
data() {
return {
mgrs: null,
mgrs2grp: null,
bcds2grp: null,
fqdn2grp: null,
groups: null,
ous: null,
mgr_list_fields: [
{
key: 'mgr_login_name',
label: 'Login Name',
sortable: false
},
{
key: 'first_name',
label: 'Vorname',
sortable: false
},
{
key: 'last_name',
label: 'Nachname',
sortable: false
},
{
key: 'email',
label: 'E-Mail',
sortable: false
},
{
key: 'actions',
label: 'Aktionen',
sortable: false
}
]
}
},
methods: {
async refresh() {
this.groups = this.mgrs2ou = this.ous = null
const res = (await GroupService.list(this.$store.state.netdb_axios_config, true)).data
this.groups = res[0]
this.bcds2grp = apiutil.dict_of_lists_by_value_of_array(res[2], 'group_name')
this.mgrs2grp = apiutil.dict_of_lists_by_value_of_array(res[1], 'group_name')
this.fqdn2grp = apiutil.dict_of_lists_by_value_of_array(res[3], 'group_name')
this.mgrs = apiutil.dict_by_value_of_array(res[5], 'login_name')
}
},
async mounted() {
await this.refresh()
}
}
</script>
<style scoped>
</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