X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/36e62deaa887cea4bd475e222c37c941af70534c..91d197b6b7066c3f37b3dbd54b2b3416e6f21bec:/src/views/run-process-panel/inputs/file-input.tsx
diff --git a/src/views/run-process-panel/inputs/file-input.tsx b/src/views/run-process-panel/inputs/file-input.tsx
index c135042d66..b0206e1452 100644
--- a/src/views/run-process-panel/inputs/file-input.tsx
+++ b/src/views/run-process-panel/inputs/file-input.tsx
@@ -2,35 +2,42 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import * as React from 'react';
+import React from 'react';
import { memoize } from 'lodash/fp';
import {
isRequiredInput,
FileCommandInputParameter,
File,
CWLType
-} from '~/models/workflow';
+} from 'models/workflow';
import { Field } from 'redux-form';
-import { ERROR_MESSAGE } from '~/validators/require';
-import { Input, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@material-ui/core';
+import { ERROR_MESSAGE } from 'validators/require';
+import { Input, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
import { GenericInputProps, GenericInput } from './generic-input';
-import { ProjectsTreePicker } from '~/views-components/projects-tree-picker/projects-tree-picker';
+import { ProjectsTreePicker } from 'views-components/projects-tree-picker/projects-tree-picker';
import { connect, DispatchProp } from 'react-redux';
-import { initProjectsTreePicker } from '~/store/tree-picker/tree-picker-actions';
-import { TreeItem } from '~/components/tree/tree';
-import { ProjectsTreePickerItem } from '~/views-components/projects-tree-picker/generic-projects-tree-picker';
-import { CollectionFile, CollectionFileType } from '~/models/collection-file';
+import { initProjectsTreePicker } from 'store/tree-picker/tree-picker-actions';
+import { TreeItem } from 'components/tree/tree';
+import { ProjectsTreePickerItem } from 'store/tree-picker/tree-picker-middleware';
+import { CollectionFile, CollectionFileType } from 'models/collection-file';
export interface FileInputProps {
input: FileCommandInputParameter;
+ options?: { showOnlyOwned: boolean, showOnlyWritable: boolean };
}
-export const FileInput = ({ input }: FileInputProps) =>
+
+type DialogContentCssRules = 'root' | 'pickerWrapper';
+
+export const FileInput = ({ input, options }: FileInputProps) =>
;
const format = (value?: File) => value ? value.basename : '';
@@ -54,7 +61,9 @@ interface FileInputComponentState {
}
const FileInputComponent = connect()(
- class FileInputComponent extends React.Component {
+ class FileInputComponent extends React.Component {
state: FileInputComponentState = {
open: false,
};
@@ -67,11 +76,12 @@ const FileInputComponent = connect()(
render() {
return <>
{this.renderInput()}
- {this.renderDialog()}
+
>;
}
openDialog = () => {
+ this.componentDidMount();
this.setState({ open: true });
}
@@ -84,7 +94,7 @@ const FileInputComponent = connect()(
this.props.input.onChange(this.state.file);
}
- setFile = (event: React.MouseEvent, { data }: TreeItem, pickerId: string) => {
+ setFile = (_: {}, { data }: TreeItem) => {
if ('type' in data && data.type === CollectionFileType.FILE) {
this.setState({ file: data });
} else {
@@ -106,31 +116,45 @@ const FileInputComponent = connect()(
{...this.props} />;
}
- renderDialog() {
- return ;
- }
-
+ dialogContentStyles: StyleRulesCallback = ({ spacing }) => ({
+ root: {
+ display: 'flex',
+ flexDirection: 'column',
+ },
+ pickerWrapper: {
+ flexBasis: `${spacing.unit * 8}vh`,
+ flexShrink: 1,
+ minHeight: 0,
+ },
+ });
+
+ dialog = withStyles(this.dialogContentStyles)(
+ ({ classes }: WithStyles) =>
+
+ );
});
-
-