Commit 30dd8360 authored by Simon Knox's avatar Simon Knox

Merge branch '11414-add-copyable-reference-to-epic-sidebar' into 'master'

Allow copying Epic reference from sidebar [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!65550
parents 49d35e1f 442aa2b5
...@@ -3,6 +3,7 @@ import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants'; ...@@ -3,6 +3,7 @@ import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
import epicConfidentialQuery from '~/sidebar/queries/epic_confidential.query.graphql'; import epicConfidentialQuery from '~/sidebar/queries/epic_confidential.query.graphql';
import epicDueDateQuery from '~/sidebar/queries/epic_due_date.query.graphql'; import epicDueDateQuery from '~/sidebar/queries/epic_due_date.query.graphql';
import epicParticipantsQuery from '~/sidebar/queries/epic_participants.query.graphql'; import epicParticipantsQuery from '~/sidebar/queries/epic_participants.query.graphql';
import epicReferenceQuery from '~/sidebar/queries/epic_reference.query.graphql';
import epicStartDateQuery from '~/sidebar/queries/epic_start_date.query.graphql'; import epicStartDateQuery from '~/sidebar/queries/epic_start_date.query.graphql';
import epicSubscribedQuery from '~/sidebar/queries/epic_subscribed.query.graphql'; import epicSubscribedQuery from '~/sidebar/queries/epic_subscribed.query.graphql';
import epicTodoQuery from '~/sidebar/queries/epic_todo.query.graphql'; import epicTodoQuery from '~/sidebar/queries/epic_todo.query.graphql';
...@@ -95,6 +96,9 @@ export const referenceQueries = { ...@@ -95,6 +96,9 @@ export const referenceQueries = {
[IssuableType.MergeRequest]: { [IssuableType.MergeRequest]: {
query: mergeRequestReferenceQuery, query: mergeRequestReferenceQuery,
}, },
[IssuableType.Epic]: {
query: epicReferenceQuery,
},
}; };
export const dateTypes = { export const dateTypes = {
......
query epicReference($fullPath: ID!, $iid: ID) {
workspace: group(fullPath: $fullPath) {
__typename
issuable: epic(iid: $iid) {
__typename
id
reference(full: true)
}
}
}
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlSprintf } from '@gitlab/ui';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
...@@ -10,8 +10,9 @@ import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; ...@@ -10,8 +10,9 @@ import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
export default { export default {
name: 'CopyableField', name: 'CopyableField',
components: { components: {
GlLoadingIcon,
ClipboardButton, ClipboardButton,
GlLoadingIcon,
GlSprintf,
}, },
props: { props: {
value: { value: {
...@@ -48,12 +49,6 @@ export default { ...@@ -48,12 +49,6 @@ export default {
loadingIconLabel() { loadingIconLabel() {
return sprintf(this.$options.i18n.loadingIconLabel, { name: this.name }); return sprintf(this.$options.i18n.loadingIconLabel, { name: this.name });
}, },
templateText() {
return sprintf(this.$options.i18n.templateText, {
name: this.name,
value: this.value,
});
},
}, },
i18n: { i18n: {
loadingIconLabel: __('Loading %{name}'), loadingIconLabel: __('Loading %{name}'),
...@@ -78,7 +73,10 @@ export default { ...@@ -78,7 +73,10 @@ export default {
class="gl-overflow-hidden gl-text-overflow-ellipsis gl-white-space-nowrap" class="gl-overflow-hidden gl-text-overflow-ellipsis gl-white-space-nowrap"
:title="value" :title="value"
> >
{{ templateText }} <gl-sprintf :message="$options.i18n.templateText">
<template #name>{{ name }}</template>
<template #value>{{ value }}</template>
</gl-sprintf>
</span> </span>
<gl-loading-icon v-if="isLoading" size="sm" inline :label="loadingIconLabel" /> <gl-loading-icon v-if="isLoading" size="sm" inline :label="loadingIconLabel" />
......
...@@ -7,6 +7,7 @@ import { IssuableType } from '~/issue_show/constants'; ...@@ -7,6 +7,7 @@ import { IssuableType } from '~/issue_show/constants';
import notesEventHub from '~/notes/event_hub'; import notesEventHub from '~/notes/event_hub';
import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue'; import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue';
import SidebarParticipants from '~/sidebar/components/participants/participants.vue'; import SidebarParticipants from '~/sidebar/components/participants/participants.vue';
import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue';
import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import sidebarEventHub from '~/sidebar/event_hub'; import sidebarEventHub from '~/sidebar/event_hub';
import SidebarDatePickerCollapsed from '~/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue'; import SidebarDatePickerCollapsed from '~/vue_shared/components/sidebar/collapsed_grouped_date_picker.vue';
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
SidebarParticipants, SidebarParticipants,
SidebarConfidentialityWidget, SidebarConfidentialityWidget,
SidebarSubscriptionsWidget, SidebarSubscriptionsWidget,
SidebarReferenceWidget,
}, },
inject: ['iid'], inject: ['iid'],
data() { data() {
...@@ -250,6 +252,9 @@ export default { ...@@ -250,6 +252,9 @@ export default {
data-testid="subscribe" data-testid="subscribe"
@expandSidebar="handleSidebarToggle" @expandSidebar="handleSidebarToggle"
/> />
<div class="block with-sub-blocks">
<sidebar-reference-widget :issuable-type="issuableType" />
</div>
</div> </div>
</aside> </aside>
</template> </template>
...@@ -10,6 +10,7 @@ import epicUtils from 'ee/epic/utils/epic_utils'; ...@@ -10,6 +10,7 @@ import epicUtils from 'ee/epic/utils/epic_utils';
import { parsePikadayDate } from '~/lib/utils/datetime_utility'; import { parsePikadayDate } from '~/lib/utils/datetime_utility';
import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue';
import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue';
import { mockEpicMeta, mockEpicData, mockAncestors } from '../mock_data'; import { mockEpicMeta, mockEpicData, mockAncestors } from '../mock_data';
...@@ -213,6 +214,10 @@ describe('EpicSidebarComponent', () => { ...@@ -213,6 +214,10 @@ describe('EpicSidebarComponent', () => {
expect(wrapper.find(SidebarSubscriptionsWidget).exists()).toBe(true); expect(wrapper.find(SidebarSubscriptionsWidget).exists()).toBe(true);
}); });
it('renders SidebarReferenceWidget', () => {
expect(wrapper.find(SidebarReferenceWidget).exists()).toBe(true);
});
describe('when sub-epics feature is available', () => { describe('when sub-epics feature is available', () => {
it('renders ancestors list', async () => { it('renders ancestors list', async () => {
store.dispatch('toggleSidebarFlag', false); store.dispatch('toggleSidebarFlag', false);
......
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue'; import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue';
...@@ -14,6 +14,9 @@ describe('SidebarCopyableField', () => { ...@@ -14,6 +14,9 @@ describe('SidebarCopyableField', () => {
const createComponent = (propsData = defaultProps) => { const createComponent = (propsData = defaultProps) => {
wrapper = shallowMount(CopyableField, { wrapper = shallowMount(CopyableField, {
propsData, propsData,
stubs: {
GlSprintf,
},
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment