Commit 20f9bdf7 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Add iteration to board list settings

Also adds the ListIteration model
parent 2a8b1445
...@@ -6,6 +6,7 @@ export const BoardType = { ...@@ -6,6 +6,7 @@ export const BoardType = {
export const ListType = { export const ListType = {
assignee: 'assignee', assignee: 'assignee',
milestone: 'milestone', milestone: 'milestone',
iteration: 'iteration',
backlog: 'backlog', backlog: 'backlog',
closed: 'closed', closed: 'closed',
label: 'label', label: 'label',
......
export default class ListIteration {
constructor(obj) {
this.id = obj.id;
this.title = obj.title;
if (IS_EE) {
this.state = obj.state;
this.webUrl = obj.web_url || obj.webUrl;
this.description = obj.description;
}
}
}
window.ListIteration = ListIteration;
...@@ -5,6 +5,7 @@ import boardsStore from '../stores/boards_store'; ...@@ -5,6 +5,7 @@ import boardsStore from '../stores/boards_store';
import ListLabel from './label'; import ListLabel from './label';
import ListAssignee from './assignee'; import ListAssignee from './assignee';
import ListMilestone from './milestone'; import ListMilestone from './milestone';
import ListIteration from './iteration';
import 'ee_else_ce/boards/models/issue'; import 'ee_else_ce/boards/models/issue';
const TYPES = { const TYPES = {
...@@ -57,6 +58,9 @@ class List { ...@@ -57,6 +58,9 @@ class List {
} else if (IS_EE && obj.milestone) { } else if (IS_EE && obj.milestone) {
this.milestone = new ListMilestone(obj.milestone); this.milestone = new ListMilestone(obj.milestone);
this.title = this.milestone.title; this.title = this.milestone.title;
} else if (IS_EE && obj.iteration) {
this.iteration = new ListIteration(obj.iteration);
this.title = this.iteration.title;
} }
// doNotFetchIssues is a temporary workaround until issues are fetched using GraphQL on issue boards // doNotFetchIssues is a temporary workaround until issues are fetched using GraphQL on issue boards
......
...@@ -4,8 +4,10 @@ import { __ } from '~/locale'; ...@@ -4,8 +4,10 @@ import { __ } from '~/locale';
export default { export default {
milestone: 'milestone', milestone: 'milestone',
iteration: 'iteration',
assignee: 'assignee', assignee: 'assignee',
labelMilestoneText: __('Milestone'), labelMilestoneText: __('Milestone'),
labelIterationText: __('Iteration'),
labelAssigneeText: __('Assignee'), labelAssigneeText: __('Assignee'),
components: { components: {
GlLink, GlLink,
...@@ -29,6 +31,9 @@ export default { ...@@ -29,6 +31,9 @@ export default {
activeListMilestone() { activeListMilestone() {
return this.activeList.milestone; return this.activeList.milestone;
}, },
activeListIteration() {
return this.activeList.iteration;
},
listTypeTitle() { listTypeTitle() {
switch (this.boardListType) { switch (this.boardListType) {
case this.$options.milestone: { case this.$options.milestone: {
...@@ -37,6 +42,9 @@ export default { ...@@ -37,6 +42,9 @@ export default {
case this.$options.assignee: { case this.$options.assignee: {
return this.$options.labelAssigneeText; return this.$options.labelAssigneeText;
} }
case this.$options.iteration: {
return this.$options.labelIterationText;
}
default: { default: {
return ''; return '';
} }
...@@ -55,6 +63,9 @@ export default { ...@@ -55,6 +63,9 @@ export default {
:href="activeListMilestone.webUrl" :href="activeListMilestone.webUrl"
>{{ activeListMilestone.title }}</gl-link >{{ activeListMilestone.title }}</gl-link
> >
<gl-link v-else-if="boardListType === $options.iteration" :href="activeListIteration.webUrl">{{
activeListIteration.title
}}</gl-link>
<gl-avatar-link <gl-avatar-link
v-else-if="boardListType === $options.assignee" v-else-if="boardListType === $options.assignee"
class="js-assignee" class="js-assignee"
......
...@@ -81,7 +81,7 @@ describe('Board List Header Component', () => { ...@@ -81,7 +81,7 @@ describe('Board List Header Component', () => {
const findSettingsButton = () => wrapper.find({ ref: 'settingsBtn' }); const findSettingsButton = () => wrapper.find({ ref: 'settingsBtn' });
describe('Settings Button', () => { describe('Settings Button', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label]; const hasSettings = [ListType.assignee, ListType.milestone, ListType.iteration, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed]; const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', (listType) => { it.each(hasSettings)('does render for List Type `%s`', (listType) => {
......
...@@ -72,7 +72,7 @@ describe('Board List Header Component', () => { ...@@ -72,7 +72,7 @@ describe('Board List Header Component', () => {
const findSettingsButton = () => wrapper.find({ ref: 'settingsBtn' }); const findSettingsButton = () => wrapper.find({ ref: 'settingsBtn' });
describe('Settings Button', () => { describe('Settings Button', () => {
const hasSettings = [ListType.assignee, ListType.milestone, ListType.label]; const hasSettings = [ListType.assignee, ListType.milestone, ListType.iteration, ListType.label];
const hasNoSettings = [ListType.backlog, ListType.closed]; const hasNoSettings = [ListType.backlog, ListType.closed];
it.each(hasSettings)('does render for List Type `%s`', (listType) => { it.each(hasSettings)('does render for List Type `%s`', (listType) => {
......
...@@ -74,7 +74,13 @@ describe('Board List Header Component', () => { ...@@ -74,7 +74,13 @@ describe('Board List Header Component', () => {
describe('Add issue button', () => { describe('Add issue button', () => {
const hasNoAddButton = [ListType.closed]; const hasNoAddButton = [ListType.closed];
const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; const hasAddButton = [
ListType.backlog,
ListType.label,
ListType.milestone,
ListType.iteration,
ListType.assignee,
];
it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => { it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
......
...@@ -78,7 +78,13 @@ describe('Board List Header Component', () => { ...@@ -78,7 +78,13 @@ describe('Board List Header Component', () => {
describe('Add issue button', () => { describe('Add issue button', () => {
const hasNoAddButton = [ListType.closed]; const hasNoAddButton = [ListType.closed];
const hasAddButton = [ListType.backlog, ListType.label, ListType.milestone, ListType.assignee]; const hasAddButton = [
ListType.backlog,
ListType.label,
ListType.milestone,
ListType.iteration,
ListType.assignee,
];
it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => { it.each(hasNoAddButton)('does not render when List Type is `%s`', (listType) => {
createComponent({ listType }); createComponent({ listType });
...@@ -167,7 +173,7 @@ describe('Board List Header Component', () => { ...@@ -167,7 +173,7 @@ describe('Board List Header Component', () => {
describe('user can drag', () => { describe('user can drag', () => {
const cannotDragList = [ListType.backlog, ListType.closed]; const cannotDragList = [ListType.backlog, ListType.closed];
const canDragList = [ListType.label, ListType.milestone, ListType.assignee]; const canDragList = [ListType.label, ListType.milestone, ListType.iteration, ListType.assignee];
it.each(cannotDragList)( it.each(cannotDragList)(
'does not have user-can-drag-class so user cannot drag list', 'does not have user-can-drag-class so user cannot drag list',
......
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