@kinvolk/headlamp-plugin
Version:
The needed infrastructure for building Headlamp plugins.
72 lines (71 loc) • 2.95 kB
TypeScript
import type { ReactNode } from 'react';
import type { ButtonStyle } from '../components/common/ActionButton/ActionButton';
import type { KubeObject } from '../lib/k8s/KubeObject';
export interface ProjectDefinition {
id: string;
namespaces: string[];
clusters: string[];
}
/** Define custom way to create new Projects */
export interface CustomCreateProject {
id: string;
name: string;
description: string;
icon: string | (() => ReactNode);
component: ({ onBack, }: {
/** Callback for going to the previous screen */
onBack: () => void;
}) => ReactNode;
}
/**
* Custom section for the project overview tab
*/
export interface ProjectOverviewSection {
id: string;
component: (props: {
project: ProjectDefinition;
projectResources: KubeObject[];
}) => ReactNode;
}
export interface ProjectDetailsTab {
id: string;
label?: ReactNode;
icon: string | ReactNode;
component?: (props: {
project: ProjectDefinition;
projectResources: KubeObject[];
}) => ReactNode;
/** Function to check if this tab be displayed in the given project. If not provided the Tab will be enabled. */
isEnabled?: ({ project }: {
project: ProjectDefinition;
}) => Promise<boolean>;
}
export interface ProjectDeleteButton {
isEnabled?: (params: {
project: ProjectDefinition;
}) => Promise<boolean>;
component: (props: {
project: ProjectDefinition;
buttonStyle?: ButtonStyle;
}) => ReactNode;
}
export interface ProjectHeaderAction {
id: string;
component: (props: {
project: ProjectDefinition;
}) => ReactNode;
/** Function to check if this action should be displayed in the given project. If not provided the action will be enabled. */
isEnabled?: ({ project }: {
project: ProjectDefinition;
}) => Promise<boolean>;
}
export interface ProjectsState {
customCreateProject: Record<string, CustomCreateProject>;
overviewSections: Record<string, ProjectOverviewSection>;
detailsTabs: Record<string, ProjectDetailsTab>;
projectDeleteButton?: ProjectDeleteButton;
headerActions: Record<string, ProjectHeaderAction>;
}
export declare const addCustomCreateProject: import("@reduxjs/toolkit").ActionCreatorWithPayload<CustomCreateProject, "projects/addCustomCreateProject">, addDetailsTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProjectDetailsTab, "projects/addDetailsTab">, addOverviewSection: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProjectOverviewSection, "projects/addOverviewSection">, setProjectDeleteButton: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProjectDeleteButton, "projects/setProjectDeleteButton">, addHeaderAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProjectHeaderAction, "projects/addHeaderAction">;
declare const _default: import("redux").Reducer<ProjectsState>;
export default _default;