Skip to content

Commit

Permalink
feat: added outcrop region and location
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinrefvol committed Oct 30, 2024
1 parent 6df30fe commit 9cd485b
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/api/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export type { GetObjectResultsDto } from './models/GetObjectResultsDto';
export type { GetObjectResultsFileDto } from './models/GetObjectResultsFileDto';
export type { GetOutcropsCommandResponse } from './models/GetOutcropsCommandResponse';
export type { GetOutcropsDto } from './models/GetOutcropsDto';
export type { GetOutcropsLocationDto } from './models/GetOutcropsLocationDto';
export type { GetOutcropsRegionDto } from './models/GetOutcropsRegionDto';
export type { GetUploadDetailQueryResponse } from './models/GetUploadDetailQueryResponse';
export type { GetUploadListQueryResponse } from './models/GetUploadListQueryResponse';
export type { GetVariogramResultsByModelIdQueryResponse } from './models/GetVariogramResultsByModelIdQueryResponse';
Expand All @@ -105,6 +107,7 @@ export type { ListMetadataTypesQueryResponse } from './models/ListMetadataTypesQ
export type { ListModelAreaTypesQueryResponse } from './models/ListModelAreaTypesQueryResponse';
export type { ListStratColumnQueryResponse } from './models/ListStratColumnQueryResponse';
export type { ListStratUnitsQueryResponse } from './models/ListStratUnitsQueryResponse';
export type { LocationDto } from './models/LocationDto';
export type { MergeModelCommandResponse } from './models/MergeModelCommandResponse';
export type { MergeModelDto } from './models/MergeModelDto';
export type { MetadataDto } from './models/MetadataDto';
Expand All @@ -126,6 +129,7 @@ export type { PrepareChunkedUploadCommandResponse } from './models/PrepareChunke
export type { PrepareChunkedUploadDto } from './models/PrepareChunkedUploadDto';
export type { ProblemDetails } from './models/ProblemDetails';
export type { RadixJobDto } from './models/RadixJobDto';
export type { RegionDto } from './models/RegionDto';
export type { StratColumnDto } from './models/StratColumnDto';
export type { StratigraphicGroupDto } from './models/StratigraphicGroupDto';
export type { StratUnitDto } from './models/StratUnitDto';
Expand Down
4 changes: 3 additions & 1 deletion src/api/generated/models/GetOutcropsDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
/* tslint:disable */
/* eslint-disable */

import type { GetOutcropsRegionDto } from './GetOutcropsRegionDto';

export type GetOutcropsDto = {
outcropId: string;
name: string;
outcropCategory: string;
region: string;
basins: Array<string>;
region: GetOutcropsRegionDto;
};

12 changes: 12 additions & 0 deletions src/api/generated/models/GetOutcropsLocationDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type GetOutcropsLocationDto = {
locationId: string;
regionId: string;
locationName: string;
country: string;
};

13 changes: 13 additions & 0 deletions src/api/generated/models/GetOutcropsRegionDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { GetOutcropsLocationDto } from './GetOutcropsLocationDto';

export type GetOutcropsRegionDto = {
regionId: string;
name: string;
locations: Array<GetOutcropsLocationDto>;
};

12 changes: 12 additions & 0 deletions src/api/generated/models/LocationDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type LocationDto = {
locationId: string;
regionId: string;
locationName: string;
country: string;
};

4 changes: 3 additions & 1 deletion src/api/generated/models/OutcropDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
/* tslint:disable */
/* eslint-disable */

import type { RegionDto } from './RegionDto';

export type OutcropDto = {
outcropId: string;
name: string;
outcropCategory: string;
region: string;
basins: Array<string>;
region: RegionDto;
};

13 changes: 13 additions & 0 deletions src/api/generated/models/RegionDto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { LocationDto } from './LocationDto';

export type RegionDto = {
regionId: string;
name: string;
locations: Array<LocationDto>;
};

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
AddAnalogueModelOutcropForm,
AnalogueModelDetail,
OutcropDto,
RegionDto,
} from '../../../api/generated';
import { useOutcropAnalouge } from '../../../hooks/useOutcropAnalogue';
import * as StyledDialog from '../../../styles/addRowDialog/AddRowDialog.styled';
Expand All @@ -23,7 +24,7 @@ export interface OutcropType {
outcropId?: string;
name?: string;
outcropCategory?: string;
region?: string;
region?: RegionDto;
basins?: Array<string>;
}

Expand Down Expand Up @@ -108,6 +109,8 @@ export const OutcropAnalogueGroup = ({
<Table.Row>
<Table.Cell></Table.Cell>
<Table.Cell>Analogue</Table.Cell>
<Table.Cell>Country</Table.Cell>
<Table.Cell>Location</Table.Cell>
<Table.Cell>Region</Table.Cell>
<Table.Cell>Basin</Table.Cell>
<Table.Cell>Category</Table.Cell>
Expand Down Expand Up @@ -136,7 +139,20 @@ export const OutcropAnalogueGroup = ({
<Table.Cell>
<Styled.StratColCell>{row.name}</Styled.StratColCell>
</Table.Cell>
<Table.Cell>{row.region}</Table.Cell>
{row.region.locations.length !== 0 ? (
<>
<Table.Cell>{row.region.locations[0].country}</Table.Cell>
<Table.Cell>
{row.region.locations[0].locationName}
</Table.Cell>
</>
) : (
<>
<Table.Cell></Table.Cell>
<Table.Cell></Table.Cell>
</>
)}
<Table.Cell>{row.region.name}</Table.Cell>
<Table.Cell>
<Styled.StratColCell>
{row.basins?.map((item) => item)}
Expand Down
48 changes: 45 additions & 3 deletions src/components/OutcropAnalogue/OutcropSelect/OutcropSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,56 @@ export const OutcropSelect = ({
helperText={error.Analogue ? error.Analogue : undefined}
/>

{outcropObject.region?.locations.length !== 0 ? (
<>
<Autocomplete
label="Country"
selectedOptions={[outcropObject.region?.locations[0].country]}
initialSelectedOptions={
outcropObject.region
? [outcropObject.region.locations[0].country]
: ['']
}
options={
outcropObject.region !== undefined
? [outcropObject.region.locations[0].country]
: ['']
}
noOptionsText="No options"
readOnly
/>

<Autocomplete
label="Location"
selectedOptions={[outcropObject.region?.locations[0].locationName]}
initialSelectedOptions={
outcropObject.region
? [outcropObject.region.locations[0].locationName]
: ['']
}
options={
outcropObject.region !== undefined
? [outcropObject.region.locations[0].locationName]
: ['']
}
noOptionsText="No options"
readOnly
/>
</>
) : (
<></>
)}

<Autocomplete
label="Region"
selectedOptions={[outcropObject.region]}
selectedOptions={[outcropObject.region?.name]}
initialSelectedOptions={
outcropObject.region ? [outcropObject.region] : ['']
outcropObject.region ? [outcropObject.region.name] : ['']
}
options={
outcropObject.region !== undefined ? [outcropObject.region] : ['']
outcropObject.region !== undefined
? [outcropObject.region.name]
: ['']
}
noOptionsText="No options"
readOnly
Expand Down

0 comments on commit 9cd485b

Please sign in to comment.