Skip to content
Snippets Groups Projects
Commit e5496b2a authored by Janis Streib's avatar Janis Streib :owl:
Browse files

FIX: show breadcrumbs again for OU-tree (fixes #574)

parent 93ff6ef5
No related branches found
No related tags found
No related merge requests found
import TransactionService from './transaction.service'
export default {
resolveParents(config, ou) {
const ta = [
{idx: 'parent_ou', name: 'org.unit.list', old: {short_name: ou}},
{
name: 'org.unit.list',
idx: 'parent_ous',
inner_join_ref: {parent_ou: 'api_func_org_unit_is_subset_of_root_node_set'}
}
]
return TransactionService.execute(config, ta)
},
getOU(config, ou) {
const ta = [
{ idx: 'parent_ou', name: 'org.unit.list', old: { short_name: ou } },
{ name: 'org.unit.list', inner_join_ref: { parent_ou: 'api_func_org_unit_is_superset_of_root_node_set' } },
{ name: 'cntl.mgr2ou.list', inner_join_ref: { parent_ou: 'default' } },
{ name: 'cntl.mgr.list', inner_join_ref: { mgr2ou_list: 'default' } },
{ name: 'dns.fqdn2ou.list', inner_join_ref: { parent_ou: 'default' } },
{ name: 'nd.bcd2ou.list', inner_join_ref: { parent_ou: 'default' } },
{ name: 'nd.bcd.list', inner_join_ref: { bcd2ou_list: 'default' } },
{idx: 'parent_ou', name: 'org.unit.list', old: {short_name: ou}},
{name: 'org.unit.list', inner_join_ref: {parent_ou: 'api_func_org_unit_is_superset_of_root_node_set'}},
{
idx: 'parent_ous',
name: 'org.unit.list',
old: {sorting_params_list: ['tree_level DESC']},
inner_join_ref: {parent_ou: 'api_func_org_unit_is_subset_of_root_node_set'}
},
{name: 'cntl.mgr2ou.list', inner_join_ref: {parent_ou: 'default'}},
{name: 'cntl.mgr.list', inner_join_ref: {mgr2ou_list: 'default'}},
{name: 'dns.fqdn2ou.list', inner_join_ref: {parent_ou: 'default'}},
{name: 'nd.bcd2ou.list', inner_join_ref: {parent_ou: 'default'}},
{name: 'nd.bcd.list', inner_join_ref: {bcd2ou_list: 'default'}},
{
name: 'cntl.group.list',
inner_join_ref: { unit_list: 'default' },
old: { sorting_params_list: ['name'] }
inner_join_ref: {unit_list: 'default'},
old: {sorting_params_list: ['name']}
},
{ name: 'org.unit_type.list', inner_join_ref: { parent_ou: 'default' } }
{name: 'org.unit_type.list', inner_join_ref: {parent_ou: 'default'}}
]
return TransactionService.execute(config, ta)
},
listOwn(config) {
const ta = [
{ idx: 'own_mgr2ou_list', name: 'cntl.mgr2ou.list', old: { is_own: true } },
{idx: 'own_mgr2ou_list', name: 'cntl.mgr2ou.list', old: {is_own: true}},
{
name: 'org.unit.list',
inner_join_ref: { own_mgr2ou_list: 'default' },
old: { sorting_params_list: ['sub_position'] }
inner_join_ref: {own_mgr2ou_list: 'default'},
old: {sorting_params_list: ['sub_position']}
},
{
idx: 'unit_list_superset',
name: 'org.unit.list',
inner_join_ref: { unit_list: 'api_func_org_unit_is_superset_of_root_node_set' }
inner_join_ref: {unit_list: 'api_func_org_unit_is_superset_of_root_node_set'}
},
{ name: 'cntl.mgr2ou.list', inner_join_ref: { unit_list_superset: 'default' } },
{ name: 'cntl.mgr.list', inner_join_ref: { mgr2ou_list: 'default' } },
{ name: 'dns.fqdn2ou.list', inner_join_ref: { unit_list_superset: 'default' } },
{ name: 'nd.bcd2ou.list', inner_join_ref: { unit_list_superset: 'default' } },
{ name: 'nd.bcd.list', inner_join_ref: { bcd2ou_list: 'default' } },
{ name: 'org.unit_type.list', inner_join_ref: { unit_list: 'default' } }
{name: 'cntl.mgr2ou.list', inner_join_ref: {unit_list_superset: 'default'}},
{name: 'cntl.mgr.list', inner_join_ref: {mgr2ou_list: 'default'}},
{name: 'dns.fqdn2ou.list', inner_join_ref: {unit_list_superset: 'default'}},
{name: 'nd.bcd2ou.list', inner_join_ref: {unit_list_superset: 'default'}},
{name: 'nd.bcd.list', inner_join_ref: {bcd2ou_list: 'default'}},
{name: 'org.unit_type.list', inner_join_ref: {unit_list: 'default'}}
]
return TransactionService.execute(config, ta)
},
......@@ -45,14 +62,14 @@ export default {
const ta = [
{
name: 'org.unit.list',
old: { sorting_params_list: ['sub_position'] }
old: {sorting_params_list: ['sub_position']}
},
{ name: 'cntl.mgr2ou.list', inner_join_ref: { unit_list: 'default' } },
{ name: 'cntl.mgr.list', inner_join_ref: { mgr2ou_list: 'default' } },
{ name: 'dns.fqdn2ou.list', inner_join_ref: { unit_list: 'default' } },
{ name: 'nd.bcd2ou.list', inner_join_ref: { unit_list: 'default' } },
{ name: 'nd.bcd.list', inner_join_ref: { bcd2ou_list: 'default' } },
{ name: 'org.unit_type.list', inner_join_ref: { unit_list: 'default' } }
{name: 'cntl.mgr2ou.list', inner_join_ref: {unit_list: 'default'}},
{name: 'cntl.mgr.list', inner_join_ref: {mgr2ou_list: 'default'}},
{name: 'dns.fqdn2ou.list', inner_join_ref: {unit_list: 'default'}},
{name: 'nd.bcd2ou.list', inner_join_ref: {unit_list: 'default'}},
{name: 'nd.bcd.list', inner_join_ref: {bcd2ou_list: 'default'}},
{name: 'org.unit_type.list', inner_join_ref: {unit_list: 'default'}}
]
return TransactionService.execute(config, ta)
}
......
......@@ -75,10 +75,6 @@ export default new Router({
resolveName: function (query) {
return query.ou.toUpperCase()
},
resolveParents: function (query) {
// const res = OUService.list(Vue.$store.state, {do_rootpath: true, short_name: query.ou})
return ['/org/ou']
}
}
},
{
......
......@@ -4,7 +4,7 @@
<template v-if="ous && ous.length === 0">
<div>
<b-alert variant="danger" class="text-center" show>
{{ $t('views.org.ou.ou_not_exist', { name: $route.params.ou }) }}
{{ $t('views.org.ou.ou_not_exist', {name: $route.params.ou}) }}
</b-alert>
</div>
</template>
......@@ -13,7 +13,7 @@
<b-row>
<b-col>
<h1>{{ ou.name }} ({{ ou.short_name }}) <small
class="text-muted">{{ $tc('system.organizational_unit', 1) }}</small></h1>
class="text-muted">{{ $tc('system.organizational_unit', 1) }}</small></h1>
<h3 class="text-muted">
<netvs-icon icon="org_types"/>
{{ outypes_by_shortname[ou.type].name }}
......@@ -83,8 +83,14 @@
</template>
<template v-slot:cell(mgr_login_name)="data">
{{ data.item.mgr_login_name }}
<b-badge variant="warning" v-if="is_svc(data.item.mgr_login_name)"><netvs-icon icon="svc_account"></netvs-icon> {{ $t('components.svc_card.svc') }}</b-badge>
<b-badge variant="info" v-if="data.item.mgr_login_name === ($store.state.impersonate_user || $store.state.user.login_name)">{{ $t('system.you') }}</b-badge>
<b-badge variant="warning" v-if="is_svc(data.item.mgr_login_name)">
<netvs-icon icon="svc_account"></netvs-icon>
{{ $t('components.svc_card.svc') }}
</b-badge>
<b-badge variant="info"
v-if="data.item.mgr_login_name === ($store.state.impersonate_user || $store.state.user.login_name)">
{{ $t('system.you') }}
</b-badge>
</template>
<template v-slot:head(actions)>
<div :id="'button-assign-mgr-' + ou.short_name">
......@@ -374,7 +380,7 @@ import FilterInput from '@/components/FilterInput.vue'
export default {
name: 'OUOverview',
components: { FilterInput, OUTreeEntry, EVLogViewer, DBEditor, Loading, PaginatorTable },
components: {FilterInput, OUTreeEntry, EVLogViewer, DBEditor, Loading, PaginatorTable},
data() {
return {
groups2ou: {},
......@@ -520,15 +526,21 @@ export default {
let res = null
if (ou_name_req) {
this.is_entry = true
EventBus.$emit('overwrite_breadcrumbs', function () {
return ['/org/ou']
})
const ou_types = (await OUTypeService.list(this.$store.state, { sorting_params_list: ['position'] })).data[0]
const ou_types = (await OUTypeService.list(this.$store.state, {sorting_params_list: ['position']})).data[0]
for (const t of ou_types) {
this.ou_type_reducer[t.short_name] = { display_name: t.name }
this.ou_type_reducer[t.short_name] = {display_name: t.name}
}
ou_name_req = ou_name_req.toUpperCase()
res = (await OUService.getOU(this.$store.state, ou_name_req)).data
const parent_ous = res.parent_ous
const bread = []
for (let i = 1; i < parent_ous.length; i++) {
bread.push({text: parent_ous[i].short_name, to: `/org/ou/${parent_ous[i].short_name}`})
}
bread.push('/org/ou')
EventBus.$emit('overwrite_breadcrumbs', function () {
return bread
})
this.mgrs2ou = apiutil.dict_of_lists_by_value_of_array(res.mgr2ou_list, 'ou_short_name')
this.mgrs_by_login_name = apiutil.dict_by_value_of_array(res.mgr_list, 'login_name')
this.fqdns2ou = apiutil.dict_of_lists_by_value_of_array(res.fqdn2ou_list, 'ou_short_name')
......@@ -541,24 +553,10 @@ export default {
}
this.ous_by_name = apiutil.dict_by_value_of_array(res.parent_ou, 'short_name')
this.ou = this.ous_by_name[ou_name_req]
this.$store.commit('setNavigationRefreshHandle', { gpk: this.ou.gpk, objType: 'org.unit' })
this.$store.commit('setNavigationRefreshHandle', {gpk: this.ou.gpk, objType: 'org.unit'})
this.groups2ou = apiutil.dict_of_lists_by_value_of_array(res.group_list, 'ou_short_name')
window.console.debug(this.groups2ou)
this.bcds_by_name = apiutil.dict_by_value_of_array(res.bcd_list, 'name')
const rootpath = (await NativeOUService.list(this.$store.state, {
do_rootpath: true,
short_name: ou_name_req,
sorting_params_list: ['tree_level ASC']
})).data[0]
EventBus.$emit('overwrite_breadcrumbs', function () {
const res = ['/org/ou']
for (const o of rootpath) {
res.push({ to: '/org/ou/' + o.short_name, text: o.short_name })
}
res.pop()
res.reverse()
return res
})
} else {
this.is_entry = false
if (this.only_own_ou) {
......@@ -591,22 +589,22 @@ export default {
this.$root.$emit('bv::show::modal', 'edit_oe')
},
create_group(ou) {
this.db_editor_presets = { ou_short_name: ou }
this.db_editor_presets = {ou_short_name: ou}
this.$root.$emit('bv::show::modal', 'create_group')
},
create_mgr_assignment(ou) {
this.db_editor_presets = { ou_short_name: ou }
this.db_editor_presets = {ou_short_name: ou}
this.$root.$emit('bv::show::modal', 'assign_user_to_oe')
},
create_fqdn_assignment(ou) {
this.fqdn2ou_action = 'create'
this.db_editor_old_data = null
this.fqdn2ou_db_editor_non_optionals = ['ou_short_name', 'fqdn_value']
this.db_editor_presets = { ou_short_name: ou }
this.db_editor_presets = {ou_short_name: ou}
this.$root.$emit('bv::show::modal', 'assign_fqdn_to_oe')
},
create_bcd_assignment(ou) {
this.db_editor_presets = { ou_short_name: ou }
this.db_editor_presets = {ou_short_name: ou}
this.bcd2ou_action = 'create'
this.db_editor_old_data = null
this.bcd2ou_db_editor_non_optionals = ['ou_short_name', 'bcd_name']
......@@ -666,7 +664,7 @@ export default {
},
mgrs_mail(user_name) {
return this.mgrs_by_login_name[user_name].first_name + ' ' + this.mgrs_by_login_name[user_name].last_name +
'<' + this.mgrs_by_login_name[user_name].email + '>'
'<' + this.mgrs_by_login_name[user_name].email + '>'
},
is_svc(user_name) {
if (user_name in (this.mgrs_by_login_name || {})) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment