@openshift-console/dynamic-plugin-sdk
Version:
Based on the concept of [webpack module federation](https://webpack.js.org/concepts/module-federation/), dynamic plugins are loaded and interpreted from remote sources at runtime. The standard way to deliver and expose dynamic plugins to Console is throug
204 lines (203 loc) • 6.01 kB
TypeScript
/// <reference types="react" />
import { CardProps, CardBodyProps } from '@patternfly/react-core';
import { K8sResourceCommon, FirehoseResult, PrometheusResponse, HealthState, StatusGroupMapper, QueryParams } from '../extensions/console-types';
import { K8sModel, Alert } from './common-types';
declare type WithClassNameProps<R = {}> = R & {
className?: string;
};
export declare type ActivityItemProps = WithClassNameProps;
export declare type ActivityBodyProps = WithClassNameProps<{
children: React.ReactNode;
}>;
export declare type AlertsBodyProps = WithClassNameProps<{
error?: boolean;
}>;
export declare type RecentEventsBodyProps = {
events: FirehoseResult<EventKind[]>;
filter?: (arg: EventKind) => boolean;
moreLink?: string;
};
declare type OngoingActvityProps<T> = {
resource: T;
};
export declare type OngoingActivityBodyProps = {
resourceActivities?: (OngoingActvityProps<K8sResourceCommon> & {
timestamp: Date;
loader?: () => Promise<React.ComponentType<Partial<OngoingActvityProps<K8sResourceCommon>>>>;
component?: React.ComponentType<Partial<OngoingActvityProps<K8sResourceCommon>>>;
})[];
prometheusActivities?: {
results: PrometheusResponse[];
loader?: () => Promise<React.ComponentType<{
results?: PrometheusResponse[];
}>>;
component?: React.ComponentType<{
results: PrometheusResponse[];
}>;
}[];
loaded: boolean;
};
export declare type AlertItemProps = {
alert: Alert;
};
export declare type HealthItemProps = WithClassNameProps<{
title: string;
details?: string;
state?: HealthState;
popupTitle?: string;
noIcon?: boolean;
icon?: React.ReactNode;
}>;
export declare type DashboardCardProps = CardProps & {
className?: string;
children: React.ReactNode;
gradient?: boolean;
};
export declare type DashboardCardBodyProps = CardBodyProps & {
classname?: string;
children: React.ReactNode;
isLoading?: boolean;
};
export declare type DashboardCardHeaderProps = WithClassNameProps<{
children: React.ReactNode;
}>;
export declare type DashboardCardTitleProps = WithClassNameProps<{
children?: React.ReactNode;
}>;
export declare type ResourceInventoryItemProps = {
resources: K8sResourceCommon[];
additionalResources?: {
[key: string]: [];
};
mapper?: StatusGroupMapper;
kind: K8sModel;
isLoading: boolean;
namespace?: string;
error: boolean;
showLink?: boolean;
TitleComponent?: React.ComponentType<{}>;
ExpandedComponent?: React.ComponentType<{}>;
basePath?: string;
dataTest?: string;
};
export declare type DetailItemProps = {
title: string;
children: React.ReactNode;
isLoading?: boolean;
error?: boolean;
valueClassName?: string;
errorMessage?: string;
};
export declare type DetailsBodyProps = {
children?: React.ReactNode;
};
export declare type UtilizationBodyProps = {
children: React.ReactNode;
};
declare type LIMIT_STATE = 'ERROR' | 'WARN' | 'OK';
export declare type TopConsumerPopoverProp = {
current: string;
max?: string;
limit?: string;
available?: string;
requested?: string;
total?: string;
limitState?: LIMIT_STATE;
requestedState?: string;
};
export declare enum ByteDataTypes {
BinaryBytes = "binaryBytes",
BinaryBytesWithoutB = "binaryBytesWithoutB",
DecimalBytes = "decimalBytes",
DecimalBytesWithoutB = "decimalBytesWithoutB"
}
export declare type UtilizationItemProps = {
title: string;
utilization?: PrometheusResponse;
limit?: PrometheusResponse;
requested?: PrometheusResponse;
isLoading: boolean;
humanizeValue: Function;
query: string | string[];
error: boolean;
max?: number;
byteDataType?: ByteDataTypes;
TopConsumerPopover?: React.ComponentType<TopConsumerPopoverProp>;
setLimitReqState?: (state: {
limit: LIMIT_STATE;
requested: LIMIT_STATE;
}) => void;
};
declare type GridDashboarCard = {
Card: React.ComponentType<any>;
span?: 4 | 6 | 12;
};
export declare type DashboardGridProps = {
mainCards: GridDashboarCard[];
leftCards?: GridDashboarCard[];
rightCards?: GridDashboarCard[];
};
declare type EventInvolvedObject = {
apiVersion?: string;
kind?: string;
name?: string;
uid?: string;
namespace?: string;
};
export declare type EventKind = {
action?: string;
count?: number;
type?: string;
involvedObject: EventInvolvedObject;
message?: string;
eventTime?: string;
lastTimestamp?: string;
firstTimestamp?: string;
reason?: string;
source: {
component: string;
host?: string;
};
series?: {
count?: number;
lastObservedTime?: string;
state?: string;
};
} & K8sResourceCommon;
export declare type UtilizationDurationDropdownProps = {
adjustDuration?: (duration: number) => number;
};
declare type UtilizationDurationState = {
duration: number;
endDate: Date;
selectedKey: string;
startDate: Date;
updateDuration: (duration: number) => void;
updateEndDate: (endDate: Date) => void;
updateSelectedKey: (key: string) => void;
};
export declare type UseUtilizationDuration = (adjustDuration?: (duration: number) => number) => UtilizationDurationState;
export declare enum PrometheusEndpoint {
LABEL = "api/v1/label",
RULES = "api/v1/rules",
QUERY = "api/v1/query",
QUERY_RANGE = "api/v1/query_range"
}
declare type PrometheusPollProps = {
delay?: number;
endpoint: PrometheusEndpoint;
endTime?: number;
namespace?: string;
query: string;
samples?: number;
timeout?: string;
timespan?: number;
};
export declare type UsePrometheusPoll = (props: PrometheusPollProps) => [PrometheusResponse, any, boolean];
export declare type Options = {
ns?: string;
name?: string;
path?: string;
queryParams?: QueryParams;
};
export {};