ownerUuid: string;
name: string;
description: string;
- properties: any;
+ properties: { [key: string]: string };
}
export const PROJECT_CREATE_FORM_NAME = 'projectCreateFormName';
export const PROJECT_CREATE_PROPERTIES_FORM_NAME = 'projectCreatePropertiesFormName';
+export const CREATE_FORM_SELECTOR = formValueSelector(PROJECT_CREATE_FORM_NAME);
export const isProjectOrRunProcessRoute = ({ router }: RootState) => {
const pathname = router.location ? router.location.pathname : '';
export const addPropertyToCreateProjectForm = (data: ResourcePropertiesFormData) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const selector = formValueSelector(PROJECT_CREATE_FORM_NAME);
- const properties = selector(getState(), 'properties') || {};
+ const properties = CREATE_FORM_SELECTOR(getState(), 'properties') || {};
properties[data.key] = data.value;
- dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', {...properties } ));
+ dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', { ...properties } ));
};
export const removePropertyFromCreateProjectForm = (key: string) =>
(dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const selector = formValueSelector(PROJECT_CREATE_FORM_NAME);
- const properties = selector(getState(), 'properties');
+ const properties = CREATE_FORM_SELECTOR(getState(), 'properties');
delete properties[key];
dispatch(change(PROJECT_CREATE_FORM_NAME, 'properties', { ...properties } ));
};
\ No newline at end of file
import { formValueSelector } from 'redux-form';
import { withStyles, StyleRulesCallback, WithStyles, Chip } from '@material-ui/core';
import { RootState } from '~/store/store';
-import { removePropertyFromCreateProjectForm, PROJECT_CREATE_FORM_NAME } from '~/store/projects/project-create-actions';
+import { removePropertyFromCreateProjectForm, CREATE_FORM_SELECTOR } from '~/store/projects/project-create-actions';
import { ArvadosTheme } from '~/common/custom-theme';
type CssRules = 'tag';
});
interface CreateProjectPropertiesListDataProps {
- properties: any;
+ properties: { [key: string]: string };
}
interface CreateProjectPropertiesListActionProps {
handleDelete: (key: string) => void;
}
-const selector = formValueSelector(PROJECT_CREATE_FORM_NAME);
const mapStateToProps = (state: RootState): CreateProjectPropertiesListDataProps => {
- const properties = selector(state, 'properties');
+ const properties = CREATE_FORM_SELECTOR(state, 'properties');
return { properties };
};