All files / ee/app/assets/javascripts/boards/components board_scope_current_iteration.vue

0% Statements 0/4
0% Branches 0/2
0% Functions 0/2
0% Lines 0/4

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                                                                                                           
<script>
import { GlFormCheckbox } from '@gitlab/ui';
import { __ } from '~/locale';
import { IterationIDs, CURRENT_ITERATION } from '../constants';
 
export default {
  i18n: {
    label: __('Scope board to current iteration'),
    title: __('Iteration'),
  },
  components: {
    GlFormCheckbox,
  },
  props: {
    canAdminBoard: {
      type: Boolean,
      required: true,
    },
    iterationId: {
      type: String,
      required: false,
      default: null,
    },
  },
  data() {
    return {
      checked: this.iterationId === IterationIDs.CURRENT,
    };
  },
  methods: {
    handleToggle() {
      this.checked = !this.checked;
      const iteration = this.checked ? CURRENT_ITERATION : { id: null };
      this.$emit('set-iteration', iteration);
    },
  },
};
</script>
 
<template>
  <div class="block iteration">
    <div class="title gl-mb-3">
      {{ $options.i18n.title }}
    </div>
    <gl-form-checkbox
      :disabled="!canAdminBoard"
      :checked="checked"
      class="gl-text-gray-500"
      @change="handleToggle"
      >{{ $options.i18n.label }}
    </gl-form-checkbox>
  </div>
</template>