@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
472 lines (458 loc) • 22.7 kB
TypeScript
import * as i1 from '@c8y/ngx-components';
import { NavigatorNodeFactory, NavigatorNode, AlertService, ProductExperienceEventSource, ModalLabels, ProductExperienceEvent, ISelectModalObject, Column, ActionControl, ServerSideDataCallback, DataGridService, ModalService, DataSourceModifier, ServerSideDataResult, ManagedObjectRealtimeService, ForOfFilterPipe, OperationRealtimeService } from '@c8y/ngx-components';
import * as i0 from '@angular/core';
import { EventEmitter, OnInit } from '@angular/core';
import * as _c8y_client from '@c8y/client';
import { IManagedObject, InventoryService, OperationService, IResultList, IOperation } from '@c8y/client';
import * as i2 from '@c8y/ngx-components/repository/shared';
import { RepositoryService, FilterCriteria, RepositoryType } from '@c8y/ngx-components/repository/shared';
import { Subject, Observable, BehaviorSubject } from 'rxjs';
import * as i3 from '@angular/router';
import { ActivatedRoute, Router, ActivatedRouteSnapshot } from '@angular/router';
import * as i4 from 'ngx-bootstrap/dropdown';
import * as i5 from 'ngx-bootstrap/tooltip';
import * as i6 from '@angular/forms';
import * as i7 from 'ngx-bootstrap/buttons';
import * as i8 from 'ngx-bootstrap/popover';
import * as i9 from '@c8y/ngx-components/operations/operation-details';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
import { TranslateService } from '@ngx-translate/core';
declare class DeviceProfileNavigationFactory implements NavigatorNodeFactory {
nodeItem: NavigatorNode;
get(): Promise<NavigatorNode>;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileNavigationFactory, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceProfileNavigationFactory>;
}
interface DeviceProfile extends Partial<IManagedObject> {
name?: string;
type: string;
c8y_Filter: {
type?: string;
};
c8y_DeviceProfile: {
firmware?: DeviceProfileFirmware;
software?: DeviceProfileSoftware[];
configuration?: DeviceProfileConfiguration[];
};
}
interface DeviceProfileFirmware {
name: string;
version: string;
url: string;
isPatch: boolean;
patchDependency?: string;
}
interface DeviceProfileSoftware {
name: string;
softwareType: string;
version: string;
url: string;
action: string;
}
interface DeviceProfileConfiguration {
url: string;
name: string;
type: string;
}
interface ComparisonResult {
profile: {
itemName: string;
itemDetails?: string;
itemType?: string;
itemUrl: string;
};
device: {
itemName: string;
itemDetails?: string;
itemType?: string;
itemUrl: string;
};
comparisonAlert?: string;
}
declare enum DeviceProfileOperation {
APPLY_PROFILE = "c8y_DeviceProfile"
}
declare const PRODUCT_EXPERIENCE_DEVICE_PROFILE: {
readonly EVENTS: {
readonly REPOSITORY: "deviceProfileRepository";
readonly DEVICE_TAB: "deviceProfileTab";
};
readonly COMPONENTS: {
readonly DEVICE_PROFILE_LIST: "device-profile-list";
readonly ADD_DEVICE_PROFILE: "add-device-profile";
readonly DEVICE_PROFILE: "device-profile";
readonly DEVICE_TAB_PROFILE: "device-tab-profile";
};
readonly ACTIONS: {
readonly CANCEL: "cancel";
readonly CREATE: "create";
readonly REMOVE: "remove";
readonly ADD: "add";
readonly SAVE: "save";
readonly ASSIGN_DEVICE_PROFILE: "assignDeviceProfile";
};
readonly RESULTS: {
readonly ADD_SOFTWARE: "addSoftware";
};
readonly FRAGMENTS: {
readonly FIRMWARE: "firmware";
readonly SOFTWARE: "software";
readonly CONFGIURATION: "configuration";
};
};
declare class DeviceProfileService {
private inventoryService;
private operationService;
private alertService;
readonly dateFrom: Date;
readonly dateTo: Date;
private queriesUtil;
private NOT_INSTALLED_WARNING;
private VERSION_MISSMATCH_WARNING;
private SAME_URL_WARNING;
constructor(inventoryService: InventoryService, operationService: OperationService, alertService: AlertService);
createDeviceProfile(deviceProfile: Partial<DeviceProfile>): Promise<_c8y_client.IResult<IManagedObject>>;
/**
* Determines the available device profiles for a given device by considering device type
* and the supported software types declared by the devices. Because of limitations in the
* Inventory Query API the methods return profile that contain at least one of the supported
* software types and omits profiles having only non-supported software types. Resulting device
* profiles need to be further filtered on the client side to exclude the ones that contain
* non-supported software types next to the supported ones.
*
* @param device A device MO
* @param name Optional device profile name filter
* @returns Candidate device profiles that contain at least on software with supported type.
*/
getDeviceProfilesByDevice(device: IManagedObject, name?: string): Promise<IResultList<IManagedObject>>;
/**
* @deprecated Use `getDeviceProfilesByDevice` instead as it also considers the supported software types.
*/
getDeviceProfilesByDeviceType(deviceType: string): Promise<IResultList<IManagedObject>>;
getDeviceProfiles(andQuery?: any): Promise<IResultList<IManagedObject>>;
getProfileOperation(deviceId: string | number): Promise<IOperation>;
createProfileOperation(device: IManagedObject, deviceProfile: Partial<DeviceProfile>): Promise<any>;
getFirmwareItems(device: IManagedObject, selectedProfile: Partial<DeviceProfile>): ComparisonResult[];
getSoftwareItems(device: IManagedObject, selectedProfile: Partial<DeviceProfile>): ComparisonResult[];
getConfigurationItems(device: IManagedObject, selectedProfile: Partial<DeviceProfile>): ComparisonResult[];
/**
* Aligns device profile managed object's `softwareType!*` fragments to the software items
* included in the device profile. Removes obsolete software type fragments and adds new.
*
* @param profilePartial The device profile managed object which `softwareType!*` fragments will be adjusted.
* @returns The adjusted device profile managed object.
*/
alignSoftwareTypeFragments(profilePartial: Partial<DeviceProfile>, profile: DeviceProfile): Partial<DeviceProfile>;
getSoftwareTypes(profile: DeviceProfile): string[];
private getAlert;
private createProfileComparison;
private createProfileComparisonFromDeviceItems;
private extendProfileComparisonWithProfileItems;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceProfileService>;
}
declare class SelectConfigurationModalComponent implements ProductExperienceEventSource {
private repositoryService;
PRODUCT_EXPERIENCE: {
readonly SOFTWARE: {
readonly EVENTS: {
readonly REPOSITORY: "softwareRepository";
readonly DEVICE_TAB: "deviceSoftware";
};
readonly COMPONENTS: {
readonly ADD_SOFTWARE_MODAL: "add-software-modal";
readonly DEVICE_SOFTWARE_CHANGES: "device-software-changes";
readonly DEVICE_SOFTWARE_LIST: "device-software-list";
};
readonly ACTIONS: {
readonly APPLY_SOFTWARE_CHANGES: "applySoftwareChanges";
readonly CLEAR_SOFTWARE_CHANGES: "clearSoftwareChanges";
readonly OPEN_INSTALL_SOFTWARE: "openInstallSoftwareModal";
readonly OPEN_UPDATE_SOFTWARE: "openUpdateSoftwareModal";
readonly DELETE_SOFTWARE: "deleteSoftware";
};
readonly RESULTS: {
readonly ADD_SOFTWARE: "addSoftware";
readonly ADD_SOFTWARE_VERSION: "addSoftwareVersion";
readonly EDIT_SOFTWARE: "editSoftware";
};
};
readonly FIRMWARE: {
readonly EVENTS: {
readonly REPOSITORY: "firmwareRepository";
readonly DEVICE_TAB: "deviceFirmware";
};
readonly COMPONENTS: {
readonly ADD_FIRMWARE_MODAL: "add-firmware-modal";
readonly ADD_FIRMWAR_PATCH_MODAL: "add-firmware-patch-modal";
readonly FIRMWARE_DEVICE_TAB: "firmware-device-tab";
readonly DEVICE_FIRMWARE_LIST: "device-firmware-list";
};
readonly ACTIONS: {
readonly OPEN_INSTALL_FIRMWARE_DIALOG: "openInstallFirmwareDialog";
readonly OPEN_REPLACE_FIRMWARE_DIALOG: "openReplaceFirmwareDialog";
readonly OPEN_INSTALL_FIRMWARE_PATCH_DIALOG: "openInstallFirmwarePatchDialog";
};
readonly RESULTS: {
readonly ADD_FIRMWARE: "addFirmware";
readonly ADD_FIRMWARE_VERSION: "addFirmwareVersion";
readonly ADD_FIRMWARE_PATCH: "addFirmwarePatch";
readonly EDIT_FIRMWARE: "editFirmware";
readonly CREATE_FIRMWARE_UPDATE_OPERATION: "createFirmwareUpdateOperation";
};
};
readonly SHARED: {
readonly COMPONENTS: {
readonly REPOSITORY_SELECT_MODAL: "repository-select-modal";
readonly SELECT_CONFIGURATION_MODAL: "select-configuration-modal";
};
};
};
title: string;
load: Subject<void>;
configurations: Observable<any[]>;
resultEmitter: EventEmitter<any[]>;
selected: any[];
deviceTypeQuery: any;
searchQuery: any;
labels: ModalLabels;
productExperienceEvent: ProductExperienceEvent;
private queriesUtil;
constructor(repositoryService: RepositoryService);
search(searchTerm: any): void;
result(selectedItems: any): void;
getItems(): Promise<_c8y_client.IResultList<IManagedObject>>;
aggregate(mos: IManagedObject[]): ISelectModalObject[];
static ɵfac: i0.ɵɵFactoryDeclaration<SelectConfigurationModalComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<SelectConfigurationModalComponent, "c8y-select-configuration-modal", never, {}, {}, never, never, true, never>;
}
declare class DeviceProfileComponent implements OnInit, ProductExperienceEventSource {
private route;
private alertService;
private inventoryService;
private bsModal;
private repositoryService;
private deviceProfileService;
DEVICE_TYPE_POPOVER: "The device profile will be available for assignments on devices of the specified type. Otherwise, it will be available for all device types.";
DEVICE_TYPE_DISABLED_POPOVER: "Device type cannot be changed on profiles with already defined firmware, software or configuration since they may not be applicable to devices of the new device type.";
PRODUCT_EXPERIENCE: {
readonly EVENTS: {
readonly REPOSITORY: "deviceProfileRepository";
readonly DEVICE_TAB: "deviceProfileTab";
};
readonly COMPONENTS: {
readonly DEVICE_PROFILE_LIST: "device-profile-list";
readonly ADD_DEVICE_PROFILE: "add-device-profile";
readonly DEVICE_PROFILE: "device-profile";
readonly DEVICE_TAB_PROFILE: "device-tab-profile";
};
readonly ACTIONS: {
readonly CANCEL: "cancel";
readonly CREATE: "create";
readonly REMOVE: "remove";
readonly ADD: "add";
readonly SAVE: "save";
readonly ASSIGN_DEVICE_PROFILE: "assignDeviceProfile";
};
readonly RESULTS: {
readonly ADD_SOFTWARE: "addSoftware";
};
readonly FRAGMENTS: {
readonly FIRMWARE: "firmware";
readonly SOFTWARE: "software";
readonly CONFGIURATION: "configuration";
};
};
deviceProfile: DeviceProfile;
profileName: string;
productExperienceEvent: ProductExperienceEvent;
private queriesUtil;
constructor(route: ActivatedRoute, alertService: AlertService, inventoryService: InventoryService, bsModal: BsModalService, repositoryService: RepositoryService, deviceProfileService: DeviceProfileService);
ngOnInit(): Promise<void>;
addFirmware(): void;
getRepositoryEntriesWithVersions$(searchTerm$: BehaviorSubject<FilterCriteria>, repoType: RepositoryType): Observable<IManagedObject[]>;
getAndAssignRepositoryBinaries(mos: IManagedObject[]): IManagedObject[];
addConfiguration(): void;
addSoftware(): void;
get isDeviceProfileEmpty(): boolean;
removeItem(removedItem: any, category: any): void;
removeFirmware(): void;
updateDeviceProfile(partialDeviceProfile: any): Promise<void>;
private getDeviceProfile;
private getDeviceTypeQuery;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DeviceProfileComponent, "c8y-device-profile", never, {}, {}, never, never, true, never>;
}
declare class DeviceProfileListComponent implements OnInit {
private repositoryService;
private gridService;
private modalService;
private bsModalService;
private translateService;
private alertService;
private router;
private activatedRoute;
private deviceProfileService;
sizeRequest: Promise<number>;
sizeRequestDone: boolean;
refresh$: EventEmitter<void>;
isDataPresent$: Observable<boolean>;
columns: Column[];
actionControls: ActionControl[];
serverSideDataCallback: ServerSideDataCallback;
pagination: {
pageSize: number;
currentPage: number;
};
productExperienceEvent: ProductExperienceEvent;
noResultsMessage: "No results to display.";
noDataMessage: "No device profiles to display.";
noResultsSubtitle: "Refine your search terms or check your spelling.";
noDataSubtitle: "Add a new device profile by clicking below.";
constructor(repositoryService: RepositoryService, gridService: DataGridService, modalService: ModalService, bsModalService: BsModalService, translateService: TranslateService, alertService: AlertService, router: Router, activatedRoute: ActivatedRoute, deviceProfileService: DeviceProfileService);
ngOnInit(): void;
onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>;
editDeviceProfile(deviceProfile: Partial<IManagedObject>): void;
createDeviceProfile(): Promise<void>;
duplicateDeviceProfile(deviceProfile: any): Promise<void>;
deleteDeviceProfile(deviceProfile: any): Promise<void>;
trackByName(_index: any, column: Column): string;
private delete;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileListComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DeviceProfileListComponent, "c8y-device-profile-list", never, {}, {}, never, never, true, never>;
}
declare class AddDeviceProfileComponent implements ProductExperienceEventSource {
private modal;
private deviceProfileService;
DEVICE_TYPE_POPOVER: "The device profile will be available for assignments on devices of the specified type. Otherwise, it will be available for all device types.";
PRODUCT_EXPERIENCE: {
readonly EVENTS: {
readonly REPOSITORY: "deviceProfileRepository";
readonly DEVICE_TAB: "deviceProfileTab";
};
readonly COMPONENTS: {
readonly DEVICE_PROFILE_LIST: "device-profile-list";
readonly ADD_DEVICE_PROFILE: "add-device-profile";
readonly DEVICE_PROFILE: "device-profile";
readonly DEVICE_TAB_PROFILE: "device-tab-profile";
};
readonly ACTIONS: {
readonly CANCEL: "cancel";
readonly CREATE: "create";
readonly REMOVE: "remove";
readonly ADD: "add";
readonly SAVE: "save";
readonly ASSIGN_DEVICE_PROFILE: "assignDeviceProfile";
};
readonly RESULTS: {
readonly ADD_SOFTWARE: "addSoftware";
};
readonly FRAGMENTS: {
readonly FIRMWARE: "firmware";
readonly SOFTWARE: "software";
readonly CONFGIURATION: "configuration";
};
};
deviceProfile: Partial<DeviceProfile>;
result: Promise<any>;
productExperienceEvent: ProductExperienceEvent;
private _save;
private _cancel;
constructor(modal: BsModalRef, deviceProfileService: DeviceProfileService);
create(): Promise<void>;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AddDeviceProfileComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AddDeviceProfileComponent, "c8y-add-device-profile", never, {}, {}, never, never, true, never>;
}
declare class DeviceTabProfileComponent implements OnInit, ProductExperienceEventSource {
deviceRealtime: ManagedObjectRealtimeService;
private deviceProfileService;
private route;
private operationRealtime;
private alertService;
PRODUCT_EXPERIENCE: {
readonly EVENTS: {
readonly REPOSITORY: "deviceProfileRepository";
readonly DEVICE_TAB: "deviceProfileTab";
};
readonly COMPONENTS: {
readonly DEVICE_PROFILE_LIST: "device-profile-list";
readonly ADD_DEVICE_PROFILE: "add-device-profile";
readonly DEVICE_PROFILE: "device-profile";
readonly DEVICE_TAB_PROFILE: "device-tab-profile";
};
readonly ACTIONS: {
readonly CANCEL: "cancel";
readonly CREATE: "create";
readonly REMOVE: "remove";
readonly ADD: "add";
readonly SAVE: "save";
readonly ASSIGN_DEVICE_PROFILE: "assignDeviceProfile";
};
readonly RESULTS: {
readonly ADD_SOFTWARE: "addSoftware";
};
readonly FRAGMENTS: {
readonly FIRMWARE: "firmware";
readonly SOFTWARE: "software";
readonly CONFGIURATION: "configuration";
};
};
device: IManagedObject;
deviceProfiles$: Observable<IResultList<IManagedObject>>;
selectedProfile: Partial<DeviceProfile>;
operation: IOperation;
firmwareItems: ComparisonResult[];
softwareItems: ComparisonResult[];
configurationItems: ComparisonResult[];
filterPipe: ForOfFilterPipe;
pattern$: BehaviorSubject<string>;
reload$: BehaviorSubject<boolean>;
productExperienceEvent: ProductExperienceEvent;
private destroyRef;
constructor(deviceRealtime: ManagedObjectRealtimeService, deviceProfileService: DeviceProfileService, route: ActivatedRoute, operationRealtime: OperationRealtimeService, alertService: AlertService);
ngOnInit(): Promise<void>;
getDeviceProfilesAndUpdateProfileItems(): Promise<void>;
selectProfile(mo: DeviceProfile): void;
createOperation(): Promise<void>;
updateProfileItems(device: any, profile: any): void;
private subscribeToManagedObjects;
private subscribeToOperations;
private toProfileForDevice;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceTabProfileComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DeviceTabProfileComponent, "c8y-device-tab-profile", never, {}, {}, never, never, true, never>;
}
declare class DeviceTabProfileDetailComponent {
sectionTitle: string;
sectionIcon: string;
emptyStateText: string;
emptyStateDetails: string;
isProfileSelected: boolean;
isEmpty: boolean;
items: ComparisonResult[];
showTextLabel: boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceTabProfileDetailComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DeviceTabProfileDetailComponent, "c8y-device-tab-profile-detail", never, { "sectionTitle": { "alias": "sectionTitle"; "required": false; }; "sectionIcon": { "alias": "sectionIcon"; "required": false; }; "emptyStateText": { "alias": "emptyStateText"; "required": false; }; "emptyStateDetails": { "alias": "emptyStateDetails"; "required": false; }; "isProfileSelected": { "alias": "isProfileSelected"; "required": false; }; "isEmpty": { "alias": "isEmpty"; "required": false; }; "items": { "alias": "items"; "required": false; }; "showTextLabel": { "alias": "showTextLabel"; "required": false; }; }, {}, never, never, true, never>;
}
declare class DeviceProfileItemListComponent {
icon: string;
comparisonResults: ComparisonResult[];
showProfileItems: boolean;
showTextLabel: boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileItemListComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DeviceProfileItemListComponent, "c8y-device-profile-item-list", never, { "icon": { "alias": "icon"; "required": false; }; "comparisonResults": { "alias": "comparisonResults"; "required": false; }; "showProfileItems": { "alias": "showProfileItems"; "required": false; }; "showTextLabel": { "alias": "showTextLabel"; "required": false; }; }, {}, never, never, true, never>;
}
declare class DeviceProfileModule {
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<DeviceProfileModule, never, [typeof i1.CoreModule, typeof i1.CommonModule, typeof i2.SharedRepositoryModule, typeof i3.RouterModule, typeof i4.BsDropdownModule, typeof i5.TooltipModule, typeof i6.ReactiveFormsModule, typeof i7.ButtonsModule, typeof i8.PopoverModule, typeof i9.OperationDetailsModule, typeof DeviceProfileComponent, typeof DeviceProfileListComponent, typeof AddDeviceProfileComponent, typeof SelectConfigurationModalComponent, typeof DeviceTabProfileComponent, typeof DeviceTabProfileDetailComponent, typeof DeviceProfileItemListComponent], never>;
static ɵinj: i0.ɵɵInjectorDeclaration<DeviceProfileModule>;
}
declare class DeviceProfileGuard {
canActivate(route: ActivatedRouteSnapshot): boolean;
private hasSupportedOperation;
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceProfileGuard, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceProfileGuard>;
}
export { AddDeviceProfileComponent, DeviceProfileComponent, DeviceProfileGuard, DeviceProfileItemListComponent, DeviceProfileListComponent, DeviceProfileModule, DeviceProfileNavigationFactory, DeviceProfileOperation, DeviceProfileService, DeviceTabProfileComponent, DeviceTabProfileDetailComponent, PRODUCT_EXPERIENCE_DEVICE_PROFILE, SelectConfigurationModalComponent };
export type { ComparisonResult, DeviceProfile, DeviceProfileConfiguration, DeviceProfileFirmware, DeviceProfileSoftware };
//# sourceMappingURL=index.d.ts.map