diff --git a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx index 3e6df56a..bddd052a 100644 --- a/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx +++ b/src/features/Compute/ComputeVariogram/CaseCard/CaseCard.tsx @@ -24,13 +24,15 @@ export default interface optionTypes { export const CaseCard = ({ name, id, - removeCase, caseType, + removeCase, + runCase, }: { name: string; id: string; - removeCase: (id: string) => void; caseType: string; + removeCase: (id: string) => void; + runCase?: () => void; }) => { const [selectedModelArea, setModelArea] = useState(); const [selectedComputeMethod, setComputeMethod] = useState(); @@ -70,19 +72,6 @@ export const CaseCard = ({ ]; const objectComputeMethods: optionTypes[] = [{ id: 15, name: 'Channel' }]; - const runCase = () => { - // eslint-disable-next-line no-console - console.log(selectedModelArea); - // eslint-disable-next-line no-console - console.log(selectedComputeMethod); - // eslint-disable-next-line no-console - console.log(selectedGrainSize); - // eslint-disable-next-line no-console - console.log(selectedVariogramModels); - // eslint-disable-next-line no-console - console.log(selectedParameters); - }; - return ( diff --git a/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx b/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx index b3601472..17c19c86 100644 --- a/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx +++ b/src/features/Compute/ComputeVariogram/CaseCard/CaseCardButtons/CaseCardButtons.tsx @@ -8,7 +8,7 @@ export const CaseCardButtons = ({ }: { id: string; removeCase: (id: string) => void; - runCase: () => void; + runCase?: () => void; }) => { return ( diff --git a/src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx b/src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx index 938c9aa0..a3171fd4 100644 --- a/src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx +++ b/src/pages/ModelPages/Compute/ComputeObject/ComputeObject.tsx @@ -1,5 +1,9 @@ import { Typography } from '@equinor/eds-core-react'; +import { useMutation } from '@tanstack/react-query'; import { useState } from 'react'; +import { useParams } from 'react-router-dom'; +import { EstimateChannelCommand } from '../../../../api/generated/models/EstimateChannelCommand'; +import { JobsService } from '../../../../api/generated/services/JobsService'; import { CaseCard } from '../../../../features/Compute/ComputeVariogram/CaseCard/CaseCard'; import { ComputeCaseInfoActions } from '../../../../features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions'; import { CaseInfoTyoe, Casetype } from '../ComputeVariogram/ComputeVariogram'; @@ -9,6 +13,12 @@ export const ComputeObject = () => { const [cases, setCases] = useState([ { id: '1', name: 'Variogram Case 1' }, ]); + const { modelId } = useParams<{ modelId: string }>(); + + const computeObject = useMutation({ + mutationFn: JobsService.postApiJobsComputeChannelEstimations, + }); + const ObjectCaseInfo: CaseInfoTyoe = { title: 'Object cases', info: 'You can add multiple cases for the different areas in your model.', @@ -29,6 +39,18 @@ export const ComputeObject = () => { setCases(newCaseList); }; + const runComputeObject = async () => { + if (!modelId) return; + const requestBody: EstimateChannelCommand = { + modelId: modelId, + }; + + const runCompute = await computeObject.mutateAsync(requestBody); + + console.log(runCompute); + console.log(computeObject); + }; + return ( @@ -38,8 +60,9 @@ export const ComputeObject = () => { key={c.id} id={c.id} name={c.name} - removeCase={removeCase} caseType={'object'} + removeCase={removeCase} + runCase={runComputeObject} /> )) ) : ( diff --git a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx index dd517bb6..12d9a360 100644 --- a/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx +++ b/src/pages/ModelPages/Compute/ComputeVariogram/ComputeVariogram.tsx @@ -1,6 +1,5 @@ import { Typography } from '@equinor/eds-core-react'; import { useState } from 'react'; - import { CaseCard } from '../../../../features/Compute/ComputeVariogram/CaseCard/CaseCard'; import { ComputeCaseInfoActions } from '../../../../features/Compute/ComputeVariogram/ComputeCaseInfoActions/ComputeCaseInfoActions'; import * as Styled from './ComputeVariogram.styled'; @@ -16,6 +15,7 @@ export interface CaseInfoTyoe { addText: string; runText: string; } + export const ComputeVariogram = () => { const [cases, setCases] = useState([ { id: '1', name: 'Variogram Case 1' }, @@ -50,8 +50,8 @@ export const ComputeVariogram = () => { key={c.id} id={c.id} name={c.name} - removeCase={removeCase} caseType={'variogram'} + removeCase={removeCase} /> )) ) : (