2017-05-06 00:15:04 -04:00
|
|
|
<script>
|
2020-01-24 10:09:00 -05:00
|
|
|
import { GlLoadingIcon, GlBadge } from '@gitlab/ui';
|
2017-12-11 07:28:11 -05:00
|
|
|
import { visitUrl } from '../../lib/utils/url_utility';
|
2017-11-29 07:19:32 -05:00
|
|
|
import tooltip from '../../vue_shared/directives/tooltip';
|
2017-08-30 01:52:08 -04:00
|
|
|
import identicon from '../../vue_shared/components/identicon.vue';
|
2017-05-08 16:22:26 -04:00
|
|
|
import eventHub from '../event_hub';
|
2019-03-25 20:03:48 -04:00
|
|
|
import { VISIBILITY_TYPE_ICON, GROUP_VISIBILITY_TYPE } from '../constants';
|
2017-05-08 16:22:26 -04:00
|
|
|
|
2017-10-04 10:10:24 -04:00
|
|
|
import itemCaret from './item_caret.vue';
|
|
|
|
import itemTypeIcon from './item_type_icon.vue';
|
|
|
|
import itemStats from './item_stats.vue';
|
2019-03-25 20:03:48 -04:00
|
|
|
import itemStatsValue from './item_stats_value.vue';
|
2017-10-04 10:10:24 -04:00
|
|
|
import itemActions from './item_actions.vue';
|
|
|
|
|
2020-06-15 11:08:20 -04:00
|
|
|
import { showLearnGitLabGroupItemPopover } from '~/onboarding_issues';
|
|
|
|
|
2017-05-06 00:15:04 -04:00
|
|
|
export default {
|
2017-11-29 07:19:32 -05:00
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2017-08-01 05:08:40 -04:00
|
|
|
components: {
|
2020-01-24 10:09:00 -05:00
|
|
|
GlBadge,
|
2019-03-25 20:03:48 -04:00
|
|
|
GlLoadingIcon,
|
2017-08-30 01:52:08 -04:00
|
|
|
identicon,
|
2017-10-04 10:10:24 -04:00
|
|
|
itemCaret,
|
|
|
|
itemTypeIcon,
|
|
|
|
itemStats,
|
2019-03-25 20:03:48 -04:00
|
|
|
itemStatsValue,
|
2017-10-04 10:10:24 -04:00
|
|
|
itemActions,
|
2017-08-01 05:08:40 -04:00
|
|
|
},
|
2017-05-06 00:15:04 -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-05-31 16:41:55 -04:00
|
|
|
default: () => ({}),
|
2017-05-24 22:04:31 -04:00
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
group: {
|
2017-06-06 10:01:42 -04:00
|
|
|
type: Object,
|
2017-10-04 10:10:24 -04:00
|
|
|
required: true,
|
2017-05-30 05:25:53 -04:00
|
|
|
},
|
2018-09-07 02:09:13 -04:00
|
|
|
action: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2017-05-16 10:29:38 -04:00
|
|
|
},
|
|
|
|
computed: {
|
2017-05-25 20:49:46 -04:00
|
|
|
groupDomId() {
|
|
|
|
return `group-${this.group.id}`;
|
|
|
|
},
|
2017-05-16 10:29:38 -04:00
|
|
|
rowClass() {
|
|
|
|
return {
|
|
|
|
'is-open': this.group.isOpen,
|
2017-10-04 10:10:24 -04:00
|
|
|
'has-children': this.hasChildren,
|
|
|
|
'has-description': this.group.description,
|
|
|
|
'being-removed': this.group.isBeingRemoved,
|
2017-05-16 10:29:38 -04:00
|
|
|
};
|
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
hasChildren() {
|
|
|
|
return this.group.childrenCount > 0;
|
2017-05-30 18:22:30 -04:00
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
hasAvatar() {
|
|
|
|
return this.group.avatarUrl !== null;
|
|
|
|
},
|
|
|
|
isGroup() {
|
|
|
|
return this.group.type === 'group';
|
|
|
|
},
|
2020-01-24 10:09:00 -05:00
|
|
|
isGroupPendingRemoval() {
|
|
|
|
return this.group.type === 'group' && this.group.pendingRemoval;
|
|
|
|
},
|
2019-03-25 20:03:48 -04:00
|
|
|
visibilityIcon() {
|
|
|
|
return VISIBILITY_TYPE_ICON[this.group.visibility];
|
|
|
|
},
|
|
|
|
visibilityTooltip() {
|
|
|
|
return GROUP_VISIBILITY_TYPE[this.group.visibility];
|
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2020-06-15 11:08:20 -04:00
|
|
|
mounted() {
|
|
|
|
if (this.group.name === 'Learn GitLab') {
|
|
|
|
showLearnGitLabGroupItemPopover(this.group.id);
|
|
|
|
}
|
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
methods: {
|
|
|
|
onClickRowGroup(e) {
|
|
|
|
const NO_EXPAND_CLS = 'no-expand';
|
2018-09-07 02:09:13 -04:00
|
|
|
const targetClasses = e.target.classList;
|
|
|
|
const parentElClasses = e.target.parentElement.classList;
|
|
|
|
|
|
|
|
if (!(targetClasses.contains(NO_EXPAND_CLS) || parentElClasses.contains(NO_EXPAND_CLS))) {
|
2017-10-04 10:10:24 -04:00
|
|
|
if (this.hasChildren) {
|
2018-09-07 02:09:13 -04:00
|
|
|
eventHub.$emit(`${this.action}toggleChildren`, this.group);
|
2017-05-24 22:04:31 -04:00
|
|
|
} else {
|
2017-12-11 07:28:11 -05:00
|
|
|
visitUrl(this.group.relativePath);
|
2017-05-24 22:04:31 -04:00
|
|
|
}
|
|
|
|
}
|
2017-07-31 06:34:25 -04:00
|
|
|
},
|
2017-05-08 16:22:26 -04:00
|
|
|
},
|
2017-05-06 00:15:04 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-11-16 15:07:38 -05:00
|
|
|
<li :id="groupDomId" :class="rowClass" class="group-row" @click.stop="onClickRowGroup">
|
2017-06-07 04:45:48 -04:00
|
|
|
<div
|
2018-06-11 05:49:47 -04:00
|
|
|
:class="{ 'project-row-contents': !isGroup }"
|
2020-03-09 14:07:59 -04:00
|
|
|
class="group-row-contents d-flex align-items-center py-2 pr-3"
|
2018-08-07 19:23:23 -04:00
|
|
|
>
|
2018-11-16 15:07:38 -05:00
|
|
|
<div class="folder-toggle-wrap append-right-4 d-flex align-items-center">
|
|
|
|
<item-caret :is-group-open="group.isOpen" />
|
|
|
|
<item-type-icon :item-type="group.type" :is-group-open="group.isOpen" />
|
2017-06-06 23:30:51 -04:00
|
|
|
</div>
|
2019-03-25 20:03:48 -04:00
|
|
|
<gl-loading-icon
|
|
|
|
v-if="group.isChildrenLoading"
|
2020-03-09 14:07:59 -04:00
|
|
|
size="lg"
|
2020-06-01 11:08:16 -04:00
|
|
|
class="d-none d-sm-inline-flex flex-shrink-0 gl-mr-3"
|
2019-03-25 20:03:48 -04:00
|
|
|
/>
|
2017-06-07 04:45:48 -04:00
|
|
|
<div
|
2019-03-25 20:03:48 -04:00
|
|
|
:class="{ 'd-sm-flex': !group.isChildrenLoading }"
|
2020-01-23 07:08:38 -05:00
|
|
|
class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0 "
|
2017-10-04 10:10:24 -04:00
|
|
|
>
|
2018-11-16 15:07:38 -05:00
|
|
|
<a :href="group.relativePath" class="no-expand">
|
2019-10-17 17:06:41 -04:00
|
|
|
<img v-if="hasAvatar" :src="group.avatarUrl" class="avatar s40" />
|
|
|
|
<identicon v-else :entity-id="group.id" :entity-name="group.name" size-class="s40" />
|
2017-06-06 23:30:51 -04:00
|
|
|
</a>
|
|
|
|
</div>
|
2019-03-25 20:03:48 -04:00
|
|
|
<div class="group-text-container d-flex flex-fill align-items-center">
|
|
|
|
<div class="group-text flex-grow-1 flex-shrink-1">
|
2020-06-01 11:08:16 -04:00
|
|
|
<div class="d-flex align-items-center flex-wrap title namespace-title gl-mr-3">
|
2019-03-25 20:03:48 -04:00
|
|
|
<a
|
|
|
|
v-tooltip
|
|
|
|
:href="group.relativePath"
|
|
|
|
:title="group.fullName"
|
2020-06-02 02:08:01 -04:00
|
|
|
class="no-expand gl-mt-3 gl-mr-3 gl-text-gray-900!"
|
2019-03-25 20:03:48 -04:00
|
|
|
data-placement="bottom"
|
|
|
|
>{{
|
|
|
|
// ending bracket must be by closing tag to prevent
|
|
|
|
// link hover text-decoration from over-extending
|
|
|
|
group.name
|
|
|
|
}}</a
|
|
|
|
>
|
|
|
|
<item-stats-value
|
|
|
|
:icon-name="visibilityIcon"
|
|
|
|
:title="visibilityTooltip"
|
2020-05-27 20:08:37 -04:00
|
|
|
css-class="item-visibility d-inline-flex align-items-center gl-mt-3 append-right-4 text-secondary"
|
2019-03-25 20:03:48 -04:00
|
|
|
/>
|
2020-05-27 20:08:37 -04:00
|
|
|
<span v-if="group.permission" class="user-access-role gl-mt-3">
|
2019-03-25 20:03:48 -04:00
|
|
|
{{ group.permission }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div v-if="group.description" class="description">
|
|
|
|
<span v-html="group.description"> </span>
|
|
|
|
</div>
|
2018-08-07 19:23:23 -04:00
|
|
|
</div>
|
2020-01-24 10:09:00 -05:00
|
|
|
<div v-if="isGroupPendingRemoval">
|
|
|
|
<gl-badge variant="warning">{{ __('pending removal') }}</gl-badge>
|
|
|
|
</div>
|
2019-03-25 20:03:48 -04:00
|
|
|
<div
|
|
|
|
class="metadata align-items-md-center d-flex flex-grow-1 flex-shrink-0 flex-wrap justify-content-md-between"
|
|
|
|
>
|
|
|
|
<item-actions v-if="isGroup" :group="group" :parent-group="parentGroup" />
|
2020-05-22 08:08:15 -04:00
|
|
|
<item-stats :item="group" class="group-stats gl-mt-2 d-none d-md-flex" />
|
2018-08-07 19:23:23 -04:00
|
|
|
</div>
|
2017-12-07 04:11:41 -05:00
|
|
|
</div>
|
2017-05-16 10:29:38 -04:00
|
|
|
</div>
|
2017-06-07 04:45:48 -04:00
|
|
|
<group-folder
|
2017-10-04 10:10:24 -04:00
|
|
|
v-if="group.isOpen && hasChildren"
|
|
|
|
:parent-group="group"
|
|
|
|
:groups="group.children"
|
2018-09-07 02:09:13 -04:00
|
|
|
:action="action"
|
2017-06-07 04:45:48 -04:00
|
|
|
/>
|
2017-05-09 19:10:19 -04:00
|
|
|
</li>
|
2017-05-06 00:15:04 -04:00
|
|
|
</template>
|