@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
182 lines • 7.66 kB
TypeScript
import { InjectionToken } from '@angular/core';
import { AlarmStatusSettings, AlarmStatusType, IAlarm, IManagedObject, SeverityFilter, SeverityType } from '@c8y/client';
import { DateTimeContext, NavigatorNode, NavigatorNodeData, Route } from '@c8y/ngx-components';
import { QueryParamsHandling } from '@angular/router';
import type { SupportedIcons } from '@c8y/ngx-components/icon-selector/icons';
import { Observable } from 'rxjs';
import { AlarmFilterInterval } from '@c8y/ngx-components/interval-picker';
export interface AlarmsModuleConfig {
/**
* Indicates whether the application is a combination of Angular and AngularJS.
* @optional
*/
hybrid?: boolean;
/**
* The root node of the navigator, which can be either a `NavigatorNode` or `NavigatorNodeData`.
* This serves as the entry point for navigation structure for Alarms views.
* @optional
*/
rootNavigatorNode?: NavigatorNode | NavigatorNodeData;
/**
* An array of `Route` objects representing the navigation routes available.
* Each route defines a navigation path and its associated components related to Alarms.
* @optional
*/
route?: Route[];
}
export declare const ALARMS_MODULE_CONFIG: InjectionToken<unknown>;
export type AlarmCount = {
[key in SeverityType]: number;
};
export declare const ALARM_STATUS_ICON: {
readonly ALERT_IDLE: "c8y-alert-idle";
readonly BELL_SLASH: "bell-slash";
readonly BELL: "bell";
};
export type AlarmStatusIcon = (typeof ALARM_STATUS_ICON)[keyof typeof ALARM_STATUS_ICON];
/**
* A lookup table to map alarm statuses to corresponding icons.
*/
export declare const AlarmIconMap: Record<AlarmStatusType, AlarmStatusIcon>;
export declare const ALARM_SEVERITY_ICON: {
readonly CIRCLE: "circle";
readonly HIGH_PRIORITY: "high-priority";
readonly WARNING: "warning";
readonly EXCLAMATION_CIRCLE: "exclamation-circle";
};
export declare const HELP_ICON = "help";
export type AlarmSeverityIcon = (typeof ALARM_SEVERITY_ICON)[keyof typeof ALARM_SEVERITY_ICON];
/**
* A lookup table to map alarm severity types to corresponding icons.
*/
export declare const ALARM_SEVERITY_ICON_MAP: Record<SeverityType, AlarmSeverityIcon>;
export type AlarmListFormFilters = {
showCleared: boolean;
severityOptions: SeverityFilter;
selectedDates?: DateTimeContext;
};
/**
* Extended interval titles with an additional title for the case when no date is selected.
*/
export declare const INTERVAL_TITLES_EXTENDED: Record<AlarmFilterInterval['id'], string>;
export declare const INTERVALS_EXTENDED: AlarmFilterInterval[];
export type WidgetTimeContextStateExtended = {
date: DateTimeContext;
interval: AlarmFilterInterval['id'];
};
export type SelectedAlarm = IAlarm | null;
export declare const DEFAULT_ALARM_COUNTS: AlarmCount;
export declare const DEFAULT_SEVERITY_VALUES: SeverityFilter;
export declare const DEFAULT_STATUS_VALUES: AlarmStatusSettings;
export declare const ALARMS_PATH = "alarms";
export type CustomFragment = {
[key: string]: unknown;
};
/**
* Default properties of a alarm. Used to extract the custom properties from a Alarm object.
*/
export declare const ALARM_DEFAULT_PROPERTIES: readonly ["severity", "source", "type", "time", "text", "id", "status", "count", "name", "history", "self", "creationTime", "firstOccurrenceTime", "lastUpdated"];
export declare const THROTTLE_REALTIME_REFRESH = 1000;
/**
* Represents the navigation options for an alarm component.
*/
export type AlarmNavigationOptions = {
/**
* Defines if the alarm should navigate to a detail view when clicked.
*/
allowNavigationToAlarmsView: boolean;
/**
* Defines if the component should try to determine the context to navigate
* to the correct alarm detail view or not. If set to true, the component will
* not try to determine the context and will always navigate to the all alarms view.
*/
alwaysNavigateToAllAlarms: boolean;
/**
* Defines if the cleared query parameter should be included in the navigation if
* the alarm is cleared.
*/
includeClearedQueryParams: boolean;
/**
* Determines how query parameters should be handled during navigation.
* This property can be set to one of three values:
*
* - `"merge"` : Merge new parameters with current parameters.
* - `"preserve"` : Preserve current parameters.
* - `""` : Replace current parameters with new parameters. This is the default behavior.
*/
queryParamsHandling: QueryParamsHandling;
};
export interface AlarmDetailsButton {
additionalButtonClasses?: string;
title: string;
icon: SupportedIcons;
additionalIconClasses?: string;
label?: string;
disabled?: boolean;
/**
* Action to be executed when the button is clicked.
* @param alarm The alarm to apply this action to
* @returns A boolean or a promise that resolves to a boolean or to the updated alarm. If the result is true, a reload will be triggered. If the result is an alarm, the alarm will be updated with the new values.
*/
action: (alarm: IAlarm) => boolean | Promise<boolean | IAlarm>;
priority?: number;
}
export interface AlarmListIndicatorBase {
priority?: number;
}
export interface AlarmListIndicatorIcon extends AlarmListIndicatorBase {
icon: SupportedIcons;
title: string;
class?: string;
}
export type AlarmListIndicator = AlarmListIndicatorIcon;
export declare const PRODUCT_EXPERIENCE_ALARMS: {
readonly EVENTS: {
readonly ALARMS: "Alarms";
};
readonly COMPONENTS: {
readonly ALARMS_FILTER: "alarms-filter";
readonly ALARMS_INTERVAL_REFRESH: "alarms-interval-refresh";
readonly ALARMS: "alarms";
readonly ALARMS_TYPE_FILTER: "alarms-type-filter";
readonly ALARM_DETAILS: "alarm-details";
};
readonly ACTIONS: {
readonly APPLY_FILTER: "applyFilter";
readonly REMOVE_CHIP_FILTER: "removeChipFilter";
readonly APPLY_TYPE_FILTER: "applyTypeFilter";
readonly CREATE_SMART_RULE: "createSmartRule";
readonly ACKNOWLEDGE_ALARM: "acknowledgeAlarm";
readonly REACTIVATE_ALARM: "reactivateAlarm";
readonly CLEAR_ALARM: "clearAlarm";
readonly RELOAD_AUDIT_LOGS: "reloadAuditLogs";
readonly USER_SPEND_TIME_ON_COMPONENT: "userSpendTimeOnComponent";
};
};
export type ReloadAlarmsListType = 'gainsightTypeFilters' | null;
declare global {
namespace CumulocityServiceRegistry {
interface SpecificExtensionKeys {
alarmDetailsButton: AlarmDetailsButtonProvider;
alarmListIndicator: AlarmListIndicatorProvider;
}
interface AlarmDetailsButtonProvider {
/**
* Determines whether the button should be shown for a given alarm.
* @param alarm The alarm for which to determine button visibility.
* @param source The managed object associated with the alarm.
* @returns The button details or false.
*/
getAlarmDetailsButton$(alarm: IAlarm, source: IManagedObject): Observable<AlarmDetailsButton | false>;
}
interface AlarmListIndicatorProvider {
/**
* Determines whether the indicator should be shown for a given alarm.
* @param alarm The alarm for which to determine indicator visibility.
* @returns The indicator details or false.
*/
getAlarmListIndicator$(alarm: IAlarm): Observable<AlarmListIndicator | false>;
}
}
}
//# sourceMappingURL=alarms.model.d.ts.map