X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/b0de143e088973715681f7eb6c41f2dccb648c2b..a1310aae9f24935feae463542e9bfde298a5d9e4:/src/views-components/dialog-create/dialog-project-create.tsx diff --git a/src/views-components/dialog-create/dialog-project-create.tsx b/src/views-components/dialog-create/dialog-project-create.tsx index 6fb8a699..e77114b3 100644 --- a/src/views-components/dialog-create/dialog-project-create.tsx +++ b/src/views-components/dialog-create/dialog-project-create.tsx @@ -5,89 +5,13 @@ import * as React from 'react'; import { reduxForm, Field } from 'redux-form'; import { compose } from 'redux'; -import TextField from '@material-ui/core/TextField'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogTitle from '@material-ui/core/DialogTitle'; +import { TextField } from '~/components/text-field/text-field'; +import { Dialog, DialogActions, DialogContent, DialogTitle } from '@material-ui/core/'; import { Button, StyleRulesCallback, WithStyles, withStyles, CircularProgress } from '@material-ui/core'; -import { NAME, DESCRIPTION } from '../../validators/create-project/create-project-validator'; +import { PROJECT_NAME_VALIDATION, PROJECT_DESCRIPTION_VALIDATION } from '~/validators/validators'; -interface DialogProjectProps { - open: boolean; - handleClose: () => void; - onSubmit: (data: { name: string, description: string }) => void; - handleSubmit: any; - submitting: boolean; -} - -interface TextFieldProps { - label: string; - floatinglabeltext: string; - className?: string; - input?: string; - meta?: any; -} - -class DialogProjectCreate extends React.Component> { - render() { - const { classes, open, handleClose, handleSubmit, onSubmit, submitting } = this.props; - - return ( - -
-
onSubmit(data))}> - Create a project - - - - - - - - {submitting && } - -
-
-
- ); - } - - renderTextField = ({ input, label, meta: { touched, error }, ...custom }: TextFieldProps) => ( - - ) -} - -type CssRules = "button" | "lastButton" | "formContainer" | "textField" | "dialog" | "dialogTitle" | "createProgress" | "dialogActions"; +type CssRules = "button" | "lastButton" | "formContainer" | "dialog" | "dialogTitle" | "createProgress" | "dialogActions"; const styles: StyleRulesCallback = theme => ({ button: { @@ -105,9 +29,6 @@ const styles: StyleRulesCallback = theme => ({ dialogTitle: { paddingBottom: "0" }, - textField: { - marginTop: "32px", - }, dialog: { minWidth: "600px", minHeight: "320px" @@ -121,8 +42,61 @@ const styles: StyleRulesCallback = theme => ({ marginBottom: "24px" } }); +interface DialogProjectProps { + open: boolean; + handleClose: () => void; + onSubmit: (data: { name: string, description: string }) => void; + handleSubmit: any; + submitting: boolean; + invalid: boolean; + pristine: boolean; +} -export default compose( - reduxForm({ form: 'projectCreateDialog' }), - withStyles(styles) -)(DialogProjectCreate); \ No newline at end of file +export const PROJECT_CREATE_DIALOG = "projectCreateDialog"; + +export const DialogProjectCreate = compose( + reduxForm({ form: PROJECT_CREATE_DIALOG }), + withStyles(styles))( + class DialogProjectCreate extends React.Component> { + render() { + const { classes, open, handleClose, handleSubmit, onSubmit, submitting, invalid, pristine } = this.props; + + return ( + +
+
onSubmit(data))}> + Create a + project + + + + + + + + {submitting && } + +
+
+
+ ); + } + } +);