All files / app/assets/javascripts/sidebar/components/assignees issuable_assignees.vue

66.66% Statements 2/3
100% Branches 0/0
50% Functions 1/2
66.66% Lines 2/3

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        7x                                                               6x                                                                      
<script>
import { GlButton } from '@gitlab/ui';
import { TYPE_ISSUE } from '~/issues/constants';
import { n__ } from '~/locale';
import UncollapsedAssigneeList from './uncollapsed_assignee_list.vue';
 
export default {
  components: {
    GlButton,
    UncollapsedAssigneeList,
  },
  props: {
    users: {
      type: Array,
      required: true,
    },
    issuableType: {
      type: String,
      required: false,
      default: TYPE_ISSUE,
    },
    signedIn: {
      type: Boolean,
      required: false,
      default: false,
    },
    editable: {
      type: Boolean,
      required: true,
    },
  },
  computed: {
    assigneesText() {
      return n__('Assignee', '%d Assignees', this.users.length);
    },
    emptyUsers() {
      return this.users.length === 0;
    },
  },
};
</script>
 
<template>
  <div class="gl-display-flex gl-flex-direction-column issuable-assignees">
    <div
      v-if="emptyUsers"
      class="gl-display-flex gl-align-items-center gl-text-gray-500 hide-collapsed"
      data-testid="none"
    >
      <span> {{ __('None') }}</span>
      <template v-if="signedIn && editable">
        <span class="gl-ml-2">-</span>
        <gl-button
          data-testid="assign-yourself"
          category="tertiary"
          variant="link"
          class="gl-ml-2"
          @click="$emit('assign-self')"
        >
          <span class="gl-text-gray-500 gl-hover-text-blue-800">{{ __('assign yourself') }}</span>
        </gl-button>
      </template>
    </div>
    <uncollapsed-assignee-list
      v-else
      :users="users"
      :issuable-type="issuableType"
      class="gl-text-gray-800 hide-collapsed gl-pt-2"
    />
  </div>
</template>