Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/gui-elements
Submodule gui-elements updated 49 files
+2 −0 CHANGELOG.md
+4 −4 package.json
+5 −5 src/cmem/ActivityControl/ActivityControlWidget.tsx
+1 −1 src/cmem/ActivityControl/ActivityExecutionErrorReportModal.tsx
+4 −4 src/cmem/ActivityControl/SilkActivityControl.tsx
+1 −1 src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx
+2 −3 src/cmem/react-flow/configuration/graph.ts
+2 −3 src/cmem/react-flow/configuration/linking.ts
+2 −3 src/cmem/react-flow/configuration/workflow.ts
+1 −1 src/components/Accordion/AccordionItem.tsx
+6 −2 src/components/Application/ApplicationSidebarNavigation.tsx
+7 −1 src/components/Application/ApplicationTitle.tsx
+4 −3 src/components/Application/stories/ColorPalettes.stories.tsx
+4 −4 src/components/AutoSuggestion/AutoSuggestion.tsx
+1 −1 src/components/AutoSuggestion/AutoSuggestionList.tsx
+9 −18 src/components/AutocompleteField/AutoCompleteField.tsx
+1 −1 src/components/AutocompleteField/autoCompleteFieldUtils.tsx
+3 −3 src/components/Button/Button.tsx
+1 −1 src/components/Card/CardHeader.tsx
+2 −2 src/components/ContextOverlay/ContextMenu.tsx
+2 −2 src/components/ContextOverlay/ContextOverlay.tsx
+1 −1 src/components/Depiction/Depiction.tsx
+1 −1 src/components/Dialog/SimpleDialog.tsx
+1 −1 src/components/Form/FieldItem.tsx
+3 −3 src/components/Form/FieldSet.tsx
+2 −2 src/components/HoverToggler/HoverToggler.tsx
+3 −3 src/components/Label/Label.tsx
+1 −1 src/components/Menu/MenuItem.tsx
+3 −3 src/components/Notification/Notification.tsx
+1 −1 src/components/OverviewItem/OverviewItemActions.tsx
+1 −1 src/components/OverviewItem/OverviewItemDepiction.tsx
+1 −1 src/components/PropertyValuePair/PropertyValueList.tsx
+1 −1 src/components/PropertyValuePair/PropertyValuePair.tsx
+2 −2 src/components/Skeleton/Skeleton.tsx
+1 −1 src/components/Structure/TitleSubsection.tsx
+1 −1 src/components/Table/Table.tsx
+4 −4 src/components/Table/TableContainer.tsx
+1 −1 src/components/Tabs/TabTitle.tsx
+1 −1 src/components/TextField/TextArea.tsx
+1 −1 src/components/Tooltip/Tooltip.tsx
+2 −2 src/extensions/codemirror/CodeMirror.tsx
+3 −3 src/extensions/react-flow/edges/EdgeLabel.tsx
+1 −1 src/extensions/react-flow/edges/EdgeTools.tsx
+1 −1 src/extensions/react-flow/handles/HandleContent.tsx
+1 −1 src/extensions/react-flow/handles/HandleTools.tsx
+1 −1 src/extensions/react-flow/markers/ReactFlowMarkers.tsx
+7 −7 src/extensions/react-flow/nodes/NodeContent.tsx
+2 −2 src/extensions/react-flow/nodes/NodeTools.tsx
+4 −3 src/extensions/react-flow/nodes/_nodes.scss
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"scripts": {},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {},
"resolutions": {
Expand All @@ -22,10 +22,11 @@
"**/minimist": "1.2.8",
"**/moment": "2.29.4",
"**/nanoid": "3.3.4",
"**/react": "^17.0.2",
"**/react-dom": "^17.0.2",
"**/react": "^18.2.0",
"**/react-dom": "^18.2.0",
"**/semver-regex": "3.1.4",
"**/@types/react": "^17.0.85",
"**/url-parse": "1.5.9"
"**/@types/react": "^18.2.0",
"**/url-parse": "1.5.9",
"**/react-redux": "^9.1.2"
}
}
22 changes: 12 additions & 10 deletions workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"watch": "node --openssl-legacy-provider --max_old_space_size=2048 scripts/build-di.dev.js --watch",
"build-di-dev": "node --openssl-legacy-provider scripts/build-di.dev.js",
"build-di-prod": "node --openssl-legacy-provider --max_old_space_size=2048 scripts/build-di.prod.js",
"test": "node scripts/test.js",
"test": "DEBUG=true node scripts/test.js",
"test-ci": "export CI=true && node scripts/test.js --coverage --reporters=\"default\" --reporters=\"jest-junit\" --no-colors -ci --silent",
"sync-trans": "sync-i18n --files 'src/locales/manual/*.json' --primary en --languages de --space 4 -- --check",
"i18n-parser": "node scripts/i18next-scanner.js",
Expand All @@ -28,7 +28,7 @@
"@eccenca/gui-elements": "^25.0.0",
"@eccenca/superagent": "^1.4.1",
"@mavrin/remark-typograf": "^2.2.0",
"@reduxjs/toolkit": "^1.9.7",
"@reduxjs/toolkit": "^2.11.1",
"@uppy/core": "1.17.0",
"@uppy/react": "1.11.10",
"@uppy/xhr-upload": "1.7.5",
Expand All @@ -53,11 +53,11 @@
"react-helmet": "^6.0.0",
"react-hook-form": "^5.1.3",
"react-i18next": "^11.18.6",
"react-redux": "^7.2.9",
"react-redux": "^9.2.0",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"react-sparklines": "^1.7.0",
"redux": "^4.2.1",
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
"store": "^2.0.12"
},
Expand Down Expand Up @@ -129,19 +129,20 @@
"<rootDir>/test/**/*(*.)@(spec|test).{js,jsx,ts,tsx}"
],
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
"^.+\\.(js|jsx|ts|tsx|mjs|cjs)$": "babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\](?!react-markdown|vfile|unist-util-stringify-position|).+\\.(js|jsx|ts|tsx)$",
"[/\\\\]node_modules[/\\\\](?!react-markdown|vfile|unist-util-stringify-position|@reduxjs/toolkit|).+\\.(js|jsx|ts|tsx|mjs|cjs)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^react-markdown$": "<rootDir>/../../node_modules/react-markdown",
"^@eccenca/gui-elements$": "<rootDir>/../../node_modules/@eccenca/gui-elements",
"^@eccenca/gui-elements/(.*)$": "<rootDir>/../../node_modules/@eccenca/gui-elements/$1",
"^@reduxjs/toolkit$": "<rootDir>/../../node_modules/@reduxjs/toolkit/dist/cjs/redux-toolkit.development.cjs",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
"@ducks(.*)$": "<rootDir>/src/app/store/ducks/$1"
},
Expand Down Expand Up @@ -180,12 +181,12 @@
"@cyclonedx/webpack-plugin": "^2.0.2",
"@svgr/webpack": "^8.1.0",
"@testing-library/jest-dom": "^6.6.4",
"@testing-library/react": "^12.1.5",
"@testing-library/react": "^14.3.1",
"@testing-library/user-event": "^14.6.1",
"@types/jest": "^30.0.0",
"@types/ramda": "^0.26.6",
"@types/react": "^17.0.85",
"@types/react-dom": "^17.0.8",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-redux": "^7.1.34",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
Expand Down Expand Up @@ -264,6 +265,7 @@
"resolutions": {
"**/minimist": "^1.2.8",
"sanitize.css": "12.0.1",
"**/url-parse": "1.5.9"
"**/url-parse": "1.5.9",
"react-redux": "^9.1.2"
}
}
2 changes: 1 addition & 1 deletion workspace/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ if (
if (argv.indexOf("--no-watch") !== -1) {
argv = argv.filter((arg) => arg !== "--no-watch");
}

argv.push("--detectOpenHandles", "--logHeapUsage")
jest.run(argv);
7 changes: 3 additions & 4 deletions workspace/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect } from "react";
import { ConnectedRouter } from "connected-react-router";
import { useDispatch } from "react-redux";
import { useDispatch, ReactReduxContext } from "react-redux";

import { commonOp } from "@ducks/common";
import RouterOutlet from "./RouterOutlet";
import { getHistory } from "./store/configureStore";
import { AppDispatch, getHistory } from "./store/configureStore";
import { IRouteProps } from "./appRoutes";
import { GlobalContextsWrapper } from "./GlobalContextsWrapper";

Expand All @@ -14,13 +14,12 @@ interface IProps {
}

export default function App({ externalRoutes, routes }: IProps) {
const dispatch = useDispatch();
const dispatch = useDispatch<AppDispatch>();

useEffect(() => {
dispatch(commonOp.fetchCommonSettingsAsync());
dispatch(commonOp.fetchExportTypesAsync());
}, [commonOp]);

return (
<GlobalContextsWrapper>
<ConnectedRouter history={getHistory()}>
Expand Down
2 changes: 1 addition & 1 deletion workspace/src/app/hooks/useCopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ICopyData {

const COPY_RESET_TIMEOUT = 1000;

const useCopyButton = (data: Array<ICopyData>, resetTimeout = COPY_RESET_TIMEOUT): JSX.Element[] => {
const useCopyButton = (data: Array<ICopyData>, resetTimeout = COPY_RESET_TIMEOUT): React.JSX.Element[] => {
const [activeButton, setActiveButton] = React.useState<string | undefined>();
const { registerError } = useErrorHandler();
const [t] = useTranslation();
Expand Down
4 changes: 2 additions & 2 deletions workspace/src/app/hooks/useErrorHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type ErrorHandlerRegisterFuncType = (
errorMessage: string,
cause: DIErrorTypes | null,
options?: ErrorHandlerOptions,
) => JSX.Element | null;
) => React.JSX.Element | null;

interface ErrorHandlerOptions {
/** The notification instance where the error should be displayed. If this is set, the
Expand All @@ -40,7 +40,7 @@ type ErrorHandlerRegisterShortFuncType = (
/** The error cause. */
cause: DIErrorTypes | null,
options?: ErrorHandlerOptions,
) => JSX.Element | null;
) => React.JSX.Element | null;

interface ErrorHandlerDict {
registerError: ErrorHandlerRegisterFuncType;
Expand Down
3 changes: 2 additions & 1 deletion workspace/src/app/hooks/useSelectFirstResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { IPageLabels } from "@ducks/router/operations";
import { workspaceOp, workspaceSel } from "@ducks/workspace";
import { DATA_TYPES } from "../constants";
import { batch, useDispatch, useSelector } from "react-redux";
import { AppDispatch } from "store/configureStore";

export const useSelectFirstResult = () => {
const dispatch = useDispatch();
const dispatch = useDispatch<AppDispatch>();
const data = useSelector(workspaceSel.resultsSelector);
const dataArrayRef = React.useRef(data);
const enabled = React.useRef(true);
Expand Down
2 changes: 1 addition & 1 deletion workspace/src/app/services/errorLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ const logError = (error: FetchError | Error, reactErrorInfo?: ErrorInfo): boolea
} else if (error instanceof Error) {
const { name, message, stack } = error;
const newStack = reactErrorInfo ? reactErrorInfo.componentStack : stack;
err = generateDefaultError(name, message, newStack);
err = generateDefaultError(name, message, newStack || undefined);
} else {
err = generateDefaultError("Uncaught Error type received ", error);
}
Expand Down
16 changes: 7 additions & 9 deletions workspace/src/app/store/configureStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import rootReducer from "./reducers";
import { configureStore, getDefaultMiddleware } from "@reduxjs/toolkit";
import { configureStore } from "@reduxjs/toolkit";
import { createBrowserHistory } from "history";
import { routerMiddleware } from "connected-react-router";
import { createLogger } from "redux-logger";
Expand All @@ -16,12 +16,7 @@ export const getHistory = () => history;

export default function configStore(options: any = {}) {
const enhancers: any[] = [];
const middleware = [
...getDefaultMiddleware({
serializableCheck: false,
}),
routerMiddleware(getHistory()),
];
const middleware = [routerMiddleware(getHistory())];
if (isDevelopment) {
const { enableStoreDevUtils, monitorPerformance, logReduxActions, logUselessRenders } = options;
// Enable redux development actions, e.g. reset store
Expand Down Expand Up @@ -59,10 +54,13 @@ export default function configStore(options: any = {}) {

store = configureStore({
reducer: rootReducer(getHistory()),
middleware,
middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: false }).concat(middleware),
devTools: isDevelopment,
enhancers,
enhancers: (defaultEnhancers) => defaultEnhancers().concat(enhancers),
});

return store;
}

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;
57 changes: 28 additions & 29 deletions workspace/src/app/store/ducks/common/commonSlice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAction, createSlice, PayloadAction } from "@reduxjs/toolkit";
import { ActionReducerMapBuilder, createAction, createSlice, PayloadAction, WritableDraft } from "@reduxjs/toolkit";
import { initialCommonState } from "./initialState";
import { LOCATION_CHANGE } from "connected-react-router";
import appRoutes from "../../../appRoutes";
Expand All @@ -13,44 +13,43 @@ import {
IInitFrontend,
IProjectTaskUpdatePayload,
IArtefactModal,
ICommonState,
} from "@ducks/common/typings";
import { setStoredLang } from "../../../../language";

/**
* @override connect-react-router location change action
* set projectId and taskId on location change
*/
const getExtraReducers = () => {
const getExtraReducers = (builder: ActionReducerMapBuilder<WritableDraft<ICommonState>>) => {
const routerChange = createAction(LOCATION_CHANGE);
return {
[routerChange.toString()]: (state) => {
const { location } = getHistory();
const updatedState = {
...state,
};

let match;
for (let route of appRoutes) {
match = matchPath<{ taskId?: string; projectId?: string }>(location.pathname, {
path: getFullRoutePath(route.path),
exact: true,
});
builder.addCase(routerChange.toString(), (state) => {
const { location } = getHistory();
const updatedState = {
...state,
};

let match;
for (let route of appRoutes) {
match = matchPath<{ taskId?: string; projectId?: string }>(location.pathname, {
path: getFullRoutePath(route.path),
exact: true,
});

if (match) {
updatedState.currentProjectId = match.params.projectId || null;
updatedState.currentTaskId = match.params.taskId || null;
break;
}
if (match) {
updatedState.currentProjectId = match.params.projectId || null;
updatedState.currentTaskId = match.params.taskId || null;
break;
}
}

if (!match) {
updatedState.currentTaskId = null;
updatedState.currentProjectId = null;
}
if (!match) {
updatedState.currentTaskId = undefined;
updatedState.currentProjectId = undefined;
}

return updatedState;
},
};
return updatedState;
});
};

export const commonSlice = createSlice({
Expand Down Expand Up @@ -164,7 +163,7 @@ export const commonSlice = createSlice({

createNewTask: (
state,
action: PayloadAction<Pick<IArtefactModal, "newTaskPreConfiguration" | "selectedDType">>
action: PayloadAction<Pick<IArtefactModal, "newTaskPreConfiguration" | "selectedDType">>,
) => {
const { newTaskPreConfiguration, selectedDType } = action.payload;
state.artefactModal.newTaskPreConfiguration = newTaskPreConfiguration;
Expand All @@ -185,5 +184,5 @@ export const commonSlice = createSlice({
state.artefactModal.info = action.payload;
},
},
extraReducers: getExtraReducers(),
extraReducers: (builder) => getExtraReducers(builder),
});
3 changes: 2 additions & 1 deletion workspace/src/app/store/ducks/common/typings.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import {
IAutocompleteDefaultResponse,
IMetadata,
Expand Down Expand Up @@ -37,7 +38,7 @@ interface AutoCompletionFrontendExtensions {
query: string,
modifiers: SuggestFieldItemRendererModifierProps,
handleSelectClick: () => any,
) => string | JSX.Element;
) => string | React.JSX.Element;
}

/** Properties for parameter auto-completion. */
Expand Down
4 changes: 2 additions & 2 deletions workspace/src/app/store/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { combineReducers } from "@reduxjs/toolkit";
import workspace from "@ducks/workspace";
import common from "@ducks/common";
import routerReducers from "@ducks/router";
import { Reducer, Action, CombinedState } from "redux";
import { Reducer, Action } from "redux";
import { IStore } from "./typings/IStore";
import error from "@ducks/error";

const reducers = (history): Reducer<CombinedState<IStore>, Action> => {
const reducers = (history): Reducer<IStore, Action> => {
return combineReducers({
common: common.reducer,
workspace,
Expand Down
8 changes: 4 additions & 4 deletions workspace/src/app/utils/uiUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import React from "react";
/** Wraps an element inside a tooltip when the wrap predicate is true. */
export const wrapTooltip = (
wrapPredicate: boolean,
childTooltip: string | JSX.Element,
child: JSX.Element,
childTooltip: string | React.JSX.Element,
child: React.JSX.Element,
position: ContextOverlayProps["placement"] = "bottom-start",
size: "large" | "small" | "medium" = "large"
): JSX.Element => {
size: "large" | "small" | "medium" = "large",
): React.JSX.Element => {
if (wrapPredicate) {
return (
<Tooltip content={childTooltip} placement={position} size={size} minimal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import React from "react";
import { useTranslation } from "react-i18next";
import { routerOp } from "@ducks/router";
import { requestProjectMetadata } from "@ducks/shared/requests";
import { AppDispatch } from "store/configureStore";

/** Component to load the "movies" example project. */
export const ExampleProjectImportMenu = () => {
const { registerError } = useErrorHandler();
const dispatch = useDispatch();
const dispatch = useDispatch<AppDispatch>();
const [t] = useTranslation();
const [exampleProjectLoaded, setExampleProjectLoaded] = React.useState<boolean | undefined>(undefined);
const [loading, setLoading] = React.useState(false);
Expand Down
3 changes: 2 additions & 1 deletion workspace/src/app/views/layout/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ import { UserMenuFooterProps } from "../../plugins/plugin.types";
import { ExampleProjectImportMenu } from "./ExampleProjectImportMenu";
import { useKeyboardHeaderShortcuts } from "./useKeyBoardHeaderShortcuts";
import { getFullRoutePath } from "../../../utils/routerUtils";
import { AppDispatch } from "store/configureStore";

interface IProps {
onClickApplicationSidebarExpand: any;
isApplicationSidebarExpanded: boolean;
}

export function Header({ onClickApplicationSidebarExpand, isApplicationSidebarExpanded }: IProps) {
const dispatch = useDispatch();
const dispatch = useDispatch<AppDispatch>();
const location = useLocation();
const locationParams = new URLSearchParams(location.search?.substring(1));
const { hotKeys } = useSelector(commonSel.initialSettingsSelector);
Expand Down
Loading