import { OrWidget, type WidgetManifest } from "../util/or-widget"; import { type PropertyValues, type TemplateResult } from "lit"; import type { AssetWidgetConfig } from "../util/widget-config"; import { type GatewayTunnelInfo, GatewayTunnelInfoType } from "@openremote/model"; export interface GatewayWidgetConfig extends AssetWidgetConfig { gatewayId?: string; type: GatewayTunnelInfoType; target: string; targetPort: number; } export declare class GatewayWidget extends OrWidget { protected widgetConfig: GatewayWidgetConfig; protected _loading: boolean; /** * Cache of the active {@link GatwayTunnelInfo} we receive from the HTTP API. * It contains all necessary information, such as ID, assigned port, target information, and autoCloseTime. */ protected _activeTunnel?: GatewayTunnelInfo; protected _isReady: boolean; protected _startedByUser: boolean; protected _refreshTimer?: number; static getManifest(): WidgetManifest; refreshContent(force: boolean): void; static get styles(): import("lit").CSSResult[]; disconnectedCallback(): void; protected firstUpdated(changedProps: PropertyValues): void; protected render(): TemplateResult; /** * HTML callback function when 'copy address' button is pressed for a TCP tunnel. */ protected _onCopyTunnelAddressClick(_ev: Event): void; /** * HTML callback function when 'start' button is pressed, meant to create / start a new tunnel. */ protected _onStartTunnelClick(_ev: Event): void; /** * HTML callback function when 'stop' button is pressed, meant to destroy the active tunnel. */ protected _onStopTunnelClick(_ev: Event): void; /** * HTML callback function when 'open' button is pressed, meant to start using the tunnel. */ protected _onTunnelNavigateClick(_ev: Event, activeTunnel?: GatewayTunnelInfo): void; /** * Internal function to set the active tunnel. * Navigates the user to the tunnel after updating. This can be disabled using the {@link silent} parameter. */ protected _setActiveTunnel(tunnelInfo?: GatewayTunnelInfo, silent?: boolean): void; /** * Function that tries to start the tunnel. It checks the configuration beforehand, * and acts as a controller to call the correct functions throughout the starting process. */ protected _tryStartTunnel(widgetConfig: GatewayWidgetConfig): void; /** * Internal function that starts the tunnel by communicating with the Manager API. */ protected _startTunnel(info: GatewayTunnelInfo): Promise; /** * Internal function that requests the Manager API for the active tunnel based on the {@link GatewayTunnelInfo} parameter. * Returns `undefined` if no tunnel could be found on the Manager instance. */ protected _getActiveTunnel(info: GatewayTunnelInfo): Promise; /** * Internal function that requests the Manager API for the gatewayStatus of the gatewayId asset in {@link GatewayTunnelInfo}. * Returns undefined if there is misalignment in the linked asset id or unexpected http code. */ protected _getGatewayStatus(info: GatewayTunnelInfo): Promise; /** * Function that tries to check the gateway status and sets the ready flag to true only if connected. */ protected _readyCheck(config: GatewayWidgetConfig): void; /** * Function that tries to destroy the currently active tunnel. */ protected _tryStopTunnel(config: GatewayWidgetConfig): void; /** * Internal function that requests the Manager API to destroy a tunnel that is in line with the {@link GatewayTunnelInfo} parameter. */ protected _stopTunnel(info: GatewayTunnelInfo): Promise; /** * Function that navigates the user to an HTTP web page that interacts with a service through the tunnel. * It will open in a new browser tab automatically. */ protected _navigateToTunnel(info: GatewayTunnelInfo): void; /** * Internal function to get the tunnel address based on {@link GatewayTunnelInfo} * WARNING: Could return incorrect address if not all fields are set. */ protected _getTunnelAddress(info: GatewayTunnelInfo): string | undefined; /** * Internal function to check whether the {@link GatewayWidgetConfig} includes the necessary information to control the tunnel. * Uses several `undefined` or empty checks. Useful for checking the object before interacting with Manager APIs. */ protected _isConfigComplete(widgetConfig: GatewayWidgetConfig): boolean; /** * Internal function that parses a {@link GatewayWidgetConfig} into a new {@link GatewayTunnelInfo}. * Be aware: this does not information received from the HTTP API such as ID, assigned port, etc. Please use {@link _activeTunnel} for this. */ protected _getTunnelInfoByConfig(config: GatewayWidgetConfig): GatewayTunnelInfo; } //# sourceMappingURL=gateway-widget.d.ts.map