2020-11-24 15:15:51 +05:30
|
|
|
import Vue from 'vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2020-11-24 15:15:51 +05:30
|
|
|
import issuableApp from './components/app.vue';
|
|
|
|
import incidentTabs from './components/incidents/incident_tabs.vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
import { issueState } from './constants';
|
|
|
|
import apolloProvider from './graphql';
|
|
|
|
import getIssueStateQuery from './queries/get_issue_state.query.graphql';
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
export default function initIssuableApp(issuableData = {}) {
|
2021-09-04 01:27:46 +05:30
|
|
|
const el = document.getElementById('js-issuable-app');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
apolloProvider.clients.defaultClient.cache.writeQuery({
|
|
|
|
query: getIssueStateQuery,
|
|
|
|
data: {
|
|
|
|
issueState: { ...issueState, issueType: el.dataset.issueType },
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
});
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const {
|
|
|
|
canUpdate,
|
|
|
|
iid,
|
|
|
|
projectNamespace,
|
|
|
|
projectPath,
|
|
|
|
projectId,
|
|
|
|
slaFeatureAvailable,
|
|
|
|
uploadMetricsFeatureAvailable,
|
|
|
|
} = issuableData;
|
|
|
|
|
|
|
|
const fullPath = `${projectNamespace}/${projectPath}`;
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
return new Vue({
|
2021-09-04 01:27:46 +05:30
|
|
|
el,
|
2020-11-24 15:15:51 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
issuableApp,
|
|
|
|
},
|
|
|
|
provide: {
|
2021-03-08 18:12:59 +05:30
|
|
|
canUpdate,
|
|
|
|
fullPath,
|
2020-11-24 15:15:51 +05:30
|
|
|
iid,
|
2021-03-08 18:12:59 +05:30
|
|
|
projectId,
|
2021-01-03 14:25:43 +05:30
|
|
|
slaFeatureAvailable: parseBoolean(slaFeatureAvailable),
|
2021-03-08 18:12:59 +05:30
|
|
|
uploadMetricsFeatureAvailable: parseBoolean(uploadMetricsFeatureAvailable),
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('issuable-app', {
|
|
|
|
props: {
|
|
|
|
...issuableData,
|
|
|
|
descriptionComponent: incidentTabs,
|
|
|
|
showTitleBorder: false,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|