Skip to content

fix missed local language save, update idp conx #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
REACT_APP_USE_AUTHENTICATION=false

REACT_APP_WS_NOTIFICATION_SERVER=ws/config-notification
REACT_APP_NOTIFICATION_SERVER=api/config

EXTEND_ESLINT=true
17,868 changes: 17,868 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion src/redux/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import {
getLocalStorageLanguage,
getLocalStorageTheme,
saveLocalStorageTheme,
saveLocalStorageLanguage,
} from './local-storage';

import { SELECT_COMPUTED_LANGUAGE, SELECT_THEME } from './actions';
import {
SELECT_COMPUTED_LANGUAGE,
SELECT_THEME,
SELECT_LANGUAGE,
} from './actions';

import { USER, SIGNIN_CALLBACK_ERROR } from '@gridsuite/commons-ui';
import { PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';
Expand All @@ -37,6 +42,11 @@ export const reducer = createReducer(initialState, {
saveLocalStorageTheme(state.theme);
},

[SELECT_LANGUAGE]: (state, action) => {
state.language = action.language;
saveLocalStorageLanguage(state.language);
},

[USER]: (state, action) => {
state.user = action.user;
},
Expand Down
13 changes: 13 additions & 0 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,17 @@ module.exports = function (app) {
ws: true,
})
);
app.use(
createProxyMiddleware('http://localhost:5025/api/config', {
pathRewrite: { '^/api/config/': '/' },
headers: { userId: 'John' },
})
);
app.use(
createProxyMiddleware('http://localhost:5024/ws/config-notification', {
pathRewrite: { '^/ws/config-notification/': '/' },
headers: { userId: 'John' },
ws: true,
})
);
};
6 changes: 3 additions & 3 deletions src/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parameters": "Parameters",
"paramsChangingError": "An error occured when changing the parameters",
"paramsRetrievingError": "An error occurred while retrieving the parameters"
"parameters": "Parameters",
"paramsChangingError": "An error occured when changing the parameters",
"paramsRetrievingError": "An error occurred while retrieving the parameters"
}
6 changes: 3 additions & 3 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parameters": "Paramètres",
"paramsChangingError": "Une erreur est survenue lors de la modification des paramètres",
"paramsRetrievingError": "Une erreur est survenue lors de la récupération des paramètres"
"parameters": "Paramètres",
"paramsChangingError": "Une erreur est survenue lors de la modification des paramètres",
"paramsRetrievingError": "Une erreur est survenue lors de la récupération des paramètres"
}
16 changes: 13 additions & 3 deletions src/utils/rest-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ import { APP_NAME, getAppName } from './config-params';
import { store } from '../redux/store';
import ReconnectingWebSocket from 'reconnecting-websocket';

const PREFIX_CONFIG_QUERIES = process.env.REACT_APP_API_GATEWAY + '/config';
const PREFIX_CONFIG_NOTIFICATION_WS =
process.env.REACT_APP_WS_GATEWAY + '/config-notification';
let PREFIX_CONFIG_QUERIES;

let PREFIX_CONFIG_NOTIFICATION_WS;

if (process.env.REACT_APP_USE_AUTHENTICATION === 'true') {
PREFIX_CONFIG_NOTIFICATION_WS =
process.env.REACT_APP_WS_GATEWAY + '/config-notification';
PREFIX_CONFIG_QUERIES = process.env.REACT_APP_API_GATEWAY + '/config';
} else {
PREFIX_CONFIG_NOTIFICATION_WS =
process.env.REACT_APP_WS_NOTIFICATION_SERVER;
PREFIX_CONFIG_QUERIES = process.env.REACT_APP_NOTIFICATION_SERVER;
}

function getToken() {
const state = store.getState();
Expand Down