X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6182baa054abdd54389c91aca9ac710bd3869f08..0b569ee693ece680309ac9c114e975c9cb3e7f64:/services/workbench2/src/views-components/data-explorer/renderers.tsx diff --git a/services/workbench2/src/views-components/data-explorer/renderers.tsx b/services/workbench2/src/views-components/data-explorer/renderers.tsx index 56926b513d..45565c4a22 100644 --- a/services/workbench2/src/views-components/data-explorer/renderers.tsx +++ b/services/workbench2/src/views-components/data-explorer/renderers.tsx @@ -36,7 +36,6 @@ import { ResourceStatus as WorkflowStatus } from "views/workflow-panel/workflow- import { getUuidPrefix, openRunProcess } from "store/workflow-panel/workflow-panel-actions"; import { openSharingDialog } from "store/sharing-dialog/sharing-dialog-actions"; import { getUserFullname, getUserDisplayName, User, UserResource } from "models/user"; -import { toggleIsAdmin } from "store/users/users-actions"; import { LinkClass, LinkResource } from "models/link"; import { navigateTo, navigateToGroupDetails, navigateToUserProfile } from "store/navigation/navigation-action"; import { withResourceData } from "views-components/data-explorer/with-resources"; @@ -53,6 +52,18 @@ import { VirtualMachinesResource } from "models/virtual-machines"; import { CopyToClipboardSnackbar } from "components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar"; import { ProjectResource } from "models/project"; import { ProcessResource } from "models/process"; +import { ServiceRepository } from "services/services"; +import { loadUsersPanel } from "store/users/users-actions"; + +export const toggleIsAdmin = (uuid: string) => + async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + const { resources } = getState(); + const data = getResource(uuid)(resources); + const isAdmin = data!.isAdmin; + const newActivity = await services.userService.update(uuid, { isAdmin: !isAdmin }); + dispatch(loadUsersPanel()); + return newActivity; + }; const renderName = (dispatch: Dispatch, item: GroupContentsResource) => { const navFunc = "groupClass" in item && item.groupClass === GroupClass.ROLE ? navigateToGroupDetails : navigateTo; @@ -88,7 +99,7 @@ const renderName = (dispatch: Dispatch, item: GroupContentsResource) => { ); }; -const FrozenProject = (props: { item: ProjectResource }) => { +export const FrozenProject = (props: { item: ProjectResource }) => { const [fullUsername, setFullusername] = React.useState(null); const getFullName = React.useCallback(() => { if (props.item.frozenByUuid) {