diff --git a/package.json b/package.json
index e7f4e74..cd6ec33 100644
--- a/package.json
+++ b/package.json
@@ -5,8 +5,8 @@
"dependencies": {
"@azure/msal-browser": "^3.23.0",
"@azure/msal-react": "^2.0.22",
- "@equinor/eds-core-react": "0.41.4",
- "@equinor/eds-data-grid-react": "0.3.0",
+ "@equinor/eds-core-react": "0.41.5",
+ "@equinor/eds-data-grid-react": "0.6.2",
"@equinor/eds-icons": "0.21.0",
"@equinor/eds-tokens": "0.9.2",
"@hookform/resolvers": "^3.3.2",
diff --git a/src/components/OutcropAnalogue/OutcropAnalogueGroup/OutcropAnalogueGroup.tsx b/src/components/OutcropAnalogue/OutcropAnalogueGroup/OutcropAnalogueGroup.tsx
index a7f8a2e..7c73941 100644
--- a/src/components/OutcropAnalogue/OutcropAnalogueGroup/OutcropAnalogueGroup.tsx
+++ b/src/components/OutcropAnalogue/OutcropAnalogueGroup/OutcropAnalogueGroup.tsx
@@ -65,8 +65,6 @@ export const OutcropAnalogueGroup = ({
requestBody: postRequestBody,
});
if (rowUpload.success) handleOutcropDialog();
- } else {
- console.log('Can not add');
}
};
diff --git a/src/features/ModelTable/ModelTable.tsx b/src/features/ModelTable/ModelTable.tsx
index 892ef6c..4cba947 100644
--- a/src/features/ModelTable/ModelTable.tsx
+++ b/src/features/ModelTable/ModelTable.tsx
@@ -7,10 +7,7 @@ import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import {
AnalogueModelsService,
- CountryDto,
- FieldDto,
OpenAPI,
- StratColumnDto,
StratigraphicGroupDto,
StratUnitDto,
} from '../../api/generated';
@@ -41,52 +38,6 @@ export const ModelTable = () => {
if (isLoading || !data?.success) return
Loading...
;
- const getRowCountries = (stratGroupList: StratigraphicGroupDto[]) => {
- const countryList: CountryDto[] = [];
-
- if (stratGroupList.length > 0) {
- stratGroupList.forEach((i) => {
- if (
- countryList.filter((item) => item.countryId === i.country.countryId)
- .length <= 0
- )
- countryList.push(i.country);
- });
- }
- return countryList;
- };
-
- const getRowField = (stratGroupList: StratigraphicGroupDto[]) => {
- const fieldList: FieldDto[] = [];
-
- if (stratGroupList.length > 0) {
- stratGroupList.forEach((i) => {
- if (
- fieldList.filter((item) => item.fieldId === i.field.fieldId).length <=
- 0
- )
- fieldList.push(i.field);
- });
- }
- return fieldList;
- };
-
- const getRowStratCol = (stratGroupList: StratigraphicGroupDto[]) => {
- const stratColList: StratColumnDto[] = [];
-
- if (stratGroupList.length > 0) {
- stratGroupList.forEach((i) => {
- if (
- stratColList.filter(
- (item) => item.stratColumnId === i.stratColumn.stratColumnId,
- ).length <= 0
- )
- stratColList.push(i.stratColumn);
- });
- }
- return stratColList;
- };
-
const getRowGroup = (stratGroupList: StratigraphicGroupDto[]) => {
const groupList: StratUnitDto[] = [];
@@ -145,64 +96,60 @@ export const ModelTable = () => {
columns={[
{ accessorKey: 'name', header: 'Model name', id: 'name' },
{
- accessorKey: 'outcrops',
id: 'outcrops',
header: 'Outcrop',
enableColumnFilter: false,
size: 100,
cell: ({ row }) => (
- {row.original.outcrops.length > 0 ??
- row.original.outcrops.map((a) => (
- {a.name + ', '}
- ))}
+ {row.original.outcrops.map((a) => (
+ {a.name + ', '}
+ ))}
),
},
{
- accessorKey: 'country',
id: 'country',
header: 'Country',
enableColumnFilter: false,
size: 120,
cell: ({ row }) => (
- {getRowCountries(row.original.stratigraphicGroups).map((i) => (
- {i.identifier},
+ {row.original.stratigraphicGroups.map((i) => (
+ {i.country.identifier},
))}
),
},
{
- accessorKey: 'field',
id: 'field',
header: 'Field',
enableColumnFilter: false,
size: 120,
cell: ({ row }) => (
- {getRowField(row.original.stratigraphicGroups).map((i) => (
- {i.identifier},
+ {row.original.stratigraphicGroups.map((i) => (
+ {i.field.identifier},
))}
),
},
{
- accessorKey: 'stratigraphicColumn',
id: 'stratigraphicColumn',
header: 'Stratigraphic column',
enableColumnFilter: false,
size: 230,
cell: ({ row }) => (
- {getRowStratCol(row.original.stratigraphicGroups).map((i) => (
- {i.identifier},
+ {row.original.stratigraphicGroups.map((i) => (
+
+ {i.stratColumn.identifier},{' '}
+
))}
),
},
{
- accessorKey: 'group',
id: 'group',
header: 'Level 1 (group)',
enableColumnFilter: false,
@@ -227,7 +174,6 @@ export const ModelTable = () => {
},
{
- accessorKey: 'navigate',
header: 'Actions',
id: 'navigate',
enableColumnFilter: false,
diff --git a/src/features/ModelView/DeleteButton/DeleteModel.styled.ts b/src/features/ModelView/DeleteButton/DeleteModel.styled.ts
new file mode 100644
index 0000000..b6c0609
--- /dev/null
+++ b/src/features/ModelView/DeleteButton/DeleteModel.styled.ts
@@ -0,0 +1,12 @@
+import styled from 'styled-components';
+import { spacings } from '../../../tokens/spacings';
+
+export const Wrapper = styled.div`
+ display: flex;
+ flex-direction: column;
+ row-gap: ${spacings.MEDIUM};
+
+ > button {
+ width: fit-content;
+ }
+`;
diff --git a/src/features/ModelView/DeleteButton/DeleteModel.tsx b/src/features/ModelView/DeleteButton/DeleteModel.tsx
new file mode 100644
index 0000000..9332799
--- /dev/null
+++ b/src/features/ModelView/DeleteButton/DeleteModel.tsx
@@ -0,0 +1,59 @@
+import { Button, Dialog, Typography } from '@equinor/eds-core-react';
+import { useMutation } from '@tanstack/react-query';
+import { useState } from 'react';
+import { useNavigate, useParams } from 'react-router-dom';
+import { AnalogueModelsService } from '../../../api/generated';
+import { queryClient } from '../../../auth/queryClient';
+import * as Styled from './DeleteModel.styled';
+
+export const DeleteModel = () => {
+ const [open, setOpen] = useState(false);
+ const { modelId } = useParams();
+ const navigate = useNavigate();
+
+ const deleteModel = useMutation({
+ mutationFn: ({ id }: { id: string }) => {
+ return AnalogueModelsService.deleteApiAnalogueModels(id);
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['analogue-model'] });
+ navigate('/');
+ },
+ });
+
+ const HandleModelDelete = async () => {
+ if (modelId) {
+ const res = await deleteModel.mutateAsync({
+ id: modelId,
+ });
+ return res;
+ }
+ };
+
+ return (
+
+ Delete model
+
+ This will delete the model along with all related cases and results.
+
+
+
+
+
+ );
+};
diff --git a/src/features/ModelView/ModelNavigationBar/ModelNavigationBar.tsx b/src/features/ModelView/ModelNavigationBar/ModelNavigationBar.tsx
index 52768b8..c69ccef 100644
--- a/src/features/ModelView/ModelNavigationBar/ModelNavigationBar.tsx
+++ b/src/features/ModelView/ModelNavigationBar/ModelNavigationBar.tsx
@@ -107,7 +107,6 @@ export const ModelNavigationBar = () => {
{
diff --git a/src/features/ModelView/ModelView.tsx b/src/features/ModelView/ModelView.tsx
index 6c7819c..7e20901 100644
--- a/src/features/ModelView/ModelView.tsx
+++ b/src/features/ModelView/ModelView.tsx
@@ -2,6 +2,7 @@ import { useState } from 'react';
import { CoordinatesDialog } from '../../components/AreaCoordinates/CoordinatesDialog/CoordinatesDialog';
import { ImageView } from '../../components/ImageView/ImageView';
import { ModelMetadataView } from '../../features/ModelView/ModelMetadataView/ModelMetadataView';
+import { DeleteModel } from './DeleteButton/DeleteModel';
import { ModelAreaCoordinates } from './ModelAreaCoordinates/ModelAreaCoordinates';
import { ModelFilesView } from './ModelFilesView/ModelFilesView';
import * as Styled from './ModelView.styled';
@@ -21,6 +22,7 @@ export const ModelView = () => {
+