diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-14 15:09:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-14 15:09:48 +0300 |
commit | 7f73b108d44ebb58d2eddcbc98808bafc94d1b11 (patch) | |
tree | c44c1d67aefe3a48ce24b1b83ce495edbf57ff25 /app/assets/javascripts/merge_requests | |
parent | 8f55aaede8e1ba5ca9ffae53313fa860ad05bffa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/merge_requests')
-rw-r--r-- | app/assets/javascripts/merge_requests/components/compare_app.vue | 18 | ||||
-rw-r--r-- | app/assets/javascripts/merge_requests/components/compare_dropdown.vue | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/app/assets/javascripts/merge_requests/components/compare_app.vue b/app/assets/javascripts/merge_requests/components/compare_app.vue index 8e02048f494..20c95174989 100644 --- a/app/assets/javascripts/merge_requests/components/compare_app.vue +++ b/app/assets/javascripts/merge_requests/components/compare_app.vue @@ -23,9 +23,6 @@ export default { currentProject: { default: () => ({}), }, - currentBranch: { - default: () => ({}), - }, inputs: { default: () => ({}), }, @@ -39,6 +36,13 @@ export default { default: '', }, }, + props: { + currentBranch: { + type: Object, + required: false, + default: () => ({}), + }, + }, data() { return { selectedProject: this.currentProject, @@ -57,6 +61,12 @@ export default { return this.commitHtml || this.loading || !this.selectedBranch.value; }, }, + watch: { + currentBranch(newVal) { + this.selectedBranch = newVal; + this.fetchCommit(); + }, + }, mounted() { this.fetchCommit(); }, @@ -67,6 +77,7 @@ export default { selectBranch(branch) { this.selectedBranch = branch; this.fetchCommit(); + this.$emit('select-branch', branch.value); }, async fetchCommit() { if (!this.selectedBranch.value) return; @@ -109,6 +120,7 @@ export default { :default="currentBranch" :toggle-class="toggleClass.branch" :qa-selector="branchQaSelector" + data-testid="compare-dropdown" @selected="selectBranch" /> </div> diff --git a/app/assets/javascripts/merge_requests/components/compare_dropdown.vue b/app/assets/javascripts/merge_requests/components/compare_dropdown.vue index a5a4e683214..6f46b41ee5b 100644 --- a/app/assets/javascripts/merge_requests/components/compare_dropdown.vue +++ b/app/assets/javascripts/merge_requests/components/compare_dropdown.vue @@ -70,6 +70,12 @@ export default { ); }, }, + watch: { + default(newVal) { + this.current = newVal; + this.selected = newVal.value; + }, + }, methods: { async fetchData() { if (!this.endpoint) return; |