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

Rewrite the service layer in typescript. #2387

Merged
merged 40 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
59823d4
Transformer loadflow service to TS.
AAJELLAL Oct 31, 2024
1a86b8b
Transformer geo-data service to TS.
AAJELLAL Oct 31, 2024
7a8e17c
Transformer non-evacuated-energy service to TS.
AAJELLAL Oct 31, 2024
c7eac6d
Transformer SA service to TS.
AAJELLAL Nov 4, 2024
d399e1e
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 4, 2024
a20e0b8
Transformer Sensi service to TS.
AAJELLAL Nov 4, 2024
624a773
Transformer shortCircuit, voltage init,Sensi, SA and notification ser…
AAJELLAL Nov 5, 2024
be89a8a
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 5, 2024
c62b5ba
Transformer tree, config, study notification and user admin services …
AAJELLAL Nov 5, 2024
8482eb5
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 5, 2024
ed91015
Transformer study index services to TS.
AAJELLAL Nov 6, 2024
9b75637
Transform network service to TS.
AAJELLAL Nov 8, 2024
43a7a96
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 8, 2024
17cfbe0
Resolve conflict.
AAJELLAL Nov 8, 2024
c966529
convert the rest of the service files to ts.
AAJELLAL Nov 12, 2024
6134d4e
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 12, 2024
5af1f3a
Fix some errors.
AAJELLAL Nov 12, 2024
6efbf2a
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 15, 2024
5dc0a7b
handle conflect and fix some sonar issues.
AAJELLAL Nov 20, 2024
6e2a695
Fix some sonar issues.
AAJELLAL Nov 21, 2024
de9b5d3
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 21, 2024
2dd9cce
Fix some sonar issues.
AAJELLAL Nov 22, 2024
5775133
Fix some sonar issues.
AAJELLAL Nov 22, 2024
ffab230
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 22, 2024
3650c5e
Merge branch 'main' into ali/rewrite-service-in-typescript
AAJELLAL Nov 25, 2024
c726b38
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Nov 25, 2024
e13129f
Merge branch 'ali/rewrite-service-in-typescript' of https://github.co…
AAJELLAL Dec 10, 2024
fd08f0a
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Dec 10, 2024
0e6ac72
Add some types.
AAJELLAL Dec 10, 2024
75d6434
Fix sonar issues.
AAJELLAL Dec 10, 2024
643462d
Remove the todos to fix sonar issues and remove unused code.
AAJELLAL Dec 10, 2024
da50fe8
Fix some review remarks
AAJELLAL Dec 10, 2024
75f849d
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Dec 16, 2024
e0d76e2
Resolve conflict.
AAJELLAL Dec 17, 2024
bf9a3c8
resolve conflict and fix some review remarks
AAJELLAL Dec 17, 2024
b4578d3
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Dec 17, 2024
73cb8fa
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Dec 18, 2024
64699f8
resolve conflict
AAJELLAL Dec 18, 2024
3f18ad6
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
AAJELLAL Dec 26, 2024
31e5ba5
resolve conflict
AAJELLAL Dec 26, 2024
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
2 changes: 1 addition & 1 deletion src/components/app-top-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import AppPackage from '../../package.json';
import { DiagramType, useDiagram } from './diagrams/diagram-common';
import { isNodeBuilt, isNodeReadOnly } from './graph/util/model-functions';
import { useParameterState } from './dialogs/parameters/parameters';
import { getServersInfos } from '../services/study';
import { getServersInfos } from '../services/study/index';
import { EQUIPMENT_TYPES } from './utils/equipment-types';
import { fetchVersion } from '../services/utils';
import { RunButtonContainer } from './run-button-container';
Expand Down
2 changes: 1 addition & 1 deletion src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { fetchValidateUser } from '../services/user-admin';
import { connectNotificationsWsUpdateConfig } from '../services/config-notification';
import { fetchConfigParameter, fetchConfigParameters } from '../services/config';
import { fetchDefaultParametersValues, fetchIdpSettings } from '../services/utils';
import { getOptionalServices } from '../services/study';
import { getOptionalServices } from '../services/study/index';
import {
changeDisplayedColumns,
changeLockedColumns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const phaseTapChangerValidationSchema = (id) => ({
return areNumbersOrdered(alphaArray) && areArrayElementsUnique(alphaArray);
}),
//regulating terminal fields
//TODO: is it possible to move it to regulating-terminal-utils.js properly since it depends on "ENABLED" ?
//TODO: is it possible to move it to regulating-terminal-utils.ts properly since it depends on "ENABLED" ?
[VOLTAGE_LEVEL]: yup
.object()
.nullable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const ratioTapChangerValidationSchema = (id) => ({
return areNumbersOrdered(ratioArray) && areArrayElementsUnique(ratioArray);
}),
//regulating terminal fields
//TODO: is it possible to move it to regulating-terminal-utils.js properly since it depends on "ENABLED" ?
//TODO: is it possible to move it to regulating-terminal-utils.ts properly since it depends on "ENABLED" ?
[VOLTAGE_LEVEL]: yup
.object()
.nullable()
Expand Down
12 changes: 6 additions & 6 deletions src/components/dialogs/parameters/sensi/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '../../../utils/field-constants';
import yup from '../../../utils/yup-config';

interface INewParamsPst {
export interface INewParamsPst {
sensitivityPST: Array<{
[MONITORED_BRANCHES]: Array<{
[ID]: string;
Expand All @@ -47,7 +47,7 @@ interface INewParamsPst {
}>;
}

interface INewParamsNodes {
export interface INewParamsNodes {
sensitivityNodes: Array<{
[SUPERVISED_VOLTAGE_LEVELS]: Array<{
[ID]: string;
Expand All @@ -65,7 +65,7 @@ interface INewParamsNodes {
}>;
}

interface INewParamsHvdc {
export interface INewParamsHvdc {
sensitivityHVDC: Array<{
[MONITORED_BRANCHES]: Array<{
[ID]: string;
Expand All @@ -84,7 +84,7 @@ interface INewParamsHvdc {
}>;
}

interface INewParamsInjections {
export interface INewParamsInjections {
sensitivityInjection: Array<{
[MONITORED_BRANCHES]: Array<{
[ID]: string;
Expand Down Expand Up @@ -288,7 +288,7 @@ export const getSensiInjectionsSetFormSchema = () => ({
),
});

interface INewParamsInjectionsSet {
export interface INewParamsInjectionsSet {
sensitivityInjectionsSet: Array<{
[MONITORED_BRANCHES]: Array<{
[ID]: string;
Expand All @@ -307,7 +307,7 @@ interface INewParamsInjectionsSet {
}>;
}

interface IRowNewParams {
export interface IRowNewParams {
[MONITORED_BRANCHES]: Array<{
[ID]: string;
[NAME]: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/network-modification-tree-pane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
fetchNetworkModificationTreeNode,
fetchStashedNodes,
} from '../services/study/tree-subtree';
import { buildNode, getUniqueNodeName, unbuildNode } from '../services/study';
import { buildNode, getUniqueNodeName, unbuildNode } from '../services/study/index';
AAJELLAL marked this conversation as resolved.
Show resolved Hide resolved
import RestoreNodesDialog from './dialogs/restore-node-dialog';
import ScenarioEditor from './graph/menus/dynamic-simulation/scenario-editor';
import { StudyDisplayMode, CopyType, UpdateType } from './network-modification.type';
Expand Down
1 change: 1 addition & 0 deletions src/components/network/network-map-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ export const NetworkMapTab = ({
`Loading geo data of study '${studyUuid}' of missing substations '${notFoundSubstationIds}' and missing lines '${notFoundLineIds}'...`
);
dispatch(setMapDataLoading(true));
console.log(' notFoundSubstationIds: ', notFoundSubstationIds);
jamal-khey marked this conversation as resolved.
Show resolved Hide resolved
const missingSubstationPositions = getMissingEquipmentsPositions(
notFoundSubstationIds,
fetchSubstationPositions
Expand Down
2 changes: 1 addition & 1 deletion src/components/spreadsheet/table-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ const TableWrapper: FunctionComponent<TableWrapperProps> = ({
return [...equipments];
}, [equipments, disabled]);

//TODO fix network.js update methods so that when an existing entry is modified or removed the whole collection
//TODO fix network.ts update methods so that when an existing entry is modified or removed the whole collection
//is reinstanciated in order to notify components using it.
//this variable is regenerated on every renders in order to gather latest external updates done to the dataset,
//it is necessary since we curently lack the system to detect changes done to it after receiving a notification
Expand Down
2 changes: 1 addition & 1 deletion src/components/study-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
connectNotificationsWsUpdateDirectories,
} from '../services/directory-notification';
import { useAllComputingStatus } from './computing-status/use-all-computing-status';
import { fetchCaseName, fetchStudyExists } from '../services/study';
import { fetchCaseName, fetchStudyExists } from '../services/study/index';
AAJELLAL marked this conversation as resolved.
Show resolved Hide resolved
import { fetchNetworkModificationTree } from '../services/study/tree-subtree';
import { fetchNetworkExistence, fetchStudyIndexationStatus } from '../services/study/network';
import { recreateStudyNetwork, reindexAllStudy } from 'services/study/study';
Expand Down
4 changes: 2 additions & 2 deletions src/redux/user-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
/*
at src/redux/store.ts:12:33
AAJELLAL marked this conversation as resolved.
Show resolved Hide resolved
at src/services/utils.js:7:1
at src/services/study/index.js:8:1
at src/services/utils.ts:7:1
at src/services/study/index.ts:8:1
at src/components/utils/inputs/input-hooks.jsx:41:1
at src/components/dialogs/commons/modification-dialog-content.jsx:19:1
at src/components/dialogs/commons/modificationDialog.jsx:12:1
Expand Down
6 changes: 3 additions & 3 deletions src/services/config.js → src/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import { backendFetch, backendFetchJson } from './utils';

const PREFIX_CONFIG_QUERIES = import.meta.env.VITE_API_GATEWAY + '/config';

export function fetchConfigParameters(appName) {
export function fetchConfigParameters(appName: string) {
console.info('Fetching UI configuration params for app : ' + appName);
const fetchParams = PREFIX_CONFIG_QUERIES + `/v1/applications/${appName}/parameters`;
return backendFetchJson(fetchParams);
}

export function fetchConfigParameter(name) {
export function fetchConfigParameter(name: string) {
const appName = getAppName(name);
console.info("Fetching UI config parameter '%s' for app '%s' ", name, appName);
const fetchParams = PREFIX_CONFIG_QUERIES + `/v1/applications/${appName}/parameters/${name}`;
return backendFetch(fetchParams).then((response) => (response.status === 204 ? null : response.json()));
}

export function updateConfigParameter(name, value) {
export function updateConfigParameter(name: string, value: string) {
const appName = getAppName(name);
console.info("Updating config parameter '%s=%s' for app '%s' ", name, value, appName);
const updateParams =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import ReconnectingWebSocket from 'reconnecting-websocket';
import { getUrlWithToken, getWsBase } from './utils';
import { getUserToken } from '../redux/user-store';
import { UUID } from 'crypto';

const PREFIX_DIRECTORY_NOTIFICATION_WS = import.meta.env.VITE_WS_GATEWAY + '/directory-notification';

export function connectDeletedStudyNotificationsWebsocket(studyUuid) {
export function connectDeletedStudyNotificationsWebsocket(studyUuid: UUID) {
// The websocket API doesn't allow relative urls
const wsBase = getWsBase();
// Add params to Url
Expand Down
3 changes: 2 additions & 1 deletion src/services/directory.js → src/services/directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
*/

import { backendFetchJson, getRequestParamFromList } from './utils';
import { UnknownArray } from 'type-fest';

const PREFIX_DIRECTORY_SERVER_QUERIES = import.meta.env.VITE_API_GATEWAY + '/directory';

export function fetchContingencyAndFiltersLists(listIds) {
export function fetchContingencyAndFiltersLists(listIds: UnknownArray) {
jamal-khey marked this conversation as resolved.
Show resolved Hide resolved
console.info('Fetching contingency and filters lists');

// Add params to Url
Expand Down
3 changes: 2 additions & 1 deletion src/services/loadflow.js → src/services/loadflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { backendFetchJson } from './utils';
import { UUID } from 'crypto';

const PREFIX_LOADFLOW_SERVER_QUERIES = import.meta.env.VITE_API_GATEWAY + '/loadflow';

Expand All @@ -27,7 +28,7 @@ export function getLoadFlowSpecificParametersDescription() {
return backendFetchJson(getLoadFlowSpecificParametersUrl);
}

export function fetchLoadFlowParameters(parameterUuid) {
export function fetchLoadFlowParameters(parameterUuid: UUID) {
console.info('fetch load flow parameters');
const url = getLoadFlowUrl() + 'parameters/' + encodeURIComponent(parameterUuid);
console.debug(url);
Expand Down
Loading
Loading