@openremote/or-dashboard-builder 1.6.4 → 1.6.5
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 +3 -3
- package/dist/umd/index.orbundle.js +4 -4
- package/lib/settings/gateway-settings.js +1 -1
- package/lib/settings/gateway-settings.js.map +1 -1
- package/lib/util/widget-config.d.ts +13 -0
- package/lib/widgets/attribute-input-widget.d.ts +2 -3
- package/lib/widgets/attribute-input-widget.js.map +1 -1
- package/lib/widgets/chart-widget.d.ts +2 -3
- package/lib/widgets/chart-widget.js.map +1 -1
- package/lib/widgets/gateway-widget.d.ts +2 -2
- package/lib/widgets/gateway-widget.js +2 -2
- package/lib/widgets/gateway-widget.js.map +1 -1
- package/lib/widgets/gauge-widget.d.ts +2 -3
- package/lib/widgets/gauge-widget.js.map +1 -1
- package/lib/widgets/image-widget.d.ts +2 -3
- package/lib/widgets/image-widget.js.map +1 -1
- package/lib/widgets/kpi-widget.d.ts +2 -3
- package/lib/widgets/kpi-widget.js.map +1 -1
- package/lib/widgets/map-widget.d.ts +3 -4
- package/lib/widgets/map-widget.js.map +1 -1
- package/package.json +10 -10
- package/src/settings/gateway-settings.ts +2 -1
- package/src/util/widget-config.ts +15 -0
- package/src/widgets/attribute-input-widget.ts +5 -6
- package/src/widgets/chart-widget.ts +2 -3
- package/src/widgets/gateway-widget.ts +13 -10
- package/src/widgets/gauge-widget.ts +2 -3
- package/src/widgets/image-widget.ts +2 -3
- package/src/widgets/kpi-widget.ts +2 -3
- package/src/widgets/map-widget.ts +3 -5
- package/tsconfig.tsbuildinfo +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -2509,7 +2509,7 @@
|
|
|
2509
2509
|
</div>
|
|
2510
2510
|
</settings-panel>
|
|
2511
2511
|
</div>
|
|
2512
|
-
`}_onAssetSelect(t){this.widgetConfig.gatewayId=t.detail.value,this.notifyConfigUpdate()}_onTunnelTypeSelect(t){this.widgetConfig.type=t.detail.value,this.notifyConfigUpdate()}_onTunnelTargetSelect(t){this.widgetConfig.target=t.detail.value,this.notifyConfigUpdate()}_onTunnelTargetPortSelect(t){this.widgetConfig.targetPort=t.detail.value,this.notifyConfigUpdate()}_fetchAssets(t=!0,e){return _d(this,void 0,void 0,(function*(){const e={realm:{name:Wn().displayRealm},select:{attributes:["tunnelingSupported"]},types:this.GATEWAY_ASSET_TYPES,attributes:t?{items:[{name:{predicateType:"string",value:"tunnelingSupported"},value:{predicateType:"boolean",value:!0}},{name:{predicateType:"string",value:"gatewayStatus"},value:{predicateType:"string",value:"CONNECTED"}}]}:void 0};return(yield Wn().rest.api.AssetResource.queryAssets(e)).data}))}};yd=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}([St("gateway-settings")],yd);var bd,vd=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},xd=function(t,e,i,n){return new(i||(i=Promise))((function(r,a){function o(t){try{l(n.next(t))}catch(t){a(t)}}function s(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}l((n=n.apply(t,e||[])).next())}))};const wd=ht`
|
|
2512
|
+
`}_onAssetSelect(t){this.widgetConfig.gatewayId=t.detail.value,this.widgetConfig.attributeRefs=[{id:t.detail.value,name:void 0}],this.notifyConfigUpdate()}_onTunnelTypeSelect(t){this.widgetConfig.type=t.detail.value,this.notifyConfigUpdate()}_onTunnelTargetSelect(t){this.widgetConfig.target=t.detail.value,this.notifyConfigUpdate()}_onTunnelTargetPortSelect(t){this.widgetConfig.targetPort=t.detail.value,this.notifyConfigUpdate()}_fetchAssets(t=!0,e){return _d(this,void 0,void 0,(function*(){const e={realm:{name:Wn().displayRealm},select:{attributes:["tunnelingSupported"]},types:this.GATEWAY_ASSET_TYPES,attributes:t?{items:[{name:{predicateType:"string",value:"tunnelingSupported"},value:{predicateType:"boolean",value:!0}},{name:{predicateType:"string",value:"gatewayStatus"},value:{predicateType:"string",value:"CONNECTED"}}]}:void 0};return(yield Wn().rest.api.AssetResource.queryAssets(e)).data}))}};yd=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}([St("gateway-settings")],yd);var bd,vd=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},xd=function(t,e,i,n){return new(i||(i=Promise))((function(r,a){function o(t){try{l(n.next(t))}catch(t){a(t)}}function s(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,s)}l((n=n.apply(t,e||[])).next())}))};const wd=ht`
|
|
2513
2513
|
#gateway-widget-wrapper {
|
|
2514
2514
|
height: 100%;
|
|
2515
2515
|
display: flex;
|
|
@@ -2527,7 +2527,7 @@
|
|
|
2527
2527
|
flex-wrap: wrap;
|
|
2528
2528
|
position: relative;
|
|
2529
2529
|
}
|
|
2530
|
-
`;let kd=bd=class extends rs{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 bd(t),getSettingsHtml:t=>new yd(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,wd]}disconnectedCallback(){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 F`
|
|
2530
|
+
`;let kd=bd=class extends rs{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 bd(t),getSettingsHtml:t=>new yd(t),getDefaultConfig:()=>({attributeRefs:[],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,wd]}disconnectedCallback(){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 F`
|
|
2531
2531
|
<div id="gateway-widget-wrapper">
|
|
2532
2532
|
<div id="gateway-widget-container">
|
|
2533
2533
|
${zt(this._loading,(()=>F`
|
|
@@ -2558,7 +2558,7 @@
|
|
|
2558
2558
|
`}))}
|
|
2559
2559
|
</div>
|
|
2560
2560
|
</div>
|
|
2561
|
-
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){const t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally((()=>{Ma(void 0,qn.i18next.t("gatewayTunnels.copySuccess"))})):(console.warn("Could not copy tunnel address as it could not be found."),Ma(void 0,qn.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),Ma(void 0,qn.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),Ma(void 0,qn.i18next.t("errorOccurred"))})).finally((()=>{this._loading=!1}))})).catch((t=>{console.error(t),Ma(void 0,qn.i18next.t("errorOccurred")),this._loading=!1}))}}_startTunnel(t){return xd(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 Wn().rest.api.GatewayServiceResource.startTunnel(t)).data}))}_getActiveTunnel(t){return xd(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 Wn().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);return 204===e.status?void 0:e.data}))}_getGatewayStatus(t){return xd(this,void 0,void 0,(function*(){const
|
|
2561
|
+
`}_onCopyTunnelAddressClick(t){if(this._isConfigComplete(this.widgetConfig)){const t=this._getTunnelInfoByConfig(this.widgetConfig),e=this._getTunnelAddress(t);e?navigator.clipboard.writeText(e).finally((()=>{Ma(void 0,qn.i18next.t("gatewayTunnels.copySuccess"))})):(console.warn("Could not copy tunnel address as it could not be found."),Ma(void 0,qn.i18next.t("errorOccurred")))}else console.warn("Could not copy tunnel address as configuration is not complete."),Ma(void 0,qn.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),Ma(void 0,qn.i18next.t("errorOccurred"))})).finally((()=>{this._loading=!1}))})).catch((t=>{console.error(t),Ma(void 0,qn.i18next.t("errorOccurred")),this._loading=!1}))}}_startTunnel(t){return xd(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 Wn().rest.api.GatewayServiceResource.startTunnel(t)).data}))}_getActiveTunnel(t){return xd(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 Wn().rest.api.GatewayServiceResource.getActiveTunnelInfo(t.realm,t.gatewayId,t.target,t.targetPort);return 204===e.status?void 0:e.data}))}_getGatewayStatus(t){var e,i;return xd(this,void 0,void 0,(function*(){if(t.gatewayId){const n=Wn().rest.api.AssetResource.get(t.gatewayId);n.catch((t=>console.error(t)));const r=yield n;if(200===r.status)return null===(i=null===(e=r.data.attributes)||void 0===e?void 0:e.gatewayStatus)||void 0===i?void 0:i.value}}))}_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 xd(this,void 0,void 0,(function*(){return(yield Wn().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:Wn().displayRealm,gatewayId:t.gatewayId,type:t.type,target:t.target,targetPort:t.targetPort}}};vd([It()],kd.prototype,"_loading",void 0),vd([It()],kd.prototype,"_activeTunnel",void 0),vd([It()],kd.prototype,"_isReady",void 0),kd=bd=vd([St("gateway-widget")],kd);var Td=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 Md=ht`
|
|
2562
2562
|
|
|
2563
2563
|
@media only screen and (min-width: 641px){
|
|
2564
2564
|
#tree {
|