Skip to content
Snippets Groups Projects
Commit 5c87cb2c authored by Robert Kossessa's avatar Robert Kossessa Committed by Janis Streib
Browse files

ADD: Filter to OUTree

parent 158b0181
Branches
No related tags found
No related merge requests found
<template> <template>
<div> <div>
<p> <template v-if="filter_match">
<b-button variant="link" class="mr-2 px-2 py-1" v-b-toggle="ou.short_name + '-children'" <p>
:style="{color: (ou.short_name + ou.name).toHSL()}" <b-button variant="link" class="mr-2 px-2 py-1" v-b-toggle="ou.short_name + '-children'"
v-if="ous_by_parent[ou.short_name] && ous_by_parent[ou.short_name].length > 0"> :style="{color: (ou.short_name + ou.name).toHSL()}"
<netvs-icon class="collapse-icon" icon="collapse"></netvs-icon> v-if="ous_by_parent[ou.short_name] && ous_by_parent[ou.short_name].length > 0">
</b-button> <netvs-icon class="collapse-icon" icon="collapse"></netvs-icon>
<b-link class="mr-3" :to="'/org/ou/'+ou.short_name">{{ ou.name }} ({{ ou.short_name }})</b-link> </b-button>
<b-button variant="link" :id="'edit-ou-' + ou.short_name" <b-link class="mr-3" :to="'/org/ou/'+ou.short_name">{{ ou.name }} ({{ ou.short_name }})</b-link>
@click="edit_ou(ou)" class="m-0 p-0"> <b-button variant="link" :id="'edit-ou-' + ou.short_name"
<netvs-icon icon="edit"></netvs-icon> @click="edit_ou(ou)" class="m-0 p-0">
</b-button> <netvs-icon icon="edit"></netvs-icon>
</p> </b-button>
</p>
</template>
<div class="pl-4 ml-2" v-if="ous_by_parent[ou.short_name]" <div class="pl-4 ml-2" v-if="ous_by_parent[ou.short_name]"
:style="{'border-left': `6px solid ${(ou.short_name + ou.name).toHSL()}`, borderRadius: '14px'}"> :style="{'border-left': `6px solid ${(ou.short_name + ou.name).toHSL()}`, borderRadius: '14px'}">
<b-collapse :id="ou.short_name + '-children'" visible> <b-collapse :id="ou.short_name + '-children'" visible>
<OUTreeEntry v-for="child_ou in ous_by_parent[ou.short_name]" :key="child_ou.short_name" :ou="child_ou" <OUTreeEntry v-for="child_ou in ous_by_parent[ou.short_name]" :key="child_ou.short_name" :ou="child_ou"
:ous_by_parent="ous_by_parent" :edit_ou="edit_ou"/> :ous_by_parent="ous_by_parent" :edit_ou="edit_ou" :filter="filter"/>
</b-collapse> </b-collapse>
</div> </div>
</div> </div>
...@@ -44,6 +46,11 @@ export default { ...@@ -44,6 +46,11 @@ export default {
default: (ou) => { default: (ou) => {
window.console.log('No DBEditor handler was passed to edit', ou) window.console.log('No DBEditor handler was passed to edit', ou)
} }
},
filter: {
type: String,
required: false,
default: ''
} }
}, },
data() { data() {
...@@ -51,6 +58,11 @@ export default { ...@@ -51,6 +58,11 @@ export default {
db_editor_presets: this.ou db_editor_presets: this.ou
} }
}, },
computed: {
filter_match() {
return this.filter === '' || this.ou.name.toLowerCase().includes(this.filter.toLowerCase())
}
},
} }
</script> </script>
......
...@@ -282,9 +282,10 @@ ...@@ -282,9 +282,10 @@
<hr> <hr>
<h2 v-if="!is_entry && ou !== ''">{{ $t('views.org.ou.sub_ous') }}</h2> <h2 v-if="!is_entry && ou !== ''">{{ $t('views.org.ou.sub_ous') }}</h2>
<Loading :data="[ous, ous_by_parent]"> <Loading :data="[ous, ous_by_parent]">
<FilterInput v-model="filter"/>
<template v-if="ou"> <template v-if="ou">
<div v-for="top_level_ou in ous_by_parent[ou.short_name]" :key="top_level_ou.short_name"> <div v-for="top_level_ou in ous_by_parent[ou.short_name]" :key="top_level_ou.short_name">
<OUTreeEntry :ou="top_level_ou" :ous_by_parent="ous_by_parent" :edit_ou="edit_ou"/> <OUTreeEntry :ou="top_level_ou" :ous_by_parent="ous_by_parent" :edit_ou="edit_ou" :filter="filter"/>
</div> </div>
<div v-if="!ous_by_parent[ou.short_name] || ous_by_parent[ou.short_name].length === 0" <div v-if="!ous_by_parent[ou.short_name] || ous_by_parent[ou.short_name].length === 0"
class="font-italic text-center my-3"> class="font-italic text-center my-3">
...@@ -293,7 +294,7 @@ ...@@ -293,7 +294,7 @@
</template> </template>
<template v-else> <template v-else>
<div v-for="top_level_ou in root_ous" :key="top_level_ou.short_name"> <div v-for="top_level_ou in root_ous" :key="top_level_ou.short_name">
<OUTreeEntry :ou="top_level_ou" :ous_by_parent="ous_by_parent" :edit_ou="edit_ou"/> <OUTreeEntry :ou="top_level_ou" :ous_by_parent="ous_by_parent" :edit_ou="edit_ou" :filter="filter"/>
</div> </div>
<div v-if="!root_ous || root_ous.length === 0" <div v-if="!root_ous || root_ous.length === 0"
class="font-italic text-center my-3"> class="font-italic text-center my-3">
...@@ -352,10 +353,11 @@ import EVLogViewer from '@/components/EVLogViewer' ...@@ -352,10 +353,11 @@ import EVLogViewer from '@/components/EVLogViewer'
import OUTreeEntry from '@/components/OUTreeEntry' import OUTreeEntry from '@/components/OUTreeEntry'
import PaginatorTable from '@/components/PaginatorTable' import PaginatorTable from '@/components/PaginatorTable'
import {EventBus} from '@/eventbus' import {EventBus} from '@/eventbus'
import FilterInput from '@/components/FilterInput.vue'
export default { export default {
name: 'OUOverview', name: 'OUOverview',
components: { OUTreeEntry, EVLogViewer, DBEditor, Loading, PaginatorTable }, components: { FilterInput, OUTreeEntry, EVLogViewer, DBEditor, Loading, PaginatorTable },
data() { data() {
return { return {
groups2ou: {}, groups2ou: {},
...@@ -372,6 +374,7 @@ export default { ...@@ -372,6 +374,7 @@ export default {
ous: null, ous: null,
ous_by_name: null, ous_by_name: null,
ous_by_parent: null, ous_by_parent: null,
filter: '',
db_editor_presets: {}, db_editor_presets: {},
fqdn2ou_db_editor_old_data: null, fqdn2ou_db_editor_old_data: null,
fqdn2ou_db_editor_non_optionals: ['ou_short_name', 'fqdn_value'], fqdn2ou_db_editor_non_optionals: ['ou_short_name', 'fqdn_value'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment