Skip to content

Commit

Permalink
set print width to 120 instead of default 80. (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
capyq authored Aug 5, 2024
1 parent cb21474 commit e345e4e
Show file tree
Hide file tree
Showing 23 changed files with 168 additions and 646 deletions.
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"printWidth": 120,
"singleQuote": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To check dependencies license compatibility with this project one locally, pleas
npm run licenses-check
```

Notes :
Notes :
* Check [license-checker-config.json](license-checker-config.json) for license white list and exclusion.
If you need to update this list, please inform organization's owners.
* Excluded dependencies :
Expand Down
2 changes: 1 addition & 1 deletion license-checker-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"onlyAllow" : [
"onlyAllow": [
"MPL-2.0",
"MIT",
"BSD-3-Clause",
Expand Down
46 changes: 9 additions & 37 deletions src/components/app-top-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import { logout, TopBar } from '@gridsuite/commons-ui';
import Parameters, { useParameterState } from './parameters';
import { PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';
import { useDispatch, useSelector } from 'react-redux';
import {
fetchAppsAndUrls,
fetchMergeConfigs,
fetchVersion,
getServersInfos,
} from '../utils/rest-api';
import { fetchAppsAndUrls, fetchMergeConfigs, fetchVersion, getServersInfos } from '../utils/rest-api';
import PropTypes from 'prop-types';
import { useMatch, useNavigate } from 'react-router-dom';
import { ReactComponent as GridMergeLogoLight } from '../images/GridMerge_logo_light.svg';
Expand Down Expand Up @@ -50,13 +45,11 @@ const AppTopBar = ({ user, userManager }) => {

const [themeLocal, handleChangeTheme] = useParameterState(PARAM_THEME);

const [languageLocal, handleChangeLanguage] =
useParameterState(PARAM_LANGUAGE);
const [languageLocal, handleChangeLanguage] = useParameterState(PARAM_LANGUAGE);

const [showParameters, setShowParameters] = useState(false);

const [showConfigurationProcesses, setShowConfigurationProcesses] =
useState(false);
const [showConfigurationProcesses, setShowConfigurationProcesses] = useState(false);

useEffect(() => {
if (user !== null) {
Expand All @@ -77,11 +70,7 @@ const AppTopBar = ({ user, userManager }) => {

const selectedTabId = useMemo(() => {
let index =
matchProcess !== null
? configs.findIndex(
(c) => c.process === matchProcess.params.processName
)
: -1;
matchProcess !== null ? configs.findIndex((c) => c.process === matchProcess.params.processName) : -1;
return index !== -1 ? matchProcess.params.processName : false;
}, [configs, matchProcess]);

Expand All @@ -90,13 +79,7 @@ const AppTopBar = ({ user, userManager }) => {
<TopBar
appName="Merge"
appColor="#4795D1"
appLogo={
theme.palette.mode === 'light' ? (
<GridMergeLogoLight />
) : (
<GridMergeLogoDark />
)
}
appLogo={theme.palette.mode === 'light' ? <GridMergeLogoLight /> : <GridMergeLogoDark />}
appVersion={AppPackage.version}
appLicense={AppPackage.license}
onParametersClick={() => setShowParameters(true)}
Expand All @@ -108,28 +91,20 @@ const AppTopBar = ({ user, userManager }) => {
theme={themeLocal}
onLanguageClick={handleChangeLanguage}
language={languageLocal}
globalVersionPromise={() =>
fetchVersion().then((res) => res?.deployVersion)
}
globalVersionPromise={() => fetchVersion().then((res) => res?.deployVersion)}
additionalModulesPromise={getServersInfos}
>
<Tabs
value={selectedTabId}
indicatorColor="primary"
variant="scrollable"
scrollButtons="auto"
onChange={(event, newValue) =>
navigate(PREFIX_URL_PROCESSES + '/' + newValue)
}
onChange={(event, newValue) => navigate(PREFIX_URL_PROCESSES + '/' + newValue)}
aria-label="parameters"
sx={styles.process}
>
{configs.map((config) => (
<Tab
key={config.processUuid}
label={config.process}
value={config.process}
/>
<Tab key={config.processUuid} label={config.process} value={config.process} />
))}
</Tabs>
{user && (
Expand All @@ -150,10 +125,7 @@ const AppTopBar = ({ user, userManager }) => {
</>
)}
</TopBar>
<Parameters
showParameters={showParameters}
hideParameters={() => setShowParameters(false)}
/>
<Parameters showParameters={showParameters} hideParameters={() => setShowParameters(false)} />
</>
);
};
Expand Down
11 changes: 2 additions & 9 deletions src/components/app-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

import App from './app';
import React from 'react';
import {
createTheme,
ThemeProvider,
StyledEngineProvider,
} from '@mui/material/styles';
import { createTheme, ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
import {
LIGHT_THEME,
CardErrorBoundary,
Expand Down Expand Up @@ -124,10 +120,7 @@ const AppWrapperWithRedux = () => {
const theme = useSelector((state) => state[PARAM_THEME]);

return (
<IntlProvider
locale={computedLanguage}
messages={messages[computedLanguage]}
>
<IntlProvider locale={computedLanguage} messages={messages[computedLanguage]}>
<BrowserRouter basename={basename}>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={getMuiTheme(theme)}>
Expand Down
85 changes: 14 additions & 71 deletions src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@ import React, { useEffect, useState, useCallback } from 'react';

import { useDispatch, useSelector } from 'react-redux';

import {
Navigate,
Routes,
Route,
useNavigate,
useLocation,
useParams,
useMatch,
} from 'react-router-dom';
import { Navigate, Routes, Route, useNavigate, useLocation, useParams, useMatch } from 'react-router-dom';

import {
selectTheme,
selectTimelineDiagonalLabels,
selectLanguage,
selectComputedLanguage,
} from '../redux/actions';
import { selectTheme, selectTimelineDiagonalLabels, selectLanguage, selectComputedLanguage } from '../redux/actions';

import {
AuthenticationRouter,
Expand Down Expand Up @@ -82,15 +69,9 @@ const App = () => {

const user = useSelector((state) => state.user);

const signInCallbackError = useSelector(
(state) => state.signInCallbackError
);
const authenticationRouterError = useSelector(
(state) => state.authenticationRouterError
);
const showAuthenticationRouterLogin = useSelector(
(state) => state.showAuthenticationRouterLogin
);
const signInCallbackError = useSelector((state) => state.signInCallbackError);
const authenticationRouterError = useSelector((state) => state.authenticationRouterError);
const showAuthenticationRouterLogin = useSelector((state) => state.showAuthenticationRouterLogin);

const [userManager, setUserManager] = useState(noUserManager);

Expand Down Expand Up @@ -122,17 +103,11 @@ const App = () => {
dispatch(selectTheme(param.value));
break;
case PARAM_TIMELINE_DIAGONAL_LABELS:
dispatch(
selectTimelineDiagonalLabels(param.value === 'true')
);
dispatch(selectTimelineDiagonalLabels(param.value === 'true'));
break;
case PARAM_LANGUAGE:
dispatch(selectLanguage(param.value));
dispatch(
selectComputedLanguage(
getComputedLanguage(param.value)
)
);
dispatch(selectComputedLanguage(getComputedLanguage(param.value)));
break;
default:
}
Expand Down Expand Up @@ -166,11 +141,7 @@ const App = () => {
setUserManager({ instance: null, error: error.message });
});
// Note: initialMatchSilentRenewCallbackUrl and dispatch don't change
}, [
initialMatchSilentRenewCallbackUrl,
dispatch,
initialMatchSigninCallbackUrl,
]);
}, [initialMatchSilentRenewCallbackUrl, dispatch, initialMatchSigninCallbackUrl]);

const connectNotificationsUpdateConfig = useCallback(() => {
const ws = connectNotificationsWsUpdateConfig();
Expand Down Expand Up @@ -219,13 +190,7 @@ const App = () => {
ws.close();
};
}
}, [
user,
dispatch,
updateParams,
connectNotificationsUpdateConfig,
snackError,
]);
}, [user, dispatch, updateParams, connectNotificationsUpdateConfig, snackError]);

return (
<>
Expand All @@ -238,39 +203,19 @@ const App = () => {
path={'/'}
element={
configs.length > 0 && (
<Navigate
replace
to={
PREFIX_URL_PROCESSES +
'/' +
configs[0].process
}
/>
<Navigate replace to={PREFIX_URL_PROCESSES + '/' + configs[0].process} />
)
}
/>
<Route
path="/sign-in-callback"
element={
<Navigate
replace
to={getPreLoginPath() || '/'}
/>
}
element={<Navigate replace to={getPreLoginPath() || '/'} />}
/>
<Route
path="/logout-callback"
element={
<h1>
Error: logout failed; you are still
logged in.
</h1>
}
/>
<Route
path={PREFIX_URL_PROCESSES + '/:processName'}
element={<ProcessRouteElement />}
element={<h1>Error: logout failed; you are still logged in.</h1>}
/>
<Route path={PREFIX_URL_PROCESSES + '/:processName'} element={<ProcessRouteElement />} />
<Route
path="*"
element={
Expand All @@ -286,9 +231,7 @@ const App = () => {
userManager={userManager}
signInCallbackError={signInCallbackError}
authenticationRouterError={authenticationRouterError}
showAuthenticationRouterLogin={
showAuthenticationRouterLogin
}
showAuthenticationRouterLogin={showAuthenticationRouterLogin}
dispatch={dispatch}
navigate={navigate}
location={location}
Expand Down
14 changes: 3 additions & 11 deletions src/components/country-state-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,18 @@ const CountryStateItem = (props) => {
const status = getIgmStatus(props.tso, props.merge);
const color = tsoColor(status);

let replacedWith = status.replacingBusinessProcess
? status.replacingBusinessProcess + ' '
: '';
let replacedWith = status.replacingBusinessProcess ? status.replacingBusinessProcess + ' ' : '';
if (status.replacingDate) {
replacedWith += new Date(status.replacingDate).toLocaleString();
}
return (
<Box sx={styles.listItem}>
<Grid container>
<Grid
item
xs={12}
style={{ display: 'flex', width: '100%', padding: 8 }}
>
<Grid item xs={12} style={{ display: 'flex', width: '100%', padding: 8 }}>
<LensIcon sx={styles.stateIcon} style={{ color: color }} />
<Box sx={styles.tsosColumn}>
<Typography variant="body1">{props.tso}</Typography>
<Typography variant="caption">
{detail.countryName}
</Typography>
<Typography variant="caption">{detail.countryName}</Typography>
</Box>
{replacedWith && (
<Box sx={styles.textReplace}>
Expand Down
Loading

0 comments on commit e345e4e

Please sign in to comment.