@openremote/or-dashboard-builder 1.2.0-snapshot.20241218144812 → 1.2.0-snapshot.20250107083343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js CHANGED
@@ -2549,7 +2549,7 @@
2549
2549
  ></or-mwc-input>
2550
2550
  `),(()=>$`
2551
2551
  <or-mwc-input .type="${lr.BUTTON}" icon="open-in-new" label="${In.i18next.t("gatewayTunnels.open")}" outlined .disabled="${e}"
2552
- @or-mwc-input-changed="${t=>this._onTunnelNavigateClick(t)}"
2552
+ @or-mwc-input-changed="${t=>this._onTunnelNavigateClick(t,this._activeTunnel)}"
2553
2553
  ></or-mwc-input>
2554
2554
  `))}
2555
2555
  </div>
@@ -2563,7 +2563,7 @@
2563
2563
  `}))}
2564
2564
  </div>
2565
2565
  </div>
2566
- `}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){const t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally((()=>{da(void 0,In.i18next.t("gatewayTunnels.copySuccess"))})):(console.warn("Could not copy tunnel address as it could not be found."),da(void 0,In.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),da(void 0,In.i18next.t("errorOccurred"))}_onStartTunnelClick(t){this._tryStartTunnel(this.widgetConfig)}_onStopTunnelClick(t){this._tryStopTunnel(this.widgetConfig)}_onTunnelNavigateClick(t){this._isConfigComplete(this.widgetConfig)?this._navigateToTunnel(this._getTunnelInfoByConfig(this.widgetConfig)):console.warn("Could not navigate to tunnel as configuration is not complete.")}_setActiveTunnel(t,e=!1){if(this._activeTunnel=t,this._refreshTimer&&clearTimeout(this._refreshTimer),null==t?void 0:t.autoCloseTime){const e=(null==t?void 0:t.autoCloseTime)-Date.now();e>0&&(this._refreshTimer=window.setTimeout((()=>{this._getActiveTunnel(this._getTunnelInfoByConfig(this.widgetConfig)).then((t=>{t?this._setActiveTunnel(t,!0):this._setActiveTunnel(void 0)}))}),e))}t&&!e&&this._navigateToTunnel(t)}_tryStartTunnel(t){if(this._isConfigComplete(t)){const e=this._getTunnelInfoByConfig(t);this._loading=!0,this._getActiveTunnel(e).then((t=>{t?(console.log("Found an active tunnel!",t),this._setActiveTunnel(t),this._loading=!1):this._startTunnel(e).then((t=>{t?(console.log("Started a new tunnel!",t),this._setActiveTunnel(t),this._startedByUser=!0):console.warn("No new tunnel!")})).catch((t=>{console.error(t),da(void 0,In.i18next.t("errorOccurred"))})).finally((()=>{this._loading=!1}))})).catch((t=>{console.error(t),da(void 0,In.i18next.t("errorOccurred")),this._loading=!1}))}}_startTunnel(t){return nd(this,void 0,void 0,(function*(){if(!(t.realm&&t.gatewayId&&t.target&&t.targetPort))throw new Error("Could not start tunnel, as some provided information was not set.");return(yield An().rest.api.GatewayServiceResource.startTunnel(t)).data}))}_getActiveTunnel(t){return nd(this,void 0,void 0,(function*(){if(!(t.realm&&t.gatewayId&&t.target&&t.targetPort))throw new Error("Could not get active tunnel, as some provided information was not set.");const e=yield An().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);return 204===e.status?void 0:e.data}))}_tryStopTunnel(t){const e=this._getTunnelInfoByConfig(t);this._loading=!0,this._stopTunnel(e).then((()=>{this._setActiveTunnel(void 0),this._startedByUser=!1})).catch((t=>{console.warn(t)})).finally((()=>{this._loading=!1}))}_stopTunnel(t){return nd(this,void 0,void 0,(function*(){return(yield An().rest.api.GatewayServiceResource.stopTunnel(t)).data}))}_navigateToTunnel(t){var e;t.realm&&t.gatewayId&&t.target&&t.targetPort||console.warn("Could not navigate to tunnel, as some provided information was not set.");const i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null===(e=window.open(i))||void 0===e||e.focus();break;default:console.error("Unknown error when navigating to tunnel.")}}_getTunnelAddress(t){switch(t.type){case"HTTPS":case"HTTP":return"//"+t.id+"."+(t.hostname?t.hostname:window.location.hostname);case"TCP":return(t.hostname?t.hostname:window.location.hostname)+":"+t.assignedPort}}_isConfigComplete(t){return t.gatewayId?t.type?t.target?!!t.targetPort||(console.error("Could not start tunnel, since no gateway target port was configured."),!1):(console.error("Could not start tunnel, since no gateway target was configured."),!1):(console.error("Could not start tunnel, since no gateway type / protocol was configured."),!1):(console.error("Could not start tunnel, since no gateway asset was configured."),!1)}_getTunnelInfoByConfig(t){return{realm:An().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};id([gt()],ad.prototype,"_loading",void 0),id([gt()],ad.prototype,"_activeTunnel",void 0),ad=ed=id([ht("gateway-widget")],ad);var od=function(t,e,i,n){var r,a=arguments.length,o=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,i,o):r(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o};const sd=o`
2566
+ `}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){const t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally((()=>{da(void 0,In.i18next.t("gatewayTunnels.copySuccess"))})):(console.warn("Could not copy tunnel address as it could not be found."),da(void 0,In.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),da(void 0,In.i18next.t("errorOccurred"))}_onStartTunnelClick(t){this._tryStartTunnel(this.widgetConfig)}_onStopTunnelClick(t){this._tryStopTunnel(this.widgetConfig)}_onTunnelNavigateClick(t,e){e?this._navigateToTunnel(e):console.warn("Could not navigate to tunnel as configuration is not complete.")}_setActiveTunnel(t,e=!1){if(this._activeTunnel=t,this._refreshTimer&&clearTimeout(this._refreshTimer),null==t?void 0:t.autoCloseTime){const e=(null==t?void 0:t.autoCloseTime)-Date.now();e>0&&(this._refreshTimer=window.setTimeout((()=>{this._getActiveTunnel(this._getTunnelInfoByConfig(this.widgetConfig)).then((t=>{t?this._setActiveTunnel(t,!0):this._setActiveTunnel(void 0)}))}),e))}t&&!e&&this._navigateToTunnel(t)}_tryStartTunnel(t){if(this._isConfigComplete(t)){const e=this._getTunnelInfoByConfig(t);this._loading=!0,this._getActiveTunnel(e).then((t=>{t?(console.log("Found an active tunnel!",t),this._setActiveTunnel(t),this._loading=!1):this._startTunnel(e).then((t=>{t?(console.log("Started a new tunnel!",t),this._setActiveTunnel(t),this._startedByUser=!0):console.warn("No new tunnel!")})).catch((t=>{console.error(t),da(void 0,In.i18next.t("errorOccurred"))})).finally((()=>{this._loading=!1}))})).catch((t=>{console.error(t),da(void 0,In.i18next.t("errorOccurred")),this._loading=!1}))}}_startTunnel(t){return nd(this,void 0,void 0,(function*(){if(!(t.realm&&t.gatewayId&&t.target&&t.targetPort))throw new Error("Could not start tunnel, as some provided information was not set.");return(yield An().rest.api.GatewayServiceResource.startTunnel(t)).data}))}_getActiveTunnel(t){return nd(this,void 0,void 0,(function*(){if(!(t.realm&&t.gatewayId&&t.target&&t.targetPort))throw new Error("Could not get active tunnel, as some provided information was not set.");const e=yield An().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);return 204===e.status?void 0:e.data}))}_tryStopTunnel(t){const e=this._getTunnelInfoByConfig(t);this._loading=!0,this._stopTunnel(e).then((()=>{this._setActiveTunnel(void 0),this._startedByUser=!1})).catch((t=>{console.warn(t)})).finally((()=>{this._loading=!1}))}_stopTunnel(t){return nd(this,void 0,void 0,(function*(){return(yield An().rest.api.GatewayServiceResource.stopTunnel(t)).data}))}_navigateToTunnel(t){var e;t.id&&t.realm&&t.gatewayId&&t.target&&t.targetPort||console.warn("Could not navigate to tunnel, as some provided information was not set.");const i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null===(e=window.open(i))||void 0===e||e.focus();break;default:console.error("Unknown error when navigating to tunnel.")}}_getTunnelAddress(t){switch(t.type){case"HTTPS":case"HTTP":return"//"+t.id+"."+(t.hostname?t.hostname:window.location.hostname);case"TCP":return(t.hostname?t.hostname:window.location.hostname)+":"+t.assignedPort}}_isConfigComplete(t){return t.gatewayId?t.type?t.target?!!t.targetPort||(console.error("Could not start tunnel, since no gateway target port was configured."),!1):(console.error("Could not start tunnel, since no gateway target was configured."),!1):(console.error("Could not start tunnel, since no gateway type / protocol was configured."),!1):(console.error("Could not start tunnel, since no gateway asset was configured."),!1)}_getTunnelInfoByConfig(t){return{realm:An().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};id([gt()],ad.prototype,"_loading",void 0),id([gt()],ad.prototype,"_activeTunnel",void 0),ad=ed=id([ht("gateway-widget")],ad);var od=function(t,e,i,n){var r,a=arguments.length,o=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,i,o):r(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o};const sd=o`
2567
2567
 
2568
2568
  @media only screen and (min-width: 641px){
2569
2569
  #tree {