--- /dev/null
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+---
+"$graph":
+- class: Workflow
+ cwlVersion: v1.2
+ hints:
+ - acrContainerImage: 7009415fdc959d0c2819ee2e9db96561+261
+ class: http://arvados.org/cwl#WorkflowRunnerResources
+ id: "#main"
+ inputs:
+ - default: []
+ id: "#main/bar"
+ type:
+ items: Directory
+ type: array
+ - default: []
+ id: "#main/foo"
+ type:
+ items: File
+ type: array
+ outputs: []
+ steps: []
+cwlVersion: v1.2
});
});
});
+
+ it('can select multi files when creating workflow', () => {
+ cy.createProject({
+ owningUser: activeUser,
+ projectName: 'myProject1',
+ addToFavorites: true
+ });
+
+ cy.createCollection(adminUser.token, {
+ name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+ owner_uuid: activeUser.user.uuid,
+ manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
+ })
+ .as('testCollection');
+
+ cy.createCollection(adminUser.token, {
+ name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+ owner_uuid: activeUser.user.uuid,
+ manifest_text: `. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:buz\n`
+ })
+ .as('testCollection2');
+
+ cy.getAll('@myProject1', '@testCollection', '@testCollection2')
+ .then(function ([myProject1, testCollection, testCollection2]) {
+ cy.readFile('cypress/fixtures/workflow_with_array_fields.yaml').then(workflow => {
+ cy.createWorkflow(adminUser.token, {
+ name: `TestWorkflow${Math.floor(Math.random() * 999999)}.cwl`,
+ definition: workflow,
+ owner_uuid: myProject1.uuid,
+ })
+ .as('testWorkflow');
+ });
+
+ cy.loginAs(activeUser);
+
+ cy.get('main').contains(myProject1.name).click();
+
+ cy.get('[data-cy=side-panel-button]').click();
+
+ cy.get('#aside-menu-list').contains('Run a process').click();
+
+ cy.get('@testWorkflow')
+ .then((testWorkflow) => {
+ cy.get('main').contains(testWorkflow.name).click();
+ cy.get('[data-cy=run-process-next-button]').click();
+
+ cy.get('label').contains('#main/foo').parent('div').find('input').click();
+ cy.get('div[role=dialog]')
+ .within(() => {
+ cy.get('p').contains('Projects').closest('div[role=button]')
+ .within(() => {
+ cy.get('svg[role=presentation]')
+ .click({ multiple: true });
+ });
+
+ cy.get(`[data-id=${testCollection.uuid}]`)
+ .find('i').click();
+
+ cy.contains('bar').closest('[data-action=TOGGLE_ACTIVE]').parent().find('input[type=checkbox]').click();
+
+ cy.contains('baz').closest('[data-action=TOGGLE_ACTIVE]').parent().find('input[type=checkbox]').click();
+
+ cy.get('[data-cy=ok-button]').click();
+ });
+
+ cy.get('label').contains('#main/bar').parent('div').find('input').click();
+ cy.get('div[role=dialog]')
+ .within(() => {
+ cy.get('p').contains('Projects').closest('div[role=button]')
+ .within(() => {
+ cy.get('svg[role=presentation]')
+ .click({ multiple: true });
+ });
+
+ cy.get(`[data-id=${testCollection.uuid}]`)
+ .find('input[type=checkbox]').click();
+
+ cy.get(`[data-id=${testCollection2.uuid}]`)
+ .find('input[type=checkbox]').click();
+
+ cy.get('[data-cy=ok-button]').click();
+ });
+ });
+
+ cy.get('label').contains('#main/foo').parent('div')
+ .within(() => {
+ cy.contains('baz');
+ cy.contains('bar');
+ });
+
+ cy.get('label').contains('#main/bar').parent('div')
+ .within(() => {
+ cy.contains(testCollection.name);
+ cy.contains(testCollection2.name);
+ });
+ });
+ });
});
\ No newline at end of file
getProperArrowAnimation: Function;
itemsMap?: Map<string, TreeItem<any>>;
classes: any;
+ showSelection: any;
+ useRadioButtons?: boolean;
+ handleCheckboxChange: Function;
}
const FLAT_TREE_ACTIONS = {
toggleActive: 'TOGGLE_ACTIVE',
};
-const ItemIcon = React.memo(({type, kind, active, groupClass, classes}: any) => {
+const ItemIcon = React.memo(({ type, kind, active, groupClass, classes }: any) => {
let Icon = ProjectIcon;
if (groupClass === GroupClass.FILTER) {
}
if (kind) {
- switch(kind) {
+ switch (kind) {
case ResourceKind.COLLECTION:
Icon = CollectionIcon;
break;
{props.getProperArrowAnimation(item.status, item.items!)}
</ListItemIcon>
</i>
+ {props.showSelection(item) && !props.useRadioButtons &&
+ <Checkbox
+ checked={item.selected}
+ className={props.classes.checkbox}
+ color="primary"
+ onClick={props.handleCheckboxChange(item)} />}
+ {props.showSelection(item) && props.useRadioButtons &&
+ <Radio
+ checked={item.selected}
+ className={props.classes.checkbox}
+ color="primary" />}
<div data-action={FLAT_TREE_ACTIONS.toggleActive} className={props.classes.renderContainer}>
<span style={{ display: 'flex', alignItems: 'center' }}>
<ItemIcon type={item.data.type} active={item.active} kind={item.data.kind} groupClass={item.data.kind === ResourceKind.GROUP ? item.data.groupClass : ''} classes={props.classes} />
{
it.open && it.items && it.items.length > 0 &&
it.flatTree ?
- <FlatTree
- it={it}
- itemsMap={itemsMap}
- classes={this.props.classes}
- levelIndentation={levelIndentation}
+ <FlatTree
+ it={it}
+ itemsMap={itemsMap}
+ showSelection={showSelection}
+ classes={this.props.classes}
+ useRadioButtons={useRadioButtons}
+ levelIndentation={levelIndentation}
+ handleCheckboxChange={this.handleCheckboxChange}
+ onContextMenu={this.props.onContextMenu}
+ handleToggleItemOpen={this.handleToggleItemOpen}
+ toggleItemActive={this.props.toggleItemActive}
+ getToggableIconClassNames={this.getToggableIconClassNames}
+ getProperArrowAnimation={this.getProperArrowAnimation}
+ /> :
+ <Collapse in={it.open} timeout="auto" unmountOnExit>
+ <Tree
+ showSelection={this.props.showSelection}
+ items={it.items}
+ render={render}
+ disableRipple={disableRipple}
+ toggleItemOpen={toggleItemOpen}
+ toggleItemActive={toggleItemActive}
+ level={level + 1}
onContextMenu={this.props.onContextMenu}
- handleToggleItemOpen={this.handleToggleItemOpen}
- toggleItemActive={this.props.toggleItemActive}
- getToggableIconClassNames={this.getToggableIconClassNames}
- getProperArrowAnimation={this.getProperArrowAnimation}
- /> :
- <Collapse in={it.open} timeout="auto" unmountOnExit>
- <Tree
- showSelection={this.props.showSelection}
- items={it.items}
- render={render}
- disableRipple={disableRipple}
- toggleItemOpen={toggleItemOpen}
- toggleItemActive={toggleItemActive}
- level={level + 1}
- onContextMenu={this.props.onContextMenu}
- toggleItemSelection={this.props.toggleItemSelection} />
- </Collapse>
+ toggleItemSelection={this.props.toggleItemSelection} />
+ </Collapse>
}
</div>)}
</List>;
const node = getNode(id)(picker);
if (node && 'kind' in node.value && node.value.kind === ResourceKind.COLLECTION) {
-
const files = await services.collectionService.files(node.value.portableDataHash);
const tree = createCollectionFilesTree(files);
const sorted = sortFilesTree(tree);
export interface DirectoryArrayInputProps {
input: DirectoryArrayCommandInputParameter;
+ options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
}
export const DirectoryArrayInput = ({ input }: DirectoryArrayInputProps) =>
});
const DirectoryArrayInputComponent = connect(mapStateToProps)(
- class DirectoryArrayInputComponent extends React.Component<DirectoryArrayInputComponentProps & GenericInputProps & DispatchProp, DirectoryArrayInputComponentState> {
+ class DirectoryArrayInputComponent extends React.Component<DirectoryArrayInputComponentProps & GenericInputProps & DispatchProp & {
+ options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
+ }, DirectoryArrayInputComponentState> {
state: DirectoryArrayInputComponentState = {
open: false,
directories: [],
.reduce((directories, { value }) =>
'kind' in value &&
value.kind === ResourceKind.COLLECTION &&
- formattedDirectories.find(({ portableDataHash }) => value.portableDataHash === portableDataHash)
+ formattedDirectories.find(({ portableDataHash, name }) => value.portableDataHash === portableDataHash && value.name === name)
? directories.concat(value)
: directories, initialDirectories);
});
const orderedDirectories = formattedDirectories.reduce((dirs, formattedDir) => {
- const dir = directories.find(({ portableDataHash }) => portableDataHash === formattedDir.portableDataHash);
+ const dir = directories.find(({ portableDataHash, name }) => portableDataHash === formattedDir.portableDataHash && name === formattedDir.name);
return dir
? [...dirs, dir]
: dirs;
<DialogActions>
<Button onClick={this.closeDialog}>Cancel</Button>
<Button
+ data-cy='ok-button'
variant='contained'
color='primary'
onClick={this.submit}>Ok</Button>
pickerId={this.props.commandInput.id}
includeCollections
showSelection
+ options={this.props.options}
toggleItemSelection={this.refreshDirectories} />
</div>
<Divider />
export interface FileArrayInputProps {
input: FileArrayCommandInputParameter;
+ options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
}
export const FileArrayInput = ({ input }: FileArrayInputProps) =>
<Field
});
const FileArrayInputComponent = connect(mapStateToProps)(
- class FileArrayInputComponent extends React.Component<FileArrayInputComponentProps & GenericInputProps & DispatchProp, FileArrayInputComponentState> {
+ class FileArrayInputComponent extends React.Component<FileArrayInputComponentProps & GenericInputProps & DispatchProp & {
+ options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
+ }, FileArrayInputComponentState> {
state: FileArrayInputComponentState = {
open: false,
files: [],
});
this.setFiles(files);
-
}
refreshFiles = () => {
<DialogActions>
<Button onClick={this.closeDialog}>Cancel</Button>
<Button
+ data-cy='ok-button'
variant='contained'
color='primary'
onClick={this.submit}>Ok</Button>
includeCollections
includeFiles
showSelection
+ options={this.props.options}
toggleItemSelection={this.refreshFiles} />
</div>
<Divider />
return <FloatArrayInput input={input as FloatArrayCommandInputParameter} />;
case isArrayOfType(input, CWLType.FILE):
- return <FileArrayInput input={input as FileArrayCommandInputParameter} />;
+ return <FileArrayInput options={{ showOnlyOwned: false, showOnlyWritable: false }} input={input as FileArrayCommandInputParameter} />;
case isArrayOfType(input, CWLType.DIRECTORY):
- return <DirectoryArrayInput input={input as DirectoryArrayCommandInputParameter} />;
+ return <DirectoryArrayInput options={{ showOnlyOwned: false, showOnlyWritable: false }} input={input as DirectoryArrayCommandInputParameter} />;
default:
return null;