All files / ee/app/assets/javascripts/compliance_dashboard/components drawer.vue

100% Statements 13/13
100% Branches 4/4
100% Functions 3/3
100% Lines 13/13

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83  3x 3x 3x 3x 3x 3x 3x 3x 3x 3x                                                         14x     34x           160x                                                                    
<script>
import { GlDrawer } from '@gitlab/ui';
import { DRAWER_Z_INDEX } from '~/lib/utils/constants';
import { COMPLIANCE_DRAWER_CONTAINER_CLASS } from '../constants';
import { getContentWrapperHeight } from '../../threat_monitoring/utils';
import BranchPath from './drawer_sections/branch_path.vue';
import Committers from './drawer_sections/committers.vue';
import MergedBy from './drawer_sections/merged_by.vue';
import Project from './drawer_sections/project.vue';
import Reference from './drawer_sections/reference.vue';
import Reviewers from './drawer_sections/reviewers.vue';
 
export default {
  components: {
    BranchPath,
    Committers,
    GlDrawer,
    MergedBy,
    Reference,
    Reviewers,
    Project,
  },
  props: {
    mergeRequest: {
      type: Object,
      required: true,
    },
    project: {
      type: Object,
      required: true,
    },
    showDrawer: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  computed: {
    hasBranchDetails() {
      return this.mergeRequest.sourceBranch && this.mergeRequest.targetBranch;
    },
    drawerHeaderHeight() {
      return getContentWrapperHeight(COMPLIANCE_DRAWER_CONTAINER_CLASS);
    },
  },
  DRAWER_Z_INDEX,
};
</script>
<template>
  <gl-drawer
    :open="showDrawer"
    :header-height="drawerHeaderHeight"
    :z-index="$options.DRAWER_Z_INDEX"
    @close="$emit('close')"
  >
    <template #title>
      <h4 data-testid="dashboard-drawer-title">{{ mergeRequest.title }}</h4>
    </template>
    <template v-if="showDrawer" #default>
      <project
        :avatar-url="project.avatarUrl"
        :compliance-framework="project.complianceFramework"
        :name="project.name"
        :url="project.webUrl"
      />
      <reference :path="mergeRequest.webUrl" :reference="mergeRequest.reference" />
      <branch-path
        v-if="hasBranchDetails"
        :source-branch="mergeRequest.sourceBranch"
        :source-branch-uri="mergeRequest.sourceBranchUri"
        :target-branch="mergeRequest.targetBranch"
        :target-branch-uri="mergeRequest.targetBranchUri"
      />
      <committers :committers="mergeRequest.committers" />
      <reviewers
        :approvers="mergeRequest.approvedByUsers"
        :commenters="mergeRequest.participants"
      />
      <merged-by :merged-by="mergeRequest.mergedBy" />
    </template>
  </gl-drawer>
</template>