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

39 lines
1 KiB
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 {
getLabelToggleState: state => (state.isShowingLabels ? 'on' : 'off'),
2020-11-24 15:15:51 +05:30
isSidebarOpen: state => state.activeId !== inactiveId,
isSwimlanesOn: state => {
2021-01-03 14:25:43 +05:30
if (!gon?.features?.boardsWithSwimlanes && !gon?.features?.swimlanes) {
2020-11-24 15:15:51 +05:30
return false;
}
return state.isShowingEpicsSwimlanes;
},
getIssueById: state => id => {
return state.issues[id] || {};
},
getIssues: (state, getters) => listId => {
const listIssueIds = state.issuesByListId[listId] || [];
return listIssueIds.map(id => getters.getIssueById(id));
},
getActiveIssue: state => {
return state.issues[state.activeId] || {};
},
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
};