-
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.
- Loading branch information
1 parent
1c2d93e
commit a49b05e
Showing
7 changed files
with
104 additions
and
30 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
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
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
59 changes: 59 additions & 0 deletions
59
...eatures/Results/CaseResult/CaseResultView/VariogramCaseResult/ImageResult/ImageResult.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,59 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { ImageView } from '../../../../../../components/ImageView/ImageView'; | ||
|
||
import { useMsal } from '@azure/msal-react'; | ||
import { | ||
GetVariogramResultsVariogramResultFileDto, | ||
ImagesService, | ||
} from '../../../../../../api/generated'; | ||
import { useAccessToken } from '../../../../../../hooks/useAccessToken'; | ||
|
||
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_'), | ||
); | ||
|
||
const imageId = wantedResultFile | ||
? wantedResultFile.variogramResultFileId | ||
: ''; | ||
|
||
const { data } = useQuery({ | ||
queryKey: ['model-cases', imageId], | ||
queryFn: () => ImagesService.getApiImagesVariogram(imageId), | ||
enabled: !!token, | ||
refetchInterval: 30000, | ||
}); | ||
|
||
// const [dataUri, setDataUri] = useState<Blob>(); | ||
|
||
// useEffect(() => { | ||
// function dataURItoBlob(dataURI: any) { | ||
// const byteString = atob(dataURI.split(',')[1]); | ||
// const ab = new ArrayBuffer(byteString.length); | ||
// const ia = new Uint8Array(ab); | ||
// for (let i = 0; i < byteString.length; i++) { | ||
// ia[i] = byteString.charCodeAt(i); | ||
// } | ||
// const bb = new Blob([ab]); | ||
// setDataUri(bb); | ||
// } | ||
|
||
// dataURItoBlob(data); | ||
// }, [data, isLoading]); | ||
|
||
// console.log(data); | ||
// console.log(dataUri); | ||
|
||
return ( | ||
<> | ||
<ImageView text="run" img={data} altText="run"></ImageView> | ||
</> | ||
); | ||
}; |
8 changes: 4 additions & 4 deletions
8
src/features/Results/CaseResult/CaseResultView/VariogramCaseResult/VariogramCaseResult.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