@kinvolk/headlamp-plugin
Version:
The needed infrastructure for building Headlamp plugins.
68 lines (67 loc) • 3.55 kB
TypeScript
import { PayloadAction } from '@reduxjs/toolkit';
import { ReactElement, ReactNode } from 'react';
import { KubeObject } from '../lib/k8s/KubeObject';
export type HeaderActionType = ((...args: any[]) => ReactNode) | null | ReactElement | ReactNode;
export type DetailsViewFunc = HeaderActionType;
export type AppBarActionType = ((...args: any[]) => ReactNode) | null | ReactElement | ReactNode;
export type RowActionType = ((item: any) => JSX.Element | null | ReactNode) | null;
export type HeaderAction = {
id: string;
action?: HeaderActionType;
};
export type RowAction = {
id: string;
action?: RowActionType;
};
export type AppBarAction = {
id: string;
action?: AppBarActionType;
};
export declare enum DefaultHeaderAction {
RESTART = "RESTART",
DELETE = "DELETE",
EDIT = "EDIT",
VIEW = "VIEW",
SCALE = "SCALE",
POD_LOGS = "POD_LOGS",
POD_TERMINAL = "POD_TERMINAL",
POD_ATTACH = "POD_ATTACH",
NODE_TOGGLE_CORDON = "NODE_TOGGLE_CORDON",
NODE_DRAIN = "NODE_DRAIN",
NODE_SHELL = "NODE_SHELL"
}
export declare enum DefaultAppBarAction {
CLUSTER = "CLUSTER",
NOTIFICATION = "NOTIFICATION",
SETTINGS = "SETTINGS",
USER = "USER",
GLOBAL_SEARCH = "GLOBAL_SEARCH"
}
type HeaderActionFuncType = (resource: KubeObject | null, actions: HeaderAction[]) => HeaderAction[];
export type HeaderActionsProcessor = {
id: string;
processor: HeaderActionFuncType;
};
export type AppBarActionsProcessorArgs = {
actions: AppBarAction[];
};
export type AppBarActionProcessorType = (info: AppBarActionsProcessorArgs) => AppBarAction[];
export type AppBarActionsProcessor = {
id: string;
processor: AppBarActionProcessorType;
};
export interface HeaderActionState {
headerActions: HeaderAction[];
headerActionsProcessors: HeaderActionsProcessor[];
appBarActions: AppBarAction[];
appBarActionsProcessors: AppBarActionsProcessor[];
}
export declare const actionButtonsSlice: import("@reduxjs/toolkit").Slice<HeaderActionState, {
setDetailsViewHeaderAction(state: import("immer").WritableDraft<HeaderActionState>, action: PayloadAction<HeaderActionType | HeaderAction>): void;
addDetailsViewHeaderActionsProcessor(state: import("immer").WritableDraft<HeaderActionState>, action: PayloadAction<HeaderActionsProcessor | HeaderActionsProcessor["processor"]>): void;
setAppBarAction(state: import("immer").WritableDraft<HeaderActionState>, action: PayloadAction<AppBarAction | AppBarAction>): void;
setAppBarActionsProcessor(state: import("immer").WritableDraft<HeaderActionState>, action: PayloadAction<AppBarActionsProcessor | AppBarActionsProcessor["processor"]>): void;
}, "actionButtons", "actionButtons", import("@reduxjs/toolkit").SliceSelectors<HeaderActionState>>;
export declare const setDetailsViewHeaderAction: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<HeaderActionType | HeaderAction, "actionButtons/setDetailsViewHeaderAction">, addDetailsViewHeaderActionsProcessor: import("@reduxjs/toolkit").ActionCreatorWithPayload<HeaderActionsProcessor | HeaderActionFuncType, "actionButtons/addDetailsViewHeaderActionsProcessor">, setAppBarAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<AppBarAction, "actionButtons/setAppBarAction">, setAppBarActionsProcessor: import("@reduxjs/toolkit").ActionCreatorWithPayload<AppBarActionsProcessor | AppBarActionProcessorType, "actionButtons/setAppBarActionsProcessor">;
declare const _default: import("redux").Reducer<HeaderActionState>;
export default _default;