2021-01-03 14:25:43 +05:30
|
|
|
<script>
|
2023-03-17 16:20:25 +05:30
|
|
|
import { GlSprintf, GlTooltipDirective } from '@gitlab/ui';
|
|
|
|
import { s__, __ } from '~/locale';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'MemberSource',
|
2023-03-17 16:20:25 +05:30
|
|
|
i18n: {
|
|
|
|
inherited: __('Inherited'),
|
|
|
|
directMember: __('Direct member'),
|
|
|
|
directMemberWithCreatedBy: s__('Members|Direct member by %{createdBy}'),
|
|
|
|
inheritedMemberWithCreatedBy: s__('Members|%{group} by %{createdBy}'),
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
2023-03-17 16:20:25 +05:30
|
|
|
components: { GlSprintf },
|
2021-01-03 14:25:43 +05:30
|
|
|
props: {
|
|
|
|
memberSource: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
isDirectMember: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
2023-03-17 16:20:25 +05:30
|
|
|
createdBy: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
showCreatedBy() {
|
|
|
|
return this.createdBy?.name && this.createdBy?.webUrl;
|
|
|
|
},
|
|
|
|
messageWithCreatedBy() {
|
|
|
|
return this.isDirectMember
|
|
|
|
? this.$options.i18n.directMemberWithCreatedBy
|
|
|
|
: this.$options.i18n.inheritedMemberWithCreatedBy;
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-03-17 16:20:25 +05:30
|
|
|
<span v-if="showCreatedBy">
|
|
|
|
<gl-sprintf :message="messageWithCreatedBy">
|
|
|
|
<template #group>
|
|
|
|
<a v-gl-tooltip.hover="$options.i18n.inherited" :href="memberSource.webUrl">{{
|
|
|
|
memberSource.fullName
|
|
|
|
}}</a>
|
|
|
|
</template>
|
|
|
|
<template #createdBy>
|
|
|
|
<a :href="createdBy.webUrl">{{ createdBy.name }}</a>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</span>
|
|
|
|
<span v-else-if="isDirectMember">{{ $options.i18n.directMember }}</span>
|
|
|
|
<a v-else v-gl-tooltip.hover="$options.i18n.inherited" :href="memberSource.webUrl">{{
|
2021-03-08 18:12:59 +05:30
|
|
|
memberSource.fullName
|
2021-01-03 14:25:43 +05:30
|
|
|
}}</a>
|
|
|
|
</template>
|