BigW Consortium Gitlab

Commit a472f078 by Alfredo Sumaran

Remove parent group prefix from current orphan group

[ci skip]
parent 5eb885e5
...@@ -5,6 +5,10 @@ export default { ...@@ -5,6 +5,10 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
baseGroup: {
type: Object,
required: false,
},
}, },
computed: { computed: {
hasGroups() { hasGroups() {
...@@ -16,6 +20,6 @@ export default { ...@@ -16,6 +20,6 @@ export default {
<template> <template>
<ul class="content-list group-list-tree" v-show="hasGroups"> <ul class="content-list group-list-tree" v-show="hasGroups">
<group-item v-for="(group, index) in groups" :key="index" :group="group" /> <group-item v-for="(group, index) in groups" :key="index" :group="group" :baseGroup="baseGroup" />
</ul> </ul>
</template> </template>
...@@ -7,6 +7,10 @@ export default { ...@@ -7,6 +7,10 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
baseGroup: {
type: Object,
required: false,
},
}, },
methods: { methods: {
toggleSubGroups(e) { toggleSubGroups(e) {
...@@ -31,6 +35,31 @@ export default { ...@@ -31,6 +35,31 @@ export default {
isExpandable() { isExpandable() {
return Object.keys(this.group.subGroups).length > 0; return Object.keys(this.group.subGroups).length > 0;
}, },
fullPath() {
let fullPath = '';
if (this.group.isOrphan) {
// check if current group is baseGroup
if (this.baseGroup) {
// Remove baseGroup prefix from our current group.fullName. e.g:
// baseGroup.fullName: `level1`
// group.fullName: `level1 / level2 / level3`
// Result: `level2 / level3`
const gfn = this.group.fullName;
const bfn = this.baseGroup.fullName;
const length = bfn.length;
const start = gfn.indexOf(bfn);
fullPath = gfn.substr(start + length + 2);
} else {
fullPath = this.group.fullName;
}
} else {
fullPath = this.group.name;
}
return fullPath;
},
}, },
}; };
</script> </script>
...@@ -92,13 +121,13 @@ export default { ...@@ -92,13 +121,13 @@ export default {
</div> </div>
<div class="title"> <div class="title">
<a :href="group.webUrl">{{group.isOrphan ? group.fullName : group.name}}</a> <a :href="group.webUrl">{{fullPath}}</a>
</div> </div>
<div class="description"> <div class="description">
{{group.description}} {{group.description}}
</div> </div>
<group-folder v-if="group.isOpen" :groups="group.subGroups" /> <group-folder v-if="group.isOpen" :groups="group.subGroups" :baseGroup="group" />
</li> </li>
</template> </template>
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