@openremote/or-dashboard-builder 1.31.0-snapshot.20260924080557 → 1.31.0
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/build/dist/umd/index.bundle.js +10 -7
- package/build/dist/umd/index.js +10 -7
- package/build/dist/umd/index.orbundle.js +12 -9
- package/build/lib/widgets/gateway-widget.d.ts.map +1 -1
- package/build/lib/widgets/gateway-widget.js +12 -9
- package/build/lib/widgets/gateway-widget.js.map +1 -1
- package/package.json +19 -19
|
@@ -4786,14 +4786,14 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4786
4786
|
flex-wrap: wrap;
|
|
4787
4787
|
position: relative;
|
|
4788
4788
|
}
|
|
4789
|
-
`,um=tW=class extends aT{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 tW(t),getSettingsHtml:t=>new uc(t),getDefaultConfig:()=>({attributeRefs:[],type:"HTTPS",target:"127.0.0.1",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig)),this._readyCheck(this.widgetConfig)}static get styles(){return[...super.styles,up]}disconnectedCallback(){this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){if(this.widgetConfig){let 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);let e=(null==(t=this.getEditMode)?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig)||!this._isReady;return X`
|
|
4789
|
+
`,um=tW=class extends aT{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 tW(t),getSettingsHtml:t=>new uc(t),getDefaultConfig:()=>({attributeRefs:[],type:"HTTPS",target:"127.0.0.1",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig)),this._readyCheck(this.widgetConfig)}static get styles(){return[...super.styles,up]}disconnectedCallback(){this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){if(!t6().hasRole("read:tunnels"))return this._loading=!1,super.firstUpdated(t);if(this.widgetConfig){let 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);let e=!t6().hasRole("write:tunnels"),i=(null==(t=this.getEditMode)?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig)||!this._isReady;return X`
|
|
4790
4790
|
<div id="gateway-widget-wrapper">
|
|
4791
4791
|
<div id="gateway-widget-container">
|
|
4792
4792
|
${t0(this._loading,()=>X` <or-loading-indicator></or-loading-indicator> `,()=>{var t;return this._activeTunnel?X`
|
|
4793
4793
|
<div>
|
|
4794
4794
|
<or-vaadin-button
|
|
4795
4795
|
theme="primary"
|
|
4796
|
-
?disabled=${e}
|
|
4796
|
+
?disabled=${i||e}
|
|
4797
4797
|
@click=${t=>this._onStopTunnelClick(t)}
|
|
4798
4798
|
>
|
|
4799
4799
|
<or-icon slot="prefix" icon="stop"></or-icon>
|
|
@@ -4802,7 +4802,7 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4802
4802
|
|
|
4803
4803
|
${t0("TCP"===this.widgetConfig.type,()=>X`
|
|
4804
4804
|
<or-vaadin-button
|
|
4805
|
-
?disabled=${
|
|
4805
|
+
?disabled=${i}
|
|
4806
4806
|
@click=${t=>this._onCopyTunnelAddressClick(t)}
|
|
4807
4807
|
>
|
|
4808
4808
|
<or-icon slot="prefix" icon="content-copy"></or-icon>
|
|
@@ -4810,7 +4810,7 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4810
4810
|
</or-vaadin-button>
|
|
4811
4811
|
`,()=>X`
|
|
4812
4812
|
<or-vaadin-button
|
|
4813
|
-
?disabled=${
|
|
4813
|
+
?disabled=${i}
|
|
4814
4814
|
@click=${t=>this._onTunnelNavigateClick(t,this._activeTunnel)}
|
|
4815
4815
|
>
|
|
4816
4816
|
<or-icon slot="prefix" icon="open-in-new"></or-icon>
|
|
@@ -4825,13 +4825,16 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4825
4825
|
</div>
|
|
4826
4826
|
`})}
|
|
4827
4827
|
`:X`
|
|
4828
|
-
<or-vaadin-button
|
|
4829
|
-
|
|
4828
|
+
<or-vaadin-button
|
|
4829
|
+
?disabled=${i||e}
|
|
4830
|
+
@click=${t=>this._onStartTunnelClick(t)}
|
|
4831
|
+
>
|
|
4832
|
+
<or-translate value=${i?"gatewayTunnels.offline":"gatewayTunnels.start"}></or-translate>
|
|
4830
4833
|
</or-vaadin-button>
|
|
4831
4834
|
`})}
|
|
4832
4835
|
</div>
|
|
4833
4836
|
</div>
|
|
4834
|
-
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){let t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally(()=>{eL(void 0,et.i18next.t("gatewayTunnels.copySuccess"))}):(console.warn("Could not copy tunnel address as it could not be found."),eL(void 0,et.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),eL(void 0,et.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){let 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)){let 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),eL(void 0,et.i18next.t("errorOccurred"))}).finally(()=>{this._loading=!1})}).catch(t=>{console.error(t),eL(void 0,et.i18next.t("errorOccurred")),this._loading=!1})}}_startTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not start tunnel, as some provided information was not set.");return(yield t6().rest.api.GatewayServiceResource.startTunnel(t)).data})}_getActiveTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not get active tunnel, as some provided information was not set.");let e=yield t6().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);if(204!==e.status)return e.data})}_getGatewayStatus(t){return uu(this,void 0,void 0,function*(){var e,i;if(t.gatewayId){let n=t6().rest.api.AssetResource.get(t.gatewayId);n.catch(t=>console.error(t));let r=yield n;if(200===r.status)return null==(i=null==(e=r.data.attributes)?void 0:e.gatewayStatus)?void 0:i.value}})}_readyCheck(t){let e=this._getTunnelInfoByConfig(t);this._getGatewayStatus(e).then(t=>{this._isReady="CONNECTED"===t})}_tryStopTunnel(t){let 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 uu(this,void 0,void 0,function*(){return(yield t6().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.");let i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null==(e=window.open(i))||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:t6().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};uh([tJ()],um.prototype,"_loading",void 0),uh([tJ()],um.prototype,"_activeTunnel",void 0),uh([tJ()],um.prototype,"_isReady",void 0),um=tW=uh([tX("gateway-widget")],um);var uf=i(976),ug=function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a};let ub=h`
|
|
4837
|
+
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){let t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally(()=>{eL(void 0,et.i18next.t("gatewayTunnels.copySuccess"))}):(console.warn("Could not copy tunnel address as it could not be found."),eL(void 0,et.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),eL(void 0,et.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){let 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(t6().hasRole("write:tunnels")&&this._isConfigComplete(t)){let 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),eL(void 0,et.i18next.t("errorOccurred"))}).finally(()=>{this._loading=!1})}).catch(t=>{console.error(t),eL(void 0,et.i18next.t("errorOccurred")),this._loading=!1})}}_startTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not start tunnel, as some provided information was not set.");return(yield t6().rest.api.GatewayServiceResource.startTunnel(t)).data})}_getActiveTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not get active tunnel, as some provided information was not set.");let e=yield t6().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);if(204!==e.status)return e.data})}_getGatewayStatus(t){return uu(this,void 0,void 0,function*(){var e,i;if(t.gatewayId){let n=t6().rest.api.AssetResource.get(t.gatewayId);n.catch(t=>console.error(t));let r=yield n;if(200===r.status)return null==(i=null==(e=r.data.attributes)?void 0:e.gatewayStatus)?void 0:i.value}})}_readyCheck(t){let e=this._getTunnelInfoByConfig(t);this._getGatewayStatus(e).then(t=>{this._isReady="CONNECTED"===t})}_tryStopTunnel(t){if(!t6().hasRole("write:tunnels"))return;let 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 uu(this,void 0,void 0,function*(){return(yield t6().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.");let i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null==(e=window.open(i))||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:t6().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};uh([tJ()],um.prototype,"_loading",void 0),uh([tJ()],um.prototype,"_activeTunnel",void 0),uh([tJ()],um.prototype,"_isReady",void 0),um=tW=uh([tX("gateway-widget")],um);var uf=i(976),ug=function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a};let ub=h`
|
|
4835
4838
|
.switch-container {
|
|
4836
4839
|
display: flex;
|
|
4837
4840
|
align-items: center;
|
package/build/dist/umd/index.js
CHANGED
|
@@ -4786,14 +4786,14 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4786
4786
|
flex-wrap: wrap;
|
|
4787
4787
|
position: relative;
|
|
4788
4788
|
}
|
|
4789
|
-
`,um=tW=class extends aT{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 tW(t),getSettingsHtml:t=>new uc(t),getDefaultConfig:()=>({attributeRefs:[],type:"HTTPS",target:"127.0.0.1",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig)),this._readyCheck(this.widgetConfig)}static get styles(){return[...super.styles,up]}disconnectedCallback(){this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){if(this.widgetConfig){let 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);let e=(null==(t=this.getEditMode)?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig)||!this._isReady;return X`
|
|
4789
|
+
`,um=tW=class extends aT{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 tW(t),getSettingsHtml:t=>new uc(t),getDefaultConfig:()=>({attributeRefs:[],type:"HTTPS",target:"127.0.0.1",targetPort:443})}}refreshContent(t){this.widgetConfig=JSON.parse(JSON.stringify(this.widgetConfig)),this._readyCheck(this.widgetConfig)}static get styles(){return[...super.styles,up]}disconnectedCallback(){this._refreshTimer&&clearTimeout(this._refreshTimer),super.disconnectedCallback()}firstUpdated(t){if(!t6().hasRole("read:tunnels"))return this._loading=!1,super.firstUpdated(t);if(this.widgetConfig){let 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);let e=!t6().hasRole("write:tunnels"),i=(null==(t=this.getEditMode)?void 0:t.call(this))||!this._isConfigComplete(this.widgetConfig)||!this._isReady;return X`
|
|
4790
4790
|
<div id="gateway-widget-wrapper">
|
|
4791
4791
|
<div id="gateway-widget-container">
|
|
4792
4792
|
${t0(this._loading,()=>X` <or-loading-indicator></or-loading-indicator> `,()=>{var t;return this._activeTunnel?X`
|
|
4793
4793
|
<div>
|
|
4794
4794
|
<or-vaadin-button
|
|
4795
4795
|
theme="primary"
|
|
4796
|
-
?disabled=${e}
|
|
4796
|
+
?disabled=${i||e}
|
|
4797
4797
|
@click=${t=>this._onStopTunnelClick(t)}
|
|
4798
4798
|
>
|
|
4799
4799
|
<or-icon slot="prefix" icon="stop"></or-icon>
|
|
@@ -4802,7 +4802,7 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4802
4802
|
|
|
4803
4803
|
${t0("TCP"===this.widgetConfig.type,()=>X`
|
|
4804
4804
|
<or-vaadin-button
|
|
4805
|
-
?disabled=${
|
|
4805
|
+
?disabled=${i}
|
|
4806
4806
|
@click=${t=>this._onCopyTunnelAddressClick(t)}
|
|
4807
4807
|
>
|
|
4808
4808
|
<or-icon slot="prefix" icon="content-copy"></or-icon>
|
|
@@ -4810,7 +4810,7 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4810
4810
|
</or-vaadin-button>
|
|
4811
4811
|
`,()=>X`
|
|
4812
4812
|
<or-vaadin-button
|
|
4813
|
-
?disabled=${
|
|
4813
|
+
?disabled=${i}
|
|
4814
4814
|
@click=${t=>this._onTunnelNavigateClick(t,this._activeTunnel)}
|
|
4815
4815
|
>
|
|
4816
4816
|
<or-icon slot="prefix" icon="open-in-new"></or-icon>
|
|
@@ -4825,13 +4825,16 @@ ${s[0]?s[0]:""}</textarea>`:X` <input
|
|
|
4825
4825
|
</div>
|
|
4826
4826
|
`})}
|
|
4827
4827
|
`:X`
|
|
4828
|
-
<or-vaadin-button
|
|
4829
|
-
|
|
4828
|
+
<or-vaadin-button
|
|
4829
|
+
?disabled=${i||e}
|
|
4830
|
+
@click=${t=>this._onStartTunnelClick(t)}
|
|
4831
|
+
>
|
|
4832
|
+
<or-translate value=${i?"gatewayTunnels.offline":"gatewayTunnels.start"}></or-translate>
|
|
4830
4833
|
</or-vaadin-button>
|
|
4831
4834
|
`})}
|
|
4832
4835
|
</div>
|
|
4833
4836
|
</div>
|
|
4834
|
-
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){let t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally(()=>{eL(void 0,et.i18next.t("gatewayTunnels.copySuccess"))}):(console.warn("Could not copy tunnel address as it could not be found."),eL(void 0,et.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),eL(void 0,et.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){let 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)){let 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),eL(void 0,et.i18next.t("errorOccurred"))}).finally(()=>{this._loading=!1})}).catch(t=>{console.error(t),eL(void 0,et.i18next.t("errorOccurred")),this._loading=!1})}}_startTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not start tunnel, as some provided information was not set.");return(yield t6().rest.api.GatewayServiceResource.startTunnel(t)).data})}_getActiveTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not get active tunnel, as some provided information was not set.");let e=yield t6().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);if(204!==e.status)return e.data})}_getGatewayStatus(t){return uu(this,void 0,void 0,function*(){var e,i;if(t.gatewayId){let n=t6().rest.api.AssetResource.get(t.gatewayId);n.catch(t=>console.error(t));let r=yield n;if(200===r.status)return null==(i=null==(e=r.data.attributes)?void 0:e.gatewayStatus)?void 0:i.value}})}_readyCheck(t){let e=this._getTunnelInfoByConfig(t);this._getGatewayStatus(e).then(t=>{this._isReady="CONNECTED"===t})}_tryStopTunnel(t){let 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 uu(this,void 0,void 0,function*(){return(yield t6().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.");let i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null==(e=window.open(i))||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:t6().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};uh([tJ()],um.prototype,"_loading",void 0),uh([tJ()],um.prototype,"_activeTunnel",void 0),uh([tJ()],um.prototype,"_isReady",void 0),um=tW=uh([tX("gateway-widget")],um);var uf=i(976),ug=function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a};let ub=h`
|
|
4837
|
+
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){let t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally(()=>{eL(void 0,et.i18next.t("gatewayTunnels.copySuccess"))}):(console.warn("Could not copy tunnel address as it could not be found."),eL(void 0,et.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),eL(void 0,et.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){let 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(t6().hasRole("write:tunnels")&&this._isConfigComplete(t)){let 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),eL(void 0,et.i18next.t("errorOccurred"))}).finally(()=>{this._loading=!1})}).catch(t=>{console.error(t),eL(void 0,et.i18next.t("errorOccurred")),this._loading=!1})}}_startTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not start tunnel, as some provided information was not set.");return(yield t6().rest.api.GatewayServiceResource.startTunnel(t)).data})}_getActiveTunnel(t){return uu(this,void 0,void 0,function*(){if(!t.realm||!t.gatewayId||!t.target||!t.targetPort)throw Error("Could not get active tunnel, as some provided information was not set.");let e=yield t6().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);if(204!==e.status)return e.data})}_getGatewayStatus(t){return uu(this,void 0,void 0,function*(){var e,i;if(t.gatewayId){let n=t6().rest.api.AssetResource.get(t.gatewayId);n.catch(t=>console.error(t));let r=yield n;if(200===r.status)return null==(i=null==(e=r.data.attributes)?void 0:e.gatewayStatus)?void 0:i.value}})}_readyCheck(t){let e=this._getTunnelInfoByConfig(t);this._getGatewayStatus(e).then(t=>{this._isReady="CONNECTED"===t})}_tryStopTunnel(t){if(!t6().hasRole("write:tunnels"))return;let 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 uu(this,void 0,void 0,function*(){return(yield t6().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.");let i=this._getTunnelAddress(t);switch(t.type){case"HTTPS":case"HTTP":null==(e=window.open(i))||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:t6().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};uh([tJ()],um.prototype,"_loading",void 0),uh([tJ()],um.prototype,"_activeTunnel",void 0),uh([tJ()],um.prototype,"_isReady",void 0),um=tW=uh([tX("gateway-widget")],um);var uf=i(976),ug=function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a};let ub=h`
|
|
4835
4838
|
.switch-container {
|
|
4836
4839
|
display: flex;
|
|
4837
4840
|
align-items: center;
|