All files / ee/app/assets/javascripts/iterations/components timebox_status_badge.vue

16.66% Statements 1/6
0% Branches 0/4
0% Functions 0/1
16.66% Lines 1/6

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        5x                                                                                    
<script>
import { GlBadge } from '@gitlab/ui';
import { __ } from '~/locale';
 
const iterationStates = {
  closed: 'closed',
  upcoming: 'upcoming',
  expired: 'expired',
};
 
export default {
  components: {
    GlBadge,
  },
  props: {
    state: {
      type: String,
      required: false,
      default: '',
    },
  },
  computed: {
    status() {
      switch (this.state) {
        case iterationStates.closed:
          return {
            text: __('Closed'),
            variant: 'danger',
          };
        case iterationStates.expired:
          return { text: __('Expired'), variant: 'warning' };
        case iterationStates.upcoming:
          return { text: __('Upcoming'), variant: 'neutral' };
        default:
          return { text: __('Open'), variant: 'success' };
      }
    },
  },
};
</script>
 
<template>
  <gl-badge :variant="status.variant">
    {{ status.text }}
  </gl-badge>
</template>