///
import * as React from 'react';
import { QuickStart } from '@patternfly/quickstarts';
import { Map as ImmutableMap } from 'immutable';
import { FirehoseResult, HealthState, K8sResourceCommon, LIMIT_STATE, PrometheusResponse, QueryParams, StatusGroupMapper, TopConsumerPopoverProps } from '../extensions/console-types';
import { Alert, K8sModel } from './common-types';
type WithClassNameProps = R & {
className?: string;
};
export type ActivityItemProps = WithClassNameProps;
export type ActivityBodyProps = WithClassNameProps<{
children: React.ReactNode;
}>;
export type AlertsBodyProps = WithClassNameProps<{
error?: boolean;
}>;
export type RecentEventsBodyProps = {
events: FirehoseResult;
filter?: (arg: EventKind) => boolean;
moreLink?: string;
};
type OngoingActvityProps = {
resource: T;
};
export type OngoingActivityBodyProps = {
resourceActivities?: (OngoingActvityProps & {
timestamp: Date;
loader?: () => Promise>>>;
component?: React.ComponentType>>;
})[];
prometheusActivities?: {
results: PrometheusResponse[];
loader?: () => Promise>;
component?: React.ComponentType<{
results: PrometheusResponse[];
}>;
}[];
loaded: boolean;
};
export type AlertItemProps = {
alert: Alert;
documentationLink?: string;
};
export type HealthItemProps = WithClassNameProps<{
title: string;
details?: string;
state?: HealthState;
popupTitle?: string;
popupClassname?: string;
popupBodyContent?: React.ReactNode | ((hide: () => void) => React.ReactNode);
popupKeepOnOutsideClick?: boolean;
noIcon?: boolean;
icon?: React.ReactNode;
}>;
export type ResourceInventoryItemProps = {
resources: K8sResourceCommon[];
additionalResources?: {
[key: string]: [];
};
mapper?: StatusGroupMapper;
kind: K8sModel;
isLoading: boolean;
namespace?: string;
error: boolean;
showLink?: boolean;
TitleComponent?: React.ComponentType<{}>;
title?: string;
titlePlural?: string;
ExpandedComponent?: React.ComponentType<{}>;
basePath?: string;
dataTest?: string;
};
export type DetailItemProps = {
title: string;
children: React.ReactNode;
isLoading?: boolean;
error?: boolean;
valueClassName?: string;
errorMessage?: string;
};
export type DetailsBodyProps = {
children?: React.ReactNode;
};
export type UtilizationBodyProps = {
children: React.ReactNode;
};
export declare enum ByteDataTypes {
BinaryBytes = "binaryBytes",
BinaryBytesWithoutB = "binaryBytesWithoutB",
DecimalBytes = "decimalBytes",
DecimalBytesWithoutB = "decimalBytesWithoutB"
}
export 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;
setLimitReqState?: (state: {
limit: LIMIT_STATE;
requested: LIMIT_STATE;
}) => void;
};
type EventInvolvedObject = {
apiVersion?: string;
kind?: string;
name?: string;
uid?: string;
namespace?: string;
};
export 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 type UtilizationDurationDropdownProps = {
adjustDuration?: (duration: number) => number;
};
type UtilizationDurationState = {
duration: number;
endDate: Date;
selectedKey: string;
startDate: Date;
updateDuration: (duration: number) => void;
updateEndDate: (endDate: Date) => void;
updateSelectedKey: (key: string) => void;
};
export type UseUtilizationDuration = (adjustDuration?: (duration: number) => number) => UtilizationDurationState;
export type Options = {
ns?: string;
name?: string;
path?: string;
queryParams?: QueryParams;
cluster?: string;
};
export type UseActiveNamespace = () => [string, (ns: string) => void];
export type UseLastNamespace = () => [
string,
React.Dispatch>,
boolean
];
export type VirtualizedGridProps = {
items: VirtualizedGridItem[] | VirtualizedGridGroupedItems;
renderCell: VirtualizedGridRenderCell;
/**
* should be set when items are grouped/ `isItemGrouped` is set to true and each group has a heading
*/
renderHeader?: VirtualizedGridRenderHeader;
/**
* Default value: false
* should be set true when items are grouped
*/
isItemsGrouped?: boolean;
/** Grid styles */
className?: string;
/** Cell Measurements */
cellWidth?: number;
cellMargin?: number;
celldefaultHeight?: number;
estimatedCellHeight?: number;
overscanRowCount?: number;
headerHeight?: number;
};
export type VirtualizedGridItem = {
[key: string]: any;
};
export type VirtualizedGridGroupedItems = {
[key: string]: VirtualizedGridItem[];
};
export type VirtualizedGridRenderHeader = (heading: string) => React.ReactNode;
export type VirtualizedGridRenderCell = (item: VirtualizedGridItem) => React.ReactNode;
export type LazyActionMenuProps = {
context: ActionContext;
variant?: ActionMenuVariant;
label?: string;
isDisabled?: boolean;
extra?: any;
};
export type ActionContext = {
[contextId: string]: any;
};
export declare enum ActionMenuVariant {
KEBAB = "plain",
DROPDOWN = "default"
}
type Request = {
active: boolean;
timeout: NodeJS.Timer;
inFlight: boolean;
data: R;
error: any;
};
export type RequestMap = ImmutableMap>;
export type Fetch = (url: string) => Promise;
export type WatchURLProps = {
url: string;
fetch?: Fetch;
};
export type WatchPrometheusQueryProps = {
query: string;
namespace?: string;
timespan?: number;
};
export type UseDashboardResources = ({ prometheusQueries, urls, notificationAlertLabelSelectors, }: {
prometheusQueries?: WatchPrometheusQueryProps[];
urls?: WatchURLProps[];
notificationAlertLabelSelectors?: {
[k: string]: string;
};
}) => {
urlResults: RequestMap;
prometheusResults: RequestMap;
notificationAlerts: {
alerts: Alert[];
loaded: boolean;
loadError: Error;
};
};
export type UseUserSettings = (key: string, defaultValue?: T, sync?: boolean) => [T, React.Dispatch>, boolean];
export type QuickStartsLoaderProps = {
children: (quickStarts: QuickStart[], loaded: boolean) => React.ReactNode;
};
export type UseURLPoll = (url: string, delay?: number, ...dependencies: any[]) => [R, any, boolean];
export {};