2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
2021-01-03 14:25:43 +05:30
|
|
|
import { GlIcon } from '@gitlab/ui';
|
2018-03-17 18:26:18 +05:30
|
|
|
import { n__ } from '../../locale';
|
|
|
|
import { MAX_CHILDREN_COUNT } from '../constants';
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
export default {
|
2021-01-03 14:25:43 +05:30
|
|
|
components: {
|
|
|
|
GlIcon,
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
props: {
|
2018-03-17 18:26:18 +05:30
|
|
|
parentGroup: {
|
2017-09-10 17:25:29 +05:30
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
groups: {
|
|
|
|
type: Array,
|
2018-11-20 20:47:30 +05:30
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
action: {
|
|
|
|
type: String,
|
2018-03-17 18:26:18 +05:30
|
|
|
required: false,
|
2018-11-20 20:47:30 +05:30
|
|
|
default: '',
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasMoreChildren() {
|
|
|
|
return this.parentGroup.childrenCount > MAX_CHILDREN_COUNT;
|
|
|
|
},
|
|
|
|
moreChildrenStats() {
|
|
|
|
return n__(
|
|
|
|
'One more item',
|
|
|
|
'%d more items',
|
|
|
|
this.parentGroup.childrenCount - this.parentGroup.children.length,
|
|
|
|
);
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-04-22 19:07:51 +05:30
|
|
|
<ul class="groups-list group-list-tree">
|
2017-09-10 17:25:29 +05:30
|
|
|
<group-item
|
|
|
|
v-for="(group, index) in groups"
|
|
|
|
:key="index"
|
|
|
|
:group="group"
|
2018-03-17 18:26:18 +05:30
|
|
|
:parent-group="parentGroup"
|
2018-11-20 20:47:30 +05:30
|
|
|
:action="action"
|
2017-09-10 17:25:29 +05:30
|
|
|
/>
|
2019-02-15 15:39:39 +05:30
|
|
|
<li v-if="hasMoreChildren" class="group-row">
|
2020-03-13 15:44:24 +05:30
|
|
|
<a :href="parentGroup.relativePath" class="group-row-contents has-more-items py-2">
|
2021-01-03 14:25:43 +05:30
|
|
|
<gl-icon name="external-link" aria-hidden="true" /> {{ moreChildrenStats }}
|
2018-03-17 18:26:18 +05:30
|
|
|
</a>
|
|
|
|
</li>
|
2017-09-10 17:25:29 +05:30
|
|
|
</ul>
|
|
|
|
</template>
|