forked from equinor/webviz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjustments according to review comments
- Loading branch information
1 parent
06065d1
commit f823a97
Showing
5 changed files
with
57 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { apiService } from "@framework/ApiService"; | ||
import { EnsembleSetAtom } from "@framework/GlobalAtoms"; | ||
|
||
import { atomWithQuery } from "jotai-tanstack-query"; | ||
|
||
import { ensembleIdentAtom } from "./baseAtoms"; | ||
|
||
const STALE_TIME = 60 * 1000; | ||
const CACHE_TIME = 60 * 1000; | ||
|
||
export const fieldWellboreTrajectoriesQueryAtom = atomWithQuery((get) => { | ||
const ensembleIdent = get(ensembleIdentAtom); | ||
const ensembleSet = get(EnsembleSetAtom); | ||
|
||
let fieldIdentifier: string | null = null; | ||
if (ensembleIdent) { | ||
const ensemble = ensembleSet.findEnsemble(ensembleIdent); | ||
if (ensemble) { | ||
fieldIdentifier = ensemble.getFieldIdentifier(); | ||
} | ||
} | ||
|
||
return { | ||
queryKey: ["getFieldWellboreTrajectories", fieldIdentifier ?? ""], | ||
queryFn: () => apiService.well.getFieldWellTrajectories(fieldIdentifier ?? ""), | ||
staleTime: STALE_TIME, | ||
gcTime: CACHE_TIME, | ||
enabled: Boolean(fieldIdentifier), | ||
}; | ||
}); |
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
22 changes: 22 additions & 0 deletions
22
frontend/src/modules/Intersection/view/atoms/queryAtoms.ts
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,22 @@ | ||
import { WellboreTrajectory_api } from "@api"; | ||
import { apiService } from "@framework/ApiService"; | ||
|
||
import { atomWithQuery } from "jotai-tanstack-query"; | ||
|
||
import { wellboreHeaderAtom } from "./baseAtoms"; | ||
|
||
const STALE_TIME = 60 * 1000; | ||
const CACHE_TIME = 60 * 1000; | ||
|
||
export const wellboreTrajectoryQueryAtom = atomWithQuery((get) => { | ||
const wellbore = get(wellboreHeaderAtom); | ||
|
||
return { | ||
queryKey: ["getWellboreTrajectory", wellbore?.uuid ?? ""], | ||
queryFn: () => apiService.well.getWellTrajectories(wellbore?.uuid ? [wellbore.uuid] : []), | ||
staleTime: STALE_TIME, | ||
gcTime: CACHE_TIME, | ||
select: (data: WellboreTrajectory_api[]) => data[0], | ||
enabled: wellbore?.uuid ? true : false, | ||
}; | ||
}); |
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