projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
21621: Add unit test for json copy to clipboard
[arvados.git]
/
services
/
workbench2
/
src
/
views-components
/
details-panel
/
details-panel.tsx
diff --git
a/services/workbench2/src/views-components/details-panel/details-panel.tsx
b/services/workbench2/src/views-components/details-panel/details-panel.tsx
index 8a05f11969ecb0cf680eb526243096a387c6614f..eb6e65d64579f2b8b6df59dab853029db83c4016 100644
(file)
--- a/
services/workbench2/src/views-components/details-panel/details-panel.tsx
+++ b/
services/workbench2/src/views-components/details-panel/details-panel.tsx
@@
-15,6
+15,7
@@
import { EmptyResource } from 'models/empty';
import { Dispatch } from "redux";
import { ResourceKind } from "models/resource";
import { ProjectDetails } from "./project-details";
import { Dispatch } from "redux";
import { ResourceKind } from "models/resource";
import { ProjectDetails } from "./project-details";
+import { RootProjectDetails } from './root-project-details';
import { CollectionDetails } from "./collection-details";
import { ProcessDetails } from "./process-details";
import { EmptyDetails } from "./empty-details";
import { CollectionDetails } from "./collection-details";
import { ProcessDetails } from "./process-details";
import { EmptyDetails } from "./empty-details";
@@
-65,7
+66,7
@@
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
const EMPTY_RESOURCE: EmptyResource = { kind: undefined, name: 'Projects' };
const EMPTY_RESOURCE: EmptyResource = { kind: undefined, name: 'Projects' };
-const getItem = (res: DetailsResource): DetailsData => {
+const getItem = (res: DetailsResource
, pathName: string
): DetailsData => {
if ('kind' in res) {
switch (res.kind) {
case ResourceKind.PROJECT:
if ('kind' in res) {
switch (res.kind) {
case ResourceKind.PROJECT:
@@
-76,15
+77,20
@@
const getItem = (res: DetailsResource): DetailsData => {
return new ProcessDetails(res);
case ResourceKind.WORKFLOW:
return new WorkflowDetails(res);
return new ProcessDetails(res);
case ResourceKind.WORKFLOW:
return new WorkflowDetails(res);
+ case ResourceKind.USER:
+ if(pathName.includes('projects')) {
+ return new RootProjectDetails(res);
+ }
+ return new EmptyDetails(EMPTY_RESOURCE);
default:
default:
- return new EmptyDetails(res);
+ return new EmptyDetails(res
as EmptyResource
);
}
} else {
return new FileDetails(res);
}
};
}
} else {
return new FileDetails(res);
}
};
-const mapStateToProps = ({ auth, detailsPanel, resources, collectionPanelFiles, selectedResourceUuid, properties }: RootState) => {
+const mapStateToProps = ({ auth, detailsPanel, resources, collectionPanelFiles, selectedResourceUuid, properties
, router
}: RootState) => {
const resource = getResource(selectedResourceUuid ?? properties.currentRouteUuid)(resources) as DetailsResource | undefined;
const file = resource
? undefined
const resource = getResource(selectedResourceUuid ?? properties.currentRouteUuid)(resources) as DetailsResource | undefined;
const file = resource
? undefined
@@
-101,6
+107,7
@@
const mapStateToProps = ({ auth, detailsPanel, resources, collectionPanelFiles,
isOpened: detailsPanel.isOpened,
tabNr: detailsPanel.tabNr,
res: resource || (file && file.value) || EMPTY_RESOURCE,
isOpened: detailsPanel.isOpened,
tabNr: detailsPanel.tabNr,
res: resource || (file && file.value) || EMPTY_RESOURCE,
+ pathname: router.location ? router.location.pathname : "",
};
};
};
};
@@
-121,6
+128,7
@@
export interface DetailsPanelDataProps {
tabNr: number;
res: DetailsResource;
isFrozen: boolean;
tabNr: number;
res: DetailsResource;
isFrozen: boolean;
+ pathname: string;
}
type DetailsPanelProps = DetailsPanelDataProps & WithStyles<CssRules>;
}
type DetailsPanelProps = DetailsPanelDataProps & WithStyles<CssRules>;
@@
-160,8
+168,7
@@
export const DetailsPanel = withStyles(styles)(
}
renderContent() {
}
renderContent() {
- const { classes, onCloseDrawer, res, tabNr, authConfig } = this.props;
-
+ const { classes, onCloseDrawer, res, tabNr, authConfig, pathname } = this.props;
let shouldShowInlinePreview = false;
if (!('kind' in res)) {
shouldShowInlinePreview = isInlineFileUrlSafe(
let shouldShowInlinePreview = false;
if (!('kind' in res)) {
shouldShowInlinePreview = isInlineFileUrlSafe(
@@
-171,7
+178,7
@@
export const DetailsPanel = withStyles(styles)(
) || authConfig.clusterConfig.Collections.TrustAllContent;
}
) || authConfig.clusterConfig.Collections.TrustAllContent;
}
- const item = getItem(res);
+ const item = getItem(res
, pathname
);
return <Grid
data-cy='details-panel'
container
return <Grid
data-cy='details-panel'
container