2018-11-08 19:23:39 +05:30
|
|
|
<script>
|
2020-04-08 14:13:33 +05:30
|
|
|
import { isEmpty } from 'lodash';
|
2019-03-02 22:35:43 +05:30
|
|
|
import MRWidgetStore from 'ee_else_ce/vue_merge_request_widget/stores/mr_widget_store';
|
|
|
|
import MRWidgetService from 'ee_else_ce/vue_merge_request_widget/services/mr_widget_service';
|
2020-07-28 23:09:34 +05:30
|
|
|
import MrWidgetApprovals from 'ee_else_ce/vue_merge_request_widget/components/approvals/approvals.vue';
|
2019-03-02 22:35:43 +05:30
|
|
|
import stateMaps from 'ee_else_ce/vue_merge_request_widget/stores/state_maps';
|
2020-01-01 13:55:28 +05:30
|
|
|
import { sprintf, s__, __ } from '~/locale';
|
|
|
|
import Project from '~/pages/projects/project';
|
|
|
|
import SmartInterval from '~/smart_interval';
|
2018-11-08 19:23:39 +05:30
|
|
|
import createFlash from '../flash';
|
2020-01-01 13:55:28 +05:30
|
|
|
import Loading from './components/loading.vue';
|
2018-12-13 13:39:08 +05:30
|
|
|
import WidgetHeader from './components/mr_widget_header.vue';
|
2020-03-13 15:44:24 +05:30
|
|
|
import WidgetSuggestPipeline from './components/mr_widget_suggest_pipeline.vue';
|
2018-12-13 13:39:08 +05:30
|
|
|
import WidgetMergeHelp from './components/mr_widget_merge_help.vue';
|
2019-02-15 15:39:39 +05:30
|
|
|
import MrWidgetPipelineContainer from './components/mr_widget_pipeline_container.vue';
|
2020-01-01 13:55:28 +05:30
|
|
|
import Deployment from './components/deployment/deployment.vue';
|
2018-12-13 13:39:08 +05:30
|
|
|
import WidgetRelatedLinks from './components/mr_widget_related_links.vue';
|
2019-07-07 11:18:12 +05:30
|
|
|
import MrWidgetAlertMessage from './components/mr_widget_alert_message.vue';
|
2018-12-13 13:39:08 +05:30
|
|
|
import MergedState from './components/states/mr_widget_merged.vue';
|
|
|
|
import ClosedState from './components/states/mr_widget_closed.vue';
|
|
|
|
import MergingState from './components/states/mr_widget_merging.vue';
|
|
|
|
import RebaseState from './components/states/mr_widget_rebase.vue';
|
|
|
|
import WorkInProgressState from './components/states/work_in_progress.vue';
|
|
|
|
import ArchivedState from './components/states/mr_widget_archived.vue';
|
|
|
|
import ConflictsState from './components/states/mr_widget_conflicts.vue';
|
|
|
|
import NothingToMergeState from './components/states/nothing_to_merge.vue';
|
|
|
|
import MissingBranchState from './components/states/mr_widget_missing_branch.vue';
|
|
|
|
import NotAllowedState from './components/states/mr_widget_not_allowed.vue';
|
|
|
|
import ReadyToMergeState from './components/states/ready_to_merge.vue';
|
|
|
|
import UnresolvedDiscussionsState from './components/states/unresolved_discussions.vue';
|
|
|
|
import PipelineBlockedState from './components/states/mr_widget_pipeline_blocked.vue';
|
|
|
|
import PipelineFailedState from './components/states/pipeline_failed.vue';
|
|
|
|
import FailedToMerge from './components/states/mr_widget_failed_to_merge.vue';
|
2019-09-04 21:01:54 +05:30
|
|
|
import MrWidgetAutoMergeEnabled from './components/states/mr_widget_auto_merge_enabled.vue';
|
2018-12-13 13:39:08 +05:30
|
|
|
import AutoMergeFailed from './components/states/mr_widget_auto_merge_failed.vue';
|
|
|
|
import CheckingState from './components/states/mr_widget_checking.vue';
|
|
|
|
import eventHub from './event_hub';
|
|
|
|
import notify from '~/lib/utils/notify';
|
|
|
|
import SourceBranchRemovalStatus from './components/source_branch_removal_status.vue';
|
2020-07-28 23:09:34 +05:30
|
|
|
import TerraformPlan from './components/terraform/mr_widget_terraform_container.vue';
|
|
|
|
import GroupedCodequalityReportsApp from '../reports/codequality_report/grouped_codequality_reports_app.vue';
|
2018-11-18 11:00:15 +05:30
|
|
|
import GroupedTestReportsApp from '../reports/components/grouped_test_reports_app.vue';
|
2018-11-08 19:23:39 +05:30
|
|
|
import { setFaviconOverlay } from '../lib/utils/common_utils';
|
2020-05-24 23:13:21 +05:30
|
|
|
import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
el: '#js-vue-mr-widget',
|
2019-10-12 21:52:04 +05:30
|
|
|
// False positive i18n lint: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/25
|
2020-04-22 19:07:51 +05:30
|
|
|
// eslint-disable-next-line @gitlab/require-i18n-strings
|
2017-08-17 22:00:37 +05:30
|
|
|
name: 'MRWidget',
|
2018-11-08 19:23:39 +05:30
|
|
|
components: {
|
2020-01-01 13:55:28 +05:30
|
|
|
Loading,
|
2018-11-08 19:23:39 +05:30
|
|
|
'mr-widget-header': WidgetHeader,
|
2020-03-13 15:44:24 +05:30
|
|
|
'mr-widget-suggest-pipeline': WidgetSuggestPipeline,
|
2018-11-08 19:23:39 +05:30
|
|
|
'mr-widget-merge-help': WidgetMergeHelp,
|
2019-02-15 15:39:39 +05:30
|
|
|
MrWidgetPipelineContainer,
|
2018-11-08 19:23:39 +05:30
|
|
|
Deployment,
|
|
|
|
'mr-widget-related-links': WidgetRelatedLinks,
|
2019-07-07 11:18:12 +05:30
|
|
|
MrWidgetAlertMessage,
|
2018-11-08 19:23:39 +05:30
|
|
|
'mr-widget-merged': MergedState,
|
|
|
|
'mr-widget-closed': ClosedState,
|
|
|
|
'mr-widget-merging': MergingState,
|
|
|
|
'mr-widget-failed-to-merge': FailedToMerge,
|
|
|
|
'mr-widget-wip': WorkInProgressState,
|
|
|
|
'mr-widget-archived': ArchivedState,
|
|
|
|
'mr-widget-conflicts': ConflictsState,
|
|
|
|
'mr-widget-nothing-to-merge': NothingToMergeState,
|
|
|
|
'mr-widget-not-allowed': NotAllowedState,
|
|
|
|
'mr-widget-missing-branch': MissingBranchState,
|
|
|
|
'mr-widget-ready-to-merge': ReadyToMergeState,
|
2020-01-01 13:55:28 +05:30
|
|
|
'sha-mismatch': ReadyToMergeState,
|
2018-11-08 19:23:39 +05:30
|
|
|
'mr-widget-checking': CheckingState,
|
|
|
|
'mr-widget-unresolved-discussions': UnresolvedDiscussionsState,
|
|
|
|
'mr-widget-pipeline-blocked': PipelineBlockedState,
|
|
|
|
'mr-widget-pipeline-failed': PipelineFailedState,
|
2019-09-04 21:01:54 +05:30
|
|
|
MrWidgetAutoMergeEnabled,
|
2018-11-08 19:23:39 +05:30
|
|
|
'mr-widget-auto-merge-failed': AutoMergeFailed,
|
|
|
|
'mr-widget-rebase': RebaseState,
|
|
|
|
SourceBranchRemovalStatus,
|
2020-07-28 23:09:34 +05:30
|
|
|
GroupedCodequalityReportsApp,
|
2018-11-18 11:00:15 +05:30
|
|
|
GroupedTestReportsApp,
|
2020-04-22 19:07:51 +05:30
|
|
|
TerraformPlan,
|
2020-05-24 23:13:21 +05:30
|
|
|
GroupedAccessibilityReportsApp,
|
2020-07-28 23:09:34 +05:30
|
|
|
MrWidgetApprovals,
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
props: {
|
|
|
|
mrData: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
2018-11-08 19:23:39 +05:30
|
|
|
default: null,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
data() {
|
2020-01-01 13:55:28 +05:30
|
|
|
const store = this.mrData && new MRWidgetStore(this.mrData);
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
return {
|
|
|
|
mr: store,
|
2020-01-01 13:55:28 +05:30
|
|
|
state: store && store.state,
|
|
|
|
service: store && this.createService(store),
|
2017-08-17 22:00:37 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2020-07-28 23:09:34 +05:30
|
|
|
shouldRenderApprovals() {
|
|
|
|
return this.mr.state !== 'nothingToMerge';
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
componentName() {
|
|
|
|
return stateMaps.stateToComponentMap[this.mr.state];
|
|
|
|
},
|
|
|
|
shouldRenderMergeHelp() {
|
|
|
|
return stateMaps.statesToShowHelpWidget.indexOf(this.mr.state) > -1;
|
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
hasPipelineMustSucceedConflict() {
|
|
|
|
return !this.mr.hasCI && this.mr.onlyAllowMergeIfPipelineSucceeds;
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
shouldRenderPipelines() {
|
2020-05-24 23:13:21 +05:30
|
|
|
return this.mr.hasCI || this.hasPipelineMustSucceedConflict;
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
shouldSuggestPipelines() {
|
|
|
|
return gon.features?.suggestPipeline && !this.mr.hasCI && this.mr.mergeRequestAddCiConfigPath;
|
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
shouldRenderCodeQuality() {
|
|
|
|
return this.mr?.codeclimate?.head_path;
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
shouldRenderRelatedLinks() {
|
2019-09-04 21:01:54 +05:30
|
|
|
return Boolean(this.mr.relatedLinks) && !this.mr.isNothingToMergeState;
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
shouldRenderSourceBranchRemovalStatus() {
|
2018-12-13 13:39:08 +05:30
|
|
|
return (
|
|
|
|
!this.mr.canRemoveSourceBranch &&
|
|
|
|
this.mr.shouldRemoveSourceBranch &&
|
|
|
|
(!this.mr.isNothingToMergeState && !this.mr.isMergedState)
|
|
|
|
);
|
|
|
|
},
|
2019-02-15 15:39:39 +05:30
|
|
|
shouldRenderCollaborationStatus() {
|
|
|
|
return this.mr.allowCollaboration && this.mr.isOpen;
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
shouldRenderMergedPipeline() {
|
2020-04-08 14:13:33 +05:30
|
|
|
return this.mr.state === 'merged' && !isEmpty(this.mr.mergePipeline);
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
showMergePipelineForkWarning() {
|
|
|
|
return Boolean(
|
|
|
|
this.mr.mergePipelinesEnabled && this.mr.sourceProjectId !== this.mr.targetProjectId,
|
|
|
|
);
|
|
|
|
},
|
2019-09-04 21:01:54 +05:30
|
|
|
mergeError() {
|
2020-03-13 15:44:24 +05:30
|
|
|
let { mergeError } = this.mr;
|
|
|
|
|
|
|
|
if (mergeError && mergeError.slice(-1) === '.') {
|
|
|
|
mergeError = mergeError.slice(0, -1);
|
|
|
|
}
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
return sprintf(s__('mrWidget|Merge failed: %{mergeError}. Please try again.'), {
|
2020-03-13 15:44:24 +05:30
|
|
|
mergeError,
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|
2019-07-07 11:18:12 +05:30
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
shouldShowAccessibilityReport() {
|
|
|
|
return this.mr.accessibilityReportPath;
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
state(newVal, oldVal) {
|
|
|
|
if (newVal !== oldVal && this.shouldRenderMergedPipeline) {
|
|
|
|
// init polling
|
|
|
|
this.initPostMergeDeploymentsPolling();
|
|
|
|
}
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
mounted() {
|
2020-03-13 15:44:24 +05:30
|
|
|
MRWidgetService.fetchInitialData()
|
|
|
|
.then(({ data }) => this.initWidget(data))
|
|
|
|
.catch(() =>
|
|
|
|
createFlash(__('Unable to load the merge request widget. Try reloading the page.')),
|
|
|
|
);
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
2018-12-05 23:21:45 +05:30
|
|
|
beforeDestroy() {
|
|
|
|
eventHub.$off('mr.discussion.updated', this.checkStatus);
|
2020-01-01 13:55:28 +05:30
|
|
|
if (this.pollingInterval) {
|
|
|
|
this.pollingInterval.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.deploymentsInterval) {
|
|
|
|
this.deploymentsInterval.destroy();
|
|
|
|
}
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
if (this.postMergeDeploymentsInterval) {
|
|
|
|
this.postMergeDeploymentsInterval.destroy();
|
|
|
|
}
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
methods: {
|
2020-01-01 13:55:28 +05:30
|
|
|
initWidget(data = {}) {
|
|
|
|
if (this.mr) {
|
|
|
|
this.mr.setData({ ...window.gl.mrWidgetData, ...data });
|
|
|
|
} else {
|
|
|
|
this.mr = new MRWidgetStore({ ...window.gl.mrWidgetData, ...data });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.state) {
|
|
|
|
this.state = this.mr.state;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.service) {
|
|
|
|
this.service = this.createService(this.mr);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setFaviconHelper();
|
|
|
|
this.initDeploymentsPolling();
|
|
|
|
|
|
|
|
if (this.shouldRenderMergedPipeline) {
|
|
|
|
this.initPostMergeDeploymentsPolling();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.initPolling();
|
|
|
|
this.bindEventHubListeners();
|
|
|
|
eventHub.$on('mr.discussion.updated', this.checkStatus);
|
|
|
|
},
|
2019-03-02 22:35:43 +05:30
|
|
|
getServiceEndpoints(store) {
|
|
|
|
return {
|
2017-08-17 22:00:37 +05:30
|
|
|
mergePath: store.mergePath,
|
|
|
|
mergeCheckPath: store.mergeCheckPath,
|
|
|
|
cancelAutoMergePath: store.cancelAutoMergePath,
|
|
|
|
removeWIPPath: store.removeWIPPath,
|
|
|
|
sourceBranchPath: store.sourceBranchPath,
|
|
|
|
ciEnvironmentsStatusPath: store.ciEnvironmentsStatusPath,
|
2019-09-30 21:07:59 +05:30
|
|
|
mergeRequestBasicPath: store.mergeRequestBasicPath,
|
|
|
|
mergeRequestWidgetPath: store.mergeRequestWidgetPath,
|
2019-10-12 21:52:04 +05:30
|
|
|
mergeRequestCachedWidgetPath: store.mergeRequestCachedWidgetPath,
|
2017-08-17 22:00:37 +05:30
|
|
|
mergeActionsContentPath: store.mergeActionsContentPath,
|
2018-03-17 18:26:18 +05:30
|
|
|
rebasePath: store.rebasePath,
|
2020-07-28 23:09:34 +05:30
|
|
|
apiApprovalsPath: store.apiApprovalsPath,
|
|
|
|
apiApprovePath: store.apiApprovePath,
|
|
|
|
apiUnapprovePath: store.apiUnapprovePath,
|
2017-08-17 22:00:37 +05:30
|
|
|
};
|
2019-03-02 22:35:43 +05:30
|
|
|
},
|
|
|
|
createService(store) {
|
|
|
|
return new MRWidgetService(this.getServiceEndpoints(store));
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2019-02-15 15:39:39 +05:30
|
|
|
checkStatus(cb, isRebased) {
|
2018-12-13 13:39:08 +05:30
|
|
|
return this.service
|
|
|
|
.checkStatus()
|
2019-10-12 21:52:04 +05:30
|
|
|
.then(({ data }) => {
|
2018-03-17 18:26:18 +05:30
|
|
|
this.handleNotification(data);
|
2019-02-15 15:39:39 +05:30
|
|
|
this.mr.setData(data, isRebased);
|
2018-03-17 18:26:18 +05:30
|
|
|
this.setFaviconHelper();
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
if (cb) {
|
2018-03-17 18:26:18 +05:30
|
|
|
cb.call(null, data);
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
})
|
2018-12-13 13:39:08 +05:30
|
|
|
.catch(() => createFlash(__('Something went wrong. Please try again.')));
|
|
|
|
},
|
|
|
|
setFaviconHelper() {
|
|
|
|
if (this.mr.ciStatusFaviconPath) {
|
|
|
|
return setFaviconOverlay(this.mr.ciStatusFaviconPath);
|
|
|
|
}
|
|
|
|
return Promise.resolve();
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
initPolling() {
|
2018-03-17 18:26:18 +05:30
|
|
|
this.pollingInterval = new SmartInterval({
|
2017-08-17 22:00:37 +05:30
|
|
|
callback: this.checkStatus,
|
2020-04-22 19:07:51 +05:30
|
|
|
startingInterval: 10 * 1000,
|
|
|
|
maxInterval: 240 * 1000,
|
|
|
|
hiddenInterval: window.gon?.features?.widgetVisibilityPolling && 360 * 1000,
|
|
|
|
incrementByFactorOf: 2,
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
},
|
|
|
|
initDeploymentsPolling() {
|
2018-12-13 13:39:08 +05:30
|
|
|
this.deploymentsInterval = this.deploymentsPoll(this.fetchPreMergeDeployments);
|
|
|
|
},
|
|
|
|
initPostMergeDeploymentsPolling() {
|
|
|
|
this.postMergeDeploymentsInterval = this.deploymentsPoll(this.fetchPostMergeDeployments);
|
|
|
|
},
|
|
|
|
deploymentsPoll(callback) {
|
|
|
|
return new SmartInterval({
|
|
|
|
callback,
|
2020-04-22 19:07:51 +05:30
|
|
|
startingInterval: 30 * 1000,
|
|
|
|
maxInterval: 240 * 1000,
|
|
|
|
incrementByFactorOf: 4,
|
2017-08-17 22:00:37 +05:30
|
|
|
immediateExecution: true,
|
|
|
|
});
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
fetchDeployments(target) {
|
|
|
|
return this.service.fetchDeployments(target);
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
fetchPreMergeDeployments() {
|
|
|
|
return this.fetchDeployments()
|
|
|
|
.then(({ data }) => {
|
2018-03-17 18:26:18 +05:30
|
|
|
if (data.length) {
|
|
|
|
this.mr.deployments = data;
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
})
|
2018-12-13 13:39:08 +05:30
|
|
|
.catch(() => this.throwDeploymentsError());
|
|
|
|
},
|
|
|
|
fetchPostMergeDeployments() {
|
|
|
|
return this.fetchDeployments('merge_commit')
|
|
|
|
.then(({ data }) => {
|
|
|
|
if (data.length) {
|
|
|
|
this.mr.postMergeDeployments = data;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(() => this.throwDeploymentsError());
|
|
|
|
},
|
|
|
|
throwDeploymentsError() {
|
|
|
|
createFlash(
|
|
|
|
__(
|
|
|
|
'Something went wrong while fetching the environments for this merge request. Please try again.',
|
|
|
|
),
|
|
|
|
);
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
fetchActionsContent() {
|
2018-12-13 13:39:08 +05:30
|
|
|
this.service
|
|
|
|
.fetchMergeActionsContent()
|
|
|
|
.then(res => {
|
2018-03-17 18:26:18 +05:30
|
|
|
if (res.data) {
|
2017-08-17 22:00:37 +05:30
|
|
|
const el = document.createElement('div');
|
2018-03-17 18:26:18 +05:30
|
|
|
el.innerHTML = res.data;
|
2017-08-17 22:00:37 +05:30
|
|
|
document.body.appendChild(el);
|
2018-03-17 18:26:18 +05:30
|
|
|
Project.initRefSwitcher();
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
})
|
2018-12-13 13:39:08 +05:30
|
|
|
.catch(() => createFlash(__('Something went wrong. Please try again.')));
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
handleNotification(data) {
|
|
|
|
if (data.ci_status === this.mr.ciStatus) return;
|
2018-03-17 18:26:18 +05:30
|
|
|
if (!data.pipeline) return;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
const { label } = data.pipeline.details.status;
|
2019-09-30 21:07:59 +05:30
|
|
|
const title = sprintf(__('Pipeline %{label}'), { label });
|
|
|
|
const message = sprintf(__('Pipeline %{label} for "%{dataTitle}"'), {
|
|
|
|
dataTitle: data.title,
|
|
|
|
label,
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
notify.notifyMe(title, message, this.mr.gitlabLogo);
|
|
|
|
},
|
|
|
|
resumePolling() {
|
|
|
|
this.pollingInterval.resume();
|
|
|
|
},
|
|
|
|
stopPolling() {
|
|
|
|
this.pollingInterval.stopTimer();
|
|
|
|
},
|
|
|
|
bindEventHubListeners() {
|
2018-12-13 13:39:08 +05:30
|
|
|
eventHub.$on('MRWidgetUpdateRequested', cb => {
|
2017-08-17 22:00:37 +05:30
|
|
|
this.checkStatus(cb);
|
|
|
|
});
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
eventHub.$on('MRWidgetRebaseSuccess', cb => {
|
|
|
|
this.checkStatus(cb, true);
|
|
|
|
});
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
// `params` should be an Array contains a Boolean, like `[true]`
|
|
|
|
// Passing parameter as Boolean didn't work.
|
2018-12-13 13:39:08 +05:30
|
|
|
eventHub.$on('SetBranchRemoveFlag', params => {
|
2018-11-08 19:23:39 +05:30
|
|
|
[this.mr.isRemovingSourceBranch] = params;
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
eventHub.$on('FailedToMerge', mergeError => {
|
2017-08-17 22:00:37 +05:30
|
|
|
this.mr.state = 'failedToMerge';
|
|
|
|
this.mr.mergeError = mergeError;
|
|
|
|
});
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
eventHub.$on('UpdateWidgetData', data => {
|
2017-08-17 22:00:37 +05:30
|
|
|
this.mr.setData(data);
|
|
|
|
});
|
|
|
|
|
|
|
|
eventHub.$on('FetchActionsContent', () => {
|
|
|
|
this.fetchActionsContent();
|
|
|
|
});
|
|
|
|
|
|
|
|
eventHub.$on('EnablePolling', () => {
|
|
|
|
this.resumePolling();
|
|
|
|
});
|
|
|
|
|
|
|
|
eventHub.$on('DisablePolling', () => {
|
|
|
|
this.stopPolling();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2020-07-28 23:09:34 +05:30
|
|
|
<div v-if="mr" class="mr-state-widget gl-mt-3">
|
2019-02-15 15:39:39 +05:30
|
|
|
<mr-widget-header :mr="mr" />
|
2020-03-13 15:44:24 +05:30
|
|
|
<mr-widget-suggest-pipeline
|
|
|
|
v-if="shouldSuggestPipelines"
|
|
|
|
class="mr-widget-workflow"
|
|
|
|
:pipeline-path="mr.mergeRequestAddCiConfigPath"
|
2020-04-08 14:13:33 +05:30
|
|
|
:pipeline-svg-path="mr.pipelinesEmptySvgPath"
|
|
|
|
:human-access="mr.humanAccess.toLowerCase()"
|
2020-03-13 15:44:24 +05:30
|
|
|
/>
|
2019-02-15 15:39:39 +05:30
|
|
|
<mr-widget-pipeline-container
|
2019-01-03 12:48:30 +05:30
|
|
|
v-if="shouldRenderPipelines"
|
2019-02-15 15:39:39 +05:30
|
|
|
class="mr-widget-workflow"
|
|
|
|
:mr="mr"
|
2019-01-03 12:48:30 +05:30
|
|
|
/>
|
2020-07-28 23:09:34 +05:30
|
|
|
<mr-widget-approvals
|
|
|
|
v-if="shouldRenderApprovals"
|
|
|
|
class="mr-widget-workflow"
|
|
|
|
:mr="mr"
|
|
|
|
:service="service"
|
|
|
|
/>
|
2019-02-15 15:39:39 +05:30
|
|
|
<div class="mr-section-container mr-widget-workflow">
|
2020-07-28 23:09:34 +05:30
|
|
|
<grouped-codequality-reports-app
|
|
|
|
v-if="shouldRenderCodeQuality"
|
|
|
|
:base-path="mr.codeclimate.base_path"
|
|
|
|
:head-path="mr.codeclimate.head_path"
|
|
|
|
:head-blob-path="mr.headBlobPath"
|
|
|
|
:base-blob-path="mr.baseBlobPath"
|
|
|
|
:codequality-help-path="mr.codequalityHelpPath"
|
|
|
|
/>
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
<grouped-test-reports-app
|
|
|
|
v-if="mr.testResultsPath"
|
2018-12-13 13:39:08 +05:30
|
|
|
class="js-reports-container"
|
2018-11-18 11:00:15 +05:30
|
|
|
:endpoint="mr.testResultsPath"
|
2020-07-28 23:09:34 +05:30
|
|
|
:pipeline-path="mr.pipeline.path"
|
2018-11-18 11:00:15 +05:30
|
|
|
/>
|
2018-12-13 13:39:08 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
<terraform-plan v-if="mr.terraformReportsPath" :endpoint="mr.terraformReportsPath" />
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
<grouped-accessibility-reports-app
|
|
|
|
v-if="shouldShowAccessibilityReport"
|
|
|
|
:endpoint="mr.accessibilityReportPath"
|
|
|
|
/>
|
|
|
|
|
2019-03-13 22:55:13 +05:30
|
|
|
<div class="mr-widget-section">
|
2019-02-15 15:39:39 +05:30
|
|
|
<component :is="componentName" :mr="mr" :service="service" />
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
<div class="mr-widget-info">
|
|
|
|
<section v-if="shouldRenderCollaborationStatus" class="mr-info-list mr-links">
|
|
|
|
<p>
|
|
|
|
{{ s__('mrWidget|Allows commits from members who can merge to the target branch') }}
|
|
|
|
</p>
|
|
|
|
</section>
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
<mr-widget-related-links
|
|
|
|
v-if="shouldRenderRelatedLinks"
|
|
|
|
:state="mr.state"
|
|
|
|
:related-links="mr.relatedLinks"
|
|
|
|
/>
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
<mr-widget-alert-message
|
|
|
|
v-if="showMergePipelineForkWarning"
|
|
|
|
type="warning"
|
|
|
|
:help-path="mr.mergeRequestPipelinesHelpPath"
|
|
|
|
>
|
|
|
|
{{
|
|
|
|
s__(
|
|
|
|
'mrWidget|Fork merge requests do not create merge request pipelines which validate a post merge result',
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</mr-widget-alert-message>
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
<mr-widget-alert-message v-if="mr.mergeError" type="danger">
|
|
|
|
{{ mergeError }}
|
|
|
|
</mr-widget-alert-message>
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
<source-branch-removal-status v-if="shouldRenderSourceBranchRemovalStatus" />
|
|
|
|
</div>
|
2017-09-10 17:25:29 +05:30
|
|
|
</div>
|
2020-05-24 23:13:21 +05:30
|
|
|
<div v-if="shouldRenderMergeHelp" class="mr-widget-footer">
|
|
|
|
<mr-widget-merge-help />
|
|
|
|
</div>
|
2017-08-17 22:00:37 +05:30
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
<mr-widget-pipeline-container
|
|
|
|
v-if="shouldRenderMergedPipeline"
|
|
|
|
class="js-post-merge-pipeline mr-widget-workflow"
|
|
|
|
:mr="mr"
|
|
|
|
:is-post-merge="true"
|
|
|
|
/>
|
2018-11-08 19:23:39 +05:30
|
|
|
</div>
|
2020-01-01 13:55:28 +05:30
|
|
|
<loading v-else />
|
2018-11-08 19:23:39 +05:30
|
|
|
</template>
|