2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
2021-01-03 14:25:43 +05:30
|
|
|
import { GlIcon } from '@gitlab/ui';
|
2022-06-21 17:19:12 +05:30
|
|
|
import { n__ } from '~/locale';
|
2018-03-17 18:26:18 +05:30
|
|
|
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>
|
2022-07-23 23:45:48 +05:30
|
|
|
<ul class="groups-list group-list-tree gl-display-flex gl-flex-direction-column gl-m-0">
|
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-02-22 17:27:13 +05:30
|
|
|
<gl-icon name="external-link" /> {{ moreChildrenStats }}
|
2018-03-17 18:26:18 +05:30
|
|
|
</a>
|
|
|
|
</li>
|
2017-09-10 17:25:29 +05:30
|
|
|
</ul>
|
|
|
|
</template>
|