Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* limitations under the License.
*/

import { FilterResourceDescriptor } from '../../../generated/events/filterResourceDescriptor';

export interface AlertFormSourceItemProps {
filterResources?: FilterResourceDescriptor[];
filterResources?: {
name?: string;
}[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,62 @@
* limitations under the License.
*/

import type { FormInstance } from 'antd';
import type { ComponentType } from 'react';
import type { InlineAlertProps } from '../../components/common/InlineAlert/InlineAlert.interface';
import type {
OperationPermission,
ResourceEntity,
} from '../../context/PermissionProvider/PermissionProvider.interface';
import { NotificationTemplate } from '../../generated/entity/events/notificationTemplate';
import { CreateEventSubscription } from '../../generated/events/api/createEventSubscription';
import {
Destination,
EventFilterRule,
EventSubscription,
SubscriptionCategory,
SubscriptionType,
Webhook,
} from '../../generated/events/eventSubscription';
import type { AddAlertFormWidgetProps } from '../../utils/AlertsClassBase';
import { AddAlertPageLoadingState } from '../AddNotificationPage/AddNotificationPage.interface';

export interface ObservabilityFilterResourceDescriptor {
containerEntities?: string[];
name?: string;
supportedActions?: EventFilterRule[];
supportedFilters?: EventFilterRule[];
}

export interface UseObservabilityAlertFormOptions {
afterSaveAction?: (fqn: string) => Promise<void> | void;
form?: FormInstance<ModifiedCreateEventSubscription>;
fqn?: string;
onCancel?: () => void;
}

export interface UseObservabilityAlertResourcesReturn {
containerEntities?: string[];
filterResources: ObservabilityFilterResourceDescriptor[];
loading: boolean;
shouldShowActionsSection: boolean;
shouldShowFiltersSection: boolean;
supportedFilters?: EventFilterRule[];
supportedTriggers?: EventFilterRule[];
}

export interface UseObservabilityAlertTemplatesReturn {
loading: boolean;
templateResourcePermission: OperationPermission;
templates: NotificationTemplate[];
}

export interface UseObservabilityAlertTemplatesOptions {
extraFormWidgets: Record<string, ComponentType<AddAlertFormWidgetProps>>;
getResourcePermission: (
resourceEntity: ResourceEntity
) => Promise<OperationPermission>;
}

export interface ModifiedWebhookConfig extends Webhook {
headers?: { key: string; value: string }[];
Expand Down Expand Up @@ -49,3 +96,51 @@ export interface ModifiedCreateEventSubscription
timeout: number;
readTimeout: number;
}

export interface UseObservabilityAlertFormReturn {
alert?: ModifiedEventSubscription;
breadcrumb: {
name: string;
url: string;
}[];
containerEntities?: string[];
extraFormButtons: Record<string, ComponentType<AddAlertFormWidgetProps>>;
extraFormWidgets: Record<string, ComponentType<AddAlertFormWidgetProps>>;
filterResources: ObservabilityFilterResourceDescriptor[];
form: FormInstance<ModifiedCreateEventSubscription>;
handleCancel: () => void;
handleSave: (data: ModifiedCreateEventSubscription) => Promise<void>;
inlineAlertDetails?: InlineAlertProps;
isEditMode: boolean;
isLoading: boolean;
loadingState: AddAlertPageLoadingState;
saving: boolean;
shouldShowActionsSection: boolean;
shouldShowFiltersSection: boolean;
supportedFilters?: EventFilterRule[];
supportedTriggers?: EventFilterRule[];
templateResourcePermission: OperationPermission;
templates: NotificationTemplate[];
}

export type ObservabilityAlertFormProps = UseObservabilityAlertFormReturn;

export type ObservabilityAlertFormFieldsProps = Pick<
ObservabilityAlertFormProps,
| 'alert'
| 'containerEntities'
| 'extraFormWidgets'
| 'filterResources'
| 'form'
| 'isLoading'
| 'shouldShowActionsSection'
| 'shouldShowFiltersSection'
| 'supportedFilters'
| 'supportedTriggers'
| 'templateResourcePermission'
| 'templates'
>;

export interface AddObservabilityPageProps {
pageTitle: string;
}
Loading
Loading