iobroker.influxdb 5.0.3 → 5.1.6
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 +190 -54
- package/admin/custom/assets/Components-BePqbwvo.js +1 -0
- package/admin/custom/assets/DataBrowser-D47Iap2M.js +1 -0
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__InfluxDBComponentsSet__mf_owner__1-Du-iBqZ7.js +1 -0
- 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 +1217 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare__shared-3YWGBSiP.js +2 -0
- 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 +122 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-B_v57Qfr.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DMyibbf8.js +9 -0
- package/admin/custom/assets/dist-CSJEdwl2.js +1 -0
- package/admin/custom/assets/helpers-DT5-3o-l.js +1 -0
- package/admin/custom/assets/hostInit-Dlg_V4HP.js +1 -0
- package/admin/custom/assets/iconLibraryData-B5fiyl1C.js +1 -0
- package/admin/custom/assets/index-Bq5Wk8fk.js +1 -0
- package/admin/custom/assets/lib-CZdKkrqv.js +3 -0
- package/admin/custom/assets/{mf-entry-bootstrap-0-1d56ce7a.js → mf-entry-bootstrap-0-2589264d.js} +14 -2
- package/admin/custom/assets/pendingShares-BeAKxbUv.js +2 -0
- package/admin/custom/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/admin/custom/assets/utils-BFhwh2EC.js +4 -0
- package/admin/custom/assets/vite-preload-helper-BbbETgeG.js +1 -0
- package/admin/custom/customComponents.js +2 -2
- package/admin/custom/i18n/de.json +28 -0
- package/admin/custom/i18n/en.json +28 -0
- package/admin/custom/i18n/es.json +28 -0
- package/admin/custom/i18n/fr.json +28 -0
- package/admin/custom/i18n/it.json +28 -0
- package/admin/custom/i18n/nl.json +28 -0
- package/admin/custom/i18n/pl.json +28 -0
- package/admin/custom/i18n/pt.json +28 -0
- package/admin/custom/i18n/ru.json +28 -0
- package/admin/custom/i18n/uk.json +28 -0
- package/admin/custom/i18n/zh-cn.json +28 -0
- package/admin/custom/mf-manifest.json +1 -1
- package/admin/i18n/de.json +18 -4
- package/admin/i18n/en.json +17 -3
- package/admin/i18n/es.json +17 -3
- package/admin/i18n/fr.json +121 -107
- package/admin/i18n/it.json +121 -107
- package/admin/i18n/nl.json +18 -4
- package/admin/i18n/pl.json +121 -107
- package/admin/i18n/pt.json +121 -107
- package/admin/i18n/ru.json +121 -107
- package/admin/i18n/uk.json +121 -107
- package/admin/i18n/zh-cn.json +121 -107
- package/admin/jsonConfig.json +33 -0
- package/admin/jsonCustom.json +37 -0
- package/build/lib/Database.js +5 -1
- package/build/lib/Database.js.map +1 -1
- package/build/lib/DatabaseInfluxDB1x.js +78 -52
- package/build/lib/DatabaseInfluxDB1x.js.map +1 -1
- package/build/lib/DatabaseInfluxDB2x.js +52 -0
- package/build/lib/DatabaseInfluxDB2x.js.map +1 -1
- package/build/lib/customTags.js +87 -0
- package/build/lib/customTags.js.map +1 -0
- package/build/lib/statistics.js +109 -0
- package/build/lib/statistics.js.map +1 -0
- package/build/main.js +360 -49
- package/build/main.js.map +1 -1
- package/docker-compose.yaml +8 -1
- package/docs/de/influxdb.md +153 -14
- package/docs/en/influxdb.md +240 -0
- package/io-package.json +91 -86
- package/package.json +9 -13
- package/admin/custom/assets/Components-B31xFgHA.js +0 -1
- package/admin/custom/assets/DataBrowser-BjC3hA47.js +0 -1
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__InfluxDBComponentsSet__mf_owner__1-B9Ylge1m.js +0 -1
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-B1eVfdnr.js +0 -1243
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-CxiY1CI5.js +0 -1494
- package/admin/custom/assets/_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DySAygl2.js +0 -9
- package/admin/custom/assets/hostInit-6uyyXgUg.js +0 -1
- package/admin/custom/assets/index-Bqsp0Vtz.js +0 -1
- package/admin/custom/assets/lib-BQ9Iy9vH.js +0 -3
- package/admin/custom/assets/rolldown-runtime-C0FnF6B9.js +0 -1
- package/admin/custom/assets/virtualExposes-BDloXo0b.js +0 -1
- package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__InfluxDBComponentsSet__customComponents_js-C-UWbkzd.js +0 -1
- package/admin/custom/assets/virtual_mf-exposes___mfe_internal__InfluxDBComponentsSet__customComponents_js-DCQ_KAEk.js +0 -2
- package/admin/custom/assets/vite-preload-helper-B7qeedMF.js +0 -1
- package/admin/words.js +0 -98
package/README.md
CHANGED
|
@@ -43,6 +43,37 @@ With `Influx 2.x` it is now also possible, to store this metadata-information be
|
|
|
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
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.
|
|
45
45
|
|
|
46
|
+
### 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).
|
|
48
|
+
|
|
49
|
+
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
|
+
|
|
51
|
+
```
|
|
52
|
+
from(bucket: "iobroker")
|
|
53
|
+
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
|
54
|
+
|> filter(fn: (r) => r._field == "value" and r.type == "temperature")
|
|
55
|
+
|> group(columns: ["room"])
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Please note:
|
|
59
|
+
- The names `value`, `q`, `ack`, `from` and `time` as well as names starting with `_` are reserved and can not be used. Rows without name or value are ignored. Ignored tags are reported as warning in the log.
|
|
60
|
+
- InfluxDB identifies a series by the measurement and all of its tags. Changing the tags of a datapoint therefore starts a new series, the values written before keep their old tags. With InfluxDB 2.x an aggregated `getHistory` over a time range in which the tags changed aggregates each series on its own, so such a range can contain two values per interval - one of the old and one of the new series. Add the tags before logging starts if you want to avoid this.
|
|
61
|
+
- Every datapoint is still written into a measurement of its own (its ID or its `Alias-ID`). Using the same `Alias-ID` for several active datapoints is not supported.
|
|
62
|
+
|
|
63
|
+
Custom tags can also be set via JavaScript with the `enableHistory` message (see [below](#enable)):
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
sendTo('influxdb.0', 'enableHistory', {
|
|
67
|
+
id: 'hm-rpc.0.ABC123.1.TEMPERATURE',
|
|
68
|
+
options: {
|
|
69
|
+
customTags: [
|
|
70
|
+
{ name: 'room', value: 'kitchen' },
|
|
71
|
+
{ name: 'type', value: 'temperature' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
46
77
|
### Migration from InfluxDB 1 to 2
|
|
47
78
|
|
|
48
79
|
Please refer to the [official guides on how to migrate](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/) from InfluxDB 1.x to 2.x. Especially the [migration instructions for time series data](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/manual-upgrade/#migrate-time-series-data) have been verified to work during adapter testing. Please always create a backup of your data before performing the migration.
|
|
@@ -107,27 +138,89 @@ Enable authentication by editing /etc/influxdb/influxdb.conf:
|
|
|
107
138
|
- Restart service: ``` service influxdb restart ```
|
|
108
139
|
|
|
109
140
|
## Self-hosted docker image for InfluxDB
|
|
110
|
-
This version of the adapter could start a self-hosted docker image of InfluxDB 2.x.
|
|
111
|
-
|
|
141
|
+
This version of the adapter could start a self-hosted docker image of InfluxDB 2.x and, optionally, Grafana next to it.
|
|
142
|
+
Of course, the docker environment must be installed and running on the host.
|
|
112
143
|
|
|
113
144
|
The `iobroker` user must have access to the docker CLI. To fix the rights start `iob fix`.
|
|
114
145
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
146
|
+
Enable it in the instance settings with **Use self-hosted InfluxDB in Docker**. All connection settings (host, port, organization, token, ...) are hidden then, because the adapter configures the connection itself.
|
|
147
|
+
|
|
148
|
+
The container is created with these fixed values:
|
|
149
|
+
|
|
150
|
+
| Setting | Value |
|
|
151
|
+
|-------------------|--------------------------------------------|
|
|
152
|
+
| URL | `http://<ioBroker-host>:8086` |
|
|
153
|
+
| User / password | `iobroker` / `iobroker` |
|
|
154
|
+
| Organization | `iobroker` |
|
|
155
|
+
| Bucket | `iobroker` |
|
|
156
|
+
| API token | `aW9icm9rZXI4NjY0NTYzODU0NjU2NTY1MjY1Ng==` |
|
|
157
|
+
|
|
158
|
+
By default, the container listens only on `127.0.0.1`, so the InfluxDB web interface can only be opened on the ioBroker host itself. To reach it from another computer, set **Start container on IP** in the panel _InfluxDB Docker_ to `0.0.0.0` (all interfaces) or to the IP of the host. **Do this only in a trusted network** - the user, password and token above are the same in every installation. You can change the password in the InfluxDB web interface (user menu → _Change password_) without affecting the adapter, which logs in with the token. Do not delete the token.
|
|
118
159
|
|
|
119
|
-
|
|
160
|
+
The data lives in the docker volumes `flux_data` and `flux_config`, so it survives an update or a re-creation of the container.
|
|
120
161
|
|
|
121
|
-
|
|
122
|
-
|
|
162
|
+
## Grafana (Charting Tool)
|
|
163
|
+
[Grafana](https://grafana.com/) is a charting tool that shows the data from InfluxDB as dashboards.
|
|
123
164
|
|
|
124
|
-
|
|
165
|
+
### Grafana in Docker
|
|
166
|
+
If InfluxDB runs in Docker (see above), the adapter can start Grafana in Docker too: enable **Use self-hosted Grafana in Docker** in the instance settings (the checkbox is only shown when **Use self-hosted InfluxDB in Docker** is enabled). The connection to InfluxDB is set up automatically - nothing has to be configured in Grafana.
|
|
125
167
|
|
|
126
|
-
|
|
168
|
+
#### First login
|
|
169
|
+
1. Open `http://<ioBroker-host>:3000` in the browser - or simply click the _Grafana_ tile on the intro page of admin (also shown as link in the instance list). The adapter adds this link when Grafana is enabled and restarts its instance once for it. The port can be changed in the panel _Grafana Docker_. Grafana listens on all interfaces by default (`0.0.0.0`); set **Start container on IP** to `127.0.0.1` if it should only be reachable from the host itself.
|
|
170
|
+
2. Log in with
|
|
171
|
+
- **user: `admin`**
|
|
172
|
+
- **password: `iobroker`** - or the value of **Admin security password** in the panel _Grafana Docker_, if it was changed before the first start.
|
|
173
|
+
3. Grafana asks to set a new password. Set one or click _Skip_.
|
|
174
|
+
|
|
175
|
+
**The admin password is only applied on the very first start of the container**, when Grafana creates its database. Changing **Admin security password** in the adapter settings later has no effect, and a password changed in Grafana is not shown in the adapter settings. If you forgot it, reset it on the ioBroker host:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
docker ps --filter name=grafana --format '{{.Names}}' # shows the container name, e.g. iob_influxdb_0_grafana
|
|
179
|
+
docker exec -it iob_influxdb_0_grafana grafana cli admin reset-admin-password <new-password>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The option **Enable user sign-ups** shows a _Sign up_ link on the login page, where everybody who can open Grafana can create a user. Disable it if Grafana is reachable from your network.
|
|
183
|
+
|
|
184
|
+
#### The data source
|
|
185
|
+
The data source `InfluxDB` is already present and set as default (_Connections → Data sources_). It uses the query language **Flux**, organization `iobroker` and bucket `iobroker`, and connects to the InfluxDB container inside the docker network, independent of the port configured for the host. The adapter writes this data source anew on every start, so it can not be edited in Grafana. You can add data sources of your own next to it.
|
|
186
|
+
|
|
187
|
+
#### The first dashboard
|
|
188
|
+
1. _Dashboards → New → New dashboard → Add visualization_ and select the data source `InfluxDB`.
|
|
189
|
+
2. Switch the query editor to _Code_ (if shown) and enter a Flux query. Every datapoint is stored in a measurement named like its ID (or its `Alias-ID`), the value is in the field `value`:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
from(bucket: "iobroker")
|
|
193
|
+
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
|
194
|
+
|> filter(fn: (r) => r._measurement == "system.adapter.admin.0.memRss" and r._field == "value")
|
|
195
|
+
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Replace `system.adapter.admin.0.memRss` with the ID of one of your logged datapoints. `aggregateWindow` reduces the number of points to what fits into the chart - use `fn: last` for values that are not numbers or should not be averaged.
|
|
199
|
+
3. Click _Refresh_ above the chart, then _Save dashboard_.
|
|
200
|
+
|
|
201
|
+
The easiest way to find the right measurement and field names is the _Data Explorer_ of the InfluxDB web interface (see above): select bucket, measurement and field there and click _Script Editor_ to get the matching Flux query. In Grafana, _Explore_ can be used to try out queries without a dashboard.
|
|
202
|
+
|
|
203
|
+
Further hints:
|
|
204
|
+
- Plugins can be installed via the option **Plugins** in the panel _Grafana Docker_ (e.g. `grafana-clock-panel`); they are installed on the next start of the container.
|
|
205
|
+
- If Grafana is accessed via a reverse proxy under a sub-path, enter the full public URL in **Server root URL**.
|
|
206
|
+
- Dashboards, users and settings are stored in the docker volume `grafana_data` and survive an update of the container.
|
|
207
|
+
|
|
208
|
+
### Grafana installed manually
|
|
209
|
+
If you do not use Docker, Grafana must be installed separately. Explanations for the different operating systems can be found [here](https://grafana.com/docs/grafana/latest/setup-grafana/installation/).
|
|
210
|
+
After the installation, open `http://<host>:3000` and log in with `admin` / `admin` (Grafana's own default; you are asked to change it right away).
|
|
211
|
+
Then create a data source as described [here](https://grafana.com/docs/grafana/latest/datasources/influxdb/):
|
|
212
|
+
- InfluxDB 1.x: query language _InfluxQL_, URL of InfluxDB, database name and the user/password of the adapter settings.
|
|
213
|
+
- InfluxDB 2.x: query language _Flux_, URL of InfluxDB, organization, token and default bucket of the adapter settings.
|
|
214
|
+
|
|
215
|
+
The query from [The first dashboard](#the-first-dashboard) works for InfluxDB 2.x. For InfluxDB 1.x with InfluxQL use e.g.:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
SELECT mean("value") FROM "system.adapter.admin.0.memRss" WHERE $timeFilter GROUP BY time($__interval) fill(previous)
|
|
219
|
+
```
|
|
127
220
|
|
|
128
221
|
## Default Settings
|
|
129
222
|
- **Debounce Time** - Protection against unstable values to make sure that only stable values are logged when the value did not change in the defined amount of Milliseconds. ATTENTION: If values change more often then this setting effectively no value will be logged (because any value is unstable)
|
|
130
|
-
- **Blocktime** - Defines for how long after storing the last value no further value is stored.
|
|
223
|
+
- **Blocktime** - Defines for how long after storing the last value no further value is stored. A value received meanwhile is not lost: when the given time in Milliseconds is over, the newest of them is logged (with its original timestamp) if it fulfills all other checks and differs from the last logged value. Values excluded by the "ignore" settings never replace it.
|
|
131
224
|
- **Record changes only** - This function makes sure that only changed values are logged if they fulfill other checks (see below). Same values will not be logged.
|
|
132
225
|
- **still record the same values (seconds)** - When using "Record changes only" you can set a time interval in seconds here after which also unchanged values will be re-logged into the DB. You can detect the values re-logged by the adapter with the "from" field.
|
|
133
226
|
- **Minimum difference from last value** - When using "Record changes only" you can define the required minimum difference between the new value and the last value. If this is not reached the value is not recorded.
|
|
@@ -144,7 +237,7 @@ Most of these values can be pre-defined in the instance settings and are then pr
|
|
|
144
237
|
The sorted values can be accessed from Javascript adapter.
|
|
145
238
|
|
|
146
239
|
* Get 50 last stored events for all IDs
|
|
147
|
-
```
|
|
240
|
+
```javascript
|
|
148
241
|
sendTo('influxdb.0', 'getHistory', {
|
|
149
242
|
id: '*',
|
|
150
243
|
options: {
|
|
@@ -161,7 +254,7 @@ sendTo('influxdb.0', 'getHistory', {
|
|
|
161
254
|
```
|
|
162
255
|
|
|
163
256
|
* Get stored values for "system.adapter.admin.0.memRss" in last hour
|
|
164
|
-
```
|
|
257
|
+
```javascript
|
|
165
258
|
var end = Date.now();
|
|
166
259
|
sendTo('influxdb.0', 'getHistory', {
|
|
167
260
|
id: 'system.adapter.admin.0.memRss',
|
|
@@ -386,7 +479,7 @@ sendTo('influxdb.0', 'flushBuffer', {id: 'mbus.0.counter.xxx'}, result => consol
|
|
|
386
479
|
```
|
|
387
480
|
if no id is provided, all buffers will be flushed.
|
|
388
481
|
|
|
389
|
-
## History Logging Management via
|
|
482
|
+
## History Logging Management via JavaScript
|
|
390
483
|
The adapter supports enabling and disabling of history logging via JavaScript and also retrieving the list of enabled data points with their settings.
|
|
391
484
|
|
|
392
485
|
### enable
|
|
@@ -451,51 +544,94 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
|
|
|
451
544
|
});
|
|
452
545
|
```
|
|
453
546
|
|
|
547
|
+
## Statistics and cleanup
|
|
548
|
+
|
|
549
|
+
The **Statistics** tab of the instance configuration lists every datapoint the database contains, with its
|
|
550
|
+
number of values, the oldest and the newest value, the number of series and a status:
|
|
551
|
+
|
|
552
|
+
| Status | Meaning |
|
|
553
|
+
|-------------------|------------------------------------------------------------------------------------------|
|
|
554
|
+
| `active` | the state exists and this instance logs it |
|
|
555
|
+
| `loggingDisabled` | the state still exists, but its logging is switched off - the history is still reachable |
|
|
556
|
+
| `objectMissing` | the state was deleted in ioBroker, so nothing can reach its history any more |
|
|
557
|
+
|
|
558
|
+
Two things are worth knowing about the numbers:
|
|
559
|
+
|
|
560
|
+
- **There is no size per datapoint.** InfluxDB does not report one, neither in 1.x (`SHOW STATS` and
|
|
561
|
+
`SHOW SHARDS` only know the engine and the shards) nor in 2.x (disk usage is monitored per bucket). The
|
|
562
|
+
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.
|
|
564
|
+
- **Counting is a full scan.** InfluxDB has no row count it could look up, so the values of the examined
|
|
565
|
+
range are really read. On a database with years of data that takes a while - the time range selector
|
|
566
|
+
above the table limits the scan if the full count is not needed.
|
|
567
|
+
|
|
568
|
+
The same data is available from JavaScript:
|
|
569
|
+
|
|
570
|
+
```javascript
|
|
571
|
+
// the whole database; `start` and `end` (ms) limit the examined range
|
|
572
|
+
sendTo('influxdb.0', 'getDpStatistics', {}, function (result) {
|
|
573
|
+
console.log(JSON.stringify(result.summary));
|
|
574
|
+
// { datapoints: 42, values: 1234567, cardinality: 44,
|
|
575
|
+
// byStatus: { active: {...}, loggingDisabled: {...}, objectMissing: {...} } }
|
|
576
|
+
console.log(JSON.stringify(result.result[0]));
|
|
577
|
+
// { id: 'hm-rpc.0.ABC123.1.TEMPERATURE', type: 'Number', count: 51234,
|
|
578
|
+
// firstTs: 1696000000000, lastTs: 1759000000000, cardinality: 1, status: 'active' }
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
`cleanupOrphaned` removes the stored values of datapoints nobody logs anymore. **Without `confirm: true`
|
|
583
|
+
nothing is deleted** - the answer only reports what a confirmed run would remove, which is what the dialog
|
|
584
|
+
in the admin shows before anything is lost:
|
|
585
|
+
|
|
586
|
+
```javascript
|
|
587
|
+
// dry run: what would be removed?
|
|
588
|
+
sendTo('influxdb.0', 'cleanupOrphaned', {}, function (result) {
|
|
589
|
+
console.log(`${result.datapoints} datapoints with ${result.values} values`);
|
|
590
|
+
console.log(result.items.map(item => item.id).join('
|
|
591
|
+
'));
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
// really remove it - this cannot be undone
|
|
595
|
+
sendTo('influxdb.0', 'cleanupOrphaned', { confirm: true }, function (result) {
|
|
596
|
+
console.log(`removed ${result.deleted.datapoints} datapoints`);
|
|
597
|
+
// result.failed lists the measurements the database refused to drop
|
|
598
|
+
});
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
The scope decides what counts as removable. By default, only states that no longer exist in ioBroker are
|
|
602
|
+
selected, because nothing can reach their history anymore. Datapoints whose logging is merely switched
|
|
603
|
+
off are a different matter - their history is still reachable and may well be wanted, so they are only
|
|
604
|
+
included when asked for explicitly:
|
|
605
|
+
|
|
606
|
+
```javascript
|
|
607
|
+
sendTo('influxdb.0', 'cleanupOrphaned', {
|
|
608
|
+
scope: { objectMissing: true, loggingDisabled: true },
|
|
609
|
+
confirm: true,
|
|
610
|
+
});
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
A datapoint that is being logged is never selected, whatever the scope says.
|
|
614
|
+
|
|
615
|
+
## Changelog
|
|
454
616
|
<!--
|
|
455
617
|
Placeholder for the next version (at the beginning of the line):
|
|
456
618
|
### **WORK IN PROGRESS**
|
|
457
619
|
-->
|
|
620
|
+
### 5.1.6 (2026-10-13)
|
|
621
|
+
* (@GermanBluefox) The "Statistics" tab works now with InfluxDB 2.0
|
|
458
622
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
* (@GermanBluefox)
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
* (@GermanBluefox) The
|
|
467
|
-
|
|
468
|
-
### 5.
|
|
469
|
-
* (@
|
|
470
|
-
* (@GermanBluefox)
|
|
471
|
-
* (@joltcoke) Fixed average and total returning null for every interval that contains a null value: parseFloat(null) is NaN and poisoned the sum of the whole interval (thanks to @joltcoke, ioBroker/ioBroker.sql#526). As the result was NaN and not null, ignoreNull could not act on it either
|
|
472
|
-
* (@joltcoke) Fixed min returning a wrong value if the interval contains a null, minmax losing the minimum if the interval starts with a null, and percentile/quantile counting a null as 0
|
|
473
|
-
|
|
474
|
-
### 5.0.1 (2026-08-15)
|
|
475
|
-
* (@GermanBluefox) Completely refactored the code to TypeScript and ES6
|
|
476
|
-
* (@GermanBluefox) Added possibility to start docker containers directly from the adapter
|
|
477
|
-
* (mcm1957) Adapter requires admin >= 7.7.2 now
|
|
478
|
-
* (arteck) Fixed the connection handling for InfluxDB 1.x: the health check (ping) and the automatic reconnect were never started
|
|
479
|
-
* (arteck) Fixed the loss of buffered values if the writing was running while new values arrived or if the write failed
|
|
480
|
-
* (arteck) Values are no longer written twice if they are written directly (buffer size 0 or conflicting points)
|
|
481
|
-
* (arteck) State IDs and database names are now escaped in the queries
|
|
482
|
-
* (arteck) The password/token is no longer written into the log by the connection test
|
|
483
|
-
* (arteck) The settings "request timeout" and "validate SSL" are now used for InfluxDB 1.x too
|
|
484
|
-
* (arteck) Fixed the cache file name if more than one instance runs in the compact mode
|
|
485
|
-
* (arteck) Fixed the aggregation for `percentile: 100`/`quantile: 1` and the last value of `integralTotal`
|
|
486
|
-
* (bluefox) Fixed empty charts for the aggregation `onchange` ("raw" in e-charts): it was run through the interval aggregation and returned only `null` values
|
|
487
|
-
* (@GermanBluefox) Minimal node.js version is 22
|
|
488
|
-
|
|
489
|
-
### 4.0.3 (2024-05-16)
|
|
490
|
-
* (bluefox) Some packages were updated
|
|
491
|
-
|
|
492
|
-
### 4.0.2 (2024-01-03)
|
|
493
|
-
* (bluefox) Corrected JSON config
|
|
494
|
-
* (Marc-Berg) Corrected filter function in booleanTypeCheckQuery
|
|
495
|
-
* (Marc-Berg) Allowed the self-signed certificates using "test connection" button
|
|
496
|
-
* (Marc-Berg) The deletion of data from DB was implemented for V2
|
|
497
|
-
* (bluefox) Added support for `count` aggregate type on getHistory
|
|
498
|
-
* (bluefox) minimal supported node.js version is 16 now
|
|
623
|
+
### 5.1.5 (2026-10-13)
|
|
624
|
+
* (@GermanBluefox) Added missing translations. Compact mode no longer can exit the whole host process. The Grafana admin password is protected now
|
|
625
|
+
|
|
626
|
+
### 5.1.4 (2026-10-13)
|
|
627
|
+
* (@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
|
|
628
|
+
|
|
629
|
+
### 5.1.3 (2026-10-13)
|
|
630
|
+
* (@GermanBluefox) The error of a failed save or delete in the data browser is no longer hidden by the reload of the table
|
|
631
|
+
|
|
632
|
+
### 5.1.2 (2026-10-13)
|
|
633
|
+
* (@franzenhof) A value received during `blockTime` is now logged when the block time is over. Before, it was dropped and a datapoint that then stayed unchanged kept its outdated value in the database (repeated by `changesRelogInterval`) until the next change
|
|
634
|
+
* (@GermanBluefox) A value excluded by `ignoreZero`/`ignoreBelowNumber`/`ignoreAboveNumber` no longer replaces the value waiting for the end of `blockTime`, and is not written on unload. A waiting value is also written when the datapoint is reconfigured instead of being lost. Note: as the waiting value keeps its original timestamp, two points in the database can now be less than `blockTime` apart
|
|
499
635
|
|
|
500
636
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
501
637
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$t as e,Dn as t,Dt as n,Gt as r,H as i,Hn as a,Ht as o,In as s,Jr as c,Jt as l,Kt as u,L as d,O as f,Tn as p,Ut as m,Wt as h,Xt as g,Yr as _,bn as v,dn as y,en as b,f as x,fn as S,hn as C,in as w,kn as T,mn as E,nn as D,on as O,pn as k,qr as A,qt as j,sn as M,wn as N,zn as P}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js";import{t as F}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare__shared-3YWGBSiP.js";import{t as I}from"./DataBrowser-D47Iap2M.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():`—`}var V={active:`success`,loggingDisabled:`warning`,objectMissing:`error`},H={active:`influxdb_status_active`,loggingDisabled:`influxdb_status_disabled`,objectMissing:`influxdb_status_missing`},U={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,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}});this.setState({loading:!1,includeDisabled:e,preview:{datapoints:t.datapoints,values:t.values,items:t.items||[]}})}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},confirm:!0});this.setState({deleting:!1,preview:null,doneText:x.t(`influxdb_cleanup_done`,t.deleted.values,t.deleted.datapoints),errorText:(e=t.failed)!=null&&e.length?x.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 c(l,{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:x.t(t)})}renderSummary(){let{summary:e}=this.state;if(!e)return null;let t=e.byStatus.objectMissing,n=e.byStatus.loggingDisabled;return _(D,{sx:{display:`flex`,gap:2,flexWrap:`wrap`,alignItems:`center`,mb:1},children:[c(b,{variant:`body2`,children:x.t(`influxdb_summary_total`,e.datapoints,e.values,z(e.cardinality))}),!!t.datapoints&&c(M,{color:`error`,size:`small`,label:x.t(`influxdb_summary_missing`,t.datapoints,t.values)}),!!n.datapoints&&c(M,{color:`warning`,size:`small`,label:x.t(`influxdb_summary_disabled`,n.datapoints,n.values)})]})}renderConfirmDialog(){let{preview:e,includeDisabled:t,deleting:n}=this.state;return e?_(y,{open:!0,onClose:()=>!n&&this.setState({preview:null}),maxWidth:`md`,fullWidth:!0,children:[c(C,{children:x.t(`influxdb_cleanup_confirm_title`)}),c(k,{children:e.datapoints?_(A,{children:[c(E,{sx:{mb:1},children:x.t(`influxdb_cleanup_confirm_text`,e.datapoints,e.values)}),c(r,{component:P,sx:{maxHeight:320},children:_(o,{size:`small`,stickyHeader:!0,children:[c(u,{children:_(j,{children:[c(h,{children:x.t(`influxdb_col_id`)}),c(h,{children:x.t(`influxdb_col_status`)}),c(h,{align:`right`,children:x.t(`influxdb_col_count`)})]})}),c(m,{children:e.items.map(e=>_(j,{children:[c(h,{sx:{wordBreak:`break-all`},children:e.id}),c(h,{children:c(M,{size:`small`,color:V[e.status],label:x.t(H[e.status])})}),c(h,{align:`right`,children:z(e.count)})]},e.id))})]})}),t&&c(N,{severity:`warning`,icon:c(f,{}),sx:{mt:1},children:x.t(`influxdb_cleanup_disabled_warning`)})]}):c(E,{children:x.t(`influxdb_cleanup_nothing`)})}),_(S,{children:[c(w,{onClick:()=>this.setState({preview:null}),disabled:n,startIcon:c(d,{}),children:x.t(`influxdb_cancel`)}),c(w,{variant:`contained`,color:`error`,disabled:n||!e.datapoints,startIcon:c(i,{}),onClick:()=>void this.confirmCleanup(),children:x.t(`influxdb_cleanup_delete`)})]})]}):null}renderItem(){if(!this.props.alive)return c(N,{severity:`info`,children:x.t(`influxdb_stats_not_running`)});let l=this.sortedStats();return _(D,{sx:{width:`100%`},children:[_(D,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,mb:1},children:[c(g,{variant:`standard`,size:`small`,value:this.state.filter,placeholder:x.t(`influxdb_filter`),onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?c(t,{position:`end`,children:c(p,{size:`small`,onClick:()=>this.setState({filter:``}),children:c(d,{})})}):null}}}),c(a,{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=>c(s,{value:e,children:x.t(R[e])},e))}),c(e,{title:x.t(`influxdb_refresh`),children:c(p,{onClick:()=>void this.load(),disabled:this.state.loading,children:c(n,{})})}),c(D,{sx:{flexGrow:1}}),c(v,{control:c(O,{checked:this.state.includeDisabled,onChange:e=>this.setState({includeDisabled:e.target.checked})}),label:x.t(`influxdb_include_disabled`)}),c(w,{variant:`contained`,color:`error`,startIcon:c(i,{}),disabled:this.state.loading,onClick:()=>void this.requestPreview(this.state.includeDisabled),children:x.t(`influxdb_cleanup`)})]}),this.state.loading&&c(T,{}),!!this.state.errorText&&c(N,{severity:`error`,sx:{mb:1},onClose:()=>this.setState({errorText:``}),children:this.state.errorText}),!!this.state.doneText&&c(N,{severity:`success`,sx:{mb:1},onClose:()=>this.setState({doneText:``}),children:this.state.doneText}),this.renderSummary(),c(r,{component:P,children:_(o,{size:`small`,stickyHeader:!0,children:[c(u,{children:_(j,{children:[c(h,{children:this.renderSortLabel(`id`,`influxdb_col_id`)}),c(h,{children:x.t(`influxdb_col_type`)}),c(h,{children:this.renderSortLabel(`status`,`influxdb_col_status`)}),c(h,{align:`right`,children:this.renderSortLabel(`count`,`influxdb_col_count`)}),c(h,{align:`right`,children:this.renderSortLabel(`cardinality`,`influxdb_col_series`)}),c(h,{children:x.t(`influxdb_col_first`)}),c(h,{children:this.renderSortLabel(`lastTs`,`influxdb_col_last`)})]})}),_(m,{children:[l.map(e=>_(j,{hover:!0,children:[c(h,{sx:{wordBreak:`break-all`},children:e.id}),c(h,{children:e.type||`—`}),c(h,{children:c(M,{size:`small`,color:V[e.status],label:x.t(H[e.status])})}),c(h,{align:`right`,children:z(e.count)}),c(h,{align:`right`,children:z(e.cardinality)}),c(h,{children:B(e.firstTs)}),c(h,{children:B(e.lastTs)})]},e.id)),!l.length&&!this.state.loading&&c(j,{children:c(h,{colSpan:7,children:c(b,{variant:`body2`,sx:{opacity:.7},children:x.t(this.state.filter?`influxdb_stats_no_match`:`influxdb_no_datapoints`)})})})]})]})}),c(b,{variant:`caption`,sx:{display:`block`,mt:1,opacity:.7},children:x.t(`influxdb_no_size`)}),this.renderConfirmDialog()]})}}};export{U 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__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js";import{t as B}from"./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare__shared-3YWGBSiP.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(`influxdb_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?`influxdb_no_data`:`influxdb_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(`influxdb_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(`influxdb_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`?`influxdb_sort_desc`:`influxdb_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(`influxdb_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(`influxdb_refresh`),children:u(h,{size:`small`,onClick:()=>void this.loadRows(),children:u(i,{})})}),u(e,{title:E.t(`influxdb_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(`influxdb_delete_selected`),children:u(`span`,{children:u(h,{size:`small`,disabled:!this.state.checked.length,onClick:()=>this.setState({confirmText:E.t(`influxdb_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(`influxdb_time`)}),u(y,{children:E.t(`influxdb_value`)}),u(y,{children:E.t(`influxdb_ack`)}),u(y,{children:E.t(`influxdb_quality`)}),u(y,{children:E.t(`influxdb_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(`influxdb_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(`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:[u(b,{label:E.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)}),u(b,{label:E.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)}),u(b,{label:E.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)})]}),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?`influxdb_save`:`influxdb_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(`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:[u(P,{checked:t.ack,onChange:e=>this.setState({entryDialog:{...t,ack:e.target.checked}})}),u(T,{children:E.t(`influxdb_ack`)}),u(b,{label:E.t(`influxdb_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(`influxdb_save`)}),u(A,{variant:`outlined`,onClick:()=>this.setState({entryDialog:null}),children:E.t(`influxdb_cancel`)})]})]}):null}renderConfirmDialog(){return this.state.confirmAction?x(C,{open:!0,onClose:()=>this.setState({confirmText:``,confirmAction:null}),children:[u(O,{children:E.t(`influxdb_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(`influxdb_delete`)}),u(A,{variant:`outlined`,onClick:()=>this.setState({confirmText:``,confirmAction:null}),children:E.t(`influxdb_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(`influxdb_select_datapoint`)})]}),this.renderEntryDialog(),this.renderConfirmDialog()]}):u(R,{severity:`info`,children:E.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-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`))return e}},r={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js`).then(e=>e.bi),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__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__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js`).then(e=>e.hr),[],import.meta.url),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild__react_mf_2_dom_mf_1_client__prebuild__-DMyibbf8.js`),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js`).then(e=>e.Gn),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js`).then(e=>e.Rt),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CQqvo_Mn.js`).then(e=>e.S),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__InfluxDBComponentsSet__mf_owner__175617253411979__prebuild___mf_0_iobroker_mf_1_json_mf_2_config__prebuild__-DYmogjuK.js`),[],import.meta.url)},i={react:{name:`react`,version:`19.3.0`,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.0`,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.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:`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.0`,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.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:`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.10`,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.2`,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};
|