iobroker.influxdb 5.1.8 → 5.2.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.
Files changed (68) hide show
  1. package/README.md +93 -14
  2. package/admin/custom/assets/Components-r5Lt8Y3c.js +1 -0
  3. package/admin/custom/assets/DataBrowser-sMNr2zs7.js +1 -0
  4. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__InfluxDBComponentsSet__mf_owner__1-CbZZL0d0.js +1 -0
  5. package/admin/custom/assets/{_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js → _virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js} +81 -98
  6. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare__shared-QaKaFZVZ.js +2 -0
  7. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-JVokFcpF.js +122 -0
  8. package/admin/custom/assets/{_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js → _virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-M61rjtmp.js} +1 -1
  9. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild__react_mf_2_dom_mf_1_client__prebuild__-Cxrvam_t.js +9 -0
  10. package/admin/custom/assets/{dist-CSJEdwl2.js → dist-B3E7IYuQ.js} +1 -1
  11. package/admin/custom/assets/helpers-DE61bb74.js +1 -0
  12. package/admin/custom/assets/{hostInit-Dlg_V4HP.js → hostInit-B4Pb8BxG.js} +1 -1
  13. package/admin/custom/assets/index-C8qlskOs.js +1 -0
  14. package/admin/custom/assets/{lib-CZdKkrqv.js → lib-p5eChX5b.js} +2 -2
  15. package/admin/custom/assets/{mf-entry-bootstrap-0-2589264d.js → mf-entry-bootstrap-0-defd8d52.js} +3 -3
  16. package/admin/custom/assets/pendingShares-BGQHb9Kb.js +2 -0
  17. package/admin/custom/assets/prod-ChPGnyiA.js +15 -0
  18. package/admin/custom/assets/rolldown-runtime-COiEfhsA.js +1 -0
  19. package/admin/custom/assets/utils-Bi7ATSfV.js +4 -0
  20. package/admin/custom/customComponents.js +2 -2
  21. package/admin/custom/i18n/de.json +4 -0
  22. package/admin/custom/i18n/en.json +4 -0
  23. package/admin/custom/i18n/es.json +4 -0
  24. package/admin/custom/i18n/fr.json +4 -0
  25. package/admin/custom/i18n/it.json +4 -0
  26. package/admin/custom/i18n/nl.json +4 -0
  27. package/admin/custom/i18n/pl.json +4 -0
  28. package/admin/custom/i18n/pt.json +4 -0
  29. package/admin/custom/i18n/ru.json +4 -0
  30. package/admin/custom/i18n/uk.json +4 -0
  31. package/admin/custom/i18n/zh-cn.json +4 -0
  32. package/admin/custom/mf-manifest.json +1 -1
  33. package/admin/i18n/de.json +2 -0
  34. package/admin/i18n/en.json +2 -0
  35. package/admin/i18n/es.json +3 -1
  36. package/admin/i18n/fr.json +3 -1
  37. package/admin/i18n/it.json +3 -1
  38. package/admin/i18n/nl.json +3 -1
  39. package/admin/i18n/pl.json +3 -1
  40. package/admin/i18n/pt.json +3 -1
  41. package/admin/i18n/ru.json +3 -1
  42. package/admin/i18n/uk.json +3 -1
  43. package/admin/i18n/zh-cn.json +3 -1
  44. package/admin/jsonConfig.json +14 -4
  45. package/build/lib/Database.js.map +1 -1
  46. package/build/lib/DatabaseInfluxDB3x.js +439 -0
  47. package/build/lib/DatabaseInfluxDB3x.js.map +1 -0
  48. package/build/lib/influx3Helpers.js +175 -0
  49. package/build/lib/influx3Helpers.js.map +1 -0
  50. package/build/lib/statistics.js +6 -4
  51. package/build/lib/statistics.js.map +1 -1
  52. package/build/main.js +168 -33
  53. package/build/main.js.map +1 -1
  54. package/docs/de/influxdb.md +13 -6
  55. package/docs/en/influxdb.md +13 -6
  56. package/io-package.json +28 -28
  57. package/package.json +2 -2
  58. package/admin/custom/assets/Components-BePqbwvo.js +0 -1
  59. package/admin/custom/assets/DataBrowser-D47Iap2M.js +0 -1
  60. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__InfluxDBComponentsSet__mf_owner__1-Du-iBqZ7.js +0 -1
  61. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare__shared-3YWGBSiP.js +0 -2
  62. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-DYmogjuK.js +0 -122
  63. package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DMyibbf8.js +0 -9
  64. package/admin/custom/assets/helpers-DT5-3o-l.js +0 -1
  65. package/admin/custom/assets/index-Bq5Wk8fk.js +0 -1
  66. package/admin/custom/assets/pendingShares-BeAKxbUv.js +0 -2
  67. package/admin/custom/assets/rolldown-runtime-Dd_uD5pT.js +0 -1
  68. package/admin/custom/assets/utils-BFhwh2EC.js +0 -4
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  This adapter saves state history into InfluxDB.
13
13
 
14
- **The Adapter supports InfluxDB 1.x and 2.x**
14
+ **The Adapter supports InfluxDB 1.x, 2.x and 3.x (Core and Enterprise)**
15
15
 
16
16
  **This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
17
17
 
@@ -36,15 +36,39 @@ When doing custom queries via the "query" message, you can use Flux queries to s
36
36
  #### Store metadata information as tags instead of fields
37
37
  For `Influx 1.x` state value, as well as associated metadata fields (`q`, `ack` and `from`) are stored as fields within InfluxDB. When using Flux-commands to retrieve this data (instead of `InfluxQL`) the data is returned in separate tables, which makes it more difficult to view the data in a joined way when using external database clients or Influx CLI `query` command. This is by design, as Influx only supports one field per data-point.
38
38
 
39
- With `Influx 2.x` it is now also possible, to store this metadata-information besides the actual value of the state as Influx Tags. Tags are indexed and allow for faster search queries. In addition, they are closely linked to the measurement stored within the db, meaning they will be returned in one table with the queried measurement which makes them much easier to handle, when used outside this adapter. There are limitations with this, however:
39
+ With `Influx 2.x` and `3.x` it is now also possible, to store this metadata-information besides the actual value of the state as Influx Tags. Tags are indexed and allow for faster search queries. In addition, they are closely linked to the measurement stored within the db, meaning they will be returned in one table with the queried measurement which makes them much easier to handle, when used outside this adapter. There are limitations with this, however:
40
40
  - The use of tags for metadata needs to be enabled under `Advanced Settings`. It is disabled by default.
41
41
  - If you decide to use tags, you cannot continue to use old measurements that were gathered with Influx 1.x, as they are stored in fields.
42
42
  - Attempting to use an existing database that was set up without enabling the Tag-feature will cause the adapter to fail to initialize, and you will see an error message about it in the log.
43
43
  - This also is valid the other way: Once you start using the Tag-feature in a new database, you cannot switch back to using fields for this database.
44
- - This feature is currently only available if you use Influx 2.x. And only if you use the new responsive GUI of Admin 5.
44
+ - This feature is only available if you use Influx 2.x or 3.x. And only if you use the new responsive GUI of Admin 5.
45
+
46
+ ### InfluxDB 3.x
47
+ InfluxDB 3 (Core and Enterprise) is supported. It has no organizations and no buckets, so the settings are the simplest of all three versions:
48
+ * **Host, port, protocol**: InfluxDB 3 listens on port `8181` by default.
49
+ * **Authentication Token**: a token that may write to and read from the database. Create one with `influxdb3 create token --admin` (or a database token). If the server runs without authentication (`--without-auth`) leave the field empty.
50
+ * **DB Name**: the name of the database. The default is `iobroker`. The adapter creates it on the first start (a token that is not allowed to create databases is fine: the first write creates it).
51
+ * **Path** and **Validate SSL certificate** work as for 2.x.
52
+
53
+ The adapter writes with the InfluxDB line protocol over HTTP (`/api/v3/write_lp`) and reads with **InfluxQL** over HTTP (`/api/v3/query_influxql`), the same way as for 1.x. No additional client library is needed. The [metadata-as-tags](#store-metadata-information-as-tags-instead-of-fields) and the [custom tags](#custom-tags) work as for 2.x.
54
+
55
+ When doing custom queries via the "query" message, use InfluxQL as described for [Influx 1.x](#influx-1x). The server accepts one statement per request; the adapter splits several statements separated by `;` and runs them one after the other, so the result is an array with one entry per statement, as with 1.x.
56
+
57
+ What InfluxDB 3 cannot do, and what the adapter does about it:
58
+
59
+ | Function | With InfluxDB 3.x |
60
+ |---|---|
61
+ | Retention | Supported: `Storage retention` is applied to the database with `PUT /api/v3/configure/database` on every start, like for the other versions. A retention that was set on the server (e.g. with `influxdb3 update database --retention-period`) is overwritten by the adapter setting; choose `infinite` and set it on the server if you prefer that. |
62
+ | `delete` / `deleteRange` | Not supported: InfluxDB 3 can not delete single values or a time range. The commands answer with an error and are not listed in `features`. |
63
+ | `deleteAll` and the cleanup of orphaned datapoints | Supported. The whole measurement (table) is deleted. InfluxDB 3 keeps the name of a deleted table in its catalog, renamed to `<name>-YYYYMMDDTHHMMSS`; the adapter does not show these leftovers. |
64
+ | `update` | Supported when `q`, `ack` and `from` are stored as fields: a value with the same time replaces the old one. Not supported with metadata as tags, as the tags are part of the series. |
65
+ | Number of series (Statistics tab) | Unknown, the column stays empty. |
66
+ | Write latency | InfluxDB 3 answers a write after the next write-ahead-log flush, which takes about a second. The adapter awaits the direct write of a value (`Buffer Datapoints` = 0), so by default it writes single values with `no_sync`: the answer comes at once and rejected values are still reported, but the value is readable and durable up to a second later. Enable `Wait for the database to store each value` (Expert Settings, `syncWrites`) to wait for the flush instead; single values then take about a second each, so prefer a buffer in that case. Batches (buffer flushes) are always written the regular way. |
67
+ | Limits of InfluxDB 3 Core | At most 2000 tables in all databases and 500 columns per table. The adapter writes one measurement (table) per datapoint, so Core can log at most about 2000 datapoints. InfluxDB 3 Enterprise has higher, configurable limits. |
68
+ | Types | InfluxDB 3 fixes the type of a field per measurement like the other versions. A type conflict is handled as before (the value is converted and the datatype of the datapoint is pinned). |
45
69
 
46
70
  ### Custom tags
47
- Every datapoint can carry additional, static InfluxDB tags. They are defined in the datapoint settings (`Custom tags`) as a list of name/value pairs and are written with every value of this datapoint - for both InfluxDB 1.x and 2.x and independent of the setting [Store metadata information as tags instead of fields](#store-metadata-information-as-tags-instead-of-fields).
71
+ Every datapoint can carry additional, static InfluxDB tags. They are defined in the datapoint settings (`Custom tags`) as a list of name/value pairs and are written with every value of this datapoint - for all InfluxDB versions and independent of the setting [Store metadata information as tags instead of fields](#store-metadata-information-as-tags-instead-of-fields).
48
72
 
49
73
  This allows selecting and grouping the values of different datapoints by their meaning instead of by their IDs, e.g. give all datapoints of the kitchen the tag `room=kitchen` and all temperature sensors the tag `type=temperature`. In Grafana, the values can then be filtered or grouped by these tags:
50
74
 
@@ -80,9 +104,50 @@ Please refer to the [official guides on how to migrate](https://docs.influxdata.
80
104
 
81
105
  After the migration, the adapter is able to work with the old data (e.g. for history-queries) as well. This only applies if you don't decide to [use Tags for storing metadata fields](#Store-metadata-information-as-tags-instead-of-fields).
82
106
 
107
+ ### Migration to InfluxDB 3
108
+
109
+ InfluxDB 3 cannot open the data files of 1.x or 2.x, and there is no upgrade tool. The data has to be exported as line protocol and written into the new database. Both paths below were tried with InfluxDB 1.8 / 2.7 and 3 Core 3.12: the exported points arrive with the same measurements, fields and tags that the adapter writes itself. Please always create a backup before you start.
110
+
111
+ Prepare the new server first: create a token (`influxdb3 create token --admin`), set the version to `3.x` in the adapter and let it create the database (or create it with `influxdb3 create database iobroker`). Stop the adapter while you import. The adapter applies the retention setting to the new database on start.
112
+
113
+ #### From InfluxDB 1.x
114
+
115
+ 1. Export the database as line protocol. The tool lives in the InfluxDB 1.x installation:
116
+ ```
117
+ influx_inspect export -datadir /var/lib/influxdb/data -waldir /var/lib/influxdb/wal -database iobroker -out export.lp
118
+ ```
119
+ 2. Remove the header of the file (the lines that begin with `#` or `CREATE`):
120
+ ```
121
+ grep -vE '^(#|CREATE)' export.lp > data.lp
122
+ ```
123
+ 3. Write it into InfluxDB 3. The export uses nanosecond timestamps:
124
+ ```
125
+ curl -X POST "http://localhost:8181/api/v3/write_lp?db=iobroker&precision=nanosecond&accept_partial=true" \
126
+ -H "Authorization: Bearer <token>" --data-binary @data.lp
127
+ ```
128
+
129
+ The metadata `q`, `ack` and `from` are stored as fields in 1.x, so keep `Store metadata information as tags` **disabled** in the adapter.
130
+
131
+ #### From InfluxDB 2.x
132
+
133
+ 1. Export the bucket as line protocol (the tool is part of `influxd`; look up the bucket ID with `influx bucket list`):
134
+ ```
135
+ influxd inspect export-lp --bucket-id <bucket-id> --engine-path /var/lib/influxdb2/engine --output-path data.lp
136
+ ```
137
+ 2. Write the file as shown above for 1.x.
138
+
139
+ Keep the adapter setting `Store metadata information as tags` as it was in 2.x: with tags enabled the export contains `q`, `ack` and `from` as tags, otherwise as fields. A database must not be mixed - the adapter refuses to start if the stored metadata does not match the setting.
140
+
141
+ #### Notes
142
+ - A large export has to be sent in several requests, e.g. split the file with `split -l 200000 data.lp part-` and write the parts one after the other. A line that is rejected (e.g. because of a type conflict inside the data) is reported with `accept_partial=true`; the remaining lines are stored.
143
+ - InfluxDB 3 Core allows only a few databases (5 by default); a deleted database still counts. Migrate everything into the one database of the adapter.
144
+ - Delete the line protocol file afterwards, it contains all of your data.
145
+
83
146
  ## Retention Policy
84
147
  While Influx 1.x supports the concept of multiple **retention policies** for one database, Influx 2 by design allows only one **retention period** per bucket. Therefore, it is only possible to set one policy for the whole database/bucket with this adapter via _Default Settings -> Storage retention_. The retention selected here will be applied on the fly and can be changed at any time. Retention policies set by the adapter will never be deleted, but instead altered if required, as otherwise Influx 1.x would delete all data that the policy applied to.
85
148
 
149
+ With InfluxDB 3.x the setting is applied to the database as its retention period, see [InfluxDB 3.x](#influxdb-3x).
150
+
86
151
  Please also read [Understanding Retention Policies](RetentionPolicies.md).
87
152
 
88
153
  ## Direct writes or buffered writes?
@@ -107,9 +172,10 @@ Please refer to the official InfluxDB pages for installation instructions depend
107
172
 
108
173
  * InfluxDB 1.x: https://docs.influxdata.com/influxdb/v1.8/introduction/install/
109
174
  * InfluxDB 2.x: https://docs.influxdata.com/influxdb/v2.2/install/
175
+ * InfluxDB 3.x: https://docs.influxdata.com/influxdb3/core/install/
110
176
 
111
177
  ### Setup authentication for InfluxDB 1.x (optional)
112
- **NOTE:** Influx DB V2.x relies on organization/token login, instead of username/password! This is only applicable for InfluxDB 1.x
178
+ **NOTE:** Influx DB V2.x relies on organization/token login, instead of username/password! InfluxDB 3.x needs only a token. This is only applicable for InfluxDB 1.x
113
179
 
114
180
  If you use DB locally, you may leave authentication disabled and skip this part.
115
181
 
@@ -138,7 +204,7 @@ Enable authentication by editing /etc/influxdb/influxdb.conf:
138
204
  - Restart service: ``` service influxdb restart ```
139
205
 
140
206
  ## Self-hosted docker image for InfluxDB
141
- This version of the adapter could start a self-hosted docker image of InfluxDB 2.x and, optionally, Grafana next to it.
207
+ This version of the adapter could start a self-hosted docker image of InfluxDB 2.x (not 3.x) and, optionally, Grafana next to it.
142
208
  Of course, the docker environment must be installed and running on the host.
143
209
 
144
210
  The `iobroker` user must have access to the docker CLI. To fix the rights start `iob fix`.
@@ -211,8 +277,9 @@ After the installation, open `http://<host>:3000` and log in with `admin` / `adm
211
277
  Then create a data source as described [here](https://grafana.com/docs/grafana/latest/datasources/influxdb/):
212
278
  - InfluxDB 1.x: query language _InfluxQL_, URL of InfluxDB, database name and the user/password of the adapter settings.
213
279
  - InfluxDB 2.x: query language _Flux_, URL of InfluxDB, organization, token and default bucket of the adapter settings.
280
+ - InfluxDB 3.x: query language _InfluxQL_ (or _SQL_), URL of InfluxDB, database name and token of the adapter settings.
214
281
 
215
- The query from [The first dashboard](#the-first-dashboard) works for InfluxDB 2.x. For InfluxDB 1.x with InfluxQL use e.g.:
282
+ The query from [The first dashboard](#the-first-dashboard) works for InfluxDB 2.x. For InfluxDB 1.x and 3.x with InfluxQL use e.g.:
216
283
 
217
284
  ```
218
285
  SELECT mean("value") FROM "system.adapter.admin.0.memRss" WHERE $timeFilter GROUP BY time($__interval) fill(previous)
@@ -560,7 +627,8 @@ Two things are worth knowing about the numbers:
560
627
  - **There is no size per datapoint.** InfluxDB does not report one, neither in 1.x (`SHOW STATS` and
561
628
  `SHOW SHARDS` only know the engine and the shards) nor in 2.x (disk usage is monitored per bucket). The
562
629
  number of **series** is shown instead: it is what drives the memory the index needs, and
563
- [custom tags](#custom-tags) are the usual way to increase it unintentionally.
630
+ [custom tags](#custom-tags) are the usual way to increase it unintentionally. InfluxDB 3.x can not tell the
631
+ number of series, the column stays empty.
564
632
  - **Counting is a full scan.** InfluxDB has no row count it could look up, so the values of the examined
565
633
  range are really read. On a database with years of data that takes a while - the time range selector
566
634
  above the table limits the scan if the full count is not needed.
@@ -612,11 +680,27 @@ sendTo('influxdb.0', 'cleanupOrphaned', {
612
680
 
613
681
  A datapoint that is being logged is never selected, whatever the scope says.
614
682
 
683
+ `scope.ids` limits a run to some of these datapoints. The IDs only narrow the selection made by the statuses,
684
+ so an ID that would not be removed anyway (e.g. one that is being logged) is ignored:
685
+
686
+ ```javascript
687
+ sendTo('influxdb.0', 'cleanupOrphaned', {
688
+ scope: { objectMissing: true, ids: ['javascript.0.oldState'] },
689
+ confirm: true,
690
+ });
691
+ ```
692
+
615
693
  ## Changelog
616
694
  <!--
617
695
  Placeholder for the next version (at the beginning of the line):
618
696
  ### **WORK IN PROGRESS**
619
697
  -->
698
+ ### 5.2.2 (2026-10-27)
699
+ * (GermanBluefox) The cleanup dialog of the statistics tab shows the oldest and the newest value of each datapoint and can preselect only datapoints whose last value is older than a given number of days, so measurements that scripts still write to stay untouched
700
+
701
+ ### 5.2.0 (2026-10-24)
702
+ * (GermanBluefox) The cleanup dialog of the statistics tab has checkboxes, so only the selected datapoints are deleted (#565)
703
+
620
704
  ### 5.1.8 (2026-10-23)
621
705
  * (@GermanBluefox) The timed relog (`changesRelogInterval`) starts right after the adapter start or a change of the datapoint settings, not only with the first update of the state
622
706
 
@@ -625,16 +709,11 @@ A datapoint that is being logged is never selected, whatever the scope says.
625
709
  * (@GermanBluefox) The ports of the docker containers (InfluxDB, Grafana) are reported to js-controller 8 as occupied (`registerUsedResource`). The port of the database itself is no longer counted as a port used by the instance
626
710
  * (@GermanBluefox) HTTP errors from InfluxDB (e.g. 500 "timeout") are no longer treated as a lost connection (#551)
627
711
  * (@GermanBluefox) Start values (`relogLastValueOnStart`) are written only once after the adapter start, not on every reconnect (#551)
712
+ * (jhoos70) Added support for InfluxDB 3.x (Core and Enterprise): data is written with the line protocol and read with InfluxQL over HTTP (inspired by the InfluxDB 3 fork of [dirkhe](https://github.com/dirkhe/ioBroker.influxdb))
628
713
 
629
714
  ### 5.1.6 (2026-10-13)
630
715
  * (@GermanBluefox) The "Statistics" tab works now with InfluxDB 2.0
631
716
 
632
- ### 5.1.5 (2026-10-13)
633
- * (@GermanBluefox) Added missing translations. Compact mode no longer can exit the whole host process. The Grafana admin password is protected now
634
-
635
- ### 5.1.4 (2026-10-13)
636
- * (@GermanBluefox) The "Statistics" tab works now also with InfluxDB 2.0. A datapoint without storage type that received a numeric string is shown there as number
637
-
638
717
  [Older changelogs can be found there](CHANGELOG_OLD.md)
639
718
 
640
719
  ## License
@@ -0,0 +1 @@
1
+ import{An as e,Bn as t,En as n,Gt as r,H as i,Jr as a,Jt as o,Kt as s,L as c,Ln as l,O as u,On as d,Ot as f,Tn as p,Un as m,Ut as h,Wt as g,Xr as _,Yr as v,Yt as y,Zt as b,an as x,cn as S,en as C,f as w,fn as T,gn as E,hn as D,mn as O,pn as k,qt as A,rn as j,sn as M,tn as N,xn as P}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js";import{t as F}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare__shared-QaKaFZVZ.js";import{t as I}from"./DataBrowser-sMNr2zs7.js";var L={all:null,year:31536e6,month:2592e6},R={all:`influxdb_range_all`,year:`influxdb_range_year`,month:`influxdb_range_month`};function z(e){return e==null?`—`:e.toLocaleString()}function B(e){return e?new Date(e).toLocaleString():`—`}function V(e,t){let n=parseFloat(t);if(!(n>0))return e.map(e=>e.id);let r=Date.now()-n*24*36e5;return e.filter(e=>e.lastTs===null||e.lastTs<r).map(e=>e.id)}var H={active:`success`,loggingDisabled:`warning`,objectMissing:`error`},U={active:`influxdb_status_active`,loggingDisabled:`influxdb_status_disabled`,objectMissing:`influxdb_status_missing`},W={DataBrowser:I,Statistics:class extends F{constructor(e){super(e),Object.assign(this.state,{stats:null,summary:null,loading:!1,errorText:``,filter:``,range:`all`,sortField:`count`,sortAsc:!1,preview:null,selected:[],olderThanDays:``,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=L[this.state.range],t=await this.sendToInstance(`getDpStatistics`,e?{start:Date.now()-e,end:Date.now()}:{});this.setState({stats:(t==null?void 0:t.result)||[],summary:(t==null?void 0:t.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}}),n=t.items||[];this.setState({loading:!1,includeDisabled:e,preview:{datapoints:t.datapoints,values:t.values,items:n},selected:V(n,this.state.olderThanDays)})}catch(e){this.setState({loading:!1,errorText:e.message})}}async confirmCleanup(){this.setState({deleting:!0,errorText:``});try{var e;let t=await this.sendToInstance(`cleanupOrphaned`,{scope:{objectMissing:!0,loggingDisabled:this.state.includeDisabled,ids:this.state.selected},confirm:!0});this.setState({deleting:!1,preview:null,doneText:w.t(`influxdb_cleanup_done`,t.deleted.values,t.deleted.datapoints),errorText:(e=t.failed)!=null&&e.length?w.t(`influxdb_cleanup_failed`,t.failed.length):``},()=>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 v(y,{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:w.t(t)})}renderSummary(){let{summary:e}=this.state;if(!e)return null;let t=e.byStatus.objectMissing,n=e.byStatus.loggingDisabled;return _(j,{sx:{display:`flex`,gap:2,flexWrap:`wrap`,alignItems:`center`,mb:1},children:[v(N,{variant:`body2`,children:w.t(`influxdb_summary_total`,e.datapoints,e.values,z(e.cardinality))}),!!t.datapoints&&v(S,{color:`error`,size:`small`,label:w.t(`influxdb_summary_missing`,t.datapoints,t.values)}),!!n.datapoints&&v(S,{color:`warning`,size:`small`,label:w.t(`influxdb_summary_disabled`,n.datapoints,n.values)})]})}renderConfirmDialog(){let{preview:e,includeDisabled:n,deleting:l,selected:f,olderThanDays:m}=this.state;if(!e)return null;let y=e.items.filter(e=>f.includes(e.id)),C=y.reduce((e,t)=>e+t.count,0),j=!!e.items.length&&y.length===e.items.length;return _(T,{open:!0,onClose:()=>!l&&this.setState({preview:null}),maxWidth:`lg`,fullWidth:!0,children:[v(E,{children:w.t(`influxdb_cleanup_confirm_title`)}),v(O,{children:e.datapoints?_(a,{children:[v(D,{sx:{mb:1},children:w.t(`influxdb_cleanup_confirm_text`,e.datapoints,e.values)}),v(b,{variant:`standard`,size:`small`,type:`number`,sx:{mb:1,width:360},label:w.t(`influxdb_cleanup_older_than`),helperText:w.t(`influxdb_cleanup_older_than_help`),value:m,disabled:l,onChange:t=>this.setState({olderThanDays:t.target.value,selected:V(e.items,t.target.value)}),slotProps:{htmlInput:{min:0},input:{endAdornment:v(d,{position:`end`,children:w.t(`influxdb_days`)})}}}),v(D,{sx:{mb:1},children:w.t(`influxdb_cleanup_selected`,y.length,C)}),v(s,{component:t,sx:{maxHeight:320},children:_(h,{size:`small`,stickyHeader:!0,children:[v(A,{children:_(o,{children:[v(r,{padding:`checkbox`,children:v(M,{size:`small`,checked:j,indeterminate:!!y.length&&!j,disabled:l,onChange:()=>this.setState({selected:j?[]:e.items.map(e=>e.id)})})}),v(r,{children:w.t(`influxdb_col_id`)}),v(r,{children:w.t(`influxdb_col_status`)}),v(r,{align:`right`,children:w.t(`influxdb_col_count`)}),v(r,{children:w.t(`influxdb_col_first`)}),v(r,{children:w.t(`influxdb_col_last`)})]})}),v(g,{children:e.items.map(e=>_(o,{children:[v(r,{padding:`checkbox`,children:v(M,{size:`small`,checked:f.includes(e.id),disabled:l,onChange:t=>this.setState({selected:t.target.checked?[...f,e.id]:f.filter(t=>t!==e.id)})})}),v(r,{sx:{wordBreak:`break-all`},children:e.id}),v(r,{children:v(S,{size:`small`,color:H[e.status],label:w.t(U[e.status])})}),v(r,{align:`right`,children:z(e.count)}),v(r,{sx:{whiteSpace:`nowrap`},children:B(e.firstTs)}),v(r,{sx:{whiteSpace:`nowrap`},children:B(e.lastTs)})]},e.id))})]})}),n&&v(p,{severity:`warning`,icon:v(u,{}),sx:{mt:1},children:w.t(`influxdb_cleanup_disabled_warning`)})]}):v(D,{children:w.t(`influxdb_cleanup_nothing`)})}),_(k,{children:[v(x,{onClick:()=>this.setState({preview:null}),disabled:l,startIcon:v(c,{}),children:w.t(`influxdb_cancel`)}),v(x,{variant:`contained`,color:`error`,disabled:l||!y.length,startIcon:v(i,{}),onClick:()=>void this.confirmCleanup(),children:w.t(`influxdb_cleanup_delete`)})]})]})}renderItem(){if(!this.props.alive)return v(p,{severity:`info`,children:w.t(`influxdb_stats_not_running`)});let a=this.sortedStats();return _(j,{sx:{width:`100%`},children:[_(j,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1},children:[v(b,{variant:`standard`,size:`small`,value:this.state.filter,placeholder:w.t(`influxdb_filter`),onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?v(d,{position:`end`,children:v(n,{size:`small`,onClick:()=>this.setState({filter:``}),children:v(c,{})})}):null}}}),v(m,{variant:`standard`,size:`small`,value:this.state.range,onChange:e=>this.setState({range:e.target.value},()=>void this.load()),children:Object.keys(R).map(e=>v(l,{value:e,children:w.t(R[e])},e))}),v(C,{title:w.t(`influxdb_refresh`),children:v(n,{onClick:()=>void this.load(),disabled:this.state.loading,children:v(f,{})})}),v(j,{sx:{flexGrow:1}}),v(P,{control:v(M,{checked:this.state.includeDisabled,onChange:e=>this.setState({includeDisabled:e.target.checked})}),label:w.t(`influxdb_include_disabled`)}),v(x,{variant:`contained`,color:`error`,startIcon:v(i,{}),disabled:this.state.loading,onClick:()=>void this.requestPreview(this.state.includeDisabled),children:w.t(`influxdb_cleanup`)})]}),this.state.loading&&v(e,{}),!!this.state.errorText&&v(p,{severity:`error`,sx:{mb:1},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}),!!this.state.doneText&&v(p,{severity:`success`,sx:{mb:1},onClose:()=>this.setState({doneText:``}),children:this.state.doneText}),this.renderSummary(),v(s,{component:t,children:_(h,{size:`small`,stickyHeader:!0,children:[v(A,{children:_(o,{children:[v(r,{children:this.renderSortLabel(`id`,`influxdb_col_id`)}),v(r,{children:w.t(`influxdb_col_type`)}),v(r,{children:this.renderSortLabel(`status`,`influxdb_col_status`)}),v(r,{align:`right`,children:this.renderSortLabel(`count`,`influxdb_col_count`)}),v(r,{align:`right`,children:this.renderSortLabel(`cardinality`,`influxdb_col_series`)}),v(r,{children:w.t(`influxdb_col_first`)}),v(r,{children:this.renderSortLabel(`lastTs`,`influxdb_col_last`)})]})}),_(g,{children:[a.map(e=>_(o,{hover:!0,children:[v(r,{sx:{wordBreak:`break-all`},children:e.id}),v(r,{children:e.type||`—`}),v(r,{children:v(S,{size:`small`,color:H[e.status],label:w.t(U[e.status])})}),v(r,{align:`right`,children:z(e.count)}),v(r,{align:`right`,children:z(e.cardinality)}),v(r,{children:B(e.firstTs)}),v(r,{children:B(e.lastTs)})]},e.id)),!a.length&&!this.state.loading&&v(o,{children:v(r,{colSpan:7,children:v(N,{variant:`body2`,sx:{opacity:.7},children:w.t(this.state.filter?`influxdb_stats_no_match`:`influxdb_no_datapoints`)})})})]})]})}),v(N,{variant:`caption`,sx:{display:`block`,mt:1,opacity:.7},children:w.t(`influxdb_no_size`)}),this.renderConfirmDialog()]})}}};export{W as default};
@@ -0,0 +1 @@
1
+ import{An as e,Bn as t,En as n,F as r,Gt as i,I as a,Jr as o,Jt as s,L as c,Ln as l,Mn as u,On as d,Ot as f,Pn as p,Pt as m,Tn as h,Un as g,Ut as _,V as v,W as y,Wt as b,Xr as x,Yr as S,Zt as C,an as w,b as T,en as E,f as D,fn as O,ft as k,gn as A,gt as j,jn as M,jt as N,mn as P,pn as F,qt as I,rn as L,sn as R,tn as z}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js";import{t as B}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare__shared-QaKaFZVZ.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?T.getObjectNameFromObj(e,null,{language:D.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 r=this.state.filter.toLowerCase(),i=(this.state.points||[]).filter(e=>{var t;return!r||e.id.toLowerCase().includes(r)||((t=this.state.names[e.id])==null?void 0:t.toLowerCase().includes(r))});return x(t,{style:V.list,children:[S(C,{variant:`standard`,style:V.filterField,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),placeholder:D.t(`influxdb_filter`),slotProps:{input:{startAdornment:S(d,{position:`start`,children:S(N,{})}),endAdornment:this.state.filter?S(d,{position:`end`,children:S(n,{size:`small`,onClick:()=>this.setState({filter:``}),children:S(c,{})})}):null}}}),this.state.loadingPoints?S(e,{}):null,x(M,{dense:!0,style:V.listItems,children:[i.map(e=>{var t;return S(u,{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:S(p,{primary:e.id,secondary:x(o,{children:[this.state.names[e.id]?S(`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?S(z,{style:{padding:16,opacity:.7},children:D.t(this.state.filter?`influxdb_no_data`:`influxdb_no_datapoints`)}):null]})]})}renderToolbar(){var e,t;let{page:i,rowsPerPage:o,total:s}=this.state,c=s?i*o+1:0,u=Math.min((i+1)*o,s);return x(`div`,{style:V.toolbar,children:[x(`div`,{style:V.title,children:[S(E,{title:((e=this.state.selected)==null?void 0:e.id)||``,children:S(`span`,{style:V.titleId,children:(t=this.state.selected)==null?void 0:t.id})}),this.state.selected&&this.state.names[this.state.selected.id]?S(`span`,{style:V.titleName,children:this.state.names[this.state.selected.id]}):null]}),S(E,{title:D.t(`influxdb_range_start`),children:S(C,{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())})}),S(E,{title:D.t(`influxdb_range_end`),children:S(C,{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())})}),S(g,{variant:`outlined`,size:`small`,value:o,onChange:e=>this.setState({rowsPerPage:Number(e.target.value),page:0},()=>void this.loadRows()),children:[50,100,500,1e3].map(e=>S(l,{value:e,children:e},e))}),S(E,{title:D.t(this.state.sort===`desc`?`influxdb_sort_desc`:`influxdb_sort_asc`),children:S(n,{size:`small`,onClick:()=>this.setState({sort:this.state.sort===`desc`?`asc`:`desc`,page:0},()=>void this.loadRows()),children:this.state.sort===`desc`?S(k,{}):S(j,{})})}),S(z,{style:V.pageInfo,children:D.t(`influxdb_page`,c.toString(),u.toString(),s.toString())}),S(n,{size:`small`,disabled:!i,onClick:()=>this.setState({page:i-1},()=>void this.loadRows()),children:S(r,{})}),S(n,{size:`small`,disabled:u>=s,onClick:()=>this.setState({page:i+1},()=>void this.loadRows()),children:S(a,{})}),S(E,{title:D.t(`influxdb_refresh`),children:S(n,{size:`small`,onClick:()=>void this.loadRows(),children:S(f,{})})}),S(E,{title:D.t(`influxdb_add`),children:S(n,{size:`small`,color:`primary`,onClick:()=>this.setState({entryDialog:{original:null,ts:Date.now().toString(),val:``,ack:!0,q:`0`}}),children:S(m,{})})}),S(E,{title:D.t(`influxdb_delete_selected`),children:S(`span`,{children:S(n,{size:`small`,disabled:!this.state.checked.length,onClick:()=>this.setState({confirmText:D.t(`influxdb_confirm_delete`,this.state.checked.length.toString()),confirmAction:()=>void this.deleteEntries(this.state.checked)}),children:S(v,{})})})})]})}renderTable(){return x(`div`,{style:V.table,children:[x(_,{size:`small`,stickyHeader:!0,children:[S(I,{children:x(s,{children:[S(i,{padding:`checkbox`,children:S(R,{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):[]})})}),S(i,{children:D.t(`influxdb_time`)}),S(i,{children:D.t(`influxdb_value`)}),S(i,{children:D.t(`influxdb_ack`)}),S(i,{children:D.t(`influxdb_quality`)}),S(i,{children:D.t(`influxdb_from`)}),S(i,{})]})}),S(b,{children:this.state.rows.map(e=>x(s,{hover:!0,children:[S(i,{padding:`checkbox`,children:S(R,{checked:this.state.checked.includes(e.ts),onChange:t=>this.setState({checked:t.target.checked?[...this.state.checked,e.ts]:this.state.checked.filter(t=>t!==e.ts)})})}),S(i,{style:V.nowrap,children:S(E,{title:e.ts.toString(),children:S(`span`,{children:U(e.ts)})})}),S(i,{style:{wordBreak:`break-all`},children:e.val===null||e.val===void 0?S(`span`,{style:{opacity:.5},children:`null`}):e.val.toString()}),S(i,{children:e.ack?`✓`:``}),S(i,{children:e.q??``}),S(i,{style:{opacity:.7},children:e.from||``}),x(i,{padding:`none`,children:[S(n,{size:`small`,onClick:()=>this.setState({entryDialog:{original:e,ts:e.ts.toString(),val:e.val===null||e.val===void 0?``:e.val.toString(),ack:!!e.ack,q:(e.q??0).toString()}}),children:S(y,{fontSize:`small`})}),S(n,{size:`small`,onClick:()=>this.setState({confirmText:D.t(`influxdb_confirm_delete_one`,U(e.ts)),confirmAction:()=>void this.deleteEntries([e.ts])}),children:S(v,{fontSize:`small`})})]})]},e.ts))})]}),!this.state.rows.length&&!this.state.loadingRows?S(z,{style:{padding:16,opacity:.7},children:D.t(`influxdb_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:[S(C,{label:D.t(`influxdb_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)}),S(C,{label:D.t(`influxdb_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)}),S(C,{label:D.t(`influxdb_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)})]}),S(z,{variant:`caption`,style:{opacity:.7},children:n?`${U(t)} · ${t}`:``})]})}renderEntryDialog(){var e;let t=this.state.entryDialog;return t?x(O,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({entryDialog:null}),children:[S(A,{children:D.t(t.original?`influxdb_save`:`influxdb_add`)}),x(P,{style:{display:`flex`,flexDirection:`column`,gap:16,paddingTop:8},children:[this.renderTimeSelector(t),((e=this.state.selected)==null?void 0:e.type)===`Boolean`?x(g,{value:t.val===`true`||t.val===`1`?`true`:`false`,onChange:e=>this.setState({entryDialog:{...t,val:e.target.value}}),children:[S(l,{value:`true`,children:`true`}),S(l,{value:`false`,children:`false`})]}):S(C,{label:D.t(`influxdb_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:[S(R,{checked:t.ack,onChange:e=>this.setState({entryDialog:{...t,ack:e.target.checked}})}),S(z,{children:D.t(`influxdb_ack`)}),S(C,{label:D.t(`influxdb_quality`),value:t.q,type:`number`,onChange:e=>this.setState({entryDialog:{...t,q:e.target.value}})})]})]}),x(F,{children:[S(w,{variant:`contained`,color:`primary`,onClick:()=>void this.saveEntry(),children:D.t(`influxdb_save`)}),S(w,{variant:`outlined`,onClick:()=>this.setState({entryDialog:null}),children:D.t(`influxdb_cancel`)})]})]}):null}renderConfirmDialog(){return this.state.confirmAction?x(O,{open:!0,onClose:()=>this.setState({confirmText:``,confirmAction:null}),children:[S(A,{children:D.t(`influxdb_delete`)}),S(P,{children:this.state.confirmText}),x(F,{children:[S(w,{variant:`contained`,color:`error`,startIcon:S(v,{}),onClick:()=>{let e=this.state.confirmAction;this.setState({confirmText:``,confirmAction:null},()=>e==null?void 0:e())},children:D.t(`influxdb_delete`)}),S(w,{variant:`outlined`,onClick:()=>this.setState({confirmText:``,confirmAction:null}),children:D.t(`influxdb_cancel`)})]})]}):null}renderItem(){return this.props.alive?x(L,{style:V.root,children:[this.renderDatapoints(),x(t,{style:V.data,children:[this.state.errorText?S(h,{severity:`error`,style:{flexShrink:0},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}):null,this.state.selected?x(o,{children:[this.renderToolbar(),this.state.loadingRows?S(e,{}):null,this.renderTable()]}):S(z,{style:{padding:16,opacity:.7},children:D.t(`influxdb_select_datapoint`)})]}),this.renderEntryDialog(),this.renderConfirmDialog()]}):S(h,{severity:`info`,children:D.t(`influxdb_instance_not_alive`)})}};export{q as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./vite-preload-helper-BbbETgeG.js";import"./dist-B3E7IYuQ.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__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js`).then(e=>e.xi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-M61rjtmp.js`),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js`).then(e=>e.gr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild__react_mf_2_dom_mf_1_client__prebuild__-Cxrvam_t.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js`).then(e=>e.Kn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js`).then(e=>e.zt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BA4yqBXv.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__97835354470012__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-JVokFcpF.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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.1`,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.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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.1`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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.1`,`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:`InfluxDBComponentsSet`,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:`InfluxDBComponentsSet`,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.14`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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.9`,scope:[`default`],loaded:!1,materialize:!0,eager:!1,from:`InfluxDBComponentsSet`,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};