feat: Version 2

Closes #627, closes #1047
This commit is contained in:
Maksim Eltyshev
2025-05-10 02:09:06 +02:00
parent ad7fb51cfa
commit 2ee1166747
1557 changed files with 76832 additions and 47042 deletions
+6 -1
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { getAccessToken } from '../utils/access-token-storage';
import ActionTypes from '../constants/ActionTypes';
@@ -10,7 +15,7 @@ const initialState = {
export default (state = initialState, { type, payload }) => {
switch (type) {
case ActionTypes.AUTHENTICATE__SUCCESS:
case ActionTypes.USING_OIDC_AUTHENTICATE__SUCCESS:
case ActionTypes.WITH_OIDC_AUTHENTICATE__SUCCESS:
return {
...state,
accessToken: payload.accessToken,
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import ActionTypes from '../constants/ActionTypes';
const initialState = {
@@ -8,6 +13,11 @@ const initialState = {
// eslint-disable-next-line default-param-last
export default (state = initialState, { type, payload }) => {
switch (type) {
case ActionTypes.SOCKET_RECONNECT_HANDLE:
return {
...state,
config: payload.config,
};
case ActionTypes.LOGIN_INITIALIZE:
return {
...state,
@@ -15,7 +25,7 @@ export default (state = initialState, { type, payload }) => {
config: payload.config,
};
case ActionTypes.AUTHENTICATE__SUCCESS:
case ActionTypes.USING_OIDC_AUTHENTICATE__SUCCESS:
case ActionTypes.WITH_OIDC_AUTHENTICATE__SUCCESS:
return {
...state,
isInitializing: true,
@@ -30,6 +40,15 @@ export default (state = initialState, { type, payload }) => {
...state,
config: payload.config,
};
case ActionTypes.USER_UPDATE_HANDLE:
if (payload.config) {
return {
...state,
config: payload.config,
};
}
return state;
default:
return state;
}
+91 -12
View File
@@ -1,11 +1,26 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { LOCATION_CHANGE_HANDLE } from '../lib/redux-router';
import ActionTypes from '../constants/ActionTypes';
import ModalTypes from '../constants/ModalTypes';
import { HomeViews, ProjectOrders } from '../constants/Enums';
const initialState = {
isContentFetching: false,
isLogouting: false,
currentModal: null,
isFavoritesEnabled: false,
isEditModeEnabled: false,
modal: null,
boardId: null,
recentCardId: null,
homeView: HomeViews.GROUPED_PROJECTS,
projectsSearch: '',
projectsOrder: ProjectOrders.BY_DEFAULT,
isHiddenProjectsVisible: false, // TODO: refactor?
};
// eslint-disable-next-line default-param-last
@@ -15,7 +30,53 @@ export default (state = initialState, { type, payload }) => {
case ActionTypes.MODAL_CLOSE:
return {
...state,
currentModal: null,
modal: null,
};
case ActionTypes.LOCATION_CHANGE_HANDLE: {
const nextState = {
...state,
isContentFetching: false,
boardId: payload.currentBoardId,
};
if (payload.currentCardId) {
nextState.recentCardId = payload.currentCardId;
} else if (nextState.boardId !== state.boardId) {
nextState.recentCardId = null;
}
if (payload.isEditModeEnabled !== undefined) {
nextState.isEditModeEnabled = payload.isEditModeEnabled;
}
return nextState;
}
case ActionTypes.LOCATION_CHANGE_HANDLE__CONTENT_FETCH:
return {
...state,
isContentFetching: true,
};
case ActionTypes.CORE_INITIALIZE:
return {
...state,
isFavoritesEnabled: payload.user.enableFavoritesByDefault,
homeView: payload.user.defaultHomeView,
projectsOrder: payload.user.defaultProjectsOrder,
};
case ActionTypes.FAVORITES_TOGGLE:
return {
...state,
isFavoritesEnabled: payload.isEnabled,
};
case ActionTypes.EDIT_MODE_TOGGLE:
return {
...state,
isEditModeEnabled: payload.isEnabled,
};
case ActionTypes.HOME_VIEW_UPDATE:
return {
...state,
homeView: payload.value,
};
case ActionTypes.LOGOUT__ACCESS_TOKEN_INVALIDATE:
return {
@@ -25,27 +86,45 @@ export default (state = initialState, { type, payload }) => {
case ActionTypes.MODAL_OPEN:
return {
...state,
currentModal: payload.type,
modal: payload,
};
case ActionTypes.USER_UPDATE_HANDLE:
if (state.currentModal === ModalTypes.USERS && payload.isCurrent && !payload.user.isAdmin) {
case ActionTypes.PROJECTS_SEARCH:
return {
...state,
projectsSearch: payload.value,
};
case ActionTypes.PROJECTS_ORDER_UPDATE:
return {
...state,
projectsOrder: payload.value,
};
case ActionTypes.HIDDEN_PROJECTS_TOGGLE:
return {
...state,
isHiddenProjectsVisible: payload.isVisible,
};
case ActionTypes.BOARD_DELETE:
if (
state.modal &&
state.modal.type === ModalTypes.BOARD_SETTINGS &&
state.modal.params.id === payload.id
) {
return {
...state,
currentModal: null,
modal: null,
};
}
return state;
case ActionTypes.PROJECT_MANAGER_DELETE:
case ActionTypes.PROJECT_MANAGER_DELETE_HANDLE:
case ActionTypes.BOARD_DELETE_HANDLE:
if (
state.currentModal === ModalTypes.PROJECT_SETTINGS &&
payload.isCurrentUser &&
payload.isCurrentProject
state.modal &&
state.modal.type === ModalTypes.BOARD_SETTINGS &&
state.modal.params.id === payload.board.id
) {
return {
...state,
currentModal: null,
modal: null,
};
}
+7 -2
View File
@@ -1,9 +1,14 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { combineReducers } from 'redux';
import router from './router';
import socket from './socket';
import orm from './orm';
import root from './root';
import common from './common';
import auth from './auth';
import core from './core';
import ui from './ui';
@@ -12,7 +17,7 @@ export default combineReducers({
router,
socket,
orm,
root,
common,
auth,
core,
ui,
+5
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { createReducer } from 'redux-orm';
import orm from '../orm';
+5
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { createRouterReducer } from '../lib/redux-router';
import history from '../history';
+5
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import ActionTypes from '../constants/ActionTypes';
const initialState = {
+10 -5
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { LOCATION_CHANGE_HANDLE } from '../../lib/redux-router';
import ActionTypes from '../../constants/ActionTypes';
@@ -9,7 +14,7 @@ const initialState = {
password: '',
},
isSubmitting: false,
isSubmittingUsingOidc: false,
isSubmittingWithOidc: false,
error: null,
};
@@ -20,7 +25,7 @@ export default (state = initialState, { type, payload }) => {
if (payload.location.pathname === Paths.OIDC_CALLBACK) {
return {
...state,
isSubmittingUsingOidc: true,
isSubmittingWithOidc: true,
};
}
@@ -35,7 +40,7 @@ export default (state = initialState, { type, payload }) => {
isSubmitting: true,
};
case ActionTypes.AUTHENTICATE__SUCCESS:
case ActionTypes.USING_OIDC_AUTHENTICATE__SUCCESS:
case ActionTypes.WITH_OIDC_AUTHENTICATE__SUCCESS:
return initialState;
case ActionTypes.AUTHENTICATE__FAILURE:
return {
@@ -43,10 +48,10 @@ export default (state = initialState, { type, payload }) => {
isSubmitting: false,
error: payload.error,
};
case ActionTypes.USING_OIDC_AUTHENTICATE__FAILURE:
case ActionTypes.WITH_OIDC_AUTHENTICATE__FAILURE:
return {
...state,
isSubmittingUsingOidc: false,
isSubmittingWithOidc: false,
error: payload.error,
};
case ActionTypes.AUTHENTICATE_ERROR_CLEAR:
+5
View File
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { combineReducers } from 'redux';
import authenticateForm from './authenticate-form';
@@ -1,8 +1,16 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import ActionTypes from '../../constants/ActionTypes';
import { ProjectTypes } from '../../constants/Enums';
const initialState = {
data: {
name: '',
description: '',
type: ProjectTypes.PRIVATE,
},
isSubmitting: false,
};
@@ -1,3 +1,8 @@
/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import ActionTypes from '../../constants/ActionTypes';
const initialState = {