Skip to content

Commit

Permalink
Merge branch 'main' into feat/metadata-empty-options
Browse files Browse the repository at this point in the history
  • Loading branch information
mheggelund authored Feb 28, 2024
2 parents 0ce0cae + a21ee52 commit 31e6793
Show file tree
Hide file tree
Showing 9 changed files with 19,192 additions and 261 deletions.
18,782 changes: 18,782 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@types/react-dom": "^18.0.0",
"axios": "^1.6.0",
"env-cmd": "^10.1.0",
"lodash": "^4.17.21",
"openapi-fetch": "^0.7.2",
"openapi-typescript-codegen": "^0.25.0",
"react": "^18.2.0",
Expand Down Expand Up @@ -66,6 +67,7 @@
},
"devDependencies": {
"@tanstack/eslint-plugin-query": "^4.32.5",
"@types/lodash": "^4.14.202",
"@types/styled-components": "^5.1.26",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
23 changes: 21 additions & 2 deletions src/components/AreaCoordinates/AreaCoordinates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Button,
Typography,
} from '@equinor/eds-core-react';
import { cloneDeep } from 'lodash';
import { useState } from 'react';
import { useParams } from 'react-router-dom';
import {
Expand Down Expand Up @@ -80,6 +81,8 @@ export const AreaCoordinates = ({
},
],
});
const [fallbackAreaCoordinate, setfallbackAreaCoordinate] =
useState<AreaCoordinateType>();
const { modelId } = useParams();
const { data, isLoading } = useFetchModel(modelId);
const { activeAreaResultList } = useModelResults(activeArea.name);
Expand Down Expand Up @@ -159,7 +162,15 @@ export const AreaCoordinates = ({
};

setActiveArea(changes.selectedItems[0]);
setAreaCoordinate(newState);

if (
fallbackAreaCoordinate === undefined ||
activeArea.modelAreaTypeId !== fallbackAreaCoordinate.modelAreaId
) {
setfallbackAreaCoordinate(cloneDeep(newState));
}

setAreaCoordinate(cloneDeep(newState));
} else {
setNewArea(undefined);
setActiveArea(changes.selectedItems[0]);
Expand Down Expand Up @@ -244,6 +255,14 @@ export const AreaCoordinates = ({
setEdit(!edit);
};

const handleCancleEdit = () => {
fallbackAreaCoordinate &&
setAreaCoordinate(cloneDeep(fallbackAreaCoordinate));

setErrors({});
setEdit(!edit);
};

if (modelAreas.isLoading || modelAreas.data === undefined || isLoading)
return <p>Loading.....</p>;

Expand Down Expand Up @@ -329,7 +348,7 @@ export const AreaCoordinates = ({
{edit ? (
<>
<Button onClick={handleSubmit}>Save coordinates</Button>
<Button variant="outlined" onClick={handleEditChange}>
<Button variant="outlined" onClick={handleCancleEdit}>
Cancel
</Button>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import { spacings } from '../../../tokens/spacings';
const StyledDialog = styled(Dialog)`
min-width: 600px;
overflow-y: scroll;
@media (max-height: 1000px) {
height: 90vh;
}
`;

const StyledDialogCustomContent = styled(Dialog.CustomContent)`
display: flex;
flex-direction: column;
row-gap: ${spacings.X_LARGE};
height: fit-content;
padding-top: ${spacings.XX_LARGE};
padding-bottom: ${spacings.XXX_LARGE};
> p {
Expand Down
10 changes: 5 additions & 5 deletions src/features/Compute/CaseGroup/CaseRow/CaseRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export const CaseRow = ({
const {
selectedIndicatorParameters,
selectedGrainSize,
selectedParameters,
selectedContiniousParameters,
selectedArchelFilter,
selectedVariogramModels,
setIndicatorParameters,
setGrainSize,
setParameters,
setContiniousParameters,
setArchelFilter,
setVariogramModels,
selectedValues,
Expand Down Expand Up @@ -105,7 +105,7 @@ export const CaseRow = ({
selectedIndicatorParameters,
selectedArchelFilter,
selectedGrainSize,
selectedParameters,
selectedContiniousParameters,
selectedVariogramModels,
);

Expand Down Expand Up @@ -306,11 +306,11 @@ export const CaseRow = ({
contParamsParamsSettings={contParamsParamsSettings}
contParamsArchelSettings={contParamsArchelSettings}
selectedModelArea={selectedRowArea(rowCase.computeCaseId)}
selectedParameters={selectedParameters}
selectedContiniousParameters={selectedContiniousParameters}
selectedArchelFilter={selectedArchelFilter}
selectedVariogramModels={selectedVariogramModels}
setModelArea={setModelArea}
setParameters={setParameters}
setContiniousParameters={setContiniousParameters}
setArchelFilter={setArchelFilter}
setVariogramModels={setVariogramModels}
existingCases={caseList}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useCaseParameters = (
useState<ListComputeSettingsInputValueDto[]>();
const [selectedGrainSize, setGrainSize] =
useState<ListComputeSettingsInputValueDto[]>();
const [selectedParameters, setParameters] =
const [selectedContiniousParameters, setContiniousParameters] =
useState<ListComputeSettingsInputValueDto[]>();
const [selectedArchelFilter, setArchelFilter] =
useState<ListComputeSettingsInputValueDto[]>();
Expand Down Expand Up @@ -182,7 +182,11 @@ export const useCaseParameters = (

case 'ContiniousParameter':
if (loaded)
getDefaultParameters(loaded, selectedParameters, setParameters);
getDefaultParameters(
loaded,
selectedContiniousParameters,
setContiniousParameters,
);
break;

case 'Archel':
Expand All @@ -196,7 +200,7 @@ export const useCaseParameters = (
selectedGrainSize,
selectedIndicatorParameters,
selectedParamValue,
selectedParameters,
selectedContiniousParameters,
selectedVariogramModels,
],
);
Expand All @@ -212,12 +216,12 @@ export const useCaseParameters = (
return {
selectedIndicatorParameters,
selectedGrainSize,
selectedParameters,
selectedContiniousParameters,
selectedArchelFilter,
selectedVariogramModels,
setIndicatorParameters,
setGrainSize,
setParameters,
setContiniousParameters,
setArchelFilter,
setVariogramModels,
selectedValues: selectedParamValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useGetParameterList = (
selectedIndicatorParameters: ListComputeSettingsInputValueDto[] | undefined,
selectedArchelFilter: ListComputeSettingsInputValueDto[] | undefined,
selectedGrainSize: ListComputeSettingsInputValueDto[] | undefined,
selectedParameters: ListComputeSettingsInputValueDto[] | undefined,
selectedContiniousParameters: ListComputeSettingsInputValueDto[] | undefined,
selectedVariogramModels: ListComputeSettingsInputValueDto[] | undefined,
) => {
const addSelectedSettings = (
Expand Down Expand Up @@ -58,7 +58,7 @@ export const useGetParameterList = (
methodType: string,
) => {
let newList = [...settingList];
if (setting) {
if (setting && setting.length > 0) {
const inputSettingTypeId = addSelectedSettings(
setting,
settingType,
Expand Down Expand Up @@ -122,7 +122,7 @@ export const useGetParameterList = (

case 'ContiniousParameter': {
const firstUpdate = updateList(
selectedParameters,
selectedContiniousParameters,
inputSettingsList,
'ContiniousParameter',
'ContiniousParameter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export const VariogramOptionSelect = ({
selectedModelArea,
selectedIndicatorParameters,
selectedGrainSize,
selectedParameters,
selectedContiniousParameters,
selectedArchelFilter,
selectedVariogramModels,
setModelArea,
setIndicatorParameters,
setGrainSize,
setParameters,
setContiniousParameters,
setArchelFilter,
setVariogramModels,
NetGrossGrainSizeSettings,
Expand All @@ -48,7 +48,7 @@ export const VariogramOptionSelect = ({
selectedModelArea?: ModelAreaDto[] | undefined;
selectedIndicatorParameters?: ListComputeSettingsInputValueDto[];
selectedGrainSize?: ListComputeSettingsInputValueDto[];
selectedParameters?: ListComputeSettingsInputValueDto[];
selectedContiniousParameters?: ListComputeSettingsInputValueDto[];
selectedArchelFilter?: ListComputeSettingsInputValueDto[] | undefined;
selectedVariogramModels: ListComputeSettingsInputValueDto[] | undefined;

Expand All @@ -61,7 +61,7 @@ export const VariogramOptionSelect = ({
setGrainSize?: React.Dispatch<
React.SetStateAction<ListComputeSettingsInputValueDto[] | undefined>
>;
setParameters?: React.Dispatch<
setContiniousParameters?: React.Dispatch<
React.SetStateAction<ListComputeSettingsInputValueDto[] | undefined>
>;
setArchelFilter?: React.Dispatch<
Expand Down Expand Up @@ -122,14 +122,13 @@ export const VariogramOptionSelect = ({
break;

case 'ContiniousParameter':
if (loaded) return getDefaultParameters(loaded, selectedParameters);
if (loaded)
return getDefaultParameters(loaded, selectedContiniousParameters);
break;

case 'Archel':
if (loaded) {
const res = getDefaultParameters(loaded, selectedArchelFilter);
return res;
}
if (loaded) return getDefaultParameters(loaded, selectedArchelFilter);

break;
}
};
Expand Down Expand Up @@ -200,7 +199,7 @@ export const VariogramOptionSelect = ({
/>
</ViewSelectedVariogramSettings>
)}
{setParameters && caseType === 'ContiniousParameter' && (
{setContiniousParameters && caseType === 'ContiniousParameter' && (
<ViewSelectedVariogramSettings
expandSettings={expandSettings}
selecteSettings={
Expand All @@ -216,7 +215,7 @@ export const VariogramOptionSelect = ({
selectedValue={
setIfLoadedValues && setIfLoadedValues('ContiniousParameter')
}
setValue={setParameters}
setValue={setContiniousParameters}
/>
</ViewSelectedVariogramSettings>
)}
Expand Down
Loading

0 comments on commit 31e6793

Please sign in to comment.