debian-mirror-gitlab/app/assets/javascripts/boards/components/new_board_button.vue
2021-12-11 22:18:48 +05:30

47 lines
1.3 KiB
Vue

<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 data-qa-selector="new_board_button" @click.prevent="showDialog">
{{ createButtonText }}
</gl-button>
</div>
</template>
</gitlab-experiment>
</template>