import { ForwardRefExoticComponent, RefAttributes } from 'react'; import { ChangeStatistic, Maybe } from '@backstage/plugin-cost-insights-common'; import { Duration } from './Duration'; /** * Generic alert type with required fields for display. The `element` field will be rendered in * the Cost Insights "Action Items" section. This should use data fetched in the CostInsightsApi * implementation to render an InfoCard or other visualization. * * The alert type exposes hooks which can be used to enable and access various events, * such as when a user dismisses or snoozes an alert. Default forms and buttons * will be rendered if a hook is defined. * * Each default form can be overridden with a custom component. It must be implemented using * React.forwardRef. See https://reactjs.org/docs/forwarding-refs * * Errors thrown within hooks will generate a snackbar error notification. * * @public */ export type Alert = { title: string | JSX.Element; subtitle: string | JSX.Element; element?: JSX.Element; status?: AlertStatus; url?: string; buttonText?: string; SnoozeForm?: Maybe; AcceptForm?: Maybe; DismissForm?: Maybe; onSnoozed?(options: AlertOptions): Promise; onAccepted?(options: AlertOptions): Promise; onDismissed?(options: AlertOptions): Promise; }; /** @public */ export type AlertForm = ForwardRefExoticComponent & RefAttributes>; /** @public */ export interface AlertOptions { data: T; group: string; } /** * Default snooze form intervals are expressed using an ISO 8601 repeating interval string. * For example, R1/P7D/2020-09-02 for 1 week or R1/P30D/2020-09-02 for 1 month. * * For example, if a user dismisses an alert on Monday January 01 for 1 week, * it can be re-served on Monday, January 08. 7 calendar days from January 02, * inclusive of the last day. * * https://en.wikipedia.org/wiki/ISO_8601#Repeating_intervals * * @public */ export interface AlertSnoozeFormData { intervals: string; } /** @public */ export interface AlertDismissFormData { other: Maybe; reason: AlertDismissReason; feedback: Maybe; } /** @public */ export declare enum AlertStatus { Snoozed = "snoozed", Accepted = "accepted", Dismissed = "dismissed" } /** @public */ export type AlertFormProps = { alert: A; onSubmit: (data: FormData) => void; disableSubmit: (isDisabled: boolean) => void; }; /** @public */ export interface AlertDismissOption { label: string; reason: string; } /** @public */ export declare enum AlertDismissReason { Other = "other", Resolved = "resolved", Expected = "expected", Seasonal = "seasonal", Migration = "migration", NotApplicable = "not-applicable" } /** @public */ export declare const AlertDismissOptions: AlertDismissOption[]; /** @public */ export type AlertSnoozeOption = { label: string; duration: Duration; }; /** @public */ export declare const AlertSnoozeOptions: AlertSnoozeOption[]; /** @public */ export interface AlertCost { id: string; aggregation: [number, number]; } /** @public */ export interface ResourceData { previous: number; current: number; name: Maybe; } /** @public */ export interface BarChartOptions { previousFill: string; currentFill: string; previousName: string; currentName: string; } /** * @public * @deprecated use BarChartOptions instead */ export interface BarChartData extends BarChartOptions { } /** @public */ export declare enum DataKey { Previous = "previous", Current = "current", Name = "name" } /** @public */ export interface ProjectGrowthData { project: string; periodStart: string; periodEnd: string; aggregation: [number, number]; change: ChangeStatistic; products: Array; } /** @public */ export interface UnlabeledDataflowData { periodStart: string; periodEnd: string; projects: Array; unlabeledCost: number; labeledCost: number; } /** @public */ export interface UnlabeledDataflowAlertProject { id: string; unlabeledCost: number; labeledCost: number; }