-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Load parameters and analogues from API. Adaptions for API d…
…ata.
- Loading branch information
1 parent
e04edda
commit 62dda86
Showing
7 changed files
with
162 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
src/features/Compute/ComputeVariogram/CaseCard/CaseCardParameters/CaseCardParameters.tsx
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
.../Compute/ComputeVariogram/CaseCard/CaseCardParameters/GrainSizeSelect/GrainSizeSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
Autocomplete, | ||
AutocompleteChanges, | ||
Chip, | ||
} from '@equinor/eds-core-react'; | ||
import { default as optionTypes } from '../../CaseCard'; | ||
import * as Styled from '../CaseCardParameters.styled'; | ||
|
||
export const GrainSizeSelect = ({ | ||
label, | ||
type, | ||
options, | ||
selectedGrainSize, | ||
setGrainSize, | ||
}: { | ||
label: string; | ||
type: string; | ||
options: optionTypes[]; | ||
selectedGrainSize?: optionTypes; | ||
setGrainSize: React.Dispatch<React.SetStateAction<optionTypes | undefined>>; | ||
}) => { | ||
const onGrainSizeChange = (changes: AutocompleteChanges<optionTypes>) => { | ||
setGrainSize && setGrainSize(changes.selectedItems[0]); | ||
}; | ||
|
||
return ( | ||
<Styled.Parameters> | ||
<Autocomplete | ||
label={label} | ||
options={options} | ||
optionLabel={(option) => option.name} | ||
onOptionsChange={onGrainSizeChange} | ||
></Autocomplete> | ||
|
||
{selectedGrainSize && ( | ||
<Chip key={selectedGrainSize.id}>{selectedGrainSize.size}</Chip> | ||
)} | ||
</Styled.Parameters> | ||
); | ||
}; |
45 changes: 45 additions & 0 deletions
45
...features/Compute/ComputeVariogram/CaseCard/CaseCardParameters/ModelSelect/ModelSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable max-lines-per-function */ | ||
import { | ||
Autocomplete, | ||
AutocompleteChanges, | ||
Chip, | ||
} from '@equinor/eds-core-react'; | ||
import { default as optionTypes } from '../../CaseCard'; | ||
import * as Styled from '../CaseCardParameters.styled'; | ||
|
||
export const ModelSelect = ({ | ||
label, | ||
type, | ||
options, | ||
selectedVariogramModels, | ||
setVariogramModels, | ||
}: { | ||
label: string; | ||
type: string; | ||
options: optionTypes[]; | ||
|
||
selectedVariogramModels?: optionTypes[] | undefined; | ||
setVariogramModels?: React.Dispatch< | ||
React.SetStateAction<optionTypes[] | undefined> | ||
>; | ||
}) => { | ||
const onModelChange = (changes: AutocompleteChanges<optionTypes>) => { | ||
setVariogramModels && setVariogramModels(changes.selectedItems); | ||
}; | ||
|
||
return ( | ||
<Styled.Parameters> | ||
<Autocomplete | ||
label={label} | ||
options={options} | ||
optionLabel={(opt) => opt.name} | ||
onOptionsChange={onModelChange} | ||
multiple | ||
></Autocomplete> | ||
|
||
{selectedVariogramModels && | ||
type === 'variogramModels' && | ||
selectedVariogramModels.map((s) => <Chip key={s.id}>{s.name}</Chip>)} | ||
</Styled.Parameters> | ||
); | ||
}; |
43 changes: 43 additions & 0 deletions
43
.../Compute/ComputeVariogram/CaseCard/CaseCardParameters/ParameterSelect/ParameterSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
Autocomplete, | ||
AutocompleteChanges, | ||
Chip, | ||
} from '@equinor/eds-core-react'; | ||
import { ParameterList } from '../../../../../../api/generated/models/ParameterList'; | ||
import * as Styled from '../CaseCardParameters.styled'; | ||
|
||
export const ParameterSelect = ({ | ||
label, | ||
type, | ||
options, | ||
selectedParameters, | ||
setParameters, | ||
}: { | ||
label: string; | ||
type: string; | ||
options: ParameterList[]; | ||
selectedParameters?: ParameterList[]; | ||
setParameters: React.Dispatch< | ||
React.SetStateAction<ParameterList[] | undefined> | ||
>; | ||
}) => { | ||
const onParameterChange = (changes: AutocompleteChanges<ParameterList>) => { | ||
setParameters(changes.selectedItems); | ||
}; | ||
|
||
return ( | ||
<Styled.Parameters> | ||
<Autocomplete | ||
label={label} | ||
options={options} | ||
optionLabel={(option) => option.name} | ||
onOptionsChange={onParameterChange} | ||
multiple | ||
></Autocomplete> | ||
{selectedParameters && | ||
selectedParameters.map((s) => ( | ||
<Chip key={s.parameterId}>{s.name}</Chip> | ||
))} | ||
</Styled.Parameters> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters