diff options
author | Andrew Fontaine <afontaine@gitlab.com> | 2019-02-08 20:03:16 +0300 |
---|---|---|
committer | Andrew Fontaine <afontaine@gitlab.com> | 2019-02-25 17:52:47 +0300 |
commit | ccdb8906d579764a2e49eee9cbe93982d6e7a2df (patch) | |
tree | f67d292456f9359b267879b804241ab4fd1fe3a8 /app/assets | |
parent | 27ed9d958ad939d08d2457e1e64061c5e4f402e4 (diff) |
Link to Changed Page if Only One Change Present
Given a static page mapping, and a review app with a single static page
change, the review app link will now go directly to that change instead
of to the home page of the review app.
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/deployment.vue | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue index 2f2a37347af..da0a9483f8e 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue @@ -54,6 +54,12 @@ export default { deployTimeago() { return this.timeFormated(this.deployment.deployed_at); }, + deploymentExternalUrl() { + if (this.deployment.changes && this.deployment.changes.length === 1) { + return this.deployment.changes[0].external_url; + } + return this.deployment.external_url; + }, hasExternalUrls() { return !!(this.deployment.external_url && this.deployment.external_url_formatted); }, @@ -78,7 +84,7 @@ export default { : ''; }, shouldRenderDropdown() { - return this.deployment.changes && this.deployment.changes.length > 0; + return this.deployment.changes && this.deployment.changes.length > 1; }, showMemoryUsage() { return this.hasMetrics && this.showMetrics; @@ -154,12 +160,12 @@ export default { v-if="shouldRenderDropdown" class="js-mr-wigdet-deployment-dropdown inline" :items="deployment.changes" - :main-action-link="deployment.external_url" + :main-action-link="deploymentExternalUrl" filter-key="path" > <template slot="mainAction" slot-scope="slotProps"> <review-app-link - :link="deployment.external_url" + :link="deploymentExternalUrl" :css-class="`deploy-link js-deploy-url inline ${slotProps.className}`" /> </template> @@ -183,7 +189,7 @@ export default { </filtered-search-dropdown> <review-app-link v-else - :link="deployment.external_url" + :link="deploymentExternalUrl" css-class="js-deploy-url js-deploy-url-feature-flag deploy-link btn btn-default btn-sm inlin" /> </template> |