Commit d2e8fb82 authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch 'cngo-organise-js-milestones' into 'master'

Organise ~/milestones code

See merge request gitlab-org/gitlab!76221
parents 14ab76f9 b45c06fe
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
import { mergeUrlParams } from '../lib/utils/url_utility';
import DropdownAjaxFilter from './dropdown_ajax_filter';
import DropdownEmoji from './dropdown_emoji';
......
import $ from 'jquery';
import initDatePicker from '~/behaviors/date_picker';
import GLForm from '~/gl_form';
import ZenMode from '~/zen_mode';
export default (initGFM = true) => {
new ZenMode(); // eslint-disable-line no-new
initDatePicker();
// eslint-disable-next-line no-new
new GLForm($('.milestone-form'), {
emojis: true,
members: initGFM,
issues: initGFM,
mergeRequests: initGFM,
epics: initGFM,
milestones: initGFM,
labels: initGFM,
snippets: initGFM,
vulnerabilities: initGFM,
});
};
import $ from 'jquery';
import Vue from 'vue';
import initDatePicker from '~/behaviors/date_picker';
import GLForm from '~/gl_form';
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import Milestone from '~/milestones/milestone';
import Sidebar from '~/right_sidebar';
import MountMilestoneSidebar from '~/sidebar/mount_milestone_sidebar';
import Translate from '~/vue_shared/translate';
import ZenMode from '~/zen_mode';
import DeleteMilestoneModal from './components/delete_milestone_modal.vue';
import PromoteMilestoneModal from './components/promote_milestone_modal.vue';
import eventHub from './event_hub';
export default () => {
export function initForm(initGFM = true) {
new ZenMode(); // eslint-disable-line no-new
initDatePicker();
// eslint-disable-next-line no-new
new GLForm($('.milestone-form'), {
emojis: true,
members: initGFM,
issues: initGFM,
mergeRequests: initGFM,
epics: initGFM,
milestones: initGFM,
labels: initGFM,
snippets: initGFM,
vulnerabilities: initGFM,
});
}
export function initShow() {
new Milestone(); // eslint-disable-line no-new
new Sidebar(); // eslint-disable-line no-new
new MountMilestoneSidebar(); // eslint-disable-line no-new
}
export function initPromoteMilestoneModal() {
Vue.use(Translate);
const promoteMilestoneModal = document.getElementById('promote-milestone-modal');
if (!promoteMilestoneModal) {
return null;
}
return new Vue({
el: promoteMilestoneModal,
render(createElement) {
return createElement(PromoteMilestoneModal);
},
});
}
export function initDeleteMilestoneModal() {
Vue.use(Translate);
const onRequestFinished = ({ milestoneUrl, successful }) => {
......@@ -72,4 +120,4 @@ export default () => {
});
},
});
};
}
/* eslint-disable no-new */
import Milestone from '~/milestones/milestone';
import Sidebar from '~/right_sidebar';
import MountMilestoneSidebar from '~/sidebar/mount_milestone_sidebar';
export default () => {
new Milestone();
new Sidebar();
new MountMilestoneSidebar();
};
......@@ -6,7 +6,7 @@ import { template, escape } from 'lodash';
import Api from '~/api';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
import { __, sprintf } from '~/locale';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
import axios from '~/lib/utils/axios_utils';
import { timeFor, parsePikadayDate, dateInWords } from '~/lib/utils/datetime_utility';
......
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import PromoteMilestoneModal from './components/promote_milestone_modal.vue';
Vue.use(Translate);
export default () => {
const promoteMilestoneModal = document.getElementById('promote-milestone-modal');
if (!promoteMilestoneModal) {
return null;
}
return new Vue({
el: promoteMilestoneModal,
render(createElement) {
return createElement(PromoteMilestoneModal);
},
});
};
import initForm from '~/milestones/form';
import { initForm } from '~/milestones';
initForm();
import initForm from '~/milestones/form';
import { initForm } from '~/milestones';
initForm();
import initDeleteMilestoneModal from '~/milestones/delete_milestone_modal_init';
import initMilestonesShow from '~/milestones/init_milestones_show';
import { initDeleteMilestoneModal, initShow } from '~/milestones';
initMilestonesShow();
initShow();
initDeleteMilestoneModal();
import initForm from '~/milestones/form';
import { initForm } from '~/milestones';
initForm();
import initDeleteMilestoneModal from '~/milestones/delete_milestone_modal_init';
import initPromoteMilestoneModal from '~/milestones/promote_milestone_modal_init';
import { initDeleteMilestoneModal, initPromoteMilestoneModal } from '~/milestones';
initDeleteMilestoneModal();
initPromoteMilestoneModal();
import initForm from '~/milestones/form';
import { initForm } from '~/milestones';
initForm();
import initMilestonesShow from '~/milestones/init_milestones_show';
import initDeleteMilestoneModal from '~/milestones/delete_milestone_modal_init';
import initPromoteMilestoneModal from '~/milestones/promote_milestone_modal_init';
import { initDeleteMilestoneModal, initPromoteMilestoneModal, initShow } from '~/milestones';
initMilestonesShow();
initShow();
initDeleteMilestoneModal();
initPromoteMilestoneModal();
......@@ -2,7 +2,7 @@
import { GlFilteredSearchSuggestion } from '@gitlab/ui';
import createFlash from '~/flash';
import { __ } from '~/locale';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
import BaseToken from '~/vue_shared/components/filtered_search_bar/tokens/base_token.vue';
import { DEFAULT_MILESTONES } from '../constants';
import { stripQuotes } from '../filtered_search_utils';
......
......@@ -2,7 +2,7 @@ import AvailableDropdownMappingsCE from '~/filtered_search/available_dropdown_ma
import DropdownAjaxFilter from '~/filtered_search/dropdown_ajax_filter';
import DropdownNonUser from '~/filtered_search/dropdown_non_user';
import DropdownUser from '~/filtered_search/dropdown_user';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
import DropdownWeight from './dropdown_weight';
export default class AvailableDropdownMappings {
......
......@@ -7,7 +7,7 @@ import Vuex from 'vuex';
import { ENTER_KEY } from '~/lib/utils/keys';
import MilestoneCombobox from '~/milestones/components/milestone_combobox.vue';
import createStore from '~/milestones/stores/';
import { projectMilestones, groupMilestones } from './mock_data';
import { projectMilestones, groupMilestones } from '../mock_data';
const extraLinks = [
{ text: 'Create new', url: 'http://127.0.0.1:3000/h5bp/html5-boilerplate/-/milestones/new' },
......
import { useFakeDate } from 'helpers/fake_date';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
describe('sortMilestonesByDueDate', () => {
useFakeDate(2021, 6, 22);
......
......@@ -9,7 +9,7 @@ import MockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises';
import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { sortMilestonesByDueDate } from '~/milestones/utils';
import { DEFAULT_MILESTONES } from '~/vue_shared/components/filtered_search_bar/constants';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
......@@ -17,7 +17,7 @@ import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/m
import { mockMilestoneToken, mockMilestones, mockRegularMilestone } from '../mock_data';
jest.mock('~/flash');
jest.mock('~/milestones/milestone_utils');
jest.mock('~/milestones/utils');
const defaultStubs = {
Portal: true,
......
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