2017-05-09 19:10:19 -04:00
|
|
|
<script>
|
2020-09-23 11:10:14 -04:00
|
|
|
import { GlIcon } from '@gitlab/ui';
|
2017-10-04 10:10:24 -04:00
|
|
|
import { n__ } from '../../locale';
|
|
|
|
import { MAX_CHILDREN_COUNT } from '../constants';
|
|
|
|
|
2017-05-09 19:10:19 -04:00
|
|
|
export default {
|
2020-09-23 11:10:14 -04:00
|
|
|
components: {
|
|
|
|
GlIcon,
|
|
|
|
},
|
2017-05-09 19:10:19 -04:00
|
|
|
props: {
|
2017-10-04 10:10:24 -04:00
|
|
|
parentGroup: {
|
2017-05-24 22:04:31 -04:00
|
|
|
type: Object,
|
|
|
|
required: false,
|
2017-06-07 04:45:48 -04:00
|
|
|
default: () => ({}),
|
2017-05-24 22:04:31 -04:00
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
groups: {
|
|
|
|
type: Array,
|
2018-09-07 02:09:13 -04:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
action: {
|
|
|
|
type: String,
|
2017-10-04 10:10:24 -04:00
|
|
|
required: false,
|
2018-09-07 02:09:13 -04:00
|
|
|
default: '',
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasMoreChildren() {
|
|
|
|
return this.parentGroup.childrenCount > MAX_CHILDREN_COUNT;
|
|
|
|
},
|
|
|
|
moreChildrenStats() {
|
2018-01-03 18:14:55 -05:00
|
|
|
return n__(
|
|
|
|
'One more item',
|
|
|
|
'%d more items',
|
2018-01-06 13:59:49 -05:00
|
|
|
this.parentGroup.childrenCount - this.parentGroup.children.length,
|
2018-01-03 18:14:55 -05:00
|
|
|
);
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2017-05-09 19:10:19 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-03-20 08:10:03 -04:00
|
|
|
<ul class="groups-list group-list-tree">
|
2017-06-07 04:45:48 -04:00
|
|
|
<group-item
|
|
|
|
v-for="(group, index) in groups"
|
|
|
|
:key="index"
|
|
|
|
:group="group"
|
2017-10-04 10:10:24 -04:00
|
|
|
:parent-group="parentGroup"
|
2018-09-07 02:09:13 -04:00
|
|
|
:action="action"
|
2017-06-07 04:45:48 -04:00
|
|
|
/>
|
2018-11-16 15:07:38 -05:00
|
|
|
<li v-if="hasMoreChildren" class="group-row">
|
2020-01-23 07:08:38 -05:00
|
|
|
<a :href="parentGroup.relativePath" class="group-row-contents has-more-items py-2">
|
2020-11-27 04:09:31 -05:00
|
|
|
<gl-icon name="external-link" /> {{ moreChildrenStats }}
|
2017-10-04 10:10:24 -04:00
|
|
|
</a>
|
|
|
|
</li>
|
2017-05-09 19:10:19 -04:00
|
|
|
</ul>
|
|
|
|
</template>
|