2018-10-15 14:42:47 +05:30
|
|
|
<script>
|
2017-08-17 22:00:37 +05:30
|
|
|
/* global ListLabel */
|
|
|
|
import Cookies from 'js-cookie';
|
2018-12-13 13:39:08 +05:30
|
|
|
import boardsStore from '../stores/boards_store';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
predefinedLabels: [
|
|
|
|
new ListLabel({ title: 'To Do', color: '#F0AD4E' }),
|
|
|
|
new ListLabel({ title: 'Doing', color: '#5CB85C' }),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
addDefaultLists() {
|
|
|
|
this.clearBlankState();
|
|
|
|
|
|
|
|
this.predefinedLabels.forEach((label, i) => {
|
2018-12-13 13:39:08 +05:30
|
|
|
boardsStore.addList({
|
2017-08-17 22:00:37 +05:30
|
|
|
title: label.title,
|
|
|
|
position: i,
|
|
|
|
list_type: 'label',
|
|
|
|
label: {
|
|
|
|
title: label.title,
|
|
|
|
color: label.color,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Save the labels
|
2018-12-13 13:39:08 +05:30
|
|
|
gl.boardService
|
|
|
|
.generateDefaultLists()
|
2018-03-17 18:26:18 +05:30
|
|
|
.then(res => res.data)
|
2018-12-13 13:39:08 +05:30
|
|
|
.then(data => {
|
|
|
|
data.forEach(listObj => {
|
|
|
|
const list = boardsStore.findList('title', listObj.title);
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
list.id = listObj.id;
|
|
|
|
list.label.id = listObj.label.id;
|
2018-12-13 13:39:08 +05:30
|
|
|
list.getIssues().catch(() => {
|
|
|
|
// TODO: handle request error
|
|
|
|
});
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(() => {
|
2018-12-13 13:39:08 +05:30
|
|
|
boardsStore.removeList(undefined, 'label');
|
2017-08-17 22:00:37 +05:30
|
|
|
Cookies.remove('issue_board_welcome_hidden', {
|
|
|
|
path: '',
|
|
|
|
});
|
2018-12-13 13:39:08 +05:30
|
|
|
boardsStore.addBlankState();
|
2017-08-17 22:00:37 +05:30
|
|
|
});
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
clearBlankState: boardsStore.removeBlankState.bind(boardsStore),
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
};
|
2018-10-15 14:42:47 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-07-31 22:56:46 +05:30
|
|
|
<div class="board-blank-state p-3">
|
2019-02-15 15:39:39 +05:30
|
|
|
<p>Add the following default lists to your Issue Board with one click:</p>
|
2019-07-31 22:56:46 +05:30
|
|
|
<ul class="list-unstyled board-blank-state-list">
|
2019-02-15 15:39:39 +05:30
|
|
|
<li v-for="(label, index) in predefinedLabels" :key="index">
|
2019-07-31 22:56:46 +05:30
|
|
|
<span
|
|
|
|
:style="{ backgroundColor: label.color }"
|
|
|
|
class="label-color position-relative d-inline-block rounded"
|
|
|
|
>
|
|
|
|
</span>
|
2018-10-15 14:42:47 +05:30
|
|
|
{{ label.title }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
2019-02-15 15:39:39 +05:30
|
|
|
Starting out with the default set of lists will get you right on the way to making the most of
|
|
|
|
your board.
|
2018-10-15 14:42:47 +05:30
|
|
|
</p>
|
|
|
|
<button
|
2018-12-05 23:21:45 +05:30
|
|
|
class="btn btn-success btn-inverted btn-block"
|
2018-10-15 14:42:47 +05:30
|
|
|
type="button"
|
2019-02-15 15:39:39 +05:30
|
|
|
@click.stop="addDefaultLists"
|
|
|
|
>
|
2018-10-15 14:42:47 +05:30
|
|
|
Add default lists
|
|
|
|
</button>
|
2019-02-15 15:39:39 +05:30
|
|
|
<button class="btn btn-default btn-block" type="button" @click.stop="clearBlankState">
|
2018-10-15 14:42:47 +05:30
|
|
|
Nevermind, I'll use my own
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|