Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimanshu Kapoor <hkapoor@gitlab.com>2019-09-09 20:48:41 +0300
committerHimanshu Kapoor <hkapoor@gitlab.com>2019-09-09 20:48:41 +0300
commit7fe209aa87e4f7fef428c515813a8c90931efef8 (patch)
tree24472056c73753c98bb3cea08d5349d631abca5c
parent2a960abb179dbff168bbc155c01d05a1bfd7ac69 (diff)
Load the same MR once it is created
Do not open another MR create box if an MR for that branch already exists and is open.
-rw-r--r--app/assets/javascripts/ide/components/merge_requests/create.vue45
1 files changed, 30 insertions, 15 deletions
diff --git a/app/assets/javascripts/ide/components/merge_requests/create.vue b/app/assets/javascripts/ide/components/merge_requests/create.vue
index 75eb76da118..393bd6bec3e 100644
--- a/app/assets/javascripts/ide/components/merge_requests/create.vue
+++ b/app/assets/javascripts/ide/components/merge_requests/create.vue
@@ -5,6 +5,25 @@ import Icon from '../../../vue_shared/components/icon.vue';
import TitleComponent from '../../../issue_show/components/title.vue';
import DescriptionComponent from '../../../issue_show/components/description.vue';
import { setTimeout, setInterval, clearInterval } from 'timers';
+import store from '../../stores';
+
+function onIframeReady(iframe, callback) {
+ let i = setInterval(() => {
+ try {
+ if (iframe.contentWindow.location.href === 'about:blank') return;
+
+ callback(iframe);
+ clearInterval(i);
+ }
+ catch (e) {}
+ }, 1000 / 60)
+
+ setTimeout(clearInterval, 10000, i);
+}
+
+function modifyMergeRequestPage(iframe) {
+ iframe.contentDocument.body.className += ' create-merge-request-iframe';
+}
export default {
components: {
@@ -14,32 +33,28 @@ export default {
},
computed: {
...mapState(['currentBranchId', 'currentProjectId', 'currentMergeRequestId']),
-
mergeRequestSrc() {
if (this.currentMergeRequestId) {
return `/${this.currentProjectId}/merge_requests/${this.currentMergeRequestId}`;
}
return `/${this.currentProjectId}/merge_requests/new?merge_request%5Bsource_branch%5D=${this.currentBranchId}&amp;merge_request%5Btarget_branch%5D=master`;
- }
+ },
+ },
+ watch: {
+
},
methods: {
- onload: () => {
+ onload() {
+ modifyMergeRequestPage($('#js-create-mr-sidebar').get(0));
+ store.dispatch('getMergeRequestsForBranch', {
+ projectId: this.currentProjectId,
+ branchId: this.currentBranchId,
+ });
}
},
mounted: () => {
- let i = setInterval(() => {
- try {
- if ($('#js-create-mr-sidebar').get(0).contentWindow.location.href === 'about:blank') return;
-
- $('#js-create-mr-sidebar').get(0).contentDocument.body.className += ' create-merge-request-iframe';
- clearInterval(i);
- console.log()
- }
- catch (e) {}
- }, 1000 / 60)
-
- setTimeout(clearInterval, 10000, i)
+ onIframeReady($('#js-create-mr-sidebar').get(0), modifyMergeRequestPage)
}
};
</script>