mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-07-25 23:18:06 -04:00
BE+FE: change log
This commit is contained in:
@@ -427,9 +427,9 @@ Device field change history is stored in `DevicesHistory` and exposed via two qu
|
||||
Returns grouped change events for one device. Events are grouped by `(timestamp, changedBy)` so that simultaneous field changes are returned as a single object.
|
||||
|
||||
```graphql
|
||||
query DeviceHistory($devGuid: String!, $changedColumn: String, $changedBy: String, $limit: Int, $offset: Int) {
|
||||
query DeviceHistory($devGUID: String!, $changedColumn: String, $changedBy: String, $limit: Int, $offset: Int) {
|
||||
deviceHistoryGrouped(
|
||||
devGuid: $devGuid
|
||||
devGUID: $devGUID
|
||||
changedColumn: $changedColumn
|
||||
changedBy: $changedBy
|
||||
limit: $limit
|
||||
@@ -454,7 +454,7 @@ query DeviceHistory($devGuid: String!, $changedColumn: String, $changedBy: Strin
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------------|----------|----------|----------------------------------------------------------------------|
|
||||
| `devGuid` | `String` | ✅ | GUID of the device to fetch history for |
|
||||
| `devGUID` | `String` | No | GUID of the device to fetch history for |
|
||||
| `changedColumn` | `String` | No | Filter to groups containing a change to this specific column |
|
||||
| `changedBy` | `String` | No | Filter to a specific attribution source (`USER`, `ARPSCAN`, etc.) |
|
||||
| `limit` | `Int` | No | Max grouped events to return (default `50`) |
|
||||
@@ -479,9 +479,9 @@ curl -X POST http://localhost:20212/graphql \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer YOUR_API_TOKEN" \
|
||||
-d '{
|
||||
"query": "query($devGuid:String!,$limit:Int,$offset:Int){deviceHistoryGrouped(devGuid:$devGuid,limit:$limit,offset:$offset){count history{timestamp changedBy changes{changedColumn oldValue newValue}}}}",
|
||||
"query": "query($devGUID:String!,$limit:Int,$offset:Int){deviceHistoryGrouped(devGUID:$devGUID,limit:$limit,offset:$offset){count history{timestamp changedBy changes{changedColumn oldValue newValue}}}}",
|
||||
"variables": {
|
||||
"devGuid": "your-device-guid-here",
|
||||
"devGUID": "your-device-guid-here",
|
||||
"limit": 25,
|
||||
"offset": 0
|
||||
}
|
||||
@@ -490,47 +490,7 @@ curl -X POST http://localhost:20212/graphql \
|
||||
|
||||
---
|
||||
|
||||
### `allDeviceHistoryGrouped` — All Devices (Global View)
|
||||
|
||||
Identical to `deviceHistoryGrouped` but returns changes across **all devices**. Used by the Change History page under Monitoring. Does not accept a `devGuid` parameter.
|
||||
|
||||
```graphql
|
||||
query AllHistory($changedColumn: String, $changedBy: String, $limit: Int, $offset: Int) {
|
||||
allDeviceHistoryGrouped(
|
||||
changedColumn: $changedColumn
|
||||
changedBy: $changedBy
|
||||
limit: $limit
|
||||
offset: $offset
|
||||
) {
|
||||
count
|
||||
history {
|
||||
devGUID
|
||||
timestamp
|
||||
changedBy
|
||||
changes {
|
||||
changedColumn
|
||||
oldValue
|
||||
newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### `curl` Example
|
||||
|
||||
```sh
|
||||
curl -X POST http://localhost:20212/graphql \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer YOUR_API_TOKEN" \
|
||||
-d '{
|
||||
"query": "query($changedBy:String,$limit:Int){allDeviceHistoryGrouped(changedBy:$changedBy,limit:$limit){count history{devGUID timestamp changedBy changes{changedColumn oldValue newValue}}}}",
|
||||
"variables": {
|
||||
"changedBy": "USER",
|
||||
"limit": 50
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -539,7 +499,7 @@ curl -X POST http://localhost:20212/graphql \
|
||||
To populate dynamic filter dropdowns, fetch available `changedBy` and `changedColumn` values via the REST endpoint:
|
||||
|
||||
```sh
|
||||
GET /devices/history/filters?devGuid=<guid> # scoped to one device
|
||||
GET /devices/history/filters?devGUID=<guid> # scoped to one device
|
||||
GET /devices/history/filters # all devices
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user