[arvados-workbench2] created: 2.4.0-131-g5550460d
git repository hosting
git at public.arvados.org
Fri Jun 10 11:14:53 UTC 2022
at 5550460d7ca90ad69b325ec58897cb0d55210bca (commit)
commit 5550460d7ca90ad69b325ec58897cb0d55210bca
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Thu Jun 9 15:58:55 2022 -0300
19007: Expands tests.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js
index 0b06e53e..1329191d 100644
--- a/cypress/integration/collection.spec.js
+++ b/cypress/integration/collection.spec.js
@@ -278,6 +278,13 @@ describe('Collection panel tests', function () {
.and(`${isWritable ? '' : 'not.'}contain`, 'Rename')
.and(`${isWritable ? '' : 'not.'}contain`, 'Remove');
cy.get('body').click(); // Collapse the menu
+ // File/dir item 'more options' button
+ cy.get('[data-cy=file-item-options-btn')
+ .first()
+ .click()
+ cy.get('[data-cy=context-menu]')
+ .should(`${isWritable ? '' : 'not.'}contain`, 'Remove');
+ cy.get('body').click(); // Collapse the menu
// Hamburger 'more options' menu button
cy.get('[data-cy=collection-files-panel-options-btn]')
.click()
diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx
index f565fba9..06b3c507 100644
--- a/src/components/collection-panel-files/collection-panel-files.tsx
+++ b/src/components/collection-panel-files/collection-panel-files.tsx
@@ -580,8 +580,11 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
</span>
<Tooltip title="More options" disableFocusListener>
<IconButton data-id='moreOptions'
+ data-cy='file-item-options-btn'
className={classes.moreOptionsButton}>
- <MoreOptionsIcon data-cy='file-item-options-btn' data-id='moreOptions' className={classes.moreOptions} />
+ <MoreOptionsIcon
+ data-id='moreOptions'
+ className={classes.moreOptions} />
</IconButton>
</Tooltip>
</div>
commit b7f56fcd62b9b91e6c806707a5fd12f03d88a92a
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Thu Jun 9 15:47:27 2022 -0300
19007: Removes unused code from the old file browser.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx
index 9c651e76..aeb8d68f 100644
--- a/src/components/file-tree/file-thumbnail.tsx
+++ b/src/components/file-tree/file-thumbnail.tsx
@@ -11,7 +11,7 @@ import { getInlineFileUrl, sanitizeToken } from "views-components/context-menu/a
import { connect } from "react-redux";
import { RootState } from "store/store";
-export interface FileThumbnailProps {
+interface FileThumbnailProps {
file: FileTreeData;
}
diff --git a/src/components/file-tree/file-tree-item.tsx b/src/components/file-tree/file-tree-item.tsx
index b522637d..d94c7297 100644
--- a/src/components/file-tree/file-tree-item.tsx
+++ b/src/components/file-tree/file-tree-item.tsx
@@ -2,71 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import React from "react";
-import { TreeItem } from "../tree/tree";
-import { DirectoryIcon, MoreOptionsIcon, DefaultIcon, FileIcon } from "../icon/icon";
-import { Typography, IconButton, StyleRulesCallback, withStyles, WithStyles, Tooltip } from '@material-ui/core';
-import { formatFileSize } from "common/formatters";
-import { ListItemTextIcon } from "../list-item-text-icon/list-item-text-icon";
-import { FileTreeData } from "./file-tree-data";
-
-type CssRules = "root" | "spacer" | "sizeInfo" | "button" | "moreOptions";
-
-const fileTreeItemStyle: StyleRulesCallback<CssRules> = theme => ({
- root: {
- display: "flex",
- alignItems: "center",
- paddingRight: `${theme.spacing.unit * 1.5}px`
- },
- spacer: {
- flex: "1"
- },
- sizeInfo: {
- width: `${theme.spacing.unit * 8}px`
- },
- button: {
- width: theme.spacing.unit * 3,
- height: theme.spacing.unit * 3,
- marginRight: theme.spacing.unit,
- },
- moreOptions: {
- position: 'absolute'
- }
-});
-
-export interface FileTreeItemProps {
- item: TreeItem<FileTreeData>;
- onMoreClick: (event: React.MouseEvent<any>, item: TreeItem<FileTreeData>) => void;
-}
-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.data.type)}
- 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
- data-cy='file-item-options-btn'
- className={classes.button}
- onClick={this.handleClick}>
- <MoreOptionsIcon className={classes.moreOptions} />
- </IconButton>
- </Tooltip>
- </div >
- </>;
- }
-
- handleClick = (event: React.MouseEvent<any>) => {
- this.props.onMoreClick(event, this.props.item);
- }
- });
+import { DirectoryIcon, DefaultIcon, FileIcon } from "../icon/icon";
export const getIcon = (type: string) => {
switch (type) {
diff --git a/src/components/file-tree/file-tree.tsx b/src/components/file-tree/file-tree.tsx
deleted file mode 100644
index e24fbb71..00000000
--- a/src/components/file-tree/file-tree.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import React from "react";
-import { TreeItem, TreeItemStatus } from "../tree/tree";
-import { VirtualTree as Tree } from "../tree/virtual-tree";
-import { FileTreeData } from "./file-tree-data";
-import { FileTreeItem } from "./file-tree-item";
-
-export interface FileTreeProps {
- items: Array<TreeItem<FileTreeData>>;
- onMenuOpen: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
- onSelectionToggle: (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => void;
- onCollapseToggle: (id: string, status: TreeItemStatus) => void;
- onFileClick: (id: string) => void;
- currentItemUuid?: string;
-}
-
-export class FileTree extends React.Component<FileTreeProps> {
- render() {
- return <Tree
- showSelection={true}
- items={this.props.items}
- disableRipple={true}
- render={this.renderItem}
- onContextMenu={this.handleContextMenu}
- toggleItemActive={this.handleToggleActive}
- toggleItemOpen={this.handleToggle}
- toggleItemSelection={this.handleSelectionChange}
- currentItemUuid={this.props.currentItemUuid} />;
- }
-
- handleContextMenu = (event: React.MouseEvent<any>, item: TreeItem<FileTreeData>) => {
- event.stopPropagation();
- this.props.onMenuOpen(event, item);
- }
-
- handleToggle = (event: React.MouseEvent<{}>, { id, status }: TreeItem<{}>) => {
- this.props.onCollapseToggle(id, status);
- }
-
- handleToggleActive = (_: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => {
- this.props.onFileClick(item.id);
- }
-
- handleSelectionChange = (event: React.MouseEvent<HTMLElement>, item: TreeItem<FileTreeData>) => {
- event.stopPropagation();
- this.props.onSelectionToggle(event, item);
- }
-
- renderItem = (item: TreeItem<FileTreeData>) =>
- <FileTreeItem
- item={item}
- onMoreClick={this.handleContextMenu} />
-
-}
commit 67543767e81f22686d3216700813714349f15f49
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date: Thu Jun 9 12:21:21 2022 -0300
19007: Brings the "More options" menu button back to the file browser.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>
diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx
index 42408270..f565fba9 100644
--- a/src/components/collection-panel-files/collection-panel-files.tsx
+++ b/src/components/collection-panel-files/collection-panel-files.tsx
@@ -8,7 +8,7 @@ import { connect } from 'react-redux';
import { FixedSizeList } from "react-window";
import AutoSizer from "react-virtualized-auto-sizer";
import servicesProvider from 'common/service-provider';
-import { CustomizeTableIcon, DownloadIcon } from 'components/icon/icon';
+import { CustomizeTableIcon, DownloadIcon, MoreOptionsIcon } from 'components/icon/icon';
import { SearchInput } from 'components/search-input/search-input';
import {
ListItemIcon,
@@ -60,6 +60,8 @@ type CssRules = "backButton"
| "pathPanelPathWrapper"
| "uploadButton"
| "uploadIcon"
+ | "moreOptionsButton"
+ | "moreOptions"
| "loader"
| "wrapper"
| "dataWrapper"
@@ -207,7 +209,18 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
},
uploadButton: {
float: 'right',
- }
+ },
+ moreOptionsButton: {
+ width: theme.spacing.unit * 3,
+ height: theme.spacing.unit * 3,
+ marginRight: theme.spacing.unit,
+ marginTop: 'auto',
+ marginBottom: 'auto',
+ justifyContent: 'center',
+ },
+ moreOptions: {
+ position: 'absolute'
+ },
});
const pathPromise = {};
@@ -375,17 +388,23 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
const handleClick = React.useCallback(
(event: any) => {
let isCheckbox = false;
+ let isMoreButton = false;
let elem = event.target;
if (elem.type === 'checkbox') {
isCheckbox = true;
}
+ // The "More options" button click event could be triggered on its
+ // internal graphic element.
+ else if ((elem.dataset && elem.dataset.id === 'moreOptions') || (elem.parentNode && elem.parentNode.dataset && elem.parentNode.dataset.id === 'moreOptions')) {
+ isMoreButton = true;
+ }
while (elem && elem.dataset && !elem.dataset.item) {
elem = elem.parentNode;
}
- if (elem && elem.dataset && !isCheckbox) {
+ if (elem && elem.dataset && !isCheckbox && !isMoreButton) {
const { parentPath, subfolderPath, breadcrumbPath, type } = elem.dataset;
if (breadcrumbPath) {
@@ -418,6 +437,14 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
const item = collectionPanelFiles[id];
props.onSelectionToggle(event, item);
}
+ if (isMoreButton) {
+ const { id } = elem.dataset;
+ const item: any = {
+ id,
+ data: rightData.find((elem) => elem.id === id),
+ };
+ onItemMenuOpen(event, item, isWritable);
+ }
},
[path, setPath, collectionPanelFiles] // eslint-disable-line react-hooks/exhaustive-deps
);
@@ -551,6 +578,12 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState
marginLeft: 'auto', marginRight: '1rem' }}>
{ formatFileSize(size) }
</span>
+ <Tooltip title="More options" disableFocusListener>
+ <IconButton data-id='moreOptions'
+ className={classes.moreOptionsButton}>
+ <MoreOptionsIcon data-cy='file-item-options-btn' data-id='moreOptions' className={classes.moreOptions} />
+ </IconButton>
+ </Tooltip>
</div>
} }</FixedSizeList>
: <div className={classes.rowEmpty}>This collection is empty</div>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list