I too think you’re right in that its the UI Client’s to keep track of visibility, but your response is missing how it’s done.
Let me show you with an example with a simple sitemap that works correctly with the classic UI:
{
“name”: “test1”,
“label”: “Test1”,
“link”: “http://ohserver:8080/rest/sitemaps/test1”,
“homepage”: {
“id”: “test1”,
“title”: “Test1”,
“link”: “http://ohserver:8080/rest/sitemaps/test1/test1”,
“leaf”: false,
“timeout”: false,
“widgets”: [
{
“widgetId”: “00”,
“type”: “Text”,
“visibility”: true,
“label”: “Graph1”,
“icon”: “text”,
“mappings”: ,
“linkedPage”: {
“id”: “00”,
“title”: “Graph1”,
“icon”: “text”,
“link”: “http://ohserver:8080/rest/sitemaps/test1/00”,
“leaf”: true,
“timeout”: false,
“widgets”: [
{
“widgetId”: “0000”,
“type”: “Switch”,
“visibility”: true,
“label”: “Rain (last 1 min)”,
“icon”: “number”,
“mappings”: [
{
“command”: “1”,
“label”: “Hour”
},
{
“command”: “2”,
“label”: “Day”
},
{
“command”: “3”,
“label”: “Week”
},
{
“command”: “4”,
“label”: “Month”
},
{
“command”: “5”,
“label”: “4 Months”
}
],
“item”: {
“link”: “http://ohserver:8080/rest/items/SCP3”,
“state”: “3”,
“type”: “Number”,
“name”: “SCP3”,
“label”: “Graph”,
“tags”: ,
“groupNames”:
},
“widgets”:
},
{
“widgetId”: “0001”,
“type”: “Chart”,
“visibility”: false,
“label”: “Rainfall (last 1 min) [0.00 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “h”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain”,
“state”: “0.00”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain”,
“label”: “Rainfall (last 1 min)”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0002”,
“type”: “Chart”,
“visibility”: false,
“label”: “Rainfall (last 1 min) [0.00 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “D”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain”,
“state”: “0.00”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain”,
“label”: “Rainfall (last 1 min)”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0003”,
“type”: “Chart”,
“visibility”: true,
“label”: “Rainfall (last 1 min) [0.00 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “W”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain”,
“state”: “0.00”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain”,
“label”: “Rainfall (last 1 min)”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0004”,
“type”: “Chart”,
“visibility”: false,
“label”: “Rainfall (last 1 min) [0.00 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “M”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain”,
“state”: “0.00”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain”,
“label”: “Rainfall (last 1 min)”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0005”,
“type”: “Chart”,
“visibility”: false,
“label”: “Rainfall (last 1 min) [0.00 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “4M”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain”,
“state”: “0.00”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain”,
“label”: “Rainfall (last 1 min)”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
}
]
},
“widgets”:
},
{
“widgetId”: “01”,
“type”: “Text”,
“visibility”: true,
“label”: “Graph2”,
“icon”: “text”,
“mappings”: ,
“linkedPage”: {
“id”: “01”,
“title”: “Graph2”,
“icon”: “text”,
“link”: “http://ohserver:8080/rest/sitemaps/test1/01”,
“leaf”: true,
“timeout”: false,
“widgets”: [
{
“widgetId”: “0100”,
“type”: “Chart”,
“visibility”: false,
“label”: “Accumulated Daily Rainfall [0.84 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “h”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain_Daily”,
“state”: “0.84”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain_Daily”,
“label”: “Accumulated Daily Rainfall”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0101”,
“type”: “Chart”,
“visibility”: false,
“label”: “Accumulated Daily Rainfall [0.84 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “D”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain_Daily”,
“state”: “0.84”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain_Daily”,
“label”: “Accumulated Daily Rainfall”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0102”,
“type”: “Chart”,
“visibility”: true,
“label”: “Accumulated Daily Rainfall [0.84 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “W”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain_Daily”,
“state”: “0.84”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain_Daily”,
“label”: “Accumulated Daily Rainfall”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0103”,
“type”: “Chart”,
“visibility”: false,
“label”: “Accumulated Daily Rainfall [0.84 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “M”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain_Daily”,
“state”: “0.84”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain_Daily”,
“label”: “Accumulated Daily Rainfall”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
},
{
“widgetId”: “0104”,
“type”: “Chart”,
“visibility”: false,
“label”: “Accumulated Daily Rainfall [0.84 mm]”,
“icon”: “rain”,
“mappings”: ,
“refresh”: 10000,
“service”: “rrd4j”,
“period”: “4M”,
“item”: {
“link”: “http://ohserver:8080/rest/items/Sensor_Garden_Rain_Daily”,
“state”: “0.84”,
“stateDescription”: {
“pattern”: “%.2f mm”,
“readOnly”: false,
“options”:
},
“type”: “Number”,
“name”: “Sensor_Garden_Rain_Daily”,
“label”: “Accumulated Daily Rainfall”,
“category”: “rain”,
“tags”: ,
“groupNames”: [
“ALL”,
“Outdoor”
]
},
“widgets”:
}
]
},
“widgets”:
}
]
}
}
There is nothing to show why a specific Chart is visible or not, it just true or false, as the logic itself is stripped out. How is the UI client supposed to figure out what to do when the state of SCP3 changes?
a) Is the way I download the sitemap incorrect and missing an attribute to include the logic?
b) does the UI need to subscribe to “something” to know the sitemap has changed (visibility) ?