@openremote/or-dashboard-builder 1.3.0-snapshot.20250122164613 → 1.3.0-snapshot.20250123153842

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
@@ -2532,7 +2532,7 @@
2532
2532
  flex-wrap: wrap;
2533
2533
  position: relative;
2534
2534
  }
2535
- `;let ad=ed=class extends $o{constructor(){super(...arguments),this._loading=!0,this._startedByUser=!1,this._refreshTimer=void 0}static getManifest(){return{displayName:"Gateway",displayIcon:"lan-connect",minColumnWidth:1,minColumnHeight:1,getContentHtml:t=>new ed(t),getSettingsHtml:t=>new td(t),getDefaultConfig:()=>({type:"HTTPS",target:"localhost",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig))}static get styles(){return[...super.styles,rd]}disconnectedCallback(){this._activeTunnel&&(this._startedByUser?this._stopTunnel(this._activeTunnel).then((()=>{console.warn("Stopped the active tunnel, as it was created through the widget.")})):console.warn("Keeping the active tunnel open, as it is not started through the widget.")),this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){return this.widgetConfig&&setTimeout((()=>{const t=this._getTunnelInfoByConfig(this.widgetConfig);this._getActiveTunnel(t).then((t=>{t&&(console.log("Existing tunnel found!",t),this._setActiveTunnel(t,!0))})).catch((t=>{console.error(t)})).finally((()=>{this._loading=!1}))}),500),super.firstUpdated(t)}render(){var t;const e=(null===(t=this.getEditMode)||void 0===t?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig);return $`
2535
+ `;let ad=ed=class extends $o{constructor(){super(...arguments),this._loading=!0,this._isReady=!1,this._startedByUser=!1,this._refreshTimer=void 0}static getManifest(){return{displayName:"Gateway",displayIcon:"lan-connect",minColumnWidth:1,minColumnHeight:1,getContentHtml:t=>new ed(t),getSettingsHtml:t=>new td(t),getDefaultConfig:()=>({type:"HTTPS",target:"localhost",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig)),this._readyCheck(this.widgetConfig)}static get styles(){return[...super.styles,rd]}disconnectedCallback(){this._activeTunnel&&(this._startedByUser?this._stopTunnel(this._activeTunnel).then((()=>{console.warn("Stopped the active tunnel, as it was created through the widget.")})):console.warn("Keeping the active tunnel open, as it is not started through the widget.")),this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){if(this.widgetConfig){const t=this._getTunnelInfoByConfig(this.widgetConfig);this._readyCheck(this.widgetConfig),setTimeout((()=>{this._getActiveTunnel(t).then((t=>{t&&(console.log("Existing tunnel found!",t),this._setActiveTunnel(t,!0))})).catch((t=>{console.error(t)})).finally((()=>{this._loading=!1}))}),500)}return super.firstUpdated(t)}render(){var t;this._getTunnelInfoByConfig(this.widgetConfig);const e=(null===(t=this.getEditMode)||void 0===t?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig)||!this._isReady;return $`
2536
2536
  <div id="gateway-widget-wrapper">
2537
2537
  <div id="gateway-widget-container">
2538
2538
  ${vt(this._loading,(()=>$`
@@ -2557,13 +2557,13 @@
2557
2557
  <div><or-translate value="gatewayTunnels.closesAt"></or-translate>: ${jo()(null===(t=this._activeTunnel)||void 0===t?void 0:t.autoCloseTime).format("lll")}</div>
2558
2558
  `}))}
2559
2559
  `:$`
2560
- <or-mwc-input .type="${lr.BUTTON}" label="${In.i18next.t("gatewayTunnels.start")}" outlined .disabled="${e}"
2560
+ <or-mwc-input .type="${lr.BUTTON}" label="${e?In.i18next.t("gatewayTunnels.offline"):In.i18next.t("gatewayTunnels.start")}" outlined .disabled="${e}"
2561
2561
  @or-mwc-input-changed="${t=>this._onStartTunnelClick(t)}"
2562
2562
  ></or-mwc-input>
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,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`
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}))}_getGatewayStatus(t){return nd(this,void 0,void 0,(function*(){const e=yield An().rest.api.AssetResource.get(t.gatewayId);return 200===e.status&&e.data&&e.data.attributes&&e.data.attributes.gatewayStatus?e.data.attributes.gatewayStatus.value:void 0}))}_readyCheck(t){const e=this._getTunnelInfoByConfig(t);this._getGatewayStatus(e).then((t=>{this._isReady="CONNECTED"===t}))}_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),id([gt()],ad.prototype,"_isReady",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 {