Fix setting empty field on file rename
authorDaniel Kos <daniel.kos@contractors.roche.com>
Fri, 26 Oct 2018 06:56:44 +0000 (08:56 +0200)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Fri, 26 Oct 2018 06:56:44 +0000 (08:56 +0200)
Feature #14351

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/store/collection-panel/collection-panel-files/collection-panel-files-actions.ts
src/views-components/rename-file-dialog/rename-file-dialog.tsx

index 9a1d645b25bda8011e939d82b32eef9e50d72e00..e441959cc8ae68da3559d26f6358fc4c1d573ec6 100644 (file)
@@ -11,7 +11,7 @@ import { snackbarActions } from "../../snackbar/snackbar-actions";
 import { dialogActions } from '../../dialog/dialog-actions';
 import { getNodeValue } from "~/models/tree";
 import { filterCollectionFilesBySelection } from './collection-panel-files-state';
-import { startSubmit, stopSubmit, reset } from 'redux-form';
+import { startSubmit, stopSubmit, reset, initialize } from 'redux-form';
 import { getDialog } from "~/store/dialog/dialog-reducer";
 import { getFileFullPath } from "~/services/collection-service/collection-service-files-response";
 import { resourcesDataActions } from "~/store/resources-data/resources-data-actions";
@@ -96,7 +96,7 @@ export interface RenameFileDialogData {
 
 export const openRenameFileDialog = (data: RenameFileDialogData) =>
     (dispatch: Dispatch) => {
-        dispatch(reset(RENAME_FILE_DIALOG));
+        dispatch(initialize(RENAME_FILE_DIALOG, data));
         dispatch(dialogActions.OPEN_DIALOG({ id: RENAME_FILE_DIALOG, data }));
     };
 
index 0abdb5d6c2cf91027ece9024ec534fc6e3bbeded..9e276ade09e71e6b9e42c485b8b6e89be73c8d57 100644 (file)
@@ -35,6 +35,7 @@ const RenameDialogFormFields = (props: WithDialogProps<RenameFileDialogData>) =>
     <Field
         name='name'
         component={TextField}
+        autoFocus={true}
     />
     <WarningCollection text="Renaming a file will change content adress." />
 </>;