UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

145 lines 5.77 kB
import { Observable } from 'rxjs'; import { IQuickLink } from './quick-links.model'; import * as i0 from "@angular/core"; /** * Service for managing quick links in Cockpit and Device Management applications. * It fetches, processes, and provides quick links to relevant documentation and navigation nodes. */ export declare class QuickLinksService { private navNodes; private readonly docsService; private readonly navigatorService; private readonly labelsToFilterOutInDeviceManagement; /** * Retrieves the default quick links for Cockpit Application. * * @returns An observable emitting an array of quick links. */ getDefaultQuickLinks$(): Observable<IQuickLink[]>; /** * Retrieves default quick links for Device Management Application * * @returns An observable emitting an array of quick links for device management. */ getQuickLinksForDeviceManagement$(): Observable<IQuickLink[]>; /** * Fetches documentation links for Cockpit Application and sorts them by priority. * * @returns An observable emitting an array of documentation links. */ private getDocLinks$; /** * Processes and modifies documentation links. * * @param links - Array of documentation links. * @param navigatorNodes - Array of navigation nodes. * * @returns An array of processed documentation links. */ private handleDocLinks; /** * Creates a quick link for adding a group if the "Groups" node is present. * * @param navigatorNodes - Array of navigation nodes. * @returns A `DocLink` for adding a group or `undefined`. */ private createAddGroupDocLink; /** * Retrieves additional documentation links related to device management. * * @returns An observable that emits a list of processed documentation links. */ private getAdditionalDocLinksForDeviceManagement$; /** * Prepares documentation links by replacing some links with a main one and filtering out irrelevant links. * * @param links - The list of documentation links to process. * @returns The processed list of documentation links. */ private prepareDocLinksForDeviceManagement; /** * Filters out documentation links that should not be included in device management. * * @param links - The list of documentation links to filter. * @returns The filtered list of documentation links. */ private filterOutDocsLinksForDeviceManagement; /** * Replaces the first occurrence of a documentation link with a main user guide link. * * @param links - The list of documentation links to process. * @returns The modified list of documentation links. */ private replaceDocsLinksWithMainOne; /** * Checks if a URL is valid. * * @param url - The URL string to validate. * @returns `true` if the URL is valid, otherwise `false`. */ private isValidURL; /** * Determines if a link belongs to the current application. * * @param link - The documentation link to check. * @returns `true` if the link is for the current app, otherwise `false`. */ private isLinkForCurrentApp; /** * Finds a navigation node by its label. * * @param nodeName - Label of the node to find. * @param navNodes - Array of navigation nodes. * * @returns The found navigation node. */ private findNavigatorNode; /** * Retrieves the default quick links for device management. * * This method returns an array of predefined quick link definitions * used for navigation within the device management section of the application. * * Each quick link is defined by a navigation path (`navPath`), and optionally * includes override properties such as a custom label, icon, or URL. * * @returns An array of quick link definitions. */ private getDefaultQuickLinksForDeviceManagement; /** * Fetches documentation links for Device Management Application and sorts them by priority. * * @returns An observable emitting an array of documentation links. */ private getSortedDocLinksForDeviceManagement; /** * Creates a document link based on the given navigation node path labels. * * @param navNodePathLabels - An array of strings representing the path labels used to find the navigation node. * @param quickLinkOverrides - An optional partial object of `DocLink` properties that can override the defaults. * @param navNodes - An array of `NavigatorNode` objects to search within for the navigation node. * * @returns A `DocLink` object with the details of the found navigation node, or `undefined` if no matching node is found. */ private createDocLinkToNavNode; /** * Ensures the given path starts with a leading slash. * * @param path - The path to check. * @returns The path with a leading slash. */ private ensureLeadingSlash; /** * Recursively searches for a visible navigation node that matches the given path labels. * * @param navNodePathLabels - An array of labels representing the navigation path. * This array is mutated as elements are shifted during recursion. * @param navNodes - An array of `NavigatorNode` objects to search within. Defaults to `this.navNodes`. * * @returns The found `NavigatorNode`. */ private findVisibleNavNode; static ɵfac: i0.ɵɵFactoryDeclaration<QuickLinksService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<QuickLinksService>; } //# sourceMappingURL=quick-links.service.d.ts.map