X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a56e6e6db2fa45008f9a3a1023f91207ea9f4f9a..01cd85043c8692b8fd743e87a304e23be6172e21:/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 4ecbc7e10b..e337423802 100644 --- a/services/workbench2/src/views-components/data-explorer/renderers.tsx +++ b/services/workbench2/src/views-components/data-explorer/renderers.tsx @@ -37,7 +37,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"; @@ -54,7 +53,20 @@ 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"; import { InlinePulser } from "components/loading/inline-pulser"; +import { ProcessTypeFilter } from "store/resource-type-filters/resource-type-filters"; + +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; @@ -90,7 +102,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) { @@ -449,8 +461,6 @@ export const TokenApiToken = withResourceData("apiToken", renderCommonData); export const TokenCreatedByIpAddress = withResourceData("createdByIpAddress", renderCommonDate); -export const TokenDefaultOwnerUuid = withResourceData("defaultOwnerUuid", renderCommonData); - export const TokenExpiresAt = withResourceData("expiresAt", renderCommonDate); export const TokenLastUsedAt = withResourceData("lastUsedAt", renderCommonDate); @@ -903,7 +913,6 @@ const _resourceWithName = withStyles( {uuid} @@ -914,7 +923,6 @@ const _resourceWithName = withStyles( {userFullname} ({uuid}) @@ -1028,7 +1036,18 @@ const renderType = (type: string, subtype: string) => {resour export const ResourceType = connect((state: RootState, props: { uuid: string }) => { const resource = getResource(props.uuid)(state.resources); - return { type: resource ? resource.kind : "", subtype: resource && resource.kind === ResourceKind.GROUP ? resource.groupClass : "" }; + return { + type: resource ? resource.kind : "", + subtype: resource + ? resource.kind === ResourceKind.GROUP + ? resource.groupClass + : resource.kind === ResourceKind.PROCESS + ? resource.requestingContainerUuid + ? ProcessTypeFilter.CHILD_PROCESS + : ProcessTypeFilter.MAIN_PROCESS + : "" + : "" + }; })((props: { type: string; subtype: string }) => renderType(props.type, props.subtype)); export const ResourceStatus = connect((state: RootState, props: { uuid: string }) => {