Commit e3c914ef authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'boards/bug-fix-list-setting-and-tooltip' into 'master'

Boards - Fix button closing tag

See merge request gitlab-org/gitlab!45608
parents 9143fda7 cf013bd7
<script>
import { GlTooltip, GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
export default {
name: 'BoardExtraActions',
components: {
GlTooltip,
GlButton,
},
props: {
canAdminList: {
type: Boolean,
required: true,
},
disabled: {
type: Boolean,
required: true,
},
openModal: {
type: Function,
required: true,
},
},
computed: {
tooltipTitle() {
if (this.disabled) {
return __('Please add a list to your board first');
}
return '';
},
},
};
</script>
<template>
<div class="board-extra-actions">
<span ref="addIssuesButtonTooltip" class="gl-ml-3">
<gl-button
v-if="canAdminList"
type="button"
data-placement="bottom"
data-track-event="click_button"
data-track-label="board_add_issues"
:disabled="disabled"
:aria-disabled="disabled"
@click="openModal"
>
{{ __('Add issues') }}
</gl-button>
</span>
<gl-tooltip v-if="disabled" :target="() => $refs.addIssuesButtonTooltip" placement="bottom">
{{ tooltipTitle }}
</gl-tooltip>
</div>
</template>
...@@ -34,14 +34,14 @@ export default { ...@@ -34,14 +34,14 @@ export default {
}, },
}, },
computed: { computed: {
...mapGetters(['isSidebarOpen']), ...mapGetters(['isSidebarOpen', 'shouldUseGraphQL']),
...mapState(['activeId', 'sidebarType', 'boardLists']), ...mapState(['activeId', 'sidebarType', 'boardLists']),
activeList() { activeList() {
/* /*
Warning: Though a computed property it is not reactive because we are Warning: Though a computed property it is not reactive because we are
referencing a List Model class. Reactivity only applies to plain JS objects referencing a List Model class. Reactivity only applies to plain JS objects
*/ */
if (this.glFeatures.graphqlBoardLists) { if (this.shouldUseGraphQL) {
return this.boardLists[this.activeId]; return this.boardLists[this.activeId];
} }
return boardsStore.state.lists.find(({ id }) => id === this.activeId); return boardsStore.state.lists.find(({ id }) => id === this.activeId);
......
import Vue from 'vue'; import Vue from 'vue';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { GlTooltip, GlButton } from '@gitlab/ui';
import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/issue';
import 'ee_else_ce/boards/models/list'; import 'ee_else_ce/boards/models/list';
...@@ -19,6 +18,7 @@ import { ...@@ -19,6 +18,7 @@ import {
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import BoardContent from '~/boards/components/board_content.vue'; import BoardContent from '~/boards/components/board_content.vue';
import BoardExtraActions from '~/boards/components/board_extra_actions.vue';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import { deprecatedCreateFlash as Flash } from '~/flash'; import { deprecatedCreateFlash as Flash } from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -299,10 +299,6 @@ export default () => { ...@@ -299,10 +299,6 @@ export default () => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Vue({ new Vue({
el: issueBoardsModal, el: issueBoardsModal,
components: {
GlTooltip,
GlButton,
},
mixins: [modalMixin], mixins: [modalMixin],
data() { data() {
return { return {
...@@ -319,13 +315,6 @@ export default () => { ...@@ -319,13 +315,6 @@ export default () => {
} }
return !this.store.lists.filter(list => !list.preset).length; return !this.store.lists.filter(list => !list.preset).length;
}, },
tooltipTitle() {
if (this.disabled) {
return __('Please add a list to your board first');
}
return '';
},
}, },
methods: { methods: {
openModal() { openModal() {
...@@ -334,29 +323,15 @@ export default () => { ...@@ -334,29 +323,15 @@ export default () => {
} }
}, },
}, },
template: ` render(createElement) {
<div class="board-extra-actions"> return createElement(BoardExtraActions, {
<span ref="addIssuesButtonTooltip" class="gl-ml-3"> props: {
<gl-button canAdminList: this.$options.el.hasAttribute('data-can-admin-list'),
type="button" openModal: this.openModal,
data-placement="bottom" disabled: this.disabled,
data-track-event="click_button" },
data-track-label="board_add_issues" });
:disabled="disabled" },
:aria-disabled="disabled"
v-if="canAdminList"
@click="openModal">
Add issues
</button>
</span>
<gl-tooltip
v-if="disabled"
:target="() => $refs.addIssuesButtonTooltip"
placement="bottom">
{{tooltipTitle}}
</gl-tooltip>
</div>
`,
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment