@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
145 lines • 6.51 kB
TypeScript
import { OnDestroy, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { AlertService, DynamicComponentAlertAggregator, WidgetGlobalAutoRefreshService } from '@c8y/ngx-components';
import { KPIDetails } from '@c8y/ngx-components/datapoint-selector';
import { DataFetchingService, ExportConfig, SourceId } from '@c8y/ngx-components/datapoints-export-selector';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject } from 'rxjs';
import { DatapointWithValues, DatapointsTableConfig, GroupedDatapointTableItem, TableColumnHeader } from '../datapoints-table-widget.model';
import { DatapointsTableService } from '../datapoints-table.service';
import { DatapointsTableViewService } from './datapoints-table-view.service';
import * as i0 from "@angular/core";
export declare class DatapointsTableViewWidgetComponent implements OnInit, OnDestroy {
private alertService;
private dataFetchingService;
private datapointsTableConfigService;
private datapointsTableViewService;
private formBuilder;
private translateService;
private widgetGlobalAutoRefresh;
/**
* Data points table widget config.
*/
config: DatapointsTableConfig;
alerts: DynamicComponentAlertAggregator;
/**
* Represents the data points where __active property is set to true.
*/
activeDatapoints: KPIDetails[];
/**
* Represents the custom CSS style for the export selector component.
*/
containerClass: string;
/**
* An array of objects representing datapoints with their corresponding values.
* Used to populate the CSV/Excel file with data.
*/
datapointsWithValues: DatapointWithValues[];
/**
* An array of `GroupedDatapointTableItem` objects representing the datapoints table items.
* Used to populate the table with data.
*/
datapointsTableItems: GroupedDatapointTableItem[];
devicesColumnHeaders: TableColumnHeader[];
/**
* Represents a configuration options used by a c8y-datapoints-export-selector.
*/
exportConfig: ExportConfig;
formGroup: ReturnType<DatapointsTableViewWidgetComponent['createForm']>;
/**
* Indicates whether there is more than one data point.
* If is true, then a column 'Device' will be displayed in the table.
*/
hasMultipleDatapoints: boolean;
/**
* Indicates whether refreshing should be enabled or disabled.
* It's 'true' when user is not allowed to view a measurements.
*/
isRefreshDisabled: boolean;
/**
* Indicates whether the component is in the initial request state
* where data for a table structure is being prepared.
*/
isInitialRequest: boolean;
/**
* Current isLoading state. Indicates whether the data is being loaded.
*/
isLoading$: BehaviorSubject<boolean>;
isExportModalOpen: boolean;
isScrolling: import("@angular/core").WritableSignal<boolean>;
seriesWithoutPermissionToRead: {
key: SourceId;
value: string[];
}[];
private TIMEOUT_ERROR_TEXT;
private SERVER_ERROR_TEXT;
private destroy$;
private scrollingSubject$;
private subscription;
private isFailedToFetchSeriesData;
/**
* Indicates if the alert has already been displayed and can be dismissed.
* The message is only displayed when a component is initialized.
*/
private isMissingAnyPermissionAlertShown;
constructor(alertService: AlertService, dataFetchingService: DataFetchingService, datapointsTableConfigService: DatapointsTableService, datapointsTableViewService: DatapointsTableViewService, formBuilder: FormBuilder, translateService: TranslateService, widgetGlobalAutoRefresh: WidgetGlobalAutoRefreshService);
ngOnInit(): Promise<void>;
ngOnDestroy(): void;
onDateChange(data: {
dateFrom?: string | null;
dateTo?: string | null;
}): void;
onExportModalOpen(isOpened: boolean): void;
onScrolling(value: boolean): void;
onCountdownEnded(): Promise<void>;
private handleGlobalTimeContextSettings;
/**
* Sets up the scrolling subscription.
*
* Ensures similar UX as in the alarms countdown-pause logic.
*/
private setScrollingSubscription;
private setDefaultRefreshRelatedProperties;
private recalculateIntervalToMatchFromNowDate;
private prepareDateRangeForm;
private createForm;
/**
* Prepares the table data by:
* - filtering out inactive data points,
* - checking if there are multiple devices as a source of data points,
* - getting the column headers for devices,
* - getting the series data for active data points (API call),
* - preparing data points with values list,
* - mapping data points with values to list items,
* - grouping data points by date and device,
* - sorting data by date descending.
*
* @param roundSeconds - Whether to round the seconds or not.
* If true, the seconds will be rounded to 0.
* If false, the seconds will be displayed as they are.
*/
private prepareTableData;
/**
* Retrieves the active data points series data and returns it as a map.
*
* It's a wrapper method with try-catch block.
*
* @param datapointsIdsWithSeries - A map of data point IDs with their associated series.
* @param config - The configuration of the data points table.
* @param roundSeconds - Whether to round the seconds or not.
* If true, the seconds will be rounded to 0.
* If false, the seconds will be displayed as they are.
* @returns A Promise that resolves to a Map object with data point IDs as keys and DataObject as values.
*/
private getActiveDatapointsSeriesDataMap;
private handleFetchError;
private handleMissingAnyPermissionErrorMessage;
private getMissingPermissionsMessage;
private updateExportConfigDateRange;
private adjustTargetDateBasedOnConditionTime;
private syncExportConfigDates;
private handleGlobalRefreshLoading;
static ɵfac: i0.ɵɵFactoryDeclaration<DatapointsTableViewWidgetComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DatapointsTableViewWidgetComponent, "c8y-datapoints-table-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}
//# sourceMappingURL=datapoints-table-view.component.d.ts.map