2017-05-06 04:15:04 +00:00
|
|
|
<script>
|
2017-12-11 12:28:11 +00:00
|
|
|
import { visitUrl } from '../../lib/utils/url_utility';
|
2017-11-29 12:19:32 +00:00
|
|
|
import tooltip from '../../vue_shared/directives/tooltip';
|
2017-08-30 05:52:08 +00:00
|
|
|
import identicon from '../../vue_shared/components/identicon.vue';
|
2017-05-08 20:22:26 +00:00
|
|
|
import eventHub from '../event_hub';
|
|
|
|
|
2017-10-04 14:10:24 +00:00
|
|
|
import itemCaret from './item_caret.vue';
|
|
|
|
import itemTypeIcon from './item_type_icon.vue';
|
|
|
|
import itemStats from './item_stats.vue';
|
|
|
|
import itemActions from './item_actions.vue';
|
|
|
|
|
2017-05-06 04:15:04 +00:00
|
|
|
export default {
|
2017-11-29 12:19:32 +00:00
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2017-08-01 09:08:40 +00:00
|
|
|
components: {
|
2017-08-30 05:52:08 +00:00
|
|
|
identicon,
|
2017-10-04 14:10:24 +00:00
|
|
|
itemCaret,
|
|
|
|
itemTypeIcon,
|
|
|
|
itemStats,
|
|
|
|
itemActions,
|
2017-08-01 09:08:40 +00:00
|
|
|
},
|
2017-05-06 04:15:04 +00:00
|
|
|
props: {
|
2017-10-04 14:10:24 +00:00
|
|
|
parentGroup: {
|
2017-05-25 02:04:31 +00:00
|
|
|
type: Object,
|
|
|
|
required: false,
|
2017-05-31 20:41:55 +00:00
|
|
|
default: () => ({}),
|
2017-05-25 02:04:31 +00:00
|
|
|
},
|
2017-10-04 14:10:24 +00:00
|
|
|
group: {
|
2017-06-06 14:01:42 +00:00
|
|
|
type: Object,
|
2017-10-04 14:10:24 +00:00
|
|
|
required: true,
|
2017-05-30 09:25:53 +00:00
|
|
|
},
|
2017-05-16 14:29:38 +00:00
|
|
|
},
|
|
|
|
computed: {
|
2017-05-26 00:49:46 +00:00
|
|
|
groupDomId() {
|
|
|
|
return `group-${this.group.id}`;
|
|
|
|
},
|
2017-05-16 14:29:38 +00:00
|
|
|
rowClass() {
|
|
|
|
return {
|
|
|
|
'is-open': this.group.isOpen,
|
2017-10-04 14:10:24 +00:00
|
|
|
'has-children': this.hasChildren,
|
|
|
|
'has-description': this.group.description,
|
|
|
|
'being-removed': this.group.isBeingRemoved,
|
2017-05-16 14:29:38 +00:00
|
|
|
};
|
|
|
|
},
|
2017-10-04 14:10:24 +00:00
|
|
|
hasChildren() {
|
|
|
|
return this.group.childrenCount > 0;
|
2017-05-30 22:22:30 +00:00
|
|
|
},
|
2017-10-04 14:10:24 +00:00
|
|
|
hasAvatar() {
|
|
|
|
return this.group.avatarUrl !== null;
|
|
|
|
},
|
|
|
|
isGroup() {
|
|
|
|
return this.group.type === 'group';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClickRowGroup(e) {
|
|
|
|
const NO_EXPAND_CLS = 'no-expand';
|
|
|
|
if (!(e.target.classList.contains(NO_EXPAND_CLS) ||
|
|
|
|
e.target.parentElement.classList.contains(NO_EXPAND_CLS))) {
|
|
|
|
if (this.hasChildren) {
|
|
|
|
eventHub.$emit('toggleChildren', this.group);
|
2017-05-25 02:04:31 +00:00
|
|
|
} else {
|
2017-12-11 12:28:11 +00:00
|
|
|
visitUrl(this.group.relativePath);
|
2017-05-25 02:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-31 10:34:25 +00:00
|
|
|
},
|
2017-05-08 20:22:26 +00:00
|
|
|
},
|
2017-05-06 04:15:04 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2017-05-12 08:36:08 +00:00
|
|
|
<li
|
2017-05-30 22:01:48 +00:00
|
|
|
@click.stop="onClickRowGroup"
|
2017-05-26 00:49:46 +00:00
|
|
|
:id="groupDomId"
|
2017-05-16 14:29:38 +00:00
|
|
|
:class="rowClass"
|
2017-10-04 14:10:24 +00:00
|
|
|
class="group-row"
|
2018-01-08 20:01:49 +00:00
|
|
|
>
|
2017-06-07 08:45:48 +00:00
|
|
|
<div
|
2017-12-22 07:01:01 +00:00
|
|
|
class="group-row-contents"
|
|
|
|
:class="{ 'project-row-contents': !isGroup }">
|
2017-10-04 14:10:24 +00:00
|
|
|
<item-actions
|
|
|
|
v-if="isGroup"
|
|
|
|
:group="group"
|
|
|
|
:parent-group="parentGroup"
|
|
|
|
/>
|
|
|
|
<item-stats
|
|
|
|
:item="group"
|
|
|
|
/>
|
2017-06-07 08:45:48 +00:00
|
|
|
<div
|
2018-01-08 20:01:49 +00:00
|
|
|
class="folder-toggle-wrap"
|
|
|
|
>
|
2017-10-04 14:10:24 +00:00
|
|
|
<item-caret
|
|
|
|
:is-group-open="group.isOpen"
|
|
|
|
/>
|
|
|
|
<item-type-icon
|
|
|
|
:item-type="group.type"
|
|
|
|
:is-group-open="group.isOpen"
|
|
|
|
/>
|
2017-06-07 03:30:51 +00:00
|
|
|
</div>
|
2017-06-07 08:45:48 +00:00
|
|
|
<div
|
2017-12-22 07:01:01 +00:00
|
|
|
class="avatar-container prepend-top-8 prepend-left-5 s24 hidden-xs"
|
2017-10-04 14:10:24 +00:00
|
|
|
:class="{ 'content-loading': group.isChildrenLoading }"
|
|
|
|
>
|
2017-06-07 08:45:48 +00:00
|
|
|
<a
|
2017-10-04 14:10:24 +00:00
|
|
|
:href="group.relativePath"
|
|
|
|
class="no-expand"
|
|
|
|
>
|
2017-06-07 08:45:48 +00:00
|
|
|
<img
|
2017-07-31 10:34:25 +00:00
|
|
|
v-if="hasAvatar"
|
2017-12-22 07:01:01 +00:00
|
|
|
class="avatar s24"
|
2017-06-07 08:45:48 +00:00
|
|
|
:src="group.avatarUrl"
|
|
|
|
/>
|
2017-08-30 05:52:08 +00:00
|
|
|
<identicon
|
2017-07-31 10:34:25 +00:00
|
|
|
v-else
|
2017-12-22 07:01:01 +00:00
|
|
|
size-class="s24"
|
2018-01-08 20:01:49 +00:00
|
|
|
:entity-id="group.id"
|
2017-08-02 09:15:00 +00:00
|
|
|
:entity-name="group.name"
|
2017-07-31 10:34:25 +00:00
|
|
|
/>
|
2017-06-07 03:30:51 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
2017-06-07 08:45:48 +00:00
|
|
|
<div
|
2018-01-08 20:01:49 +00:00
|
|
|
class="title namespace-title"
|
|
|
|
>
|
2017-06-07 08:45:48 +00:00
|
|
|
<a
|
2017-11-29 12:19:32 +00:00
|
|
|
v-tooltip
|
2017-10-04 14:10:24 +00:00
|
|
|
:href="group.relativePath"
|
2017-11-29 12:19:32 +00:00
|
|
|
:title="group.fullName"
|
|
|
|
class="no-expand"
|
2018-01-04 07:02:47 +00:00
|
|
|
data-placement="bottom"
|
2017-12-07 09:11:41 +00:00
|
|
|
>{{
|
|
|
|
// ending bracket must be by closing tag to prevent
|
|
|
|
// link hover text-decoration from over-extending
|
|
|
|
group.name
|
|
|
|
}}</a>
|
2017-10-04 14:10:24 +00:00
|
|
|
<span
|
|
|
|
v-if="group.permission"
|
2017-12-07 09:11:41 +00:00
|
|
|
class="user-access-role"
|
2017-10-04 14:10:24 +00:00
|
|
|
>
|
2018-01-08 20:01:49 +00:00
|
|
|
{{ group.permission }}
|
2017-10-04 14:10:24 +00:00
|
|
|
</span>
|
2017-06-07 03:30:51 +00:00
|
|
|
</div>
|
2017-06-07 08:45:48 +00:00
|
|
|
<div
|
2017-12-07 09:11:41 +00:00
|
|
|
v-if="group.description"
|
|
|
|
class="description">
|
2017-12-21 21:15:50 +00:00
|
|
|
<span v-html="group.description">
|
|
|
|
</span>
|
2017-12-07 09:11:41 +00:00
|
|
|
</div>
|
2017-05-16 14:29:38 +00:00
|
|
|
</div>
|
2017-06-07 08:45:48 +00:00
|
|
|
<group-folder
|
2017-10-04 14:10:24 +00:00
|
|
|
v-if="group.isOpen && hasChildren"
|
|
|
|
:parent-group="group"
|
|
|
|
:groups="group.children"
|
2017-06-07 08:45:48 +00:00
|
|
|
/>
|
2017-05-09 23:10:19 +00:00
|
|
|
</li>
|
2017-05-06 04:15:04 +00:00
|
|
|
</template>
|