debian-mirror-gitlab/app/assets/javascripts/boards/stores/getters.js

37 lines
991 B
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { find } from 'lodash';
2020-11-24 15:15:51 +05:30
import { inactiveId } from '../constants';
2019-12-26 22:10:19 +05:30
export default {
2020-11-24 15:15:51 +05:30
isSidebarOpen: state => state.activeId !== inactiveId,
2021-02-22 17:27:13 +05:30
isSwimlanesOn: () => false,
2020-11-24 15:15:51 +05:30
getIssueById: state => id => {
return state.issues[id] || {};
},
2021-01-29 00:20:46 +05:30
getIssuesByList: (state, getters) => listId => {
2020-11-24 15:15:51 +05:30
const listIssueIds = state.issuesByListId[listId] || [];
return listIssueIds.map(id => getters.getIssueById(id));
},
2021-01-29 00:20:46 +05:30
activeIssue: state => {
2020-11-24 15:15:51 +05:30
return state.issues[state.activeId] || {};
},
2021-01-03 14:25:43 +05:30
2021-01-29 00:20:46 +05:30
projectPathForActiveIssue: (_, getters) => {
const referencePath = getters.activeIssue.referencePath || '';
return referencePath.slice(0, referencePath.indexOf('#'));
},
2021-01-03 14:25:43 +05:30
getListByLabelId: state => labelId => {
return find(state.boardLists, l => l.label?.id === labelId);
},
getListByTitle: state => title => {
return find(state.boardLists, l => l.title === title);
},
shouldUseGraphQL: () => {
return gon?.features?.graphqlBoardLists;
},
2019-12-26 22:10:19 +05:30
};