Commit a2edabc8 authored by Florie Guibert's avatar Florie Guibert

Boards - Remove List model from GraphQL boards

Review feedback
parent 1a19552e
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
GlSprintf, GlSprintf,
GlTooltipDirective, GlTooltipDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { n__, s__ } from '~/locale'; import { n__, s__, __ } from '~/locale';
import AccessorUtilities from '../../lib/utils/accessor'; import AccessorUtilities from '../../lib/utils/accessor';
import IssueCount from './issue_count.vue'; import IssueCount from './issue_count.vue';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
...@@ -19,6 +19,12 @@ import { isScopedLabel } from '~/lib/utils/common_utils'; ...@@ -19,6 +19,12 @@ import { isScopedLabel } from '~/lib/utils/common_utils';
import { isListDraggable } from '~/boards/boards_util'; import { isListDraggable } from '~/boards/boards_util';
export default { export default {
i18n: {
newIssue: __('New issue'),
listSettings: __('List settings'),
expand: s__('Boards|Expand'),
collapse: s__('Boards|Collapse'),
},
components: { components: {
GlButtonGroup, GlButtonGroup,
GlButton, GlButton,
...@@ -97,7 +103,7 @@ export default { ...@@ -97,7 +103,7 @@ export default {
return n__(`%d issue`, `%d issues`, this.issuesCount); return n__(`%d issue`, `%d issues`, this.issuesCount);
}, },
chevronTooltip() { chevronTooltip() {
return this.list.collapsed ? s__('Boards|Expand') : s__('Boards|Collapse'); return this.list.collapsed ? this.$options.i18n.expand : this.$options.i18n.collapse;
}, },
chevronIcon() { chevronIcon() {
return this.list.collapsed ? 'chevron-down' : 'chevron-right'; return this.list.collapsed ? 'chevron-down' : 'chevron-right';
...@@ -329,8 +335,8 @@ export default { ...@@ -329,8 +335,8 @@ export default {
v-show="!list.collapsed" v-show="!list.collapsed"
ref="newIssueBtn" ref="newIssueBtn"
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="__('New issue')" :aria-label="$options.i18n.newIssue"
:title="__('New issue')" :title="$options.i18n.newIssue"
class="issue-count-badge-add-button no-drag" class="issue-count-badge-add-button no-drag"
icon="plus" icon="plus"
@click="showNewIssueForm" @click="showNewIssueForm"
...@@ -340,13 +346,13 @@ export default { ...@@ -340,13 +346,13 @@ export default {
v-if="isSettingsShown" v-if="isSettingsShown"
ref="settingsBtn" ref="settingsBtn"
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="__('List settings')" :aria-label="$options.i18n.listSettings"
class="no-drag js-board-settings-button" class="no-drag js-board-settings-button"
:title="__('List settings')" :title="$options.i18n.listSettings"
icon="settings" icon="settings"
@click="openSidebarSettings" @click="openSidebarSettings"
/> />
<gl-tooltip :target="() => $refs.settingsBtn">{{ __('List settings') }}</gl-tooltip> <gl-tooltip :target="() => $refs.settingsBtn">{{ $options.i18n.listSettings }}</gl-tooltip>
</gl-button-group> </gl-button-group>
</h3> </h3>
</header> </header>
......
...@@ -12,6 +12,11 @@ import { sprintf, __ } from '~/locale'; ...@@ -12,6 +12,11 @@ import { sprintf, __ } from '~/locale';
export default { export default {
name: 'BoardList', name: 'BoardList',
i18n: {
loadingIssues: __('Loading issues'),
loadingMoreissues: __('Loading more issues'),
showingAllIssues: __('Showing all issues'),
},
components: { components: {
BoardCard, BoardCard,
BoardNewIssue, BoardNewIssue,
...@@ -68,6 +73,9 @@ export default { ...@@ -68,6 +73,9 @@ export default {
// When list is draggable, the reference to the list needs to be accessed differently // When list is draggable, the reference to the list needs to be accessed differently
return this.canAdminList ? this.$refs.list.$el : this.$refs.list; return this.canAdminList ? this.$refs.list.$el : this.$refs.list;
}, },
showingAllIssues() {
return this.issues.length === this.list.issuesCount;
},
treeRootWrapper() { treeRootWrapper() {
return this.canAdminList ? Draggable : 'ul'; return this.canAdminList ? Draggable : 'ul';
}, },
...@@ -201,7 +209,7 @@ export default { ...@@ -201,7 +209,7 @@ export default {
<div <div
v-if="loading" v-if="loading"
class="gl-mt-4 gl-text-center" class="gl-mt-4 gl-text-center"
:aria-label="__('Loading issues')" :aria-label="$options.i18n.loadingIssues"
data-testid="board_list_loading" data-testid="board_list_loading"
> >
<gl-loading-icon /> <gl-loading-icon />
...@@ -230,8 +238,8 @@ export default { ...@@ -230,8 +238,8 @@ export default {
:disabled="disabled" :disabled="disabled"
/> />
<li v-if="showCount" class="board-list-count gl-text-center" data-issue-id="-1"> <li v-if="showCount" class="board-list-count gl-text-center" data-issue-id="-1">
<gl-loading-icon v-if="loadingMore" label="Loading more issues" /> <gl-loading-icon v-if="loadingMore" :label="$options.i18n.loadingMoreissues" />
<span v-if="issues.length === list.issuesCount">{{ __('Showing all issues') }}</span> <span v-if="showingAllIssues">{{ $options.i18n.showingAllIssues }}</span>
<span v-else>{{ paginatedIssueText }}</span> <span v-else>{{ paginatedIssueText }}</span>
</li> </li>
</component> </component>
......
...@@ -3,7 +3,7 @@ import Vuex from 'vuex'; ...@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import BoardListHeader from 'ee/boards/components/board_list_header_new.vue'; import BoardListHeader from 'ee/boards/components/board_list_header_new.vue';
import getters from 'ee/boards/stores/getters'; import getters from 'ee/boards/stores/getters';
import { mockList2 } from 'jest/boards/mock_data'; import { mockLabelList } from 'jest/boards/mock_data';
import { ListType, inactiveId } from '~/boards/constants'; import { ListType, inactiveId } from '~/boards/constants';
import sidebarEventHub from '~/sidebar/event_hub'; import sidebarEventHub from '~/sidebar/event_hub';
...@@ -37,7 +37,7 @@ describe('Board List Header Component', () => { ...@@ -37,7 +37,7 @@ describe('Board List Header Component', () => {
const boardId = '1'; const boardId = '1';
const listMock = { const listMock = {
...mockList2, ...mockLabelList,
listType, listType,
collapsed, collapsed,
}; };
...@@ -109,7 +109,7 @@ describe('Board List Header Component', () => { ...@@ -109,7 +109,7 @@ describe('Board List Header Component', () => {
}); });
it('does not emit event when there is an active List', () => { it('does not emit event when there is an active List', () => {
store.state.activeId = mockList2.id; store.state.activeId = mockLabelList.id;
createComponent({ listType: hasSettings[0] }); createComponent({ listType: hasSettings[0] });
wrapper.vm.openSidebarSettings(); wrapper.vm.openSidebarSettings();
......
...@@ -16507,6 +16507,9 @@ msgstr "" ...@@ -16507,6 +16507,9 @@ msgstr ""
msgid "Loading issues" msgid "Loading issues"
msgstr "" msgstr ""
msgid "Loading more issues"
msgstr ""
msgid "Loading snippet" msgid "Loading snippet"
msgstr "" msgstr ""
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { mockList2 } from 'jest/boards/mock_data'; import { mockLabelList } from 'jest/boards/mock_data';
import BoardListHeader from '~/boards/components/board_list_header_new.vue'; import BoardListHeader from '~/boards/components/board_list_header_new.vue';
import { ListType } from '~/boards/constants'; import { ListType } from '~/boards/constants';
...@@ -31,7 +31,7 @@ describe('Board List Header Component', () => { ...@@ -31,7 +31,7 @@ describe('Board List Header Component', () => {
const boardId = '1'; const boardId = '1';
const listMock = { const listMock = {
...mockList2, ...mockLabelList,
listType, listType,
collapsed, collapsed,
}; };
......
...@@ -295,7 +295,7 @@ export const mockList = { ...@@ -295,7 +295,7 @@ export const mockList = {
issuesCount: 1, issuesCount: 1,
}; };
export const mockList2 = { export const mockLabelList = {
id: 'gid://gitlab/List/2', id: 'gid://gitlab/List/2',
title: 'To Do', title: 'To Do',
position: 0, position: 0,
...@@ -314,7 +314,7 @@ export const mockList2 = { ...@@ -314,7 +314,7 @@ export const mockList2 = {
issuesCount: 0, issuesCount: 0,
}; };
export const mockLists = [mockList, mockList2]; export const mockLists = [mockList, mockLabelList];
export const mockListsById = keyBy(mockLists, 'id'); export const mockListsById = keyBy(mockLists, 'id');
......
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