debian-mirror-gitlab/app/assets/javascripts/boards/components/config_toggle.vue

66 lines
1.5 KiB
Vue
Raw Normal View History

2021-04-17 20:07:23 +05:30
<script>
import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui';
import { formType } from '~/boards/constants';
import eventHub from '~/boards/eventhub';
import { s__, __ } from '~/locale';
2021-09-04 01:27:46 +05:30
import Tracking from '~/tracking';
2021-04-17 20:07:23 +05:30
export default {
components: {
GlButton,
},
directives: {
GlTooltip: GlTooltipDirective,
GlModalDirective,
},
2021-09-04 01:27:46 +05:30
mixins: [Tracking.mixin()],
2021-04-17 20:07:23 +05:30
props: {
boardsStore: {
type: Object,
2021-04-29 21:17:54 +05:30
required: false,
default: null,
2021-04-17 20:07:23 +05:30
},
canAdminList: {
type: Boolean,
required: true,
},
hasScope: {
type: Boolean,
required: true,
},
},
computed: {
buttonText() {
return this.canAdminList ? s__('Boards|Edit board') : s__('Boards|View scope');
},
tooltipTitle() {
return this.hasScope ? __("This board's scope is reduced") : '';
},
},
methods: {
showPage() {
2021-09-04 01:27:46 +05:30
this.track('click_button', { label: 'edit_board' });
2021-04-17 20:07:23 +05:30
eventHub.$emit('showBoardModal', formType.edit);
2021-04-29 21:17:54 +05:30
if (this.boardsStore) {
this.boardsStore.showPage(formType.edit);
}
2021-04-17 20:07:23 +05:30
},
},
};
</script>
<template>
<div class="gl-ml-3 gl-display-flex gl-align-items-center">
<gl-button
v-gl-modal-directive="'board-config-modal'"
v-gl-tooltip
:title="tooltipTitle"
:class="{ 'dot-highlight': hasScope }"
data-qa-selector="boards_config_button"
@click.prevent="showPage"
>
{{ buttonText }}
</gl-button>
</div>
</template>