2019-12-26 22:10:19 +05:30
|
|
|
import Vue from 'vue';
|
2020-05-24 23:13:21 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2021-06-08 01:23:25 +05:30
|
|
|
import { IssuableType } from '~/issue_show/constants';
|
2021-04-17 20:07:23 +05:30
|
|
|
import IssuesListApp from '~/issues_list/components/issues_list_app.vue';
|
2020-05-24 23:13:21 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-04-17 20:07:23 +05:30
|
|
|
import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_utils';
|
2019-12-26 22:10:19 +05:30
|
|
|
import IssuablesListApp from './components/issuables_list_app.vue';
|
2021-04-17 20:07:23 +05:30
|
|
|
import JiraIssuesImportStatusRoot from './components/jira_issues_import_status_app.vue';
|
2019-12-26 22:10:19 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
export function mountJiraIssuesListApp() {
|
2021-04-17 20:07:23 +05:30
|
|
|
const el = document.querySelector('.js-jira-issues-import-status');
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const defaultClient = createDefaultClient();
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient,
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
render(createComponent) {
|
2021-04-17 20:07:23 +05:30
|
|
|
return createComponent(JiraIssuesImportStatusRoot, {
|
2020-05-24 23:13:21 +05:30
|
|
|
props: {
|
|
|
|
canEdit: parseBoolean(el.dataset.canEdit),
|
|
|
|
isJiraConfigured: parseBoolean(el.dataset.isJiraConfigured),
|
|
|
|
issuesPath: el.dataset.issuesPath,
|
|
|
|
projectPath: el.dataset.projectPath,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
export function mountIssuablesListApp() {
|
2021-04-17 20:07:23 +05:30
|
|
|
if (!gon.features?.vueIssuablesList) {
|
2019-12-26 22:10:19 +05:30
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
document.querySelectorAll('.js-issuables-list').forEach((el) => {
|
2021-01-29 00:20:46 +05:30
|
|
|
const { canBulkEdit, emptyStateMeta = {}, scopedLabelsAvailable, ...data } = el.dataset;
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-01-29 00:20:46 +05:30
|
|
|
provide: {
|
|
|
|
scopedLabelsAvailable: parseBoolean(scopedLabelsAvailable),
|
|
|
|
},
|
2019-12-26 22:10:19 +05:30
|
|
|
render(createElement) {
|
2020-05-24 23:13:21 +05:30
|
|
|
return createElement(IssuablesListApp, {
|
|
|
|
props: {
|
|
|
|
...data,
|
2020-10-24 23:57:45 +05:30
|
|
|
emptyStateMeta:
|
|
|
|
Object.keys(emptyStateMeta).length !== 0
|
|
|
|
? convertObjectPropsToCamelCase(JSON.parse(emptyStateMeta))
|
|
|
|
: {},
|
2020-05-24 23:13:21 +05:30
|
|
|
canBulkEdit: Boolean(canBulkEdit),
|
|
|
|
},
|
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
export function mountIssuesListApp() {
|
2021-04-17 20:07:23 +05:30
|
|
|
const el = document.querySelector('.js-issues-list');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
2021-06-08 01:23:25 +05:30
|
|
|
autocompleteAwardEmojisPath,
|
|
|
|
autocompleteUsersPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
calendarPath,
|
|
|
|
canBulkUpdate,
|
|
|
|
canEdit,
|
|
|
|
canImportIssues,
|
|
|
|
email,
|
2021-06-08 01:23:25 +05:30
|
|
|
emailsHelpPagePath,
|
2021-04-29 21:17:54 +05:30
|
|
|
emptyStateSvgPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
endpoint,
|
2021-04-29 21:17:54 +05:30
|
|
|
exportCsvPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
groupEpicsPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
hasBlockedIssuesFeature,
|
|
|
|
hasIssuableHealthStatusFeature,
|
2021-04-29 21:17:54 +05:30
|
|
|
hasIssues,
|
2021-04-17 20:07:23 +05:30
|
|
|
hasIssueWeightsFeature,
|
2021-06-08 01:23:25 +05:30
|
|
|
hasMultipleIssueAssigneesFeature,
|
2021-04-29 21:17:54 +05:30
|
|
|
importCsvIssuesPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
initialEmail,
|
2021-04-29 21:17:54 +05:30
|
|
|
isSignedIn,
|
|
|
|
issuesPath,
|
|
|
|
jiraIntegrationPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
markdownHelpPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
maxAttachmentSize,
|
|
|
|
newIssuePath,
|
|
|
|
projectImportJiraPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
projectIterationsPath,
|
|
|
|
projectLabelsPath,
|
|
|
|
projectMilestonesPath,
|
|
|
|
projectPath,
|
|
|
|
quickActionsHelpPath,
|
|
|
|
resetPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
rssPath,
|
|
|
|
showNewIssueLink,
|
|
|
|
signInPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
// Currently does not use Vue Apollo, but need to provide {} for now until the
|
|
|
|
// issue is fixed upstream in https://github.com/vuejs/vue-apollo/pull/1153
|
|
|
|
apolloProvider: {},
|
|
|
|
provide: {
|
2021-06-08 01:23:25 +05:30
|
|
|
autocompleteAwardEmojisPath,
|
|
|
|
autocompleteUsersPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
calendarPath,
|
|
|
|
canBulkUpdate: parseBoolean(canBulkUpdate),
|
|
|
|
emptyStateSvgPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
endpoint,
|
2021-06-08 01:23:25 +05:30
|
|
|
groupEpicsPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
hasBlockedIssuesFeature: parseBoolean(hasBlockedIssuesFeature),
|
|
|
|
hasIssuableHealthStatusFeature: parseBoolean(hasIssuableHealthStatusFeature),
|
2021-04-29 21:17:54 +05:30
|
|
|
hasIssues: parseBoolean(hasIssues),
|
2021-04-17 20:07:23 +05:30
|
|
|
hasIssueWeightsFeature: parseBoolean(hasIssueWeightsFeature),
|
2021-06-08 01:23:25 +05:30
|
|
|
hasMultipleIssueAssigneesFeature: parseBoolean(hasMultipleIssueAssigneesFeature),
|
2021-04-29 21:17:54 +05:30
|
|
|
isSignedIn: parseBoolean(isSignedIn),
|
|
|
|
issuesPath,
|
|
|
|
jiraIntegrationPath,
|
|
|
|
newIssuePath,
|
2021-06-08 01:23:25 +05:30
|
|
|
projectIterationsPath,
|
|
|
|
projectLabelsPath,
|
|
|
|
projectMilestonesPath,
|
|
|
|
projectPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
rssPath,
|
|
|
|
showNewIssueLink: parseBoolean(showNewIssueLink),
|
|
|
|
signInPath,
|
|
|
|
// For CsvImportExportButtons component
|
|
|
|
canEdit: parseBoolean(canEdit),
|
|
|
|
email,
|
|
|
|
exportCsvPath,
|
|
|
|
importCsvIssuesPath,
|
|
|
|
maxAttachmentSize,
|
|
|
|
projectImportJiraPath,
|
|
|
|
showExportButton: parseBoolean(hasIssues),
|
|
|
|
showImportButton: parseBoolean(canImportIssues),
|
|
|
|
showLabel: !parseBoolean(hasIssues),
|
2021-06-08 01:23:25 +05:30
|
|
|
// For IssuableByEmail component
|
|
|
|
emailsHelpPagePath,
|
|
|
|
initialEmail,
|
|
|
|
issuableType: IssuableType.Issue,
|
|
|
|
markdownHelpPath,
|
|
|
|
quickActionsHelpPath,
|
|
|
|
resetPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
},
|
|
|
|
render: (createComponent) => createComponent(IssuesListApp),
|
|
|
|
});
|
|
|
|
}
|