@openremote/or-log-viewer 1.24.0 → 1.24.2

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
@@ -819,7 +819,7 @@
819
819
  `}
820
820
  </div>
821
821
  </div>
822
- `}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}onClose(t){this.buttonAction&&this.buttonAction(),this.dispatchChangedEvent({opened:!1,closeReason:t})}onOpen(){this.dispatchChangedEvent({opened:!0})}dispatchChangedEvent(t){this.dispatchEvent(new rs(t))}};rc([tu({type:String,attribute:!1})],rm.prototype,"text",void 0),rc([tu({type:String})],rm.prototype,"buttonText",void 0),rc([tu({type:Object,attribute:!1})],rm.prototype,"buttonAction",void 0),rc([tu({type:Number})],rm.prototype,"timeout",void 0),rc([tu({type:Boolean})],rm.prototype,"_open",void 0),rc([tb("#mdc-snackbar")],rm.prototype,"_mdcElem",void 0),rm=rc([tm("or-mwc-snackbar")],rm);var rp=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},ru=function(t,e,n,i){return new(n||(n=Promise))(function(r,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function l(t){try{c(i.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?r(t.value):((e=t.value)instanceof n?e:new n(function(t){t(e)})).then(o,l)}c((i=i.apply(t,e||[])).next())})};let rh=l(202),rf=l(288),rb=o`
822
+ `}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}onClose(t){this.buttonAction&&this.buttonAction(),this.dispatchChangedEvent({opened:!1,closeReason:t})}onOpen(){this.dispatchChangedEvent({opened:!0})}dispatchChangedEvent(t){this.dispatchEvent(new rs(t))}};rc([tu({type:String,attribute:!1})],rm.prototype,"text",void 0),rc([tu({type:String})],rm.prototype,"buttonText",void 0),rc([tu({type:Object,attribute:!1})],rm.prototype,"buttonAction",void 0),rc([tu({type:Number})],rm.prototype,"timeout",void 0),rc([tu({type:Boolean})],rm.prototype,"_open",void 0),rc([tb("#mdc-snackbar")],rm.prototype,"_mdcElem",void 0),rm=rc([tm("or-mwc-snackbar")],rm);var rp=l(202),ru=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},rh=function(t,e,n,i){return new(n||(n=Promise))(function(r,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function l(t){try{c(i.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?r(t.value):((e=t.value)instanceof n?e:new n(function(t){t(e)})).then(o,l)}c((i=i.apply(t,e||[])).next())})};let rf=l(288),rb=o`
823
823
  :host {
824
824
  --internal-or-log-viewer-background-color: var(--or-log-viewer-background-color, var(--or-app-color2, ${a(tM.DefaultColor2)}));
825
825
  --internal-or-log-viewer-text-color: var(--or-log-viewer-text-color, var(--or-app-color3, ${a(tM.DefaultColor3)}));
@@ -1004,5 +1004,5 @@
1004
1004
  </tbody>
1005
1005
  </table>
1006
1006
  </div>
1007
- `}_copyRow(t){return ru(this,void 0,void 0,function*(){try{var e,n;let i,r=t.message||"";yield navigator.clipboard.writeText(r),e=void 0,n=tN.i18next.t("copiedToClipboard"),e||(e=rm.DialogHostElement||document.body),(i=new rm).text=n,i.buttonText=void 0,i.buttonAction=void 0,i.isOpen=!0,i.addEventListener(rs.NAME,t=>{t.stopPropagation(),t.detail.opened||window.setTimeout(()=>{i.parentElement&&i.parentElement.removeChild(i)},0)}),e.append(i)}catch(t){console.error("Failed to copy:",t)}})}_getIntervalOptions(){return["HOUR","DAY","WEEK","MONTH","YEAR"].map(t=>[t,tN.i18next.t(t.toLowerCase())])}_loadData(){return ru(this,void 0,void 0,function*(){if(this._loading)return;this._loading=!0;let t=yield t$().rest.api.SyslogResource.getEvents({level:this.level,per_page:this.getLimit(),page:this._currentPage,from:this._getFrom(),to:this.timestamp?this.timestamp.getTime():void 0,category:this.categories,subCategory:this.filter?this.filter.split(";"):void 0});this._loading=!1,200===t.status&&(this._data=t.data,this._pageCount=this._getPageCount(t))})}_getPageCount(t){let e=t.headers.link;if(e){let t=rh.parse(e).rel("last");if(Array.isArray(t)&&t.length>0&&(t=t[0]),t&&t.uri){let e=new URL(t.uri);return parseInt(tM.Util.getQueryParameters(e.search).page)}}}_updatePage(t){this._pageCount&&(t?this._currentPage<this._pageCount&&(this._data=void 0,this._currentPage++):this._currentPage>1&&(this._data=void 0,this._currentPage--))}_subscribeEvents(){return ru(this,void 0,void 0,function*(){t$().events&&(this._eventSubscriptionId=yield t$().events.subscribe({eventType:"syslog"},t=>this._onEvent(t)))})}_unsubscribeEvents(){this._eventSubscriptionId&&(t$().events.unsubscribe(this._eventSubscriptionId),this._eventSubscriptionId=void 0)}_getFrom(){if(this.timestamp&&this.interval)return this._calculateTimestamp(this.timestamp,!1).getTime()}_calculateTimestamp(t,e){if(!this.interval)return;let n=iU()(t);if(void 0!==e)switch(this.interval){case"HOUR":n.add(e?1:-1,"hour");break;case"DAY":n.add(e?1:-1,"day");break;case"WEEK":n.add(e?1:-1,"week");break;case"MONTH":n.add(e?1:-1,"month");break;case"YEAR":n.add(e?1:-1,"year")}return n.toDate()}_onEvent(t){if(this.categories&&!this.categories.find(e=>e===t.category)||this.filter&&!this.filter.split(";").find(e=>e===t.subCategory)||!this._eventMatchesLevel(t))return;let e=this.getLimit();this._data.length===e-1&&this._data.pop(),this._data.splice(0,0,t),this._refresh&&window.clearTimeout(this._refresh),this._refresh=window.setTimeout(()=>this.requestUpdate("_data"),2e3)}_eventMatchesLevel(t){return!this.level||"INFO"===this.level||"WARN"===this.level&&("WARN"===t.level||"ERROR"===t.level)||"ERROR"===this.level&&"ERROR"===t.level}_cleanup(){this._table&&(this._table.destroy(),this._table=void 0),this._refresh&&window.clearTimeout(this._refresh)}};rg.DEFAULT_TIMESTAMP_FORMAT="L HH:mm:ss",rg.DEFAULT_LIMIT=50,rg.DEFAULT_LEVEL="INFO",rg.DEFAULT_INTERVAL="HOUR",rp([tu({type:String})],rg.prototype,"interval",void 0),rp([tu({type:Number})],rg.prototype,"timestamp",void 0),rp([tu({type:Number})],rg.prototype,"limit",void 0),rp([tu({type:Array})],rg.prototype,"categories",void 0),rp([tu({type:String})],rg.prototype,"filter",void 0),rp([tu({type:String})],rg.prototype,"level",void 0),rp([tu({type:Boolean})],rg.prototype,"live",void 0),rp([tu({type:Object})],rg.prototype,"config",void 0),rp([tu()],rg.prototype,"_loading",void 0),rp([tu()],rg.prototype,"_data",void 0),rp([tb("#table")],rg.prototype,"_tableElem",void 0),rg=tz=rp([tm("or-log-viewer")],rg)})(),c})());
1007
+ `}_copyRow(t){return rh(this,void 0,void 0,function*(){try{var e,n;let i,r=t.message||"";yield navigator.clipboard.writeText(r),e=void 0,n=tN.i18next.t("copiedToClipboard"),e||(e=rm.DialogHostElement||document.body),(i=new rm).text=n,i.buttonText=void 0,i.buttonAction=void 0,i.isOpen=!0,i.addEventListener(rs.NAME,t=>{t.stopPropagation(),t.detail.opened||window.setTimeout(()=>{i.parentElement&&i.parentElement.removeChild(i)},0)}),e.append(i)}catch(t){console.error("Failed to copy:",t)}})}_getIntervalOptions(){return["HOUR","DAY","WEEK","MONTH","YEAR"].map(t=>[t,tN.i18next.t(t.toLowerCase())])}_loadData(){return rh(this,void 0,void 0,function*(){if(this._loading)return;this._loading=!0;let t=yield t$().rest.api.SyslogResource.getEvents({level:this.level,per_page:this.getLimit(),page:this._currentPage,from:this._getFrom(),to:this.timestamp?this.timestamp.getTime():void 0,category:this.categories,subCategory:this.filter?this.filter.split(";"):void 0});this._loading=!1,200===t.status&&(this._data=t.data,this._pageCount=this._getPageCount(t))})}_getPageCount(t){let e=t.headers.link;if(e){let t=(0,rp.parse)(e).rel("last");if(Array.isArray(t)&&t.length>0&&(t=t[0]),t&&t.uri){let e=new URL(t.uri);return parseInt(tM.Util.getQueryParameters(e.search).page)}}}_updatePage(t){this._pageCount&&(t?this._currentPage<this._pageCount&&(this._data=void 0,this._currentPage++):this._currentPage>1&&(this._data=void 0,this._currentPage--))}_subscribeEvents(){return rh(this,void 0,void 0,function*(){t$().events&&(this._eventSubscriptionId=yield t$().events.subscribe({eventType:"syslog"},t=>this._onEvent(t)))})}_unsubscribeEvents(){this._eventSubscriptionId&&(t$().events.unsubscribe(this._eventSubscriptionId),this._eventSubscriptionId=void 0)}_getFrom(){if(this.timestamp&&this.interval)return this._calculateTimestamp(this.timestamp,!1).getTime()}_calculateTimestamp(t,e){if(!this.interval)return;let n=iU()(t);if(void 0!==e)switch(this.interval){case"HOUR":n.add(e?1:-1,"hour");break;case"DAY":n.add(e?1:-1,"day");break;case"WEEK":n.add(e?1:-1,"week");break;case"MONTH":n.add(e?1:-1,"month");break;case"YEAR":n.add(e?1:-1,"year")}return n.toDate()}_onEvent(t){if(this.categories&&!this.categories.find(e=>e===t.category)||this.filter&&!this.filter.split(";").find(e=>e===t.subCategory)||!this._eventMatchesLevel(t))return;let e=this.getLimit();this._data.length===e-1&&this._data.pop(),this._data.splice(0,0,t),this._refresh&&window.clearTimeout(this._refresh),this._refresh=window.setTimeout(()=>this.requestUpdate("_data"),2e3)}_eventMatchesLevel(t){return!this.level||"INFO"===this.level||"WARN"===this.level&&("WARN"===t.level||"ERROR"===t.level)||"ERROR"===this.level&&"ERROR"===t.level}_cleanup(){this._table&&(this._table.destroy(),this._table=void 0),this._refresh&&window.clearTimeout(this._refresh)}};rg.DEFAULT_TIMESTAMP_FORMAT="L HH:mm:ss",rg.DEFAULT_LIMIT=50,rg.DEFAULT_LEVEL="INFO",rg.DEFAULT_INTERVAL="HOUR",ru([tu({type:String})],rg.prototype,"interval",void 0),ru([tu({type:Number})],rg.prototype,"timestamp",void 0),ru([tu({type:Number})],rg.prototype,"limit",void 0),ru([tu({type:Array})],rg.prototype,"categories",void 0),ru([tu({type:String})],rg.prototype,"filter",void 0),ru([tu({type:String})],rg.prototype,"level",void 0),ru([tu({type:Boolean})],rg.prototype,"live",void 0),ru([tu({type:Object})],rg.prototype,"config",void 0),ru([tu()],rg.prototype,"_loading",void 0),ru([tu()],rg.prototype,"_data",void 0),ru([tb("#table")],rg.prototype,"_tableElem",void 0),rg=tz=ru([tm("or-log-viewer")],rg)})(),c})());
1008
1008
  //# sourceMappingURL=index.js.map