Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14433_properties_i...
[arvados-workbench2.git] / src / store / details-panel / details-panel-action.ts
index 6aebc050b806951d2a388a4eaae7e8ba664afc91..2c742a1f38a3f4e63698019c092dec34935f1079 100644 (file)
@@ -14,6 +14,8 @@ import { startSubmit, stopSubmit } from 'redux-form';
 import { resourcesActions } from '~/store/resources/resources-actions';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 
+export const SLIDE_TIMEOUT = 500;
+
 export const detailsPanelActions = unionize({
     TOGGLE_DETAILS_PANEL: ofType<{}>(),
     LOAD_DETAILS_PANEL: ofType<string>()
@@ -66,4 +68,12 @@ export const createProjectProperty = (data: TagProperty) =>
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_PROPERTIES_FORM_NAME }));
             throw new Error('Could not add property to the project.');
         }
-    };
\ No newline at end of file
+    };
+export const toggleDetailsPanel = () => (dispatch: Dispatch) => {
+    // because of material-ui issue resizing details panel breaks tabs.
+    // triggering window resize event fixes that.
+    setTimeout(() => {
+        window.dispatchEvent(new Event('resize'));
+    }, SLIDE_TIMEOUT);
+    dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
+};