17426: Can add plugin middlewares and context menus
[arvados-workbench2.git] / src / common / plugintypes.ts
index 00cc1e3643572a3c040dd08814dbc1ca1d6dd720..2ce0bb1256615a5e172625d498648ac5e5f8c7e7 100644 (file)
@@ -3,16 +3,18 @@
 // 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.
@@ -42,4 +44,6 @@ export interface PluginConfig {
     enableNewButtonMatchers: EnableNew[];
 
     newButtonMenuList: ElementListReducer[];
+
+    middlewares: MiddlewareListReducer[];
 }