// SPDX-License-Identifier: AGPL-3.0
import React from "react";
-import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox, Chip } from "@material-ui/core";
+import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox, Chip, withTheme } from "@material-ui/core";
import { FavoriteStar, PublicFavoriteStar } from "../favorite-star/favorite-star";
import { Resource, ResourceKind, TrashableResource } from "models/resource";
import {
ActiveIcon,
SetupIcon,
InactiveIcon,
+ ErrorIcon,
} from "components/icon/icon";
import { formatDate, formatFileSize, formatTime } from "common/formatters";
import { resourceLabel } from "common/labels";
import { CopyToClipboardSnackbar } from "components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar";
import { ProjectResource } from "models/project";
import { ProcessResource } from "models/process";
-import { setBreadcrumbs } from "store/breadcrumbs/breadcrumbs-actions";
+import { InlinePulser } from "components/loading/inline-pulser";
const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
const navFunc = "groupClass" in item && item.groupClass === GroupClass.ROLE ? navigateToGroupDetails : navigateTo;
<Typography
color="primary"
style={{ width: "auto", cursor: "pointer" }}
- onClick={() => dispatch<any>(navFunc(item.uuid))}
+ onClick={(ev) => {
+ ev.stopPropagation()
+ dispatch<any>(navFunc(item.uuid))
+ }}
>
{item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION ? <IllegalNamingWarning name={item.name} /> : null}
{item.name}
const renderResourceLink = (dispatch: Dispatch, item: Resource ) => {
var displayName = getResourceDisplayName(item);
-console.log(displayName, item)
+
return (
<Typography
noWrap
onClick={() => {
item.kind === ResourceKind.GROUP && (item as GroupResource).groupClass === "role"
? dispatch<any>(navigateToGroupDetails(item.uuid))
- : item.kind === ResourceKind.USER
+ : item.kind === ResourceKind.USER
? dispatch<any>(navigateToUserProfile(item.uuid))
- : dispatch<any>(navigateTo(item.uuid));
+ : dispatch<any>(navigateTo(item.uuid));
}}
>
{resourceLabel(item.kind, item && item.kind === ResourceKind.GROUP ? (item as GroupResource).groupClass || "" : "")}:{" "}
export const ResourceLinkTail = connect((state: RootState, props: { uuid: string }) => {
const resource = getResource<LinkResource>(props.uuid)(state.resources);
const tailResource = getResource<Resource>(resource?.tailUuid || "")(state.resources);
- const userUuid = state.auth.user?.uuid
return {
item: tailResource || { uuid: resource?.tailUuid || "", kind: resource?.tailKind || ResourceKind.NONE },
<Typography
style={{ color: theme.palette.primary.main }}
inline
- noWrap
>
{uuid}
</Typography>
<Typography
style={{ color: theme.palette.primary.main }}
inline
- noWrap
>
{userFullname} ({uuid})
</Typography>
}
}
);
+
+export const GroupMembersCount = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const group = getResource<GroupResource>(props.uuid)(state.resources);
+
+ return {
+ value: group?.memberCount,
+ };
+
+ }
+)(withTheme()((props: {value: number | null | undefined, theme:ArvadosTheme}) => {
+ if (props.value === undefined) {
+ // Loading
+ return <Typography component={"div"}>
+ <InlinePulser />
+ </Typography>;
+ } else if (props.value === null) {
+ // Error
+ return <Typography>
+ <Tooltip title="Failed to load member count">
+ <ErrorIcon style={{color: props.theme.customs.colors.greyL}}/>
+ </Tooltip>
+ </Typography>;
+ } else {
+ return <Typography children={props.value} />;
+ }
+}));