-export const createProjectProperty = (data: TagProperty) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const { detailsPanel, resources } = getState();
- const project = getResource(detailsPanel.resourceUuid)(resources) as ProjectResource;
- dispatch(startSubmit(PROJECT_PROPERTIES_FORM_NAME));
- try {
- if (project) {
- project.properties[data.key] = data.value;
- const updatedProject = await services.projectService.update(project.uuid, project);
- dispatch(resourcesActions.SET_RESOURCES([updatedProject]));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Property has been successfully added.", hideDuration: 2000 }));
- dispatch(stopSubmit(PROJECT_PROPERTIES_FORM_NAME));
- }
- return;
- } catch (e) {
- 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, getState: () => RootState) => {
+ // 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());
+ if (getState().detailsPanel.isOpened) {
+ dispatch<any>(loadDetailsPanel(getState().detailsPanel.resourceUuid));
+ }
+};