@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
112 lines • 5.58 kB
TypeScript
import { OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
import { FormArray, FormBuilder, NgForm } from '@angular/forms';
import { AlarmService, IAlarm, IResultList } from '@c8y/client';
import { AlertService, OnBeforeSave } from '@c8y/ngx-components';
import { AlarmsViewService } from '@c8y/ngx-components/alarms';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { AlarmListWidgetConfig, DATE_SELECTION, AlarmListRefreshOption } from '../alarm-list-widget.model';
import { AlarmWidgetService } from '../alarm-widget.service';
import { Interval } from '@c8y/ngx-components/interval-picker';
import { WidgetConfigService } from '@c8y/ngx-components/context-dashboard';
import * as i0 from "@angular/core";
export declare class AlarmListWidgetConfigComponent implements OnInit, OnChanges, OnBeforeSave, OnDestroy {
private alarmListWidgetService;
private alarmService;
private alarmsViewService;
private alertService;
private form;
private formBuilder;
private translateService;
private widgetConfigService;
config: AlarmListWidgetConfig;
readonly REFRESH_INTERVAL_IN_MILLISECONDS: number[];
readonly SEVERITY_LABELS: {
readonly CRITICAL: "CRITICAL";
readonly MAJOR: "MAJOR";
readonly MINOR: "MINOR";
readonly WARNING: "WARNING";
};
readonly STATUS_LABELS: {
readonly ACKNOWLEDGED: "ACKNOWLEDGED";
readonly CLEARED: "CLEARED";
readonly ACTIVE: "ACTIVE";
};
readonly ACKNOWLEDGE_STATUS_VALUE: "ACKNOWLEDGED";
readonly CLEARED_STATUS_VALUE: "CLEARED";
readonly BELL_SLASH_ICON: "bell-slash";
readonly BELL_ICON: "bell";
readonly C8Y_ALERT_IDLE_ICON: "c8y-alert-idle";
readonly ALARM_ORDER_LABELS: {
readonly BY_ACTIVE: "By active status";
readonly BY_DATE_ASCENDING: "By date (ascending)";
readonly BY_DATE_DESCENDING: "By date (descending)";
readonly BY_SEVERITY: "By severity";
};
readonly GLOBAL_INTERVAL_OPTION: AlarmListRefreshOption;
alarms$: BehaviorSubject<IResultList<IAlarm> | null>;
formGroup: ReturnType<AlarmListWidgetConfigComponent['createForm']>;
isLoading: boolean;
orderList: ("BY_ACTIVE" | "BY_DATE_ASCENDING" | "BY_DATE_DESCENDING" | "BY_SEVERITY")[];
refreshTypePopoverMessage: string;
refreshTypeTitle: string;
severityList: string[];
showDateFilter: boolean;
DATE_SELECTION: typeof DATE_SELECTION;
dateSelection: DATE_SELECTION | undefined;
dateSelectionHelp: any;
refreshOption: AlarmListRefreshOption;
/**
* Order does matter.
*/
statusList: ("ACKNOWLEDGED" | "CLEARED" | "ACTIVE")[];
set previewMapSet(template: TemplateRef<any>);
private formChangesSubscription;
constructor(alarmListWidgetService: AlarmWidgetService, alarmService: AlarmService, alarmsViewService: AlarmsViewService, alertService: AlertService, form: NgForm, formBuilder: FormBuilder, translateService: TranslateService, widgetConfigService: WidgetConfigService);
ngOnInit(): Promise<void>;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
onBeforeSave(config?: AlarmListWidgetConfig): boolean | Promise<boolean> | Observable<boolean>;
onDateFilterChange(event: {
selectedDates: [Date, Date];
interval: Interval['id'];
}): void;
removeType(index: number): void;
addType(): void;
updateRefreshOption(): void;
get types(): FormArray;
dateSelectionChange(dateSelection: DATE_SELECTION): void;
private filterEmptyTypes;
private isContainingOnlyEmptyTypes;
private getAlarms;
private initializeForm;
private createForm;
private isAutorefershDisabled;
private minSelectedCheckboxes;
private initializeTypes;
private initDateSelection;
/**
* Initializes and handles the form change subscription for the Alarm list preview at Widget's configuration.
*
* This method subscribes to form value changes with a debounce time of 500ms.
* It compares the previous and current form values to determine if the changes are relevant.
* If the only change is in the `isAutoRefreshEnabled` property, the change is ignored.
*/
private handlePreviewSubscription;
/**
* Determines if the only changes between two `AlarmListWidgetConfig` objects are in the `isAutoRefreshEnabled` and `refreshInterval` properties.
*
* This method compares two configurations by omitting `isAutoRefreshEnabled` and `refreshInterval`.
* It returns true if these are the only properties that differ between the previous and current configurations.
* Note that `refreshInterval` is relevant only when the refresh type is set to an interval.
*
* @param previousConfig - The previous configuration of `AlarmListWidgetConfig`.
* @param currentConfig - The current configuration of `AlarmListWidgetConfig`.
* @returns `true` if the differences are confined to `isAutoRefreshEnabled` and `refreshInterval`, `false` otherwise.
*/
private isOnlyAutoRefreshOrIntervalChanged;
private updateConfigBasedOnRefreshOption;
static ɵfac: i0.ɵɵFactoryDeclaration<AlarmListWidgetConfigComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AlarmListWidgetConfigComponent, "c8y-alarm-list-widget-config", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, false, never>;
}
//# sourceMappingURL=alarm-list-widget-config.component.d.ts.map