iobroker.sql 4.2.0 → 4.2.1
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/README.md +3 -4
- package/admin/custom/assets/{Components-CYBqz3DR.js → Components-DSsR9Vkk.js} +1 -1
- package/admin/custom/assets/DataBrowser-7kgmmIwY.js +1 -0
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-BkAtL7lu.js +1 -0
- package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__173647931027197__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BXkVrp-h.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js} +96 -96
- package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare__shared-Cngqjbz9.js +2 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-RXcK0i6Q.js +122 -0
- package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__173647931027197__prebuild__react_mf_2_dom_mf_1_client__prebuild__-YkkLtJg3.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild__react_mf_2_dom_mf_1_client__prebuild__-TBtXQFpm.js} +1 -1
- package/admin/custom/assets/{dist-CzitsFi7.js → dist-CSJEdwl2.js} +1 -1
- package/admin/custom/assets/helpers-DT5-3o-l.js +1 -0
- package/admin/custom/assets/{hostInit-DIOUH9oj.js → hostInit-ff9zqDdL.js} +1 -1
- package/admin/custom/assets/{index-D6PAQQ9J.js → index-BiVFssgl.js} +1 -1
- package/admin/custom/assets/{lib-CbSOBh3z.js → lib-CJNvVWNJ.js} +1 -1
- package/admin/custom/assets/{mf-entry-bootstrap-0-e018258d.js → mf-entry-bootstrap-0-93bb3b2a.js} +3 -3
- package/admin/custom/assets/{pendingShares-yWRueDAR.js → pendingShares-CpzmKQTZ.js} +2 -2
- package/admin/custom/assets/{utils-DUKzLJUz.js → utils-BFhwh2EC.js} +1 -1
- package/admin/custom/assets/vite-preload-helper-BbbETgeG.js +1 -0
- package/admin/custom/customComponents.js +2 -2
- package/admin/custom/mf-manifest.json +1 -1
- package/io-package.json +14 -14
- package/package.json +3 -3
- package/admin/custom/assets/DataBrowser-CQWCId83.js +0 -1
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__SqlComponentsSet__mf_owner__1-BhenO-eY.js +0 -1
- package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__173647931027197__loadShare__shared-D7KMOV5W.js +0 -2
- package/admin/custom/assets/_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__173647931027197__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-CUnqgVSc.js +0 -122
- package/admin/custom/assets/helpers-BZgjFQNf.js +0 -1
- package/admin/custom/assets/vite-preload-helper-DjNwdemH.js +0 -1
- /package/admin/custom/assets/{_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__173647931027197__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js → _virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js} +0 -0
package/README.md
CHANGED
|
@@ -620,6 +620,9 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
|
|
|
620
620
|
-->
|
|
621
621
|
|
|
622
622
|
## Changelog
|
|
623
|
+
### 4.2.1 (2026-10-13)
|
|
624
|
+
* (@GermanBluefox) The error of a failed save or delete in the data browser is no longer hidden by the reload of the table
|
|
625
|
+
|
|
623
626
|
### 4.2.0 (2026-10-03)
|
|
624
627
|
* (@GermanBluefox) `npm run build:ts` no longer needs the optional `mysql2` and `sqlite3` drivers to be installed
|
|
625
628
|
* (@GermanBluefox) Fixed buffered values being lost when the adapter stops, and unload no longer hangs when there is nothing else to write (#577)
|
|
@@ -648,10 +651,6 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
|
|
|
648
651
|
### 4.1.4 (2026-08-27)
|
|
649
652
|
* (@GermanBluefox) Connection errors no longer start with the useless class name `AggregateError`: the log now shows only the real reason, e.g. `connect ECONNREFUSED 127.0.0.1:3306; connect ECONNREFUSED ::1:3306`
|
|
650
653
|
|
|
651
|
-
### 4.1.3 (2026-08-27)
|
|
652
|
-
* (@GermanBluefox) Connection errors are logged with the real reason again: Node reports a failed TCP connect as an `AggregateError` whose own message is empty, so the log only showed the word `AggregateError` instead of e.g. `connect ECONNREFUSED 127.0.0.1:3306`
|
|
653
|
-
* (@GermanBluefox) The reconnection loop no longer repeats the same connection error every 30 seconds: the first occurrence is logged as error, repetitions go to debug and once an hour a reminder is logged
|
|
654
|
-
|
|
655
654
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
656
655
|
|
|
657
656
|
## License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$t as e,Dn as t,Dt as n,Gt as r,H as i,Ht as a,Jr as o,Jt as s,
|
|
1
|
+
import{$t as e,Dn as t,Dt as n,Gt as r,H as i,Ht as a,Jr as o,Jt as s,Kt as c,L as l,O as u,Tn as d,Ut as f,Wt as p,Xt as m,Yr as h,bn as g,dn as _,en as v,f as y,fn as b,hn as x,in as S,kn as C,mn as w,nn as T,on as E,pn as D,qr as O,qt as k,sn as A,wn as j,zn as M}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js";import{t as N}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare__shared-Cngqjbz9.js";import{t as P}from"./DataBrowser-7kgmmIwY.js";function F(e){if(e==null)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${r===0?n:n.toFixed(1)} ${t[r]}`}function I(e){return e?new Date(e).toLocaleString():`—`}var L={active:`success`,loggingDisabled:`warning`,objectMissing:`error`},R={active:`sql_status_active`,loggingDisabled:`sql_status_disabled`,objectMissing:`sql_status_missing`},z={DataBrowser:P,Statistics:class extends N{constructor(e){super(e),Object.assign(this.state,{stats:null,summary:null,loading:!1,errorText:``,filter:``,sortField:`count`,sortAsc:!1,preview:null,includeDisabled:!1,deleting:!1,doneText:``})}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.load()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.stats&&await this.load()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async load(){this.setState({loading:!0,errorText:``,doneText:``});try{let e=await this.sendToInstance(`getDpStatistics`,{});this.setState({stats:(e==null?void 0:e.result)||[],summary:(e==null?void 0:e.summary)||null,loading:!1})}catch(e){this.setState({loading:!1,stats:[],summary:null,errorText:e.message})}}async requestPreview(e){this.setState({loading:!0,errorText:``});try{let t=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:e}});this.setState({loading:!1,includeDisabled:e,preview:{datapoints:t.datapoints,rows:t.rows,estimatedBytes:t.estimatedBytes,items:t.items||[]}})}catch(e){this.setState({loading:!1,errorText:e.message})}}async confirmCleanup(){this.setState({deleting:!0,errorText:``});try{let e=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:this.state.includeDisabled},confirm:!0});this.setState({deleting:!1,preview:null,doneText:y.t(`sql_cleanup_done`,e.deleted.rows,e.deleted.datapoints)},()=>void this.load())}catch(e){this.setState({deleting:!1,errorText:e.message})}}sortedStats(){let{stats:e,filter:t,sortField:n,sortAsc:r}=this.state,i=t.trim().toLowerCase(),a=(e||[]).filter(e=>!i||e.id.toLowerCase().includes(i)),o=r?1:-1;return a.sort((e,t)=>{let r=e[n],i=t[n];return r===i?e.id>t.id?1:e.id<t.id?-1:0:r==null?1:i==null?-1:(r>i?1:-1)*o})}renderSortLabel(e,t){return o(s,{active:this.state.sortField===e,direction:this.state.sortField===e&&this.state.sortAsc?`asc`:`desc`,onClick:()=>this.setState({sortField:e,sortAsc:this.state.sortField!==e||!this.state.sortAsc}),children:y.t(t)})}renderSummary(){let{summary:e}=this.state;if(!e)return null;let t=e.byStatus.objectMissing,n=e.byStatus.loggingDisabled;return h(T,{sx:{display:`flex`,gap:2,flexWrap:`wrap`,alignItems:`center`,mb:1},children:[o(v,{variant:`body2`,children:y.t(`sql_summary_total`,e.datapoints,e.rows,F(e.estimatedBytes))}),!!t.datapoints&&o(A,{color:`error`,size:`small`,label:y.t(`sql_summary_missing`,t.datapoints,t.rows)}),!!n.datapoints&&o(A,{color:`warning`,size:`small`,label:y.t(`sql_summary_disabled`,n.datapoints,n.rows)})]})}renderConfirmDialog(){let{preview:e,includeDisabled:t,deleting:n}=this.state;return e?h(_,{open:!0,onClose:()=>!n&&this.setState({preview:null}),maxWidth:`md`,fullWidth:!0,children:[o(x,{children:y.t(`sql_cleanup_confirm_title`)}),o(D,{children:e.datapoints?h(O,{children:[o(w,{sx:{mb:1},children:y.t(`sql_cleanup_confirm_text`,e.datapoints,e.rows,F(e.estimatedBytes))}),o(r,{component:M,sx:{maxHeight:320},children:h(a,{size:`small`,stickyHeader:!0,children:[o(c,{children:h(k,{children:[o(p,{children:y.t(`sql_col_id`)}),o(p,{children:y.t(`sql_col_status`)}),o(p,{align:`right`,children:y.t(`sql_col_count`)}),o(p,{align:`right`,children:y.t(`sql_col_size`)})]})}),o(f,{children:e.items.map(e=>h(k,{children:[o(p,{sx:{wordBreak:`break-all`},children:e.id}),o(p,{children:o(A,{size:`small`,color:L[e.status],label:y.t(R[e.status])})}),o(p,{align:`right`,children:e.count.toLocaleString()}),o(p,{align:`right`,children:F(e.estimatedBytes)})]},e.index))})]})}),t&&o(j,{severity:`warning`,icon:o(u,{}),sx:{mt:1},children:y.t(`sql_cleanup_disabled_warning`)})]}):o(w,{children:y.t(`sql_cleanup_nothing`)})}),h(b,{children:[o(S,{onClick:()=>this.setState({preview:null}),disabled:n,startIcon:o(l,{}),children:y.t(`sql_cancel`)}),o(S,{variant:`contained`,color:`error`,disabled:n||!e.datapoints,startIcon:o(i,{}),onClick:()=>void this.confirmCleanup(),children:y.t(`sql_cleanup_delete`)})]})]}):null}renderItem(){if(!this.props.alive)return o(j,{severity:`info`,children:y.t(`sql_instance_not_running`)});let s=this.sortedStats();return h(T,{sx:{width:`100%`},children:[h(T,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1},children:[o(m,{variant:`standard`,size:`small`,value:this.state.filter,placeholder:y.t(`sql_filter`),onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?o(t,{position:`end`,children:o(d,{size:`small`,onClick:()=>this.setState({filter:``}),children:o(l,{})})}):null}}}),o(e,{title:y.t(`sql_reload`),children:o(d,{onClick:()=>void this.load(),disabled:this.state.loading,children:o(n,{})})}),o(T,{sx:{flexGrow:1}}),o(g,{control:o(E,{checked:this.state.includeDisabled,onChange:e=>this.setState({includeDisabled:e.target.checked})}),label:y.t(`sql_include_disabled`)}),o(S,{variant:`contained`,color:`error`,startIcon:o(i,{}),disabled:this.state.loading,onClick:()=>void this.requestPreview(this.state.includeDisabled),children:y.t(`sql_cleanup`)})]}),this.state.loading&&o(C,{}),!!this.state.errorText&&o(j,{severity:`error`,sx:{mb:1},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}),!!this.state.doneText&&o(j,{severity:`success`,sx:{mb:1},onClose:()=>this.setState({doneText:``}),children:this.state.doneText}),this.renderSummary(),o(r,{component:M,children:h(a,{size:`small`,stickyHeader:!0,children:[o(c,{children:h(k,{children:[o(p,{children:this.renderSortLabel(`id`,`sql_col_id`)}),o(p,{children:y.t(`sql_col_type`)}),o(p,{children:this.renderSortLabel(`status`,`sql_col_status`)}),o(p,{align:`right`,children:this.renderSortLabel(`count`,`sql_col_count`)}),o(p,{align:`right`,children:this.renderSortLabel(`estimatedBytes`,`sql_col_size`)}),o(p,{children:y.t(`sql_col_first`)}),o(p,{children:this.renderSortLabel(`lastTs`,`sql_col_last`)})]})}),h(f,{children:[s.map(e=>h(k,{hover:!0,children:[o(p,{sx:{wordBreak:`break-all`},children:e.id}),o(p,{children:e.type||`—`}),o(p,{children:o(A,{size:`small`,color:L[e.status],label:y.t(R[e.status])})}),o(p,{align:`right`,children:e.count.toLocaleString()}),o(p,{align:`right`,children:F(e.estimatedBytes)}),o(p,{children:I(e.firstTs)}),o(p,{children:I(e.lastTs)})]},e.index)),!s.length&&!this.state.loading&&o(k,{children:o(p,{colSpan:7,children:o(v,{variant:`body2`,sx:{opacity:.7},children:y.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)})})})]})]})}),o(v,{variant:`caption`,sx:{display:`block`,mt:1,opacity:.7},children:y.t(`sql_size_is_estimate`)}),this.renderConfirmDialog()]})}}};export{z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$t as e,An as t,At as n,Dn as r,Dt as i,F as a,Hn as o,Ht as s,I as c,In as l,Jr as u,Kt as d,L as f,Nn as p,Nt as m,Tn as h,Ut as g,V as _,W as v,Wt as y,Xt as b,Yr as x,b as S,dn as C,dt as w,en as T,f as E,fn as D,hn as O,ht as k,in as A,jn as j,kn as M,nn as N,on as P,pn as F,qr as I,qt as L,wn as R,zn as z}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js";import{t as B}from"./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare__shared-Cngqjbz9.js";var V={root:{display:`flex`,width:`100%`,height:`calc(100vh - 220px)`,minHeight:400,gap:8},list:{width:320,minWidth:220,display:`flex`,flexDirection:`column`,overflow:`hidden`},filterField:{padding:8,flexShrink:0},listItems:{overflowY:`auto`,flexGrow:1,minHeight:0},data:{flexGrow:1,display:`flex`,flexDirection:`column`,overflow:`hidden`},toolbar:{display:`flex`,alignItems:`center`,flexWrap:`nowrap`,gap:8,padding:8,overflow:`hidden`,flexShrink:0},title:{display:`flex`,flexDirection:`column`,flexGrow:1,minWidth:60,overflow:`hidden`},titleId:{fontWeight:`bold`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},titleName:{fontSize:`smaller`,opacity:.7,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},dateField:{width:200,flexShrink:0},table:{overflowY:`auto`,flexGrow:1,minHeight:0},nowrap:{whiteSpace:`nowrap`},pageInfo:{whiteSpace:`nowrap`,flexShrink:0},grow:{flexGrow:1}},H=e=>({"& input::-webkit-calendar-picker-indicator":{filter:e.palette.mode===`dark`?`invert(1)`:`none`,cursor:`pointer`}});function U(e){let t=new Date(e);if(isNaN(t.getTime()))return String(e);let n=(e,t)=>e.toString().padStart(t||2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}.${n(t.getMilliseconds(),3)}`}function W(e){let t=e=>e.toString().padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function G(e){let t=e=>e.toString().padStart(2,`0`);return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`}function K(e){if(!e)return;let t=new Date(e).getTime();return isNaN(t)?void 0:t}var q=class extends B{constructor(e){super(e),this.state={...this.state,points:null,names:{},filter:``,selected:null,rows:[],total:0,page:0,rowsPerPage:100,sort:`desc`,start:``,end:``,checked:[],loadingPoints:!1,loadingRows:!1,errorText:``,entryDialog:null,confirmText:``,confirmAction:null}}async componentDidMount(){await super.componentDidMount(),this.props.alive&&await this.loadDatapoints()}async componentDidUpdate(e){this.props.alive&&!e.alive&&!this.state.points&&await this.loadDatapoints()}get instance(){return`${this.props.oContext.adapterName}.${this.props.oContext.instance}`}async sendToInstance(e,t){let n=await this.props.oContext.socket.sendTo(this.instance,e,t);if(n!=null&&n.error)throw Error(n.error);return n}async loadDatapoints(){this.setState({loadingPoints:!0,errorText:``});try{let e=await this.sendToInstance(`getDatapoints`,{}),t=(e==null?void 0:e.result)||[];this.setState({points:t,loadingPoints:!1},()=>void this.loadNames(t))}catch(e){this.setState({loadingPoints:!1,points:[],errorText:e.message})}}async loadNames(e){if(e.length)try{let t=await this.props.oContext.socket.getObjectsById(e.map(e=>e.id)),n={};for(let r of e){let e=t==null?void 0:t[r.id],i=e?S.getObjectNameFromObj(e,null,{language:E.getLanguage()}):``;i&&i!==r.id&&(n[r.id]=i)}this.setState({names:n})}catch(e){console.warn(`Cannot read the names of the objects: ${e.message}`)}}async loadRows(e){let t=this.state.selected;if(t){this.setState(t=>({loadingRows:!0,errorText:e?t.errorText:``}));try{let e=await this.sendToInstance(`getRawEntries`,{id:t.id,start:K(this.state.start),end:K(this.state.end),limit:this.state.rowsPerPage,offset:this.state.page*this.state.rowsPerPage,sort:this.state.sort});this.setState({rows:(e==null?void 0:e.result)||[],total:(e==null?void 0:e.total)||0,checked:[],loadingRows:!1})}catch(e){this.setState({rows:[],total:0,loadingRows:!1,errorText:e.message})}}}selectDatapoint(e){this.setState({selected:e,page:0,rows:[],total:0,checked:[]},()=>void this.loadRows())}parseValue(e){var t,n;if(e===``)return null;if(((t=this.state.selected)==null?void 0:t.type)===`Number`){let t=parseFloat(e.replace(`,`,`.`));return isNaN(t)?0:t}return((n=this.state.selected)==null?void 0:n.type)===`Boolean`?e===`true`||e===`1`:e}async saveEntry(){let e=this.state.entryDialog,t=this.state.selected;if(!e||!t)return;let n=parseInt(e.ts,10);if(!n){this.setState({errorText:`Invalid timestamp`});return}let r={ts:n,val:this.parseValue(e.val),ack:e.ack,q:parseInt(e.q,10)||0};this.setState({entryDialog:null,loadingRows:!0});try{e.original?await this.sendToInstance(`update`,{id:t.id,state:r}):await this.sendToInstance(`storeState`,{id:t.id,state:r})}catch(e){this.setState({errorText:e.message})}await this.loadRows(!0)}async deleteEntries(e){let t=this.state.selected;if(t&&e.length){this.setState({loadingRows:!0});try{e.length===1?await this.sendToInstance(`delete`,{id:t.id,ts:e[0]}):await this.sendToInstance(`delete`,e.map(e=>({id:t.id,ts:e})))}catch(e){this.setState({errorText:e.message})}await this.loadRows(!0)}}renderDatapoints(){let e=this.state.filter.toLowerCase(),i=(this.state.points||[]).filter(t=>{var n;return!e||t.id.toLowerCase().includes(e)||((n=this.state.names[t.id])==null?void 0:n.toLowerCase().includes(e))});return x(z,{style:V.list,children:[u(b,{variant:`standard`,style:V.filterField,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),placeholder:E.t(`sql_filter`),slotProps:{input:{startAdornment:u(r,{position:`start`,children:u(n,{})}),endAdornment:this.state.filter?u(r,{position:`end`,children:u(h,{size:`small`,onClick:()=>this.setState({filter:``}),children:u(f,{})})}):null}}}),this.state.loadingPoints?u(M,{}):null,x(t,{dense:!0,style:V.listItems,children:[i.map(e=>{var t;return u(j,{selected:((t=this.state.selected)==null?void 0:t.id)===e.id,onClick:()=>this.selectDatapoint(e),sx:e=>({"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"& .MuiListItemText-secondary":{color:e.palette.primary.contrastText,opacity:.8},"&:hover":{backgroundColor:e.palette.primary.dark}}}),children:u(p,{primary:e.id,secondary:x(I,{children:[this.state.names[e.id]?u(`b`,{children:this.state.names[e.id]}):null,this.state.names[e.id]?` `:``,`[${e.type||`?`}]`]}),slotProps:{primary:{style:{wordBreak:`break-all`}},secondary:{style:{wordBreak:`break-word`}}}})},e.id)}),!i.length&&!this.state.loadingPoints?u(T,{style:{padding:16,opacity:.7},children:E.t(this.state.filter?`sql_no_data`:`sql_no_datapoints`)}):null]})]})}renderToolbar(){var t,n;let{page:r,rowsPerPage:s,total:d}=this.state,f=d?r*s+1:0,p=Math.min((r+1)*s,d);return x(`div`,{style:V.toolbar,children:[x(`div`,{style:V.title,children:[u(e,{title:((t=this.state.selected)==null?void 0:t.id)||``,children:u(`span`,{style:V.titleId,children:(n=this.state.selected)==null?void 0:n.id})}),this.state.selected&&this.state.names[this.state.selected.id]?u(`span`,{style:V.titleName,children:this.state.names[this.state.selected.id]}):null]}),u(e,{title:E.t(`sql_range_start`),children:u(b,{variant:`outlined`,size:`small`,style:V.dateField,sx:H,type:`datetime-local`,value:this.state.start,onChange:e=>this.setState({start:e.target.value,page:0},()=>void this.loadRows())})}),u(e,{title:E.t(`sql_range_end`),children:u(b,{variant:`outlined`,size:`small`,style:V.dateField,sx:H,type:`datetime-local`,value:this.state.end,onChange:e=>this.setState({end:e.target.value,page:0},()=>void this.loadRows())})}),u(o,{variant:`outlined`,size:`small`,value:s,onChange:e=>this.setState({rowsPerPage:Number(e.target.value),page:0},()=>void this.loadRows()),children:[50,100,500,1e3].map(e=>u(l,{value:e,children:e},e))}),u(e,{title:E.t(this.state.sort===`desc`?`sql_sort_desc`:`sql_sort_asc`),children:u(h,{size:`small`,onClick:()=>this.setState({sort:this.state.sort===`desc`?`asc`:`desc`,page:0},()=>void this.loadRows()),children:this.state.sort===`desc`?u(w,{}):u(k,{})})}),u(T,{style:V.pageInfo,children:E.t(`sql_page`,f.toString(),p.toString(),d.toString())}),u(h,{size:`small`,disabled:!r,onClick:()=>this.setState({page:r-1},()=>void this.loadRows()),children:u(a,{})}),u(h,{size:`small`,disabled:p>=d,onClick:()=>this.setState({page:r+1},()=>void this.loadRows()),children:u(c,{})}),u(e,{title:E.t(`sql_refresh`),children:u(h,{size:`small`,onClick:()=>void this.loadRows(),children:u(i,{})})}),u(e,{title:E.t(`sql_add`),children:u(h,{size:`small`,color:`primary`,onClick:()=>this.setState({entryDialog:{original:null,ts:Date.now().toString(),val:``,ack:!0,q:`0`}}),children:u(m,{})})}),u(e,{title:E.t(`sql_delete_selected`),children:u(`span`,{children:u(h,{size:`small`,disabled:!this.state.checked.length,onClick:()=>this.setState({confirmText:E.t(`sql_confirm_delete`,this.state.checked.length.toString()),confirmAction:()=>void this.deleteEntries(this.state.checked)}),children:u(_,{})})})})]})}renderTable(){return x(`div`,{style:V.table,children:[x(s,{size:`small`,stickyHeader:!0,children:[u(d,{children:x(L,{children:[u(y,{padding:`checkbox`,children:u(P,{indeterminate:!!this.state.checked.length&&this.state.checked.length<this.state.rows.length,checked:!!this.state.rows.length&&this.state.checked.length===this.state.rows.length,onChange:e=>this.setState({checked:e.target.checked?this.state.rows.map(e=>e.ts):[]})})}),u(y,{children:E.t(`sql_time`)}),u(y,{children:E.t(`sql_value`)}),u(y,{children:E.t(`sql_ack`)}),u(y,{children:E.t(`sql_quality`)}),u(y,{children:E.t(`sql_from`)}),u(y,{})]})}),u(g,{children:this.state.rows.map(t=>x(L,{hover:!0,children:[u(y,{padding:`checkbox`,children:u(P,{checked:this.state.checked.includes(t.ts),onChange:e=>this.setState({checked:e.target.checked?[...this.state.checked,t.ts]:this.state.checked.filter(e=>e!==t.ts)})})}),u(y,{style:V.nowrap,children:u(e,{title:t.ts.toString(),children:u(`span`,{children:U(t.ts)})})}),u(y,{style:{wordBreak:`break-all`},children:t.val===null||t.val===void 0?u(`span`,{style:{opacity:.5},children:`null`}):t.val.toString()}),u(y,{children:t.ack?`✓`:``}),u(y,{children:t.q??``}),u(y,{style:{opacity:.7},children:t.from||``}),x(y,{padding:`none`,children:[u(h,{size:`small`,onClick:()=>this.setState({entryDialog:{original:t,ts:t.ts.toString(),val:t.val===null||t.val===void 0?``:t.val.toString(),ack:!!t.ack,q:(t.q??0).toString()}}),children:u(v,{fontSize:`small`})}),u(h,{size:`small`,onClick:()=>this.setState({confirmText:E.t(`sql_confirm_delete_one`,U(t.ts)),confirmAction:()=>void this.deleteEntries([t.ts])}),children:u(_,{fontSize:`small`})})]})]},t.ts))})]}),!this.state.rows.length&&!this.state.loadingRows?u(T,{style:{padding:16,opacity:.7},children:E.t(`sql_no_data`)}):null]})}renderTimeSelector(e){let t=parseInt(e.ts,10),n=!isNaN(t),r=!!e.original,i=(r,i)=>{let a=new Date(n?t:Date.now()),o=W(a),s=G(a),c=a.getMilliseconds();if(r===`date`){if(!i)return;o=i}else if(r===`time`){if(!i)return;s=i.length===5?`${i}:00`:i}else c=Math.min(999,Math.max(0,parseInt(i,10)||0));let l=new Date(`${o}T${s}.${c.toString().padStart(3,`0`)}`).getTime();isNaN(l)||this.setState({entryDialog:{...e,ts:l.toString()}})};return x(`div`,{children:[x(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[u(b,{label:E.t(`sql_date`),type:`date`,value:n?W(new Date(t)):``,disabled:r,style:{flexGrow:1},sx:H,slotProps:{inputLabel:{shrink:!0}},onChange:e=>i(`date`,e.target.value)}),u(b,{label:E.t(`sql_time`),type:`time`,value:n?G(new Date(t)):``,disabled:r,style:{flexGrow:1},sx:H,slotProps:{inputLabel:{shrink:!0},htmlInput:{step:1}},onChange:e=>i(`time`,e.target.value)}),u(b,{label:E.t(`sql_ms`),type:`number`,value:n?new Date(t).getMilliseconds():``,disabled:r,style:{width:100},slotProps:{inputLabel:{shrink:!0},htmlInput:{min:0,max:999}},onChange:e=>i(`ms`,e.target.value)})]}),u(T,{variant:`caption`,style:{opacity:.7},children:n?`${U(t)} · ${t}`:``})]})}renderEntryDialog(){var e;let t=this.state.entryDialog;return t?x(C,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({entryDialog:null}),children:[u(O,{children:E.t(t.original?`sql_save`:`sql_add`)}),x(F,{style:{display:`flex`,flexDirection:`column`,gap:16,paddingTop:8},children:[this.renderTimeSelector(t),((e=this.state.selected)==null?void 0:e.type)===`Boolean`?x(o,{value:t.val===`true`||t.val===`1`?`true`:`false`,onChange:e=>this.setState({entryDialog:{...t,val:e.target.value}}),children:[u(l,{value:`true`,children:`true`}),u(l,{value:`false`,children:`false`})]}):u(b,{label:E.t(`sql_value`),value:t.val,autoFocus:!0,onChange:e=>this.setState({entryDialog:{...t,val:e.target.value}})}),x(`div`,{style:{display:`flex`,alignItems:`center`,gap:16},children:[u(P,{checked:t.ack,onChange:e=>this.setState({entryDialog:{...t,ack:e.target.checked}})}),u(T,{children:E.t(`sql_ack`)}),u(b,{label:E.t(`sql_quality`),value:t.q,type:`number`,onChange:e=>this.setState({entryDialog:{...t,q:e.target.value}})})]})]}),x(D,{children:[u(A,{variant:`contained`,color:`primary`,onClick:()=>void this.saveEntry(),children:E.t(`sql_save`)}),u(A,{variant:`outlined`,onClick:()=>this.setState({entryDialog:null}),children:E.t(`sql_cancel`)})]})]}):null}renderConfirmDialog(){return this.state.confirmAction?x(C,{open:!0,onClose:()=>this.setState({confirmText:``,confirmAction:null}),children:[u(O,{children:E.t(`sql_delete`)}),u(F,{children:this.state.confirmText}),x(D,{children:[u(A,{variant:`contained`,color:`error`,startIcon:u(_,{}),onClick:()=>{let e=this.state.confirmAction;this.setState({confirmText:``,confirmAction:null},()=>e==null?void 0:e())},children:E.t(`sql_delete`)}),u(A,{variant:`outlined`,onClick:()=>this.setState({confirmText:``,confirmAction:null}),children:E.t(`sql_cancel`)})]})]}):null}renderItem(){return this.props.alive?x(N,{style:V.root,children:[this.renderDatapoints(),x(z,{style:V.data,children:[this.state.errorText?u(R,{severity:`error`,style:{flexShrink:0},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}):null,this.state.selected?x(I,{children:[this.renderToolbar(),this.state.loadingRows?u(M,{}):null,this.renderTable()]}):u(T,{style:{padding:16,opacity:.7},children:E.t(`sql_select_datapoint`)})]}),this.renderEntryDialog(),this.renderConfirmDialog()]}):u(R,{severity:`info`,children:E.t(`sql_instance_not_alive`)})}};export{q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vite-preload-helper-BbbETgeG.js";import"./dist-CSJEdwl2.js";var t=e=>{let t=e;for(let e=0;e<5;e++){let e=t==null?void 0:t.default;if(!e||typeof e!=`object`||Object.keys(e).length===0)break;let n=Object.getPrototypeOf(e);if(n!==null&&n!==Object.prototype)break;let r=Object.keys(t).filter(e=>e!=="default").map(e=>t[e]);if(r.length>0&&r.some(e=>e!==void 0))break;t=e}return t},n=(e,t,n,r)=>{var i,a;let o=(i=globalThis.__mf_module_cache__)==null?void 0:i.share,s=t.map(e=>o==null?void 0:o[e]).find(e=>e!==void 0),c=e=>{let t=String(e||``).split(/[^0-9]+/).map(Number),r=String(n||``).split(/[^0-9]+/).map(Number);for(let e=0;e<Math.max(t.length,r.length);e++){if((t[e]||0)<(r[e]||0))return!0;if((t[e]||0)>(r[e]||0))return!1}return!1};if(!c((s==null?void 0:s.version)??(s==null||(a=s.default)==null?void 0:a.version)))for(let t of e){var l,u;let e=o==null?void 0:o[t];if(e===void 0)continue;let n=(e==null?void 0:e.version)??(e==null||(l=e.default)==null?void 0:l.version);if(!(n!==void 0&&c(n))&&(!r||typeof(e==null?void 0:e[r])==`function`||typeof(e==null||(u=e.default)==null?void 0:u[r])==`function`)){let n=typeof(e==null?void 0:e[r])==`function`?e:e==null?void 0:e.default,i=n==null?void 0:n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;if(!r||t.endsWith(`/client`)||!i)return e;let a={};for(let e of[`createRoot`,`hydrateRoot`])a[e]=(...t)=>{i.usingClientEntryPoint=!0;try{return n[e](...t)}finally{i.usingClientEntryPoint=!1}};return{...a,default:a}}}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js`).then(e=>e.bi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js`),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js`).then(e=>e.hr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild__react_mf_2_dom_mf_1_client__prebuild__-TBtXQFpm.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js`).then(e=>e.Gn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js`).then(e=>e.Rt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BJJWYgdj.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__SqlComponentsSet__mf_owner__153366462090512__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-RXcK0i6Q.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i.react;return e.lib?e.lib:(e.loading||=(async()=>{try{let{react:n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react/jsx-runtime`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react/jsx-runtime`,`react/jsx-runtime`],[`default:react`,`react`],`19.3.0`,void 0);return a===void 0?(e.loading=(async()=>{try{let{"react/jsx-runtime":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"react-dom":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom/client":{name:`react-dom/client`,version:`19.3.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`react-dom/client`];if(e.lib)return e.lib;if(e.loading)return e.loading;let a=n([`default:react-dom/client`,`react-dom/client`,`default:react-dom`,`react-dom`],[`default:react`,`react`],`19.3.0`,`createRoot`);return a===void 0?(e.loading=(async()=>{try{let{"react-dom/client":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading):(e.lib=function(){return a},e.loaded=!0,e.lib)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/icons-material":{name:`@mui/icons-material`,version:`9.5.0`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@mui/icons-material`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@mui/icons-material":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.10`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/gui-components`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/gui-components":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/json-config":{name:`@iobroker/json-config`,version:`10.1.2`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`SqlComponentsSet`,canLiveRebind:!0,get(){let e=i[`@iobroker/json-config`];return e.lib?e.lib:(e.loading||=(async()=>{try{let{"@iobroker/json-config":n}=r,i=t({...await n()});return i.__esModule!==!0&&Object.defineProperty(i,"__esModule",{value:!0,enumerable:!1}),e.lib=function(){return i},e.loaded=!0,e.lib}finally{e.loading=void 0}})(),e.loading)},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},a=[];export{a as usedRemotes,i as usedShared};
|