mirror of
https://github.com/plankanban/planka.git
synced 2025-12-27 01:11:50 +03:00
@@ -108,10 +108,13 @@ export const selectLabelsForCurrentBoard = createSelector(
|
||||
return boardModel;
|
||||
}
|
||||
|
||||
return boardModel.labels.toRefArray().map((label) => ({
|
||||
...label,
|
||||
isPersisted: !isLocalId(label.id),
|
||||
}));
|
||||
return boardModel
|
||||
.getOrderedLabelsQuerySet()
|
||||
.toRefArray()
|
||||
.map((label) => ({
|
||||
...label,
|
||||
isPersisted: !isLocalId(label.id),
|
||||
}));
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -49,6 +49,22 @@ export const selectNextBoardPosition = createSelector(
|
||||
},
|
||||
);
|
||||
|
||||
export const selectNextLabelPosition = createSelector(
|
||||
orm,
|
||||
(_, boardId) => boardId,
|
||||
(_, __, index) => index,
|
||||
(_, __, ___, excludedId) => excludedId,
|
||||
({ Board }, boardId, index, excludedId) => {
|
||||
const boardModel = Board.withId(boardId);
|
||||
|
||||
if (!boardModel) {
|
||||
return boardModel;
|
||||
}
|
||||
|
||||
return nextPosition(boardModel.getOrderedLabelsQuerySet().toRefArray(), index, excludedId);
|
||||
},
|
||||
);
|
||||
|
||||
export const selectNextListPosition = createSelector(
|
||||
orm,
|
||||
(_, boardId) => boardId,
|
||||
@@ -102,6 +118,7 @@ export default {
|
||||
selectIsCoreInitializing,
|
||||
selectIsLogouting,
|
||||
selectNextBoardPosition,
|
||||
selectNextLabelPosition,
|
||||
selectNextListPosition,
|
||||
selectNextCardPosition,
|
||||
selectNextTaskPosition,
|
||||
|
||||
@@ -7,6 +7,7 @@ import projects from './projects';
|
||||
import projectManagers from './project-managers';
|
||||
import boards from './boards';
|
||||
import boardMemberships from './board-memberships';
|
||||
import labels from './labels';
|
||||
import lists from './lists';
|
||||
import cards from './cards';
|
||||
import tasks from './tasks';
|
||||
@@ -22,6 +23,7 @@ export default {
|
||||
...projectManagers,
|
||||
...boards,
|
||||
...boardMemberships,
|
||||
...labels,
|
||||
...lists,
|
||||
...cards,
|
||||
...tasks,
|
||||
|
||||
25
client/src/selectors/labels.js
Normal file
25
client/src/selectors/labels.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { createSelector } from 'redux-orm';
|
||||
|
||||
import orm from '../orm';
|
||||
|
||||
export const makeSelectLabelById = () =>
|
||||
createSelector(
|
||||
orm,
|
||||
(_, id) => id,
|
||||
({ Label }, id) => {
|
||||
const labelModel = Label.withId(id);
|
||||
|
||||
if (!labelModel) {
|
||||
return labelModel;
|
||||
}
|
||||
|
||||
return labelModel.ref;
|
||||
},
|
||||
);
|
||||
|
||||
export const selectLabelById = makeSelectLabelById();
|
||||
|
||||
export default {
|
||||
makeSelectLabelById,
|
||||
selectLabelById,
|
||||
};
|
||||
Reference in New Issue
Block a user