diff --git a/backend/src/config.py b/backend/src/config.py index dec6095e4..b33374ac2 100644 --- a/backend/src/config.py +++ b/backend/src/config.py @@ -16,7 +16,7 @@ SMDA_SUBSCRIPTION_KEY = os.environ["WEBVIZ_SMDA_SUBSCRIPTION_KEY"] SMDA_RESOURCE_SCOPE = os.environ["WEBVIZ_SMDA_RESOURCE_SCOPE"] SUMO_ENV = os.getenv("WEBVIZ_SUMO_ENV", "dev") -GRAPH_SCOPES = ["User.ReadBasic.All"] +GRAPH_SCOPES = ["User.Read", "User.ReadBasic.All"] RESOURCE_SCOPES_DICT = { "sumo": [f"api://{sumo_app_reg[SUMO_ENV]['RESOURCE_ID']}/access_as_user"], diff --git a/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx b/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx index f0982bb09..8e65c388c 100644 --- a/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx +++ b/frontend/src/framework/internal/components/SelectEnsemblesDialog/private-components/userAvatar.tsx @@ -18,7 +18,7 @@ function useUserInfoQuery( ): UseQueryResult { return useQuery({ queryKey: ["getUserInfo", userId], - queryFn: () => apiService.graph.userInfo(userId), + queryFn: () => apiService.graph.userInfo(`${userId.toUpperCase()}@equinor.com`), staleTime: STALE_TIME, cacheTime: CACHE_TIME, enabled: userId !== "", @@ -42,5 +42,5 @@ export const UserAvatar: React.FC = (props) => { /> ); } - return ; + return ; } \ No newline at end of file diff --git a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx index 06729a6fa..90e07bc3d 100644 --- a/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx +++ b/frontend/src/framework/internal/components/SelectEnsemblesDialog/selectEnsemblesDialog.tsx @@ -2,6 +2,7 @@ import React from "react"; import { CaseInfo_api, EnsembleInfo_api } from "@api"; import { apiService } from "@framework/ApiService"; +import { useAuthProvider } from "@framework/internal/providers/AuthProvider"; import { ApiStateWrapper } from "@lib/components/ApiStateWrapper"; import { Button } from "@lib/components/Button"; import { CircularProgress } from "@lib/components/CircularProgress"; @@ -10,12 +11,15 @@ import { Dropdown } from "@lib/components/Dropdown"; import { IconButton } from "@lib/components/IconButton"; import { Label } from "@lib/components/Label"; import { Select } from "@lib/components/Select"; +import { Switch } from "@lib/components/Switch"; +import { TableSelect, TableSelectOption } from "@lib/components/TableSelect"; +import { TagPicker } from "@lib/components/TagPicker"; import { useValidState } from "@lib/hooks/useValidState"; import { Add, Check, Remove } from "@mui/icons-material"; import { useQuery } from "@tanstack/react-query"; import { isEqual } from "lodash"; -import { Switch } from "@lib/components/Switch"; + import { UserAvatar } from "./private-components/userAvatar"; export type EnsembleItem = { @@ -47,6 +51,8 @@ export const SelectEnsemblesDialog: React.FC = (prop users: [], }); + const { userInfo } = useAuthProvider(); + React.useLayoutEffect(() => { setNewlySelectedEnsembles(props.selectedEnsembles); }, [props.selectedEnsembles]); @@ -179,13 +185,23 @@ export const SelectEnsemblesDialog: React.FC = (prop filteredCases = filteredCases.filter((c) => c.status === "keep"); } if (casesFilteringOptions.onlyMyCases) { - filteredCases = filteredCases.filter((c) => c.user === "me"); + filteredCases = filteredCases.filter((c) => c.user === userInfo?.username.replace("@equinor.com", "")); + } else if (casesFilteringOptions.users.length > 0) { + filteredCases = filteredCases.filter((c) => casesFilteringOptions.users.includes(c.user)); } return filteredCases; } const fieldOpts = fieldsQuery.data?.map((f) => ({ value: f.field_identifier, label: f.field_identifier })) ?? []; - const caseOpts = filterCases(casesQuery.data)?.map((c) => ({ value: c.uuid, label: c.name, icon: })) ?? []; + const caseOpts: TableSelectOption[] = + filterCases(casesQuery.data)?.map((el) => ({ + id: el.uuid, + values: [ + { label: el.name }, + { label: el.user, adornment: }, + { label: el.status }, + ], + })) ?? []; const ensembleOpts = ensemblesQuery.data?.map((e) => ({ value: e.name, label: `${e.name} (${e.realization_count} reals)` })) ?? []; @@ -199,6 +215,7 @@ export const SelectEnsemblesDialog: React.FC = (prop title="Select ensembles" modal width={"75%"} + minWidth={800} actions={
+ ))} + + )} +
setHasFocus(true)} + onBlur={() => setHasFocus(false)} + tabIndex={0} + > + {filteredOptions.length === 0 && ( +
+ {props.options.length === 0 || filters.some((el) => el !== "") + ? noMatchingOptionsText + : noOptionsText} +
+ )} + { + return ( +
{ + if (option.disabled) { + return; + } + toggleValue(option, index); + }} + style={{ height: 24 }} + > + {option.values.map((value, index) => { + return ( +
0, + })} + style={{ width: `${columnSizesPerc[index]}%` }} + > + {value.adornment} + + {value.label} + +
+ ); + })} +
+ ); + }} + direction="vertical" + startIndex={startIndex} + /> +
+ + + ); +}); + +TableSelect.displayName = "TableSelect";