From 0ccacd7bbdbb63e451ec17e6a650d329f5d4ac9c Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 30 Oct 2018 10:45:54 +0000 Subject: Prevents review app to render an empty dropdown. When a deployment has no files to show in the dropdown we fallback to the regular single button for the review app link. This commit moves the review app link into a component since it's used twice. --- .../components/deployment.vue | 41 +++++++++------------- .../components/review_app_link.vue | 30 ++++++++++++++++ 2 files changed, 47 insertions(+), 24 deletions(-) create mode 100644 app/assets/javascripts/vue_merge_request_widget/components/review_app_link.vue (limited to 'app/assets/javascripts') 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 5e7a35e9396..57c52a2016a 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue @@ -10,6 +10,7 @@ import { visitUrl } from '../../lib/utils/url_utility'; import createFlash from '../../flash'; import MemoryUsage from './memory_usage.vue'; import StatusIcon from './mr_widget_status_icon.vue'; +import ReviewAppLink from './review_app_link.vue'; import MRWidgetService from '../services/mr_widget_service'; export default { @@ -21,6 +22,7 @@ export default { Icon, TooltipOnTruncate, FilteredSearchDropdown, + ReviewAppLink, }, directives: { tooltip, @@ -63,6 +65,12 @@ export default { deployedText() { return this.$options.deployedTextMap[this.deployment.status]; }, + shouldRenderDropdown() { + return ( + this.enableCiEnvironmentsStatusChanges && + (this.deployment.changes && this.deployment.changes.length > 0) + ); + }, }, methods: { stopEnvironment() { @@ -133,7 +141,7 @@ export default {
- - - {{ __('View app') }} - - - + :link="deployment.external_url" + css-class="js-deploy-url js-deploy-url-feature-flag deploy-link btn btn-default btn-sm inlin" + /> +import Icon from '~/vue_shared/components/icon.vue'; + +export default { + components: { + Icon, + }, + props: { + link: { + type: String, + required: true, + }, + cssClass: { + type: String, + required: true, + }, + }, +}; + + -- cgit v1.2.1