Skip to content

Commit 64eebf0

Browse files
author
Hugo Marcellin
committed
Replace IDirectory by ElementAttributes
1 parent 01fca87 commit 64eebf0

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/components/search/search-bar.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ import {
2020
useDebounce,
2121
useSnackMessage,
2222
fetchDirectoryContent,
23+
ElementAttributes,
2324
} from '@gridsuite/commons-ui';
2425
import { Search } from '@mui/icons-material';
2526
import { useDispatch, useSelector } from 'react-redux';
2627
import { setSelectedDirectory, setTreeData } from '../../redux/actions';
2728
import { updatedTree } from '../tree-views-container';
2829
import { useIntl } from 'react-intl';
2930
import { SearchItem } from './search-item';
30-
import { IDirectory, ITreeData, ReduxState } from '../../redux/reducer.type';
31+
import { ITreeData, ReduxState } from '../../redux/reducer.type';
3132
import { UUID } from 'crypto';
3233

3334
export const SEARCH_FETCH_TIMEOUT_MILLIS = 1000; // 1 second
@@ -114,7 +115,7 @@ export const SearchBar: FunctionComponent<SearchBarProps> = ({ inputRef }) => {
114115
);
115116

116117
const updateMapData = useCallback(
117-
(nodeId: string, children: IDirectory) => {
118+
(nodeId: string, children: ElementAttributes[]) => {
118119
if (!treeDataRef.current) {
119120
return;
120121
}

src/redux/reducer.type.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77
import { UUID } from 'crypto';
8+
import { ElementAttributes } from '@gridsuite/commons-ui';
89

910
type UserProfile = {
1011
sub: string;
@@ -22,30 +23,14 @@ interface IUser {
2223
expires_at: number;
2324
}
2425

25-
export interface IDirectory {
26-
elementUuid: UUID;
27-
elementName: string;
28-
type: 'DIRECTORY';
29-
accessRights: {
30-
isPrivate: boolean;
31-
};
32-
owner: string;
33-
subdirectoriesCount: number;
34-
creationDate: string;
35-
lastModificationDate: string;
36-
lastModifiedBy: string;
37-
children: any[];
38-
parentUuid: null | UUID;
39-
}
40-
4126
export interface ITreeData {
42-
rootDirectories: IDirectory[];
27+
rootDirectories: ElementAttributes[];
4328
mapData: Record<string, any>;
4429
}
4530

4631
export interface ReduxState {
4732
activeDirectory: UUID;
48-
selectedDirectory: IDirectory;
33+
selectedDirectory: ElementAttributes;
4934
treeData: ITreeData;
5035
user: IUser;
5136
}

0 commit comments

Comments
 (0)