All files / app/assets/javascripts/vue_merge_request_widget/components/deployment deployment.vue

100% Statements 5/5
33.33% Branches 1/3
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 586x                                                   174x 13x   161x     13x                                                  
<!-- eslint-disable vue/multi-word-component-names -->
<script>
import { MANUAL_DEPLOY, WILL_DEPLOY, CREATED } from './constants';
import DeploymentActions from './deployment_actions.vue';
import DeploymentInfo from './deployment_info.vue';
 
export default {
  // name: 'Deployment' is a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/26#possible-false-positives
  // eslint-disable-next-line @gitlab/require-i18n-strings
  name: 'Deployment',
  components: {
    DeploymentActions,
    DeploymentInfo,
  },
  props: {
    deployment: {
      type: Object,
      required: true,
    },
    showMetrics: {
      type: Boolean,
      required: true,
    },
  },
  computed: {
    computedDeploymentStatus() {
      if (this.deployment.status === CREATED) {
        return this.isManual ? MANUAL_DEPLOY : WILL_DEPLOY;
      }
      return this.deployment.status;
    },
    isManual() {
      return Boolean(this.deployment.details?.playable_build?.play_path);
    },
  },
};
</script>
 
<template>
  <div class="deploy-heading gl-pl-5 gl-pr-4">
    <div class="ci-widget media">
      <div class="media-body">
        <div class="deploy-body">
          <deployment-info
            :computed-deployment-status="computedDeploymentStatus"
            :deployment="deployment"
            :show-metrics="showMetrics"
          />
          <deployment-actions
            :deployment="deployment"
            :computed-deployment-status="computedDeploymentStatus"
          />
        </div>
      </div>
    </div>
  </div>
</template>