Skip to content
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

Move directory api to commons ui #2103

Merged
merged 7 commits into from
May 29, 2024
Merged
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
165 changes: 140 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@gridsuite/commons-ui": "0.55.0",
"@gridsuite/commons-ui": "0.59.0",
"@hookform/resolvers": "^3.3.4",
"@mui/icons-material": "^5.15.14",
"@mui/lab": "5.0.0-alpha.169",
Expand Down
5 changes: 3 additions & 2 deletions src/components/app-top-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ import {
EQUIPMENT_INFOS_TYPES,
EQUIPMENT_TYPES,
} from './utils/equipment-types';
import { fetchAppsAndUrls, fetchVersion } from '../services/utils';
import { fetchVersion } from '../services/utils';
import { RunButtonContainer } from './run-button-container';
import { useComputationResultsCount } from '../hooks/use-computation-results-count';

import { Settings } from '@mui/icons-material';
import { fetchAppsMetadata } from '@gridsuite/commons-ui';

const styles = {
currentNodeBox: {
Expand Down Expand Up @@ -242,7 +243,7 @@ const AppTopBar = ({ user, tabIndex, onChangeTab, userManager }) => {

useEffect(() => {
if (user !== null) {
fetchAppsAndUrls().then((res) => {
fetchAppsMetadata().then((res) => {
setAppsAndUrls(res);
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/create-study-dialog/import-parameters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FunctionComponent, useCallback, useState } from 'react';
import { AdvancedParameterButton } from './advanced-parameter-button';
import { CaseImportParameters } from 'services/network-conversion';
import { Box, Divider, Theme } from '@mui/material';
import { Parameter } from '@gridsuite/commons-ui';

export interface ImportParametersProps {
formatWithParameters: CaseImportParameters[];
Expand Down Expand Up @@ -50,7 +51,7 @@ export const ImportParameters: FunctionComponent<ImportParametersProps> = (
/>
{areParamsDisplayed && (
<FlatParameters
paramsAsArray={formatWithParameters}
paramsAsArray={formatWithParameters as Parameter[]}
initValues={currentParameters}
onChange={onChange}
variant="standard"
Expand Down
4 changes: 2 additions & 2 deletions src/components/dialogs/commons/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

export function getIdOrValue(value: { id: string; label: string } | string) {
export function getIdOrValue(value: any) {
return typeof value !== 'string' ? value?.id ?? null : value;
}

export function getLabelOrValue(value: { id: string; label: string } | string) {
export function getLabelOrValue(value: any) {
Comment on lines +8 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove typescript check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation errors, too hard to properly type, seen with @flomillot

return typeof value !== 'string' ? value?.label ?? null : value;
}
5 changes: 0 additions & 5 deletions src/components/dialogs/contingency-list-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { updateConfigParameter } from '../../services/config';
import { fetchContingencyAndFiltersLists } from '../../services/directory';
import { fetchContingencyCount } from '../../services/study';
import { DirectoryItemSelector } from '@gridsuite/commons-ui';
import { fetchDirectoryContent, fetchRootFolders } from 'services/directory';
import { fetchElementsMetadata } from 'services/explore';
import { isNodeBuilt } from 'components/graph/util/model-functions';

function makeButton(onClick, message, disabled) {
Expand Down Expand Up @@ -247,9 +245,6 @@ const ContingencyListSelector = (props) => {
onClose={addFavorites}
types={CONTINGENCY_TYPES}
title={intl.formatMessage({ id: 'ContingencyListsSelection' })}
fetchDirectoryContent={fetchDirectoryContent}
fetchRootFolders={fetchRootFolders}
fetchElementsInfos={fetchElementsMetadata}
/>
</>
);
Expand Down
5 changes: 0 additions & 5 deletions src/components/dialogs/import-modification-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { CopyType } from '../graph/menus/network-modification-node-editor';
import { copyOrMoveModifications } from '../../services/study';
import { UUID } from 'crypto';
import { FunctionComponent } from 'react';
import { fetchDirectoryContent, fetchRootFolders } from 'services/directory';
import { fetchElementsMetadata } from 'services/explore';

/**
* Dialog to select some network modifications and append them in the current node
Expand Down Expand Up @@ -74,9 +72,6 @@ const ImportModificationDialog: FunctionComponent<
title={intl.formatMessage({
id: 'ModificationsSelection',
})}
fetchDirectoryContent={fetchDirectoryContent}
fetchRootFolders={fetchRootFolders}
fetchElementsInfos={fetchElementsMetadata}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ import { EQUIPMENT_TYPES } from 'components/utils/equipment-types';

import { DirectoryItemsInput } from '@gridsuite/commons-ui';
import { getIdOrValue } from '../../commons/utils';
import {
fetchDirectoryContent,
fetchPath,
fetchRootFolders,
} from 'services/directory';
import { fetchElementsMetadata } from 'services/explore';

const ByFilterDeletionForm = () => {
const intl = useIntl();
Expand Down Expand Up @@ -69,10 +63,6 @@ const ByFilterDeletionForm = () => {
label={'filter'}
equipmentTypes={[equipmentTypeWatch]}
disable={!equipmentTypeWatch}
fetchDirectoryContent={fetchDirectoryContent}
fetchRootFolders={fetchRootFolders}
fetchElementsInfos={fetchElementsMetadata}
fetchDirectoryElementPath={fetchPath}
/>
);
}, [equipmentTypeWatch]);
Expand Down
Loading
Loading