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

ADD: delete and edit groups

parent 8dd219f8
Pipeline #112541 passed with stages
in 8 minutes and 58 seconds
......@@ -2,12 +2,38 @@
<b-card no-body :header-bg-variant="group.is_sub_group?'transparent':'light'" :key="'card-group-' + group.name" :class="group.is_sub_group?'mb-4' : 'mb-4 shadow'" v-if="bcds2grp != null" >
<template v-slot:header>
<b-row>
<b-col>
<b-col lg="3">
<h4>
{{ group.name }}
</h4>
<p class="text-muted">Gruppenname</p>
</b-col>
<b-col>
<p>
{{ group.description }}
</p>
<p class="text-muted">Beschriebung</p>
</b-col>
<b-col lg="2">
<b-button-group class="d-flex">
<b-button @click="editGroup(group)" variant="outline-primary"
:id="'button-edit-group-' + group.name">
<font-awesome-icon :icon="['far', 'edit']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-edit-group-' + group.name" triggers="hover"
variant="primary" placement="bottom">
Gruppe editieren
</b-tooltip>
<b-button @click="deleteGroup(group)" variant="outline-danger"
:id="'button-delete-group-' + group.name">
<font-awesome-icon :icon="['fas', 'unlink']"></font-awesome-icon>
</b-button>
<b-tooltip :target="'button-delete-group-' + group.name" triggers="hover"
variant="danger" placement="bottom">
Gruppe löschen
</b-tooltip>
</b-button-group>
</b-col>
</b-row>
</template>
<b-button block squared variant="outline-secondary" v-b-toggle="group.name + '-collapse-bcds'">
......@@ -158,6 +184,8 @@
:delete-bcd-item="deleteBcdItem"
:delete-mgr-item="deleteMgrItem"
:create-bcd2-group="createBcd2Group"
:delete-group="deleteGroup"
:edit-group="editGroup"
></GroupCard>
</b-container>
</b-collapse>
......@@ -284,6 +312,14 @@ export default {
type: Function,
required: true
},
deleteGroup: {
type: Function,
required: true
},
editGroup: {
type: Function,
required: true
},
createSubgroup: {
type: Function,
required: false
......
......@@ -31,15 +31,17 @@
:fqdn2grp="fqdn2grp"
:bcds2grp="bcds2grp"
:mgrs2grp="mgrs2grp"
:delete-group="deleteGroup"
:edit-group="editGroup"
>
</GroupCard>
</template>
</Loading>
<DBEditor v-if="db_editor_object_fq_name" modal_id="assign_to_group" :object_function="db_editor_function"
<DBEditor modal_id="assign_to_group" :object_function="db_editor_function"
:object_fq_name="db_editor_object_fq_name"
:presets="db_editor_presets"
:non_optionals_order="['group_name', 'parent_name', 'do_copy_assignments', 'mgr_login_name', 'bcd_name', 'fqdn_value']"
:object_title="db_editor_object_fq_name[db_editor_object_fq_name]"
:non_optionals_order="['group_name', 'parent_name', 'description', 'do_copy_assignments', 'mgr_login_name', 'bcd_name', 'fqdn_value']"
:object_title="db_editor_object_fq_name != null?db_editor_object_fq_name[db_editor_object_fq_name]:''"
:old_data="db_editor_old_data">
</DBEditor>
</div>
......@@ -53,6 +55,7 @@ import transactionutil from '@/util/transactionutil'
import Mgr2GroupService from '@/api-services.gen/cntl.mgr2group'
import BCD2GroupService from '@/api-services.gen/nd.bcd2group'
import FQDN2GroupService from '@/api-services.gen/dns.fqdn2group'
import GenGroupService from '@/api-services.gen/cntl.group'
import DBEditor from '@/components/DBEditor'
import GroupCard from '@/components/GroupCard'
......@@ -116,6 +119,14 @@ export default {
this.$store.state.show_sidebar = true
}
},
deleteGroup(item) {
const ta = transactionutil.generateDeleteElement('cntl.group', GenGroupService.deleteParamsList(), item, 'Gruppe ' + item.name)
this.$store.commit('addTransactionElement', ta)
this.$emit('commited', ta)
if (!this.isMobile() && !this.$store.state.show_sidebar) {
this.$store.state.show_sidebar = true
}
},
createSubgroup(parent_name) {
this.db_editor_function = 'create'
this.db_editor_old_data = {}
......@@ -150,6 +161,14 @@ export default {
this.db_editor_old_data = item
this.db_editor_object_fq_name = 'dns.fqdn2group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
},
editGroup(item) {
window.console.debug(item)
this.db_editor_function = 'update'
this.db_editor_presets = {}
this.db_editor_old_data = item
this.db_editor_object_fq_name = 'cntl.group'
this.$root.$emit('bv::show::modal', 'assign_to_group')
}
},
async mounted() {
......
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