// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { Dispatch } from 'redux';
+import { Dispatch, Middleware } from 'redux';
import { RootStore, RootState } from '~/store/store';
import { ResourcesState } from '~/store/resources/resources';
import { Location } from 'history';
+import { ServiceRepository } from "~/services/services";
export type ElementListReducer = (startingList: React.ReactElement[], itemClass?: string) => React.ReactElement[];
export type CategoriesListReducer = (startingList: string[]) => string[];
export type NavigateMatcher = (dispatch: Dispatch, getState: () => RootState, uuid: string) => boolean;
export type LocationChangeMatcher = (store: RootStore, pathname: string) => boolean;
export type EnableNew = (location: Location, currentItemId: string, currentUserUUID: string | undefined, resources: ResourcesState) => boolean;
+export type MiddlewareListReducer = (startingList: Middleware[], services: ServiceRepository) => Middleware[];
export interface PluginConfig {
// Customize the list of possible center panels by adding or removing Route components.
enableNewButtonMatchers: EnableNew[];
newButtonMenuList: ElementListReducer[];
+
+ middlewares: MiddlewareListReducer[];
}
//
// SPDX-License-Identifier: AGPL-3.0
-import { TagProperty } from "~/models/tag";
import { Resource, ResourceKind } from '~/models/resource';
export interface LinkResource extends Resource {
tailKind: string;
linkClass: string;
name: string;
- properties: TagProperty;
+ properties: any;
kind: ResourceKind.LINK;
}
TAG = 'tag',
PERMISSION = 'permission',
PRESET = 'preset',
-}
\ No newline at end of file
+}
appBarRight: undefined,
accountMenuList: [],
enableNewButtonMatchers: [],
- newButtonMenuList: []
+ newButtonMenuList: [],
+ middlewares: []
};
// Starting here, import and register your Workbench 2 plugins. //
// import { register as blankUIPluginRegister } from '~/plugins/blank/index';
-import { register as examplePluginRegister, routePath as exampleRoutePath } from '~/plugins/example/index';
+import { register as sampleTrackerPluginRegister } from '~/plugins/sample-tracker/index';
+import { studyListRoutePath } from '~/plugins/sample-tracker/studyList';
+// import { register as examplePluginRegister, routePath as exampleRoutePath } from '~/plugins/example/index';
import { register as rootRedirectRegister } from '~/plugins/root-redirect/index';
// blankUIPluginRegister(pluginConfig);
-examplePluginRegister(pluginConfig);
-rootRedirectRegister(pluginConfig, exampleRoutePath);
+sampleTrackerPluginRegister(pluginConfig);
+rootRedirectRegister(pluginConfig, studyListRoutePath);
ownerUuid: string;
description?: string;
kind: ResourceKind,
- menuKind: ContextMenuKind;
+ menuKind: ContextMenuKind | string;
isTrashed?: boolean;
isEditable?: boolean;
outputUuid?: string;
kind: res.kind,
menuKind,
ownerUuid: res.ownerUuid,
- isTrashed: ('isTrashed' in res) ? res.isTrashed: false,
+ isTrashed: ('isTrashed' in res) ? res.isTrashed : false,
}));
}
};
import { SUBPROCESS_PANEL_ID } from '~/store/subprocess-panel/subprocess-panel-actions';
import { ALL_PROCESSES_PANEL_ID } from './all-processes-panel/all-processes-panel-action';
import { Config } from '~/common/config';
+import { pluginConfig } from '~/plugins';
+import { MiddlewareListReducer } from '~/common/plugintypes';
const composeEnhancers =
(process.env.NODE_ENV === 'development' &&
return next(action);
};
- const middlewares: Middleware[] = [
+ let middlewares: Middleware[] = [
routerMiddleware(history),
thunkMiddleware.withExtraArgument(services),
authMiddleware(services),
subprocessMiddleware,
];
+ const reduceMiddlewaresFn: (a: Middleware[],
+ b: MiddlewareListReducer) => Middleware[] = (a, b) => b(a, services);
+
+ middlewares = pluginConfig.middlewares.reduce(reduceMiddlewaresFn, middlewares);
+
const enhancer = composeEnhancers(applyMiddleware(redirectToMiddleware, ...middlewares));
return createStore(rootReducer, enhancer);
}
interface ProjectNameFieldProps {
validate: Validator[];
+ label?: string;
}
// Validation behavior depends on the value of ForwardSlashNameSubstitution.
name='name'
component={TextField}
validate={props.validate}
- label="Project Name"
+ label={props.label || "Project Name"}
autoFocus={true} /></span>
);
handleDelete: (key: string, value: string) => () => dispatch<any>(deleteProjectProperty(key, value)),
});
-type ProjectPropertiesDialogProps = ProjectPropertiesDialogDataProps & ProjectPropertiesDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
+type ProjectPropertiesDialogProps = ProjectPropertiesDialogDataProps & ProjectPropertiesDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
export const ProjectPropertiesDialog = connect(mapStateToProps, mapDispatchToProps)(
withStyles(styles)(
- withDialog(PROJECT_PROPERTIES_DIALOG_NAME)(
- ({ classes, open, closeDialog, handleDelete, project }: ProjectPropertiesDialogProps) =>
- <Dialog open={open}
- onClose={closeDialog}
- fullWidth
- maxWidth='sm'>
- <DialogTitle>Properties</DialogTitle>
- <DialogContent>
- <ProjectPropertiesForm />
- {project && project.properties &&
- Object.keys(project.properties).map(k =>
- Array.isArray(project.properties[k])
- ? project.properties[k].map((v: string) =>
- getPropertyChip(
- k, v,
- handleDelete(k, v),
- classes.tag))
- : getPropertyChip(
- k, project.properties[k],
- handleDelete(k, project.properties[k]),
- classes.tag)
- )
- }
- </DialogContent>
- <DialogActions>
- <Button
- variant='text'
- color='primary'
- onClick={closeDialog}>
- Close
+ withDialog(PROJECT_PROPERTIES_DIALOG_NAME)(
+ ({ classes, open, closeDialog, handleDelete, project }: ProjectPropertiesDialogProps) =>
+ <Dialog open={open}
+ onClose={closeDialog}
+ fullWidth
+ maxWidth='sm'>
+ <DialogTitle>Properties</DialogTitle>
+ <DialogContent>
+ <ProjectPropertiesForm />
+ {project && project.properties &&
+ Object.keys(project.properties).map(k =>
+ Array.isArray(project.properties[k])
+ ? project.properties[k].map((v: string) =>
+ getPropertyChip(
+ k, v,
+ handleDelete(k, v),
+ classes.tag))
+ : getPropertyChip(
+ k, project.properties[k],
+ handleDelete(k, project.properties[k]),
+ classes.tag)
+ )
+ }
+ </DialogContent>
+ <DialogActions>
+ <Button
+ variant='text'
+ color='primary'
+ onClick={closeDialog}>
+ Close
</Button>
- </DialogActions>
- </Dialog>
- )
-));
\ No newline at end of file
+ </DialogActions>
+ </Dialog>
+ )
+ ));