Skip to content

Conversation

@Mathieu-Deharbe
Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe commented Dec 4, 2025

PR Summary

allows to add a description to individual netmods in the tree view using : gridsuite/commons-ui#955

moves NetworkModificationMetadata to commons-ui

Mathieu-Deharbe and others added 11 commits December 4, 2025 13:30
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
const rootNetworks = useSelector((state: AppState) => state.rootNetworks);
const isMonoRootStudy = useSelector((state: AppState) => state.isMonoRootStudy);
const highlightedModificationUuid = useSelector((state: AppState) => state.highlightedModificationUuid);
const [hoveredRowIndex, setHoveredRowIndex] = useState<number>();
Copy link
Contributor

Choose a reason for hiding this comment

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

no initial value for this state ?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe -1 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

and no need to precise type if there is a default value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually when I precised -1 as a default value, the hovered index was lost when the page rerendered. It is surprising because according to react help it shouldn't. I don't have the explanation.

import { setModificationDescription } from '../../../../services/study/network-modifications';

export interface DescriptionRendererProps extends ICellRendererParams<NetworkModificationMetadata> {
setModifications: React.Dispatch<SetStateAction<NetworkModificationMetadata[]>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't import the whole react dependency, but just dispatch like it's done for set state action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually you made me realise that I don't need that prop anymore. Removed : 1dcc6d6

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, but you still import React

Copy link
Contributor Author

@Mathieu-Deharbe Mathieu-Deharbe Dec 16, 2025

Choose a reason for hiding this comment

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

sorry : removed here : adbd106

@EtienneLt EtienneLt changed the title add netmod decsription add field description to modification Dec 16, 2025
*/
import { ICellRendererParams } from 'ag-grid-community';
import { DescriptionModificationDialog, EditNoteIcon, NetworkModificationMetadata } from '@gridsuite/commons-ui';
import React, { useCallback, useState } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

You still have a global react import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry : removed here : adbd106

import { setModificationDescription } from '../../../../services/study/network-modifications';

export interface DescriptionRendererProps extends ICellRendererParams<NetworkModificationMetadata> {
setModifications: React.Dispatch<SetStateAction<NetworkModificationMetadata[]>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, but you still import React

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants