[ARVADOS-WORKBENCH2] created: 1.3.0-12-g0070db3
Git user
git at public.curoverse.com
Mon Dec 3 09:43:49 EST 2018
at 0070db330ad6cbd9078b0c9f10bd18a32e4d1012 (commit)
commit 0070db330ad6cbd9078b0c9f10bd18a32e4d1012
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:43:37 2018 +0100
Add more space before and after ImageFileThumbnail
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx
index cb071ad..324156a 100644
--- a/src/components/file-tree/file-thumbnail.tsx
+++ b/src/components/file-tree/file-thumbnail.tsx
@@ -20,11 +20,12 @@ export const FileThumbnail =
type ImageFileThumbnailCssRules = 'thumbnail';
-const imageFileThumbnailStyle = withStyles<ImageFileThumbnailCssRules>({
+const imageFileThumbnailStyle = withStyles<ImageFileThumbnailCssRules>(theme => ({
thumbnail: {
maxWidth: 250,
+ margin: `${theme.spacing.unit}px 0`,
}
-});
+}));
const ImageFileThumbnail = imageFileThumbnailStyle(
({ classes, file }: WithStyles<ImageFileThumbnailCssRules> & FileThumbnailProps) =>
commit bd90d772a159901336b119b0ad82109e3ec1d9fc
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:41:43 2018 +0100
Set ImageFileThumbnail to file's url
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx
index d782e60..cb071ad 100644
--- a/src/components/file-tree/file-thumbnail.tsx
+++ b/src/components/file-tree/file-thumbnail.tsx
@@ -32,5 +32,6 @@ const ImageFileThumbnail = imageFileThumbnailStyle(
? null
: <img
className={classes.thumbnail}
- alt={file.name} />
+ alt={file.name}
+ src={file.url} />
);
commit 4b1c3715e20a9a1b9b10f419c2cd88fe51fbbfbe
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:41:16 2018 +0100
Update collection-panel-files to pass file url files tree
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/views-components/collection-panel-files/collection-panel-files.ts b/src/views-components/collection-panel-files/collection-panel-files.ts
index 294bd6d..d912ac1 100644
--- a/src/views-components/collection-panel-files/collection-panel-files.ts
+++ b/src/views-components/collection-panel-files/collection-panel-files.ts
@@ -18,8 +18,8 @@ import { FileTreeData } from "~/components/file-tree/file-tree-data";
import { Dispatch } from "redux";
import { collectionPanelFilesAction } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
import { ContextMenuKind } from "../context-menu/context-menu";
-import { getNode, getNodeChildrenIds, Tree } from "~/models/tree";
-import { CollectionFileType } from "~/models/collection-file";
+import { getNode, getNodeChildrenIds, Tree, TreeNode, initTreeNode } from "~/models/tree";
+import { CollectionFileType, createCollectionDirectory } from "~/models/collection-file";
import { openContextMenu, openCollectionFilesContextMenu } from '~/store/context-menu/context-menu-actions';
import { openUploadCollectionFilesDialog } from '~/store/collections/collection-upload-actions';
import { ResourceKind } from "~/models/resource";
@@ -63,23 +63,22 @@ export const CollectionPanelFiles = connect(memoizedMapStateToProps(), mapDispat
const collectionItemToTreeItem = (tree: Tree<CollectionPanelDirectory | CollectionPanelFile>) =>
(id: string): TreeItem<FileTreeData> => {
- const node = getNode(id)(tree) || {
+ const node: TreeNode<CollectionPanelDirectory | CollectionPanelFile> = getNode(id)(tree) || initTreeNode({
id: '',
- children: [],
parent: '',
value: {
- name: 'Invalid node',
- type: CollectionFileType.DIRECTORY,
+ ...createCollectionDirectory({ name: 'Invalid file' }),
selected: false,
collapsed: true
}
- };
+ });
return {
active: false,
data: {
name: node.value.name,
size: node.value.type === CollectionFileType.FILE ? node.value.size : undefined,
- type: node.value.type
+ type: node.value.type,
+ url: node.value.url,
},
id: node.id,
items: getNodeChildrenIds(node.id)(tree)
commit 6679f4cd3a96759e165ba52d20a2296a94638b46
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:40:03 2018 +0100
Add url to FileTreeData
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/file-tree/file-tree-data.ts b/src/components/file-tree/file-tree-data.ts
index 4be4ace..4154611 100644
--- a/src/components/file-tree/file-tree-data.ts
+++ b/src/components/file-tree/file-tree-data.ts
@@ -5,5 +5,6 @@
export interface FileTreeData {
name: string;
type: string;
+ url: string;
size?: number;
}
commit 0259a44c3a1ab6f8e9ce24ce60c8fbb09aa3ee70
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:22:15 2018 +0100
Create FileThumbnail
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx
new file mode 100644
index 0000000..d782e60
--- /dev/null
+++ b/src/components/file-tree/file-thumbnail.tsx
@@ -0,0 +1,36 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import isImage from 'is-image';
+import { withStyles, WithStyles } from '@material-ui/core';
+import { FileTreeData } from '~/components/file-tree/file-tree-data';
+import { CollectionFileType } from '~/models/collection-file';
+
+export interface FileThumbnailProps {
+ file: FileTreeData;
+}
+
+export const FileThumbnail =
+ ({ file }: FileThumbnailProps) =>
+ file.type === CollectionFileType.FILE && isImage(file.name)
+ ? <ImageFileThumbnail file={file} />
+ : null;
+
+type ImageFileThumbnailCssRules = 'thumbnail';
+
+const imageFileThumbnailStyle = withStyles<ImageFileThumbnailCssRules>({
+ thumbnail: {
+ maxWidth: 250,
+ }
+});
+
+const ImageFileThumbnail = imageFileThumbnailStyle(
+ ({ classes, file }: WithStyles<ImageFileThumbnailCssRules> & FileThumbnailProps) =>
+ file.type === CollectionFileType.DIRECTORY
+ ? null
+ : <img
+ className={classes.thumbnail}
+ alt={file.name} />
+);
diff --git a/src/components/file-tree/file-tree-item.tsx b/src/components/file-tree/file-tree-item.tsx
index 89bf43c..0e8c92e 100644
--- a/src/components/file-tree/file-tree-item.tsx
+++ b/src/components/file-tree/file-tree-item.tsx
@@ -9,6 +9,7 @@ import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles, Too
import { formatFileSize } from "~/common/formatters";
import { ListItemTextIcon } from "../list-item-text-icon/list-item-text-icon";
import { FileTreeData } from "./file-tree-data";
+import { FileThumbnail } from '~/components/file-tree/file-thumbnail';
type CssRules = "root" | "spacer" | "sizeInfo" | "button" | "moreOptions";
@@ -42,22 +43,25 @@ export const FileTreeItem = withStyles(fileTreeItemStyle)(
class extends React.Component<FileTreeItemProps & WithStyles<CssRules>> {
render() {
const { classes, item } = this.props;
- return <div className={classes.root}>
- <ListItemTextIcon
- icon={getIcon(item)}
- name={item.data.name} />
- <div className={classes.spacer} />
- <Typography
- className={classes.sizeInfo}
- variant="caption">{formatFileSize(item.data.size)}</Typography>
- <Tooltip title="More options" disableFocusListener>
- <IconButton
- className={classes.button}
- onClick={this.handleClick}>
- <MoreOptionsIcon className={classes.moreOptions}/>
- </IconButton>
- </Tooltip>
- </div >;
+ return <>
+ <div className={classes.root}>
+ <ListItemTextIcon
+ icon={getIcon(item)}
+ name={item.data.name} />
+ <div className={classes.spacer} />
+ <Typography
+ className={classes.sizeInfo}
+ variant="caption">{formatFileSize(item.data.size)}</Typography>
+ <Tooltip title="More options" disableFocusListener>
+ <IconButton
+ className={classes.button}
+ onClick={this.handleClick}>
+ <MoreOptionsIcon className={classes.moreOptions} />
+ </IconButton>
+ </Tooltip>
+ </div >
+ <FileThumbnail file={item.data} />
+ </>;
}
handleClick = (event: React.MouseEvent<any>) => {
commit 86756a239efd4b410295b403ff712a4b3e7304f5
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Dec 3 15:21:51 2018 +0100
Add is-image dependency
Feature #14563
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/package.json b/package.json
index 64a24dc..623b86d 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"classnames": "2.2.6",
"cwlts": "1.15.29",
"debounce": "1.2.0",
+ "is-image": "2.0.0",
"js-yaml": "3.12.0",
"lodash": "4.17.11",
"react": "16.5.2",
diff --git a/typings/global.d.ts b/typings/global.d.ts
index b9f1cc6..93aa3cf 100644
--- a/typings/global.d.ts
+++ b/typings/global.d.ts
@@ -13,4 +13,8 @@ declare interface System {
declare var System: System;
declare module 'react-splitter-layout';
-declare module 'react-rte';
\ No newline at end of file
+declare module 'react-rte';
+
+declare module 'is-image' {
+ export default function isImage(value: string): boolean;
+}
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 1eaa15f..f08c370 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4329,6 +4329,11 @@ ignore-walk@^3.0.1:
dependencies:
minimatch "^3.0.4"
+image-extensions@^1.0.1:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/image-extensions/-/image-extensions-1.1.0.tgz#b8e6bf6039df0056e333502a00b6637a3105d894"
+ integrity sha1-uOa/YDnfAFbjM1AqALZjejEF2JQ=
+
immutable@^3.8.1:
version "3.8.2"
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
@@ -4644,6 +4649,13 @@ is-glob@^4.0.0:
dependencies:
is-extglob "^2.1.1"
+is-image at 2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-image/-/is-image-2.0.0.tgz#454c9569578de31869371fbfaea4958f461b3e0c"
+ integrity sha1-RUyVaVeN4xhpNx+/rqSVj0YbPgw=
+ dependencies:
+ image-extensions "^1.0.1"
+
is-in-browser@^1.0.2, is-in-browser@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-in-browser/-/is-in-browser-1.1.3.tgz#56ff4db683a078c6082eb95dad7dc62e1d04f835"
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list