diff --git a/src/components/ImageView/ImageView.tsx b/src/components/ImageView/ImageView.tsx index bee0c726..f40b0db4 100644 --- a/src/components/ImageView/ImageView.tsx +++ b/src/components/ImageView/ImageView.tsx @@ -10,24 +10,6 @@ export const ImageView = ({ img: string; altText: string; }) => { - // function _arrayBufferToBase64(buffer: any) { - // let binary = ''; - // const bytes = new Uint8Array(buffer); - // const len = bytes.byteLength; - // for (let i = 0; i < len; i++) { - // binary += String.fromCharCode(bytes[i]); - // } - // return window.btoa(binary); - // } - - // const [res, setRes] = useState(); - - // useEffect(() => { - // const res = _arrayBufferToBase64(img); - // setRes(res); - // }, [img]); - // console.log(res); - return ( {altText} @@ -35,5 +17,3 @@ export const ImageView = ({ ); }; - -// `data:image/png;base64,${img}` diff --git a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.tsx b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.tsx index 2e3afaa7..c1a71631 100644 --- a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.tsx +++ b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.tsx @@ -1,19 +1,13 @@ import { useQuery } from '@tanstack/react-query'; -// import { ImageView } from '../../../../../../components/ImageView/ImageView'; - -import { useMsal } from '@azure/msal-react'; -import { GetVariogramResultsVariogramResultFileDto } from '../../../../../../api/generated'; -import { useAccessToken } from '../../../../../../hooks/useAccessToken'; import { getVariogramImage } from '../../../../../../api/custom/getImageById'; -// import { ImageView } from '../../../../../../components/ImageView/ImageView'; +import { GetVariogramResultsVariogramResultFileDto } from '../../../../../../api/generated'; +import { ImageView } from '../../../../../../components/ImageView/ImageView'; export const ImageResult = ({ resultFiels, }: { resultFiels: GetVariogramResultsVariogramResultFileDto[]; }) => { - const { instance, accounts } = useMsal(); - const token = useAccessToken(instance, accounts[0]); const wantedResultFile = resultFiels.find((x) => x.fileName.includes('variogram_slices_'), ); @@ -23,16 +17,17 @@ export const ImageResult = ({ : ''; const { data } = useQuery({ - queryKey: ['model-cases', imageId], + queryKey: ['case-image', imageId], queryFn: () => getVariogramImage(imageId), - enabled: !!token, - refetchInterval: 30000, }); return ( <> - lol - {/* */} + ); }; diff --git a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramCaseResult.tsx b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramCaseResult.tsx index 8aa808e7..13d4c596 100644 --- a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramCaseResult.tsx +++ b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramCaseResult.tsx @@ -9,8 +9,6 @@ export const VariogramCaseResult = ({ }: { resultList: GetVariogramResultsDto[]; }) => { - console.log(resultList); - return ( <> {resultList.map((item) => ( diff --git a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramResultTable.tsx b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramResultTable.tsx index a32a0e29..73f64c1c 100644 --- a/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramResultTable.tsx +++ b/src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramResultTable.tsx @@ -1,25 +1,43 @@ import { Table } from '@equinor/eds-core-react'; import { GetVariogramResultsDto } from '../../../../../api/generated'; +import { useFetchCases } from '../../../../../hooks/useFetchCases'; + +const NumberOfDecimals = 3; export const VariogramResultTable = ({ data, }: { data: GetVariogramResultsDto; }) => { + const roundResultString = (value?: number) => { + if (value) { + return value.toFixed(NumberOfDecimals); + } + }; + const caseList = useFetchCases(); + const resultCase = caseList.data?.data.filter( + (c) => c.computeCaseId === data.computeCaseId, + ); + + // console.log(data); + // console.log(resultCase && resultCase[0]); + return ( Quality factor - {data.quality} + {roundResultString(data.quality)} Model area - --Data-- + {resultCase && resultCase[0].modelArea.name} Compute method - --Method-- + + {resultCase && resultCase[0].computeMethod.name} + Attribute @@ -31,7 +49,7 @@ export const VariogramResultTable = ({ Sigma - {data.sigma} + {roundResultString(data.sigma)}