fixed filtering in the history

This commit is contained in:
Salijoghli 2025-06-10 12:33:06 +04:00
parent 1c095306e0
commit 5e03d48ced
3 changed files with 97 additions and 42 deletions

View File

@ -1823,17 +1823,17 @@
"$": [
"ts",
192,
1749540890888
1749543336268
],
"$ts": 1749540890888
"$ts": 1749543336268
},
"startDate": {
"$": [
"ts",
192,
1749540890888
1749543336268
],
"$ts": 1749499200000
"$ts": 1749541536268
}
},
"meta": {
@ -2006,7 +2006,7 @@
}
},
"props": {
"formattedValue": "Jun 4, 2025 12:00 AM",
"formattedValue": "Jun 10, 2025 11:45 AM",
"style": {
"margin": 15
}
@ -2064,6 +2064,7 @@
"config": {
"expression": "now()"
},
"enabled": false,
"type": "expr"
}
},
@ -2090,7 +2091,15 @@
}
},
"props": {
"formattedValue": "Jun 5, 2025 11:34 AM",
"formattedValue": "Jun 11, 2025 12:15 PM",
"maxDate": {
"$": [
"ts",
192,
1749542669794
],
"$ts": 1749715452000
},
"style": {
"margin": 15
},
@ -2098,9 +2107,9 @@
"$": [
"ts",
0,
1749541102438
1749543373731
],
"$ts": 1749108890000
"$ts": 1749629736000
}
},
"scripts": {
@ -2286,8 +2295,22 @@
"$ts": 1747562336635
},
"priority_filters": "",
"time_from_filter": 1748980800000,
"time_to_filter": 1749108890000
"time_from_filter": {
"$": [
"ts",
192,
1749543368762
],
"$ts": 1749541536000
},
"time_to_filter": {
"$": [
"ts",
192,
1749543373742
],
"$ts": 1749629736000
}
},
"meta": {
"name": "Table"
@ -2302,17 +2325,6 @@
"config": {
"path": "this.custom.time_from_filter"
},
"enabled": false,
"transforms": [
{
"formatType": "datetime",
"formatValue": {
"date": "medium",
"time": "medium"
},
"type": "format"
}
],
"type": "property"
}
},
@ -2321,12 +2333,15 @@
"config": {
"path": "this.custom.time_to_filter"
},
"transforms": [
{
"code": "\tfrom java.util import Date\n\tfrom java.text import SimpleDateFormat\n\n\tif value is not None:\n\t formatter \u003d SimpleDateFormat(\"yyyy-M-d H:mm:ss\")\n\t return formatter.format(Date(value))\n\telse:\n\t return \"\"\n",
"type": "script"
}
],
"type": "property"
}
},
"props.columns[2].filter.number.value": {
"binding": {
"config": {
"path": "this.custom.time_to_filter"
},
"enabled": false,
"type": "property"
}
},
@ -2458,8 +2473,7 @@
"condition": ""
},
"date": {
"condition": "",
"value": ""
"condition": "later than date time"
},
"enabled": true,
"number": {
@ -3103,11 +3117,11 @@
{
"Description": "alm:papapapa - papapapa",
"Duration": "00:02:02",
"EndTimestamp": 1749541007000,
"ID": 86,
"EndTimestamp": 1749543629000,
"ID": 155,
"MCM": "System",
"Priority": "Low",
"StartTimestamp": 1749540885000,
"StartTimestamp": 1749543507000,
"Tag": "alm:papapapa"
}
],
@ -3233,8 +3247,22 @@
"download_in_progress": true,
"enable_timeout": false,
"priority_filters": "",
"time_from_filter": 1748980800000,
"time_to_filter": 1749108890000,
"time_from_filter": {
"$": [
"ts",
192,
1749543368762
],
"$ts": 1749541536000
},
"time_to_filter": {
"$": [
"ts",
192,
1749543373742
],
"$ts": 1749629736000
},
"type_filters": null
},
"events": {

View File

@ -0,0 +1,33 @@
{
"scope": "DG",
"version": 2,
"restricted": false,
"overridable": true,
"files": [
"query.sql"
],
"attributes": {
"useMaxReturnSize": false,
"autoBatchEnabled": false,
"fallbackValue": "",
"maxReturnSize": 100,
"cacheUnit": "SEC",
"type": "Query",
"enabled": true,
"cacheAmount": 1,
"cacheEnabled": false,
"database": "MariaDB",
"fallbackEnabled": false,
"lastModificationSignature": "6748eaa152183180c6431e52bd5d1c58f2e9026fefc3fe2663abf90dc4b6a2c7",
"permissions": [
{
"zone": "default",
"role": ""
}
],
"lastModification": {
"actor": "ilia-gu-autstand",
"timestamp": "2025-06-09T10:14:52Z"
}
}
}

View File

@ -101,22 +101,16 @@ def set_message_filters(self):
def set_time_from_filters(self):
"This filter sets the time from for history"
time = self.props.value
utc_offset = -self.session.props.device.timezone.utcOffset
#time = system.date.addHours(time, utc_offset)
epoch = system.date.toMillis(time)
payload = {}
payload["data"] = epoch
payload["data"] = time
system.perspective.sendMessage("set-from-filters", payload = payload,
scope = "page")
def set_time_to_filters(self):
"This filter sets the time to for history"
time = self.props.value
utc_offset = -self.session.props.device.timezone.utcOffset
#time = system.date.addHours(time, utc_offset)
epoch = system.date.toMillis(time)
payload = {}
payload["data"] = epoch
payload["data"] = time
system.perspective.sendMessage("set-to-filters", payload = payload,
scope = "page")