UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

968 lines (946 loc) 43.9 kB
import { IResultList, IManagedObject, InventoryService, InventoryBinaryService, OperationService, EventService, EventBinaryService, IResult, IManagedObjectBinary, IIdentified, IOperation, IEvent, IdReference, IFetchResponse } from '@c8y/client'; import { BaseColumn, ColumnConfig, CellRendererContext, AlertService, OperationRealtimeService, ServiceRegistry, GlobalConfigService, Row, FilteringFormRendererContext, ForOfFilterPipe, TypeaheadComponent, ProductExperienceEventSource, IUpdateItemEvent, ModalLabels, ISelectModalObject, ModalSelectionMode, ProductExperienceEvent, ISelectModalOption } from '@c8y/ngx-components'; import * as i0 from '@angular/core'; import { OnInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, TemplateRef } from '@angular/core'; import * as rxjs from 'rxjs'; import { Observable, BehaviorSubject, Subject } from 'rxjs'; import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons'; import { TranslateService } from '@ngx-translate/core'; import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms'; declare global { namespace CumulocityServiceRegistry { interface SpecificExtensionKeys { asm: IAdvancedSoftwareService; } } } interface IAdvancedSoftwareService { isASMAvailable(): Promise<boolean>; list(filter: any): Promise<IResultList<IManagedObject>>; } declare class DescriptionGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig & { filterLabel?: string; placeholder?: string; }); } declare class DeviceTypeCellRendererComponent implements OnInit { context: CellRendererContext; deviceType: string; constructor(context: CellRendererContext); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<DeviceTypeCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<DeviceTypeCellRendererComponent, "c8y-device-type-cell-renderer", never, {}, {}, never, never, true, never>; } declare class DeviceTypeGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig & { filterLabel?: string; placeholder?: string; path?: string; }); } declare enum RepositoryType { FIRMWARE = "c8y_Firmware", SOFTWARE = "c8y_Software", CONFIGURATION = "c8y_ConfigurationDump", PROFILE = "c8y_Profile" } declare const REPOSITORY_BINARY_TYPES: { c8y_Software: string; c8y_Firmware: string; c8y_ConfigurationDump: string; }; interface ModalModel { selected?: { id?: string; name?: string; [key: string]: any; }; version?: string; dependency?: { c8y_Firmware: { version: string; }; }; patchVersion?: string; description?: string; deviceType?: string; softwareType?: any; configurationType?: string; binary?: { file?: File; url?: string; }; c8y_Global?: any; } interface RepositoryCategory extends Partial<IManagedObject> { type: string; description?: string; c8y_Filter?: { type: string; }; softwareType?: string; } interface FirmwareBinary extends Partial<IManagedObject> { type: 'c8y_FirmwareBinary'; c8y_Firmware: { version: string; url: string; }; } interface FirmwarePatchBinary extends FirmwareBinary { c8y_Patch: { dependency: string; }; } interface SoftwareBinary extends Partial<IManagedObject> { type: string; c8y_Software: { version: string; url: string; }; } type RepositoryBinary = FirmwareBinary | SoftwareBinary | FirmwarePatchBinary; interface SelectedRepositoryBinary { id?: string; name: string; version: string; url: string; dependency?: string; c8y_Patch?: boolean; isPatch?: boolean; patchDependency?: string; softwareType?: string; } interface DeviceFirmware { version: string; url: string; name: string; } interface DeviceSoftware { name: string; version?: string; url: string; softwareType?: string; } interface DeviceSoftwareChange extends DeviceSoftware { action: 'install' | 'delete'; } interface ConfigurationSnapshot { id?: string; time: string; name: string; binaryUrl?: string; binary?: any; binaryType?: any; deviceType?: string; configurationType?: string; description?: string; } interface SupportedConfigurationItem { name: string; deviceType?: string; configurationType?: string; isLegacy?: boolean; } interface DeviceConfigurationListEmptyState { icon?: SupportedIconsSuggestions; title?: string; text?: string; } declare enum DeviceConfigurationOperation { UPLOAD_CONFIG = "c8y_UploadConfigFile", DOWNLOAD_CONFIG = "c8y_DownloadConfigFile", CONFIG = "c8y_Configuration", SEND_CONFIG = "c8y_SendConfiguration" } interface FilterCriteria { name?: string; [key: string]: any; } declare const PRODUCT_EXPERIENCE_REPOSITORY_SHARED: { 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"; }; }; }; declare class RepositoryService { private inventory; private inventoryBinary; private operation; private alert; private event; private operationRealtime; private eventBinary; private serviceRegistry; private globalConfigService; readonly dateFrom: Date; readonly dateTo: Date; private queriesUtil; private advancedSoftwareService; constructor(inventory: InventoryService, inventoryBinary: InventoryBinaryService, operation: OperationService, alert: AlertService, event: EventService, operationRealtime: OperationRealtimeService, eventBinary: EventBinaryService, serviceRegistry: ServiceRegistry, globalConfigService: GlobalConfigService); /** * Lists repository entries of given type. * @param type The type of repository entries to list. * @param options Extra listing options. */ listRepositoryEntries(type: RepositoryType, options?: { /** Additional query. */ query?: any; /** (deprecated - to be removed) Only include entries with matching partial names. */ partialName?: string; /** Include entries with matching partial text in the specified properties. */ partialTextFilter?: { partialText: string; properties: string[]; }; /** Exclude legacy entries. */ skipLegacy?: boolean; /** Exclude default ordering. */ skipDefaultOrder?: boolean; /** Other request params. */ params?: any; }): Promise<IResultList<IManagedObject>>; create(modal: ModalModel, type: RepositoryType, mo?: Partial<IManagedObject>): Promise<RepositoryCategory>; createRepositoryObject(modal: ModalModel, type: RepositoryType): Promise<RepositoryCategory>; saveBinary(file: File, global: Partial<IManagedObject>): Promise<IResult<IManagedObjectBinary>>; createOrUpdateRepositoryEntry(modal: ModalModel, type: RepositoryType): Promise<IResult<RepositoryCategory>>; createRepositoryBinary(modal: ModalModel, binaryURL: string, type: RepositoryType, parent: RepositoryCategory): Promise<IResult<FirmwareBinary | SoftwareBinary | FirmwarePatchBinary>>; prepareRepositoryBinaryMO(modal: ModalModel, binaryURL: string, type: RepositoryType): { [type]: { url: string; }; type: any; c8y_Global: any; }; linkBinary(repositoryBinary: any, binary: IManagedObjectBinary, repositoryEntry?: RepositoryCategory): Promise<IResult<IIdentified>>; cleanUp(mosToDelete: IIdentified[]): void; delete(entity: IIdentified): Promise<IResult<null>>; errorMsg(): void; getBaseVersionsCount$(entry: IManagedObject): Observable<number>; getBaseVersionFromMO(mo: RepositoryBinary): string; isPatch(mo: RepositoryBinary): boolean; getPatchVersionsCount$(entry: IManagedObject, baseVersion: FirmwareBinary): Observable<number>; isLegacyEntry(entry: Partial<IManagedObject>): boolean; /** * Lists all versions (base and patch ones) of given top level entry. * Versions are ordered by creation time (assuming the earlier created, the older the version). * @param entry Top level repository entry. * @param params Additional query params. */ listAllVersions(entry: Partial<IManagedObject>, params?: {}): Promise<IResultList<IManagedObject>>; /** * Lists base versions of given top level entry. * Versions are ordered by creation time (assuming the earlier created, the older the version). * @param entry Top level repository entry. * @param params Additional query params. */ listBaseVersions(entry: Partial<IManagedObject>, params?: {}): Promise<IResultList<IManagedObject>>; /** * Lists patch versions of given base version under the entry. * Versions are ordered by creation time (assuming the earlier created, the older the version). * @param entry Top level repository entry. * @param baseVersion Base version. * @param params Additional query params. */ listPatchVersions(entry: IManagedObject, baseVersion: FirmwareBinary | string, params?: {}): Promise<IResultList<IManagedObject>>; /** * Lists patch versions of given base version under the entry including the base version. * Versions are ordered by creation time (assuming the earlier created, the older the version). * In terms of legacy base version the entry gets transformed to fit the needed data model. * @param entry Top level repository entry. * @param baseVersion Base version. * @param params Additional query params. */ listBaseVersionAndPatches(entry: IManagedObject, baseVersion: IManagedObject, params?: {}): Promise<IResultList<IManagedObject>> | Promise<{ data: ({ c8y_Firmware: { version: any; url: any; }; } & IManagedObject)[]; }>; listChildren(entry: Partial<IManagedObject>, filters?: {}, params?: any): Promise<IResultList<IManagedObject>>; /** * Fetches all items from the list starting with the provided page. * @param firstPage The first page of the list to fetch all items for. */ fetchAllItemsFromList(firstPage: any): Promise<any>; /** * Gets top level repository entry managed object for base or patch version. * @param mo Base or patch version managed object with parents. */ getRepositoryEntryMO$(mo: IManagedObject): Observable<IManagedObject | undefined>; /** * Gets base or patch version managed object. * @param deviceRepositoryFragment Device repository fragment. * @param type Top level repository entry type. * @param configuration Configuration object with options: * - **skipLegacy** - `boolean` - Exclude legacy entries. * - **filters** - `object` - Filter object. * * @deprecated as it doesn't support 'missing url' case */ getRepositoryBinaryMoByVersion(deviceRepositoryFragment: DeviceFirmware | DeviceSoftware, type: RepositoryType, { skipLegacy, filters }?: { skipLegacy?: boolean; filters?: object; }): Promise<IManagedObject>; getBinaryName$(binaryUrl: string): Observable<string>; /** * Generates an inventory query object which can be used to find * repository entries of specified type matching the type of provided device. * @param repositoryType The type of repository entries which will be queried with the generated query. * @param device The device for which matching repository entries will be queried with the generated query. */ getDeviceTypeQuery(repositoryType: RepositoryType, device: IManagedObject): object; /** * Generates an inventory query object which can be used to find * repository entries matching the predefined software types provided in the device. * @param device The device for which matching repository entries will be queried with the generated query. * @param query The query to which the software types filters will be attached. Default value is an object containg repository type software. */ getSoftwareTypeQuery(device: IManagedObject, query?: object): object; /** * Generates an inventory query object which can be used to find configuration repository entries * matching the type of provided device and specified configuration type. * @param device The device for which matching repository entries will be queried with the generated query. * @param configurationType Configuration type for which matching repository entries will be queried with the generated query. */ getConfigurationTypeQuery(device: IManagedObject, configurationType: string): object; /** * Gets the list of software installed in the device in the uniform format. * Supports c8y_SoftwareList and c8y_Software fragments. * @param device The device whose software list should be returned. */ getDeviceSoftwareList(device: IManagedObject): DeviceSoftware[]; /** * Prepares a software update operation for given device and the list of changes, and sends it to the device. * @param device The device which the operation should be prepared for and sent to. * @param changes The list of software changes which should be applied. */ createSoftwareUpdateOperation(device: IManagedObject, changes: DeviceSoftwareChange[]): Promise<IOperation>; /** * Prepares a software update operation for given device and changes. * Returned operation type depends on device's supported operations. * Supports c8y_SoftwareUpdate, c8y_SoftwareList, and c8y_Software operations. * @param device The device for which operation should be prepared. * @param changes The list of software changes which should be applied. */ getSoftwareUpdateOperation(device: IManagedObject, changes: DeviceSoftwareChange[]): Promise<IOperation>; /** * Extracts the list of device software changes from given operation in the context of given device. * @param operation The operation from which the list should be extracted. * @param device The target device of the operation. */ getDeviceSoftwareChangesFromOperation(operation: IOperation, device: IManagedObject): Promise<DeviceSoftwareChange[]>; /** * Prepares a firmware update operation for given device and the selected repository binary, and sends it to the device. * @param device The device which the operation should be prepared for and sent to. * @param selectedOption The selected repository binary option. */ createFirmwareUpdateOperation(device: IManagedObject, selectedOption: SelectedRepositoryBinary): Promise<IOperation>; /** * Prepares a firmware update operation for given device and selected version. * Supports c8y_Firmware operation. * @param device The device for which operation should be prepared. * @param selectedOption Selected firmware version. */ getFirmwareUpdateOperation(device: IManagedObject, selectedOption: SelectedRepositoryBinary): IOperation; /** * Prepares a configuration file upload operation for given device and configuration type. * @param device The device for which operation should be prepared. * @param configurationType Selected configuration type. * @param isLegacy A legacy operation is created without a configurationType. */ getUploadConfigurationFileOperation(device: IManagedObject, configurationType: string, isLegacy?: boolean): IOperation; /** * Prepares a configuration file download operation for given device and configuration type. * @param device The device for which operation should be prepared. * @param configurationType Selected configuration type. * @param binaryUrl The url of a binary to be downloaded. * @param isLegacy A legacy operation is created without a configurationType. */ getDownloadConfigurationFileOperation(device: IManagedObject, configurationType: string, configSnapshot: ConfigurationSnapshot, isLegacy?: boolean): IOperation; /** * Gets the last firmware update operation for given device. * Looks for c8y_Firmware operations. * @param deviceId The ID of the device to find an operation for. */ getLastFirmwareUpdateOperation(deviceId: string | number): Promise<IOperation>; /** * Gets the last software update operation for given device. * Looks for c8y_SoftwareUpdate, c8y_SoftwareList, or c8y_Software operations. * @param deviceId The ID of the device to find an operation for. */ getLastSoftwareUpdateOperation(deviceId: string | number): Promise<IOperation>; /** * Iterates over the list of filters and queries the operations. * If a query returns at least one operation, the first one will be returned. * Otherwise the next query will be performed. * If none of the queries returns any operation, null will be returned. * @param filtersList The list of filters for the queries. */ getFirstMatchingOperation(filtersList: any[]): Promise<IOperation>; /** * Iterates over the list of filters and queries the operations. * It compares the operations retrieved by the queries by 'creationTime' * and return the latest one. * If none of the queries returns any operation, null will be returned. * @param filtersList The list of filters for the queries. */ getLatestMatchingOperation(filtersList: any[]): Promise<IOperation>; /** * Creates the operation and returns an observable to track its progress. * Fails the observable when the operation returns FAILED status. * Completes the observable when the operation returns SUCCESSFUL status. * @param operation The operation to create and track. */ createObservedOperation(operation: IOperation): Observable<IOperation>; /** * Returns an observable to track progress of given operation. * Fails the observable when the operation returns FAILED status. * Completes the observable when the operation returns SUCCESSFUL status. * @param operation The operation to be observed. */ observeOperation(operation: IOperation): Observable<IOperation>; /** * Gets a single event with latest creationTime for the given device Id and event type. * @param deviceId The device Id for which the events should be queried. * @param type Event type. */ getLatestConfigurationEvent(deviceId: string | number, type: string): Promise<IEvent | undefined>; /** * Gets a list of operations for the given device Id, and operation type. * @param deviceId The device Id for which the operation should be queried. * @param operationType Operation type fragment. */ getConfigFileOperationList(deviceId: string | number, operationType: string): Promise<IOperation[]>; /** * Gets latest uploaded configuration snapshot for the given device, and configuration type. * @param device The device for which the configuration snapshot was uploaded. * @param configurationType Selected configuration type. */ getConfigSnapshot(device: IManagedObject, configurationType: string): Promise<ConfigurationSnapshot | undefined>; getLegacyConfigSnapshot(deviceId: any): Promise<ConfigurationSnapshot>; /** * Returns a binary object as text. * @param binaryUrl The URL to find binary * @param options The object with additional options: * - **allowExternal** - `boolean` - allows downloading external binary file * - **noAlerts** - `boolean` - do not display an alert message; defaults to `false` */ getBinaryText(binaryUrl: string, options: { allowExternal: boolean; noAlerts?: boolean; }): Promise<string>; /** * Returns a binary object as File. * @param binaryUrl The URL to find binary * @param options The object with additional options: * - **allowExternal** - `boolean` - allows downloading external binary file */ getBinaryFile(binaryUrl: string, options: { allowExternal: boolean; }): Promise<File>; /** * Gets the last configuration update operation for given device. * Looks for c8y_Configuration and c8y_SendConfiguration operations. * @param deviceId The ID of the device to find an operation for. */ getLastConfigUpdateOperation(deviceId: string | number): Promise<IOperation>; /** * Prepares a configuration download operation for given device and its current configuration. * Supports c8y_SendConfiguration operation. * @param device The device for which operation should be prepared. */ createTextBasedConfigurationReloadOperation(device: IManagedObject): IOperation; /** * Prepares a configuration update operation for the given device. * Supports c8y_Configuration operation. * @param device The device for which operation should be prepared. * @param config The configuration which will update the existing one. */ createTextBasedConfigurationUpdateOperation(device: IManagedObject, config: string): IOperation; getBinary(binaryId: IdReference): Promise<IFetchResponse>; /** * Gets all available snapshots from the repository for the given device. * @param device The device for which the snapshots should be prepared. * @param configurationType Selected configuration type. */ getSnapshotsFromRepository(device: any, configurationType: any): Promise<IManagedObject[]>; /** * Checks if a device already have a given software installed * @param deviceId Id of the device to be checked * @param software The software to be checked */ isSoftwareInstalledOnDevice(deviceId: string | number, software: DeviceSoftware): Promise<boolean>; /** * Returns a binary object. * @param binaryId binary ID * @param options The object with additional options: * - **noAlerts** - `boolean` - do not display an alert message; defaults to `false` */ private getInternalBinaryResponse; /** * Returns a binary object. * @param binaryUrl The URL to find binary * @param options The object with additional options: * - **noAlerts** - `boolean` - do not display an alert message; defaults to `false` */ private getExternalBinaryResponse; private getBaseVersionResultListForLegacyEntry; private getDeviceSoftwareChangesFromSoftwareListOperation; private getDeviceSoftwareChangesFromSoftwareOperation; private getCurrentSoftware; private softwareListToLegacy; private getGlobalFragment; private removeOutdatedBinary; static ɵfac: i0.ɵɵFactoryDeclaration<RepositoryService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RepositoryService>; } declare class FileCellRendererComponent { context: CellRendererContext; private inventoryBinaryService; private repositoryService; constructor(context: CellRendererContext, inventoryBinaryService: InventoryBinaryService, repositoryService: RepositoryService); isBinaryFile(): boolean; getBinaryName(configuration: IManagedObject): rxjs.Observable<string>; static ɵfac: i0.ɵɵFactoryDeclaration<FileCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FileCellRendererComponent, "c8y-file-cell-renderer", never, {}, {}, never, never, true, never>; } declare class FileGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig & { filterLabel?: string; placeholder?: string; }); } declare class RepositoryItemNameCellRendererComponent { context: CellRendererContext; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<RepositoryItemNameCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<RepositoryItemNameCellRendererComponent, "c8y-repository-item-name-cell-renderer", never, {}, {}, never, never, true, never>; } declare class RepositoryItemNameGridColumn extends BaseColumn { callback: (row: Row) => void; constructor(initialColumnConfig?: ColumnConfig & { filterLabel?: string; placeholder?: string; callback?: (row: Row) => void; }); } declare class TypeCellRendererComponent { context: CellRendererContext; constructor(context: CellRendererContext); static ɵfac: i0.ɵɵFactoryDeclaration<TypeCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<TypeCellRendererComponent, "c8y-type-cell-renderer", never, {}, {}, never, never, true, never>; } declare class TypeFilteringFormRendererComponent implements OnInit, AfterViewInit { context: FilteringFormRendererContext; changeDetectorRef: ChangeDetectorRef; private repositoryService; private elementRef; path: string; selectedType: IManagedObject; types$: Observable<IResultList<IManagedObject>>; search$: BehaviorSubject<string>; filterPipe: ForOfFilterPipe<IManagedObject>; typeaheadPlaceholder: "Start typing to search, for example, {{ example }}"; typeahead: TypeaheadComponent; private queriesUtil; private types; constructor(context: FilteringFormRendererContext, changeDetectorRef: ChangeDetectorRef, repositoryService: RepositoryService, elementRef: ElementRef); onEnterKeyUp(event: KeyboardEvent): void; onEscapeKeyDown(event: KeyboardEvent): void; ngOnInit(): void; ngAfterViewInit(): void; applyFilter(): void; private removeDuplicatesType; static ɵfac: i0.ɵɵFactoryDeclaration<TypeFilteringFormRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<TypeFilteringFormRendererComponent, "c8y-type-filtering-form-renderer", never, {}, {}, never, never, true, never>; } declare class TypeGridColumn extends BaseColumn { repositoryType: RepositoryType; constructor(initialColumnConfig?: ColumnConfig & { /** Column header */ header?: string; /** Search field label */ filterLabel?: string; /** Search field placeholder */ placeholder?: string; /** MO property path to be used for quering */ path?: string; /** Repository type */ repositoryType?: RepositoryType; /** Typeahead input placeholder example value */ example?: string; }); } declare class VersionsCellRendererComponent { context: CellRendererContext; private repositoryService; isLegacy: any; item: any; constructor(context: CellRendererContext, repositoryService: RepositoryService); getBaseVersionsCount$(item: IManagedObject): Observable<number | string>; static ɵfac: i0.ɵɵFactoryDeclaration<VersionsCellRendererComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<VersionsCellRendererComponent, "c8y-versions-cell-renderer", never, {}, {}, never, never, true, never>; } declare class VersionsGridColumn extends BaseColumn { constructor(initialColumnConfig?: ColumnConfig); } declare enum LinkRenderType { DOWNLOAD = 0, LINK = 1, TEXTONLY = 2 } declare class FileDownloadComponent { private repositoryService; private inventoryBinaryService; private alertService; url: string; linkRenderType: typeof LinkRenderType; isDownloading: boolean; constructor(repositoryService: RepositoryService, inventoryBinaryService: InventoryBinaryService, alertService: AlertService); getBinaryName$(binaryUrl: any): rxjs.Observable<string>; determineBehavior(): LinkRenderType; downloadFile(): Promise<void>; static ɵfac: i0.ɵɵFactoryDeclaration<FileDownloadComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FileDownloadComponent, "c8y-file-download", never, { "url": { "alias": "url"; "required": false; }; }, {}, never, never, true, never>; } /** * RepositorySelectModalComponent displays repository entries options and allows to select them. * * ```typescript * import { take } from 'rxjs/operators'; * import { RepositorySelectModalComponent, ModalSelectionMode, RepositoryType } from '@c8y/ngx-components/repository/shared'; * * const initialState = { * repositoryType: RepositoryType.FIRMWARE, * title: gettext('Install firmware'), * subTitle: gettext('Available firmwares matching the device type'), * icon: 'c8y-firmware', * mode: ModalSelectionMode.SINGLE, * labels: { ok: gettext('Install') }, * disableSelected: false * }; * * const modal = this.bsModal.show(RepositorySelectModalComponent, { * ignoreBackdropClick: true, * initialState * }); * * modal.content.load.next(); * modal.content.resultEmitter.pipe(take(1)).subscribe((firmware) => { * }) * ``` */ declare class RepositorySelectModalComponent implements ProductExperienceEventSource { private repositoryService; private translateService; 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"; }; }; }; /** * Optional * Allows to provide custom data. * ```typescript * import { from } from 'rxjs'; * * const repositoryEntry = { name: 'ExampleEntry', type: 'c8y_Firmware' }; * const versions = [{ c8y_Firmware: { version: '1.0.0', url: 'http://example.com' } }]; * * const initialState = {repositoryEntriesWithVersions$: from({ ...repositoryEntry, versions })}; * ``` */ repositoryEntriesWithVersions$: Observable<IManagedObject[]>; /** * Repository entry type. */ repositoryType: RepositoryType.FIRMWARE | RepositoryType.SOFTWARE; /** * Optional * Allows to use custom badges templates. * ```typescript * import { gettext } from '@c8y/ngx-components/gettext'; * * const badgeTemplates = { '=1': gettext('{{count}} version'), other: gettext('{{count}} versions') }; * const initialState = { badgeTemplates }; * ``` */ badgeTemplates: { '=1': "{{count}} version"; other: "{{count}} versions"; }; /** * Optional * Allows to provide custom modal title. */ title: string; /** * Optional * Allows to provide custom modal subtitle. */ subTitle: string; /** * Loads the content of the modal. * Must be invoked by the modal's caller. */ load: Subject<void>; /** * Triggers an update of the item list emitted. */ updateInstallableList$: Subject<IUpdateItemEvent<any>>; /** * Optional * Emits a filter criteria object currently entered in the filter input. * Use it to filter the items if you use custom repositoryEntriesWithVersions$. */ searchTerm: BehaviorSubject<FilterCriteria>; /** * Optional * Allows to provide device type query to restrict search criteria. * Only takes effect when repositoryEntriesWithVersions$ is not provided, * otherwise modal's caller have to provide already filtered data in the repositoryEntriesWithVersions$. */ deviceTypeQuery: any; /** * Optional * Allows to provide query to restrict search criteria. * Only takes effect when repositoryEntriesWithVersions$ is not provided, * otherwise modal's caller have to provide already filtered data in the repositoryEntriesWithVersions$. */ searchQuery: any; /** * Optional * Allows to provide custom labels for the buttons responsible for confirm/dismiss modal actions. */ labels: ModalLabels; /** * Optional * Allows to hide the name filter input field. * By default, the filter input field is displayed. */ showFilter: boolean; /** * Optional * Allows to show a warning that the search criteria should be narrowed down. * By default, this warning is hidden. */ areMoreEntries: boolean; /** * Optional * Allows to display a more specific than the default message in case there are no items to display. */ noItemsMessage: string; /** * Optional * Allows to pass the array of items. Each item from this array will be marked as selected in the modal. */ selected: SelectedRepositoryBinary[]; /** * Emits whenever a new repository binary have been selected in the modal. */ onChoiceUpdated: EventEmitter<ISelectModalObject>; /** * Emits the list of selected options. */ resultEmitter: EventEmitter<SelectedRepositoryBinary[]>; /** * Optional * Allows to change selection mode. * Supported options: * * single: only single option can be selected. * * multiple: multiple options can be selected. */ mode: ModalSelectionMode; /** * Optional * Allows to use custom icon in the modal header. */ icon: string; /** * Allows to block selection of the other versions from the same repository entry. */ disableSelected: boolean; /** * Allows to hide items that have no options available. */ hideEmptyItems: boolean; filterCriteria: FilterCriteria; repositoryEntries$: Observable<ISelectModalObject[]>; modalEntries: Observable<ISelectModalObject[]>; /** * Optional * Allows to provide additional template that will be rendered in the * filters block on top of the results list in the select modal. */ additionalFilterTemplate: TemplateRef<any>; productExperienceEvent: ProductExperienceEvent; private PAGE_SIZE; private queriesUtil; private repositoryEntries; constructor(repositoryService: RepositoryService, translateService: TranslateService); ngOnInit(): void; getAndAssignRepositoryBinaries(mos: IManagedObject[]): IManagedObject[]; search(filterCriteria: FilterCriteria): void; result(selectedItems: SelectedRepositoryBinary[]): void; aggregate(mos: IManagedObject[]): Promise<ISelectModalObject[]>; getSelectModalOptions(versions: RepositoryBinary[], selectedItems: SelectedRepositoryBinary[], repositoryEntry: RepositoryCategory, repositoryType: RepositoryType): ISelectModalOption[]; isBinaryRepositorySelected(selectedItems: SelectedRepositoryBinary[], repositoryEntry: RepositoryCategory, repositoryBinary: RepositoryBinary, repositoryType: RepositoryType): boolean; getSelectModalObject(repositoryEntry: RepositoryCategory, options: ISelectModalOption[]): ISelectModalObject; static ɵfac: i0.ɵɵFactoryDeclaration<RepositorySelectModalComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<RepositorySelectModalComponent, "c8y-repository-select-modal", never, {}, {}, never, never, true, never>; } declare class SoftwareTypeComponent implements OnInit, ControlValueAccessor, Validator { private repositoryService; changeDetectorRef: ChangeDetectorRef; private translateService; softwareTypeMO: IManagedObject; disabled: boolean; style: any; required: boolean; placeholder: string; emitResultsOnly: boolean; showBtnInNotFoundMessage: boolean; allowFreeEntries: boolean; showClearSelectionOption: boolean; clearSelectionOptionLabel: string; set presetSoftwareTypes(types: string[] | IManagedObject[] | Observable<string[] | IManagedObject[]>); deviceSoftwareTypeModel: TypeaheadComponent; notFoundTypeAddNewTemplate: TemplateRef<unknown>; notFoundTypeTemplate: TemplateRef<unknown>; onSelectSoftware: EventEmitter<IManagedObject>; notFoundTemplateToUse: TemplateRef<unknown>; filterPipe: ForOfFilterPipe<IManagedObject>; softwaresResult$: Observable<IResultList<IManagedObject>>; search$: BehaviorSubject<string>; softwaresResult: IResultList<IManagedObject>; private queriesUtil; private softwareTypes; private presetSoftwareTypes$; constructor(repositoryService: RepositoryService, changeDetectorRef: ChangeDetectorRef, translateService: TranslateService); ngOnInit(): void; getSoftwareByTypeResult(searchString: string): Promise<IResultList<IManagedObject>> | Observable<IResultList<IManagedObject>>; selectSoftware(software: any): void; clearSoftware(): void; resetInput(): void; writeValue(value: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; validate(control: AbstractControl<any, any>): ValidationErrors; private searchInPreset; private searchInRepository; private removeDuplicatesBySoftwareType; static ɵfac: i0.ɵɵFactoryDeclaration<SoftwareTypeComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SoftwareTypeComponent, "c8y-software-type", never, { "softwareTypeMO": { "alias": "softwareTypeMO"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "style": { "alias": "style"; "required": false; }; "required": { "alias": "required"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "emitResultsOnly": { "alias": "emitResultsOnly"; "required": false; }; "showBtnInNotFoundMessage": { "alias": "showBtnInNotFoundMessage"; "required": false; }; "allowFreeEntries": { "alias": "allowFreeEntries"; "required": false; }; "showClearSelectionOption": { "alias": "showClearSelectionOption"; "required": false; }; "clearSelectionOptionLabel": { "alias": "clearSelectionOptionLabel"; "required": false; }; "presetSoftwareTypes": { "alias": "presetSoftwareTypes"; "required": false; }; }, { "onSelectSoftware": "onSelectSoftware"; }, never, never, true, never>; } declare class SharedRepositoryModule { static ɵfac: i0.ɵɵFactoryDeclaration<SharedRepositoryModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<SharedRepositoryModule, never, [typeof RepositorySelectModalComponent, typeof FileDownloadComponent, typeof SoftwareTypeComponent], [typeof RepositorySelectModalComponent, typeof FileDownloadComponent, typeof SoftwareTypeComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<SharedRepositoryModule>; } export { DescriptionGridColumn, DeviceConfigurationOperation, DeviceTypeCellRendererComponent, DeviceTypeGridColumn, FileCellRendererComponent, FileDownloadComponent, FileGridColumn, LinkRenderType, PRODUCT_EXPERIENCE_REPOSITORY_SHARED, REPOSITORY_BINARY_TYPES, RepositoryItemNameCellRendererComponent, RepositoryItemNameGridColumn, RepositorySelectModalComponent, RepositoryService, RepositoryType, SharedRepositoryModule, SoftwareTypeComponent, TypeCellRendererComponent, TypeFilteringFormRendererComponent, TypeGridColumn, VersionsCellRendererComponent, VersionsGridColumn }; export type { ConfigurationSnapshot, DeviceConfigurationListEmptyState, DeviceFirmware, DeviceSoftware, DeviceSoftwareChange, FilterCriteria, FirmwareBinary, FirmwarePatchBinary, IAdvancedSoftwareService, ModalModel, RepositoryBinary, RepositoryCategory, SelectedRepositoryBinary, SoftwareBinary, SupportedConfigurationItem }; //# sourceMappingURL=index.d.ts.map