Commit b0cf4817 authored by Axel García's avatar Axel García

Improve epic form bundle

This improves both the data source and the data
selection, removing helper functions on the
component
parent 2b98addb
......@@ -7,7 +7,7 @@ import {
GlFormGroup,
GlFormInput,
} from '@gitlab/ui';
import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
import { visitUrl } from '~/lib/utils/url_utility';
import createFlash from '~/flash';
import { __ } from '~/locale';
import LabelsSelectVue from '~/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue';
......@@ -34,6 +34,14 @@ export default {
type: String,
required: true,
},
labelsFetchPath: {
type: String,
required: true,
},
labelsManagePath: {
type: String,
required: true,
},
markdownPreviewPath: {
type: String,
required: false,
......@@ -62,9 +70,6 @@ export default {
},
},
methods: {
groupUrl(path) {
return joinPaths('/groups', this.groupPath, '/-/', path);
},
save() {
this.loading = true;
......@@ -180,11 +185,9 @@ export default {
:allow-multiselect="true"
:allow-scoped-labels="false"
:selected-labels="labels"
:labels-fetch-path="
groupUrl('labels.json?include_ancestor_groups=true&only_group_labels=true')
"
:labels-manage-path="groupUrl('labels')"
:labels-filter-base-path="groupUrl('epics')"
:labels-fetch-path="labelsFetchPath"
:labels-manage-path="labelsManagePath"
:labels-filter-base-path="groupEpicsPath"
:labels-list-title="__('Select label')"
:dropdown-button-text="__('Choose labels')"
variant="embedded"
......
......@@ -16,16 +16,27 @@ export function initEpicForm() {
return null;
}
const {
groupPath,
groupEpicsPath,
labelsFetchPath,
labelsManagePath,
markdownDocsPath,
markdownPreviewPath,
} = el.dataset;
return new Vue({
el,
apolloProvider,
render(createElement) {
return createElement(EpicForm, {
props: {
groupPath: el.dataset.groupFullPath,
groupEpicsPath: el.dataset.groupEpicsPath,
markdownPreviewPath: el.dataset.markdownPreviewPath,
markdownDocsPath: el.dataset.markdownDocsPath,
groupPath,
groupEpicsPath,
labelsFetchPath,
labelsManagePath,
markdownDocsPath,
markdownPreviewPath,
},
});
},
......
......@@ -2,4 +2,4 @@
- breadcrumb_title _("New")
- page_title _("New epic")
.js-epic-new{ data: { group_full_path: @group.full_path, group_epics_path: group_epics_path(@group), markdown_preview_path: preview_markdown_path(@group), markdown_docs_path: help_page_path('user/markdown') } }
.js-epic-new{ data: { group_path: @group.full_path, group_epics_path: group_epics_path(@group), labels_fetch_path: group_labels_path(@group, format: :json, only_group_labels: true, include_ancestor_groups: true), labels_manage_path: group_labels_path(@group), markdown_preview_path: preview_markdown_path(@group), markdown_docs_path: help_page_path('user/markdown') } }
......@@ -20,6 +20,8 @@ describe('ee/epic/components/epic_form.vue', () => {
propsData: {
groupPath: TEST_GROUP_PATH,
groupEpicsPath: TEST_HOST,
labelsFetchPath: TEST_HOST,
labelsManagePath: TEST_HOST,
},
stubs: {
ApolloMutation,
......
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