Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new_board_button.vue « components « boards « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 96cf0fadd6aaa90a6e56aed8ba023f03c64f1b0e (plain)
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
<script>
import { GlButton, GlModalDirective } from '@gitlab/ui';
import { formType } from '~/boards/constants';
import eventHub from '~/boards/eventhub';
import { s__ } from '~/locale';
import Tracking from '~/tracking';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';

export default {
  components: {
    GlButton,
    GitlabExperiment,
  },
  directives: {
    GlModalDirective,
  },
  mixins: [Tracking.mixin()],
  inject: ['multipleIssueBoardsAvailable', 'canAdminBoard'],
  computed: {
    canShowCreateButton() {
      return this.canAdminBoard && this.multipleIssueBoardsAvailable;
    },
    createButtonText() {
      return s__('Boards|New board');
    },
  },
  methods: {
    showDialog() {
      this.track('click_button', { label: 'create_board' });
      eventHub.$emit('showBoardModal', formType.new);
    },
  },
};
</script>

<template>
  <gitlab-experiment name="prominent_create_board_btn">
    <template #control> </template>
    <template #candidate>
      <div v-if="canShowCreateButton" class="gl-ml-1 gl-mr-3 gl-display-flex gl-align-items-center">
        <gl-button @click.prevent="showDialog">
          {{ createButtonText }}
        </gl-button>
      </div>
    </template>
  </gitlab-experiment>
</template>