From 19cafbe18fbca6a1208d82a95b56ef62fce49829 Mon Sep 17 00:00:00 2001
From: "emanuele.laface@esss.se" <emanuele.laface@esss.se>
Date: Sun, 26 Jun 2022 21:29:12 +0200
Subject: [PATCH] ccg page temp

---
 WebSites/ccg/ccg                              |   9 +
 WebSites/ccg/dashboard.json                   | 456 +++++++++++++++++-
 .../thirdparty/flot_extended.plugin.js        |  14 +-
 3 files changed, 462 insertions(+), 17 deletions(-)
 create mode 100644 WebSites/ccg/ccg

diff --git a/WebSites/ccg/ccg b/WebSites/ccg/ccg
new file mode 100644
index 0000000..1c0556d
--- /dev/null
+++ b/WebSites/ccg/ccg
@@ -0,0 +1,9 @@
+{
+	"version": 1,
+	"header_image": "",
+	"allow_edit": true,
+	"plugins": [],
+	"panes": [],
+	"datasources": [],
+	"columns": 4
+}
\ No newline at end of file
diff --git a/WebSites/ccg/dashboard.json b/WebSites/ccg/dashboard.json
index 677865c..f4697ec 100644
--- a/WebSites/ccg/dashboard.json
+++ b/WebSites/ccg/dashboard.json
@@ -1,7 +1,7 @@
 {
 	"version": 1,
 	"header_image": "",
-	"allow_edit": true,
+	"allow_edit": false,
 	"plugins": [],
 	"panes": [
 		{
@@ -68,9 +68,9 @@
 			"title": "ISRC / LEBT",
 			"width": 1,
 			"row": {
-				"1": 35,
-				"2": 27,
-				"3": 19,
+				"1": 11,
+				"2": 23,
+				"3": 11,
 				"4": 11,
 				"5": 1,
 				"7": 1,
@@ -97,13 +97,443 @@
 						"plot_type": "line",
 						"legend": true,
 						"height": 5,
-						"value": "datasources[\"Clock\"][\"numeric_value\"];\nvar series = document.getElementById(\"time-series\").value;\n\nlet data = [\n    {label: \"LEBT-010:Vac-VGC-10000:PrsR\", data: datasources[series][\"LEBT-010:Vac-VGC-10000:PrsR\"]},\n    {label: \"LEBT-010:Vac-VGC-30000:PrsR\", data: datasources[series][\"LEBT-010:Vac-VGC-30000:PrsR\"]}\n];\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\nvar series = document.getElementById(\"time-series\").value;\n\nlet pvs = [\"LEBT-010:Vac-VGC-10000:PrsR\", \"LEBT-010:Vac-VGC-30000:PrsR\"];\nvar data = [];\n\npvs.forEach(function (item, index) {\n  data.push({label: item, data: datasources[series][item]});\n});\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
 						"xticks": "6",
 						"x_timestamp": true,
 						"zoom": "xy"
 					}
 				}
 			]
+		},
+		{
+			"title": "RFQ",
+			"width": 1,
+			"row": {
+				"1": 31,
+				"2": 11,
+				"3": 27,
+				"4": 27
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 4,
+			"widgets": [
+				{
+					"type": "flot_extended_plugin",
+					"settings": {
+						"plot_type": "line",
+						"legend": true,
+						"height": 5,
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\nvar series = document.getElementById(\"time-series\").value;\n\nlet pvs = [\"RFQ-010:Vac-VGC-10000:PrsR\",\"RFQ-010:Vac-VGC-20000:PrsR\",\"RFQ-010:Vac-VGC-30000:PrsR\",\"RFQ-010:Vac-VGC-40000:PrsR\"];\nvar data = [];\n\npvs.forEach(function (item, index) {\n  data.push({label: item, data: datasources[series][item]});\n});\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
+						"xticks": "6",
+						"x_timestamp": true,
+						"zoom": "xy"
+					}
+				}
+			]
+		},
+		{
+			"title": "MEBT",
+			"width": 1,
+			"row": {
+				"1": 59,
+				"2": 39,
+				"3": 47,
+				"4": 43
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 4,
+			"widgets": [
+				{
+					"type": "flot_extended_plugin",
+					"settings": {
+						"plot_type": "line",
+						"legend": true,
+						"height": 5,
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\nvar series = document.getElementById(\"time-series\").value;\n\nlet pvs = [\"MEBT-010:Vac-VGC-10000:PrsR\",\"MEBT-010:Vac-VGC-30000:PrsR\",\"MEBT-010:Vac-VGC-40000:PrsR\"];\nvar data = [];\n\npvs.forEach(function (item, index) {\n  data.push({label: item, data: datasources[series][item]});\n});\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
+						"xticks": "6",
+						"x_timestamp": true,
+						"zoom": "xy"
+					}
+				}
+			]
+		},
+		{
+			"title": "DTL",
+			"width": 1,
+			"row": {
+				"1": 83,
+				"2": 51,
+				"3": 63,
+				"4": 59
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 4,
+			"widgets": [
+				{
+					"type": "flot_extended_plugin",
+					"settings": {
+						"plot_type": "line",
+						"legend": true,
+						"height": 5,
+						"value": "datasources[\"Clock\"][\"numeric_value\"];\nvar series = document.getElementById(\"time-series\").value;\n\nlet pvs = [\"DTL-010:Vac-VGC-10000:PrsR\",\"DTL-010:Vac-VGC-20000:PrsR\",\"DTL-010:Vac-VGC-50000:PrsR\"];\nvar data = [];\n\npvs.forEach(function (item, index) {\n  data.push({label: item, data: datasources[series][item]});\n});\n\nfreeboard.showLoadingIndicator(false);\nreturn data;\n",
+						"xticks": "6",
+						"x_timestamp": true,
+						"zoom": "xy"
+					}
+				}
+			]
+		},
+		{
+			"title": "LEBT-010:Vac-VGC-10000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 23,
+				"2": 35,
+				"3": 23,
+				"4": 23
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 2
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"LEBT-010:Vac-VGC-10000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "LEBT-010:Vac-VGC-30000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 27,
+				"2": 35,
+				"3": 23,
+				"4": 23
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 2,
+				"4": 1
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"title": "",
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"LEBT-010:Vac-VGC-30000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "RFQ-010:Vac-VGC-10000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 43,
+				"2": 63,
+				"3": 39,
+				"4": 39
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"RFQ-010:Vac-VGC-10000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "RFQ-010:Vac-VGC-20000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 47,
+				"2": 63,
+				"3": 39,
+				"4": 39
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 2,
+				"4": 2
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"RFQ-010:Vac-VGC-20000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "RFQ-010:Vac-VGC-30000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 51,
+				"2": 67,
+				"3": 39,
+				"4": 39
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 3,
+				"4": 3
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"RFQ-010:Vac-VGC-30000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "RFQ-010:Vac-VGC-40000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 55,
+				"2": 67,
+				"3": 43,
+				"4": 39
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 2,
+				"4": 4
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"RFQ-010:Vac-VGC-40000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "MEBT-010:Vac-VGC-10000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 71,
+				"2": 71,
+				"3": 59,
+				"4": 55
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"MEBT-010:Vac-VGC-10000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "MEBT-010:Vac-VGC-30000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 75,
+				"2": 71,
+				"3": 59,
+				"4": 55
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 2,
+				"4": 2
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"MEBT-010:Vac-VGC-30000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBet"
+					}
+				}
+			]
+		},
+		{
+			"title": "MEBT-010:Vac-VGC-40000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 79,
+				"2": 75,
+				"3": 59,
+				"4": 55
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 3,
+				"4": 3
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"MEBT-010:Vac-VGC-40000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "DTL-010:Vac-VGC-10000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 95,
+				"2": 75,
+				"3": 75,
+				"4": 71
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 1,
+				"4": 1
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"DTL-010:Vac-VGC-10000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "DTL-010:Vac-VGC-20000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 99,
+				"2": 79,
+				"3": 75,
+				"4": 71
+			},
+			"col": {
+				"1": 1,
+				"2": 1,
+				"3": 2,
+				"4": 2
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"DTL-010:Vac-VGC-20000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
+		},
+		{
+			"title": "DTL-010:Vac-VGC-50000:PrsR",
+			"width": 1,
+			"row": {
+				"1": 103,
+				"2": 79,
+				"3": 75,
+				"4": 71
+			},
+			"col": {
+				"1": 1,
+				"2": 2,
+				"3": 3,
+				"4": 3
+			},
+			"col_width": 1,
+			"widgets": [
+				{
+					"type": "text_widget",
+					"settings": {
+						"size": "regular",
+						"value": "datasources[\"realtime\"][\"DTL-010:Vac-VGC-50000:PrsR\"][\"value\"]",
+						"animate": true,
+						"units": "mBar"
+					}
+				}
+			]
 		}
 	],
 	"datasources": [
@@ -181,9 +611,21 @@
 				"url": "/data/api/v1/archiver/LEBT-010:Vac-VGC-10000:PrsR,LEBT-010:Vac-VGC-30000:PrsR,RFQ-010:Vac-VGC-10000:PrsR,RFQ-010:Vac-VGC-20000:PrsR,RFQ-010:Vac-VGC-30000:PrsR,RFQ-010:Vac-VGC-40000:PrsR,MEBT-010:Vac-VGC-10000:PrsR,MEBT-010:Vac-VGC-30000:PrsR,MEBT-010:Vac-VGC-40000:PrsR,DTL-010:Vac-VGC-10000:PrsR,DTL-010:Vac-VGC-20000:PrsR,DTL-010:Vac-VGC-50000:PrsR/600/100/freeboard",
 				"use_thingproxy": false,
 				"refresh": 10,
-				"method": "GET"
+				"method": "GET",
+				"name": "live"
+			}
+		},
+		{
+			"name": "realtime",
+			"type": "JSON",
+			"settings": {
+				"url": "/data/api/v2/pvget/LEBT-010:Vac-VGC-10000:PrsR,LEBT-010:Vac-VGC-30000:PrsR,RFQ-010:Vac-VGC-10000:PrsR,RFQ-010:Vac-VGC-20000:PrsR,RFQ-010:Vac-VGC-30000:PrsR,RFQ-010:Vac-VGC-40000:PrsR,MEBT-010:Vac-VGC-10000:PrsR,MEBT-010:Vac-VGC-30000:PrsR,MEBT-010:Vac-VGC-40000:PrsR,DTL-010:Vac-VGC-10000:PrsR,DTL-010:Vac-VGC-20000:PrsR,DTL-010:Vac-VGC-50000:PrsR",
+				"use_thingproxy": true,
+				"refresh": 10,
+				"method": "GET",
+				"name": "realtime"
 			}
 		}
 	],
 	"columns": 4
-}
\ No newline at end of file
+}
diff --git a/WebSites/ccg/plugins/thirdparty/flot_extended.plugin.js b/WebSites/ccg/plugins/thirdparty/flot_extended.plugin.js
index 82e5ec4..7a2c747 100755
--- a/WebSites/ccg/plugins/thirdparty/flot_extended.plugin.js
+++ b/WebSites/ccg/plugins/thirdparty/flot_extended.plugin.js
@@ -64,7 +64,7 @@
 
 
         self.reset = function(e) {
-            self.zoom(e, {
+            self.zoom(e, { 
                 xaxis: {from: null, to: null},
                 yaxis: {from: null, to: null},
             })
@@ -73,7 +73,7 @@
 
         self.zoom = function (event, ranges) {
             if (!ranges.xaxis) return
-
+            
             var opts = plot.getOptions()
             _.each(opts.xaxes, function(axis) {
                 axis.min = ranges.xaxis.from
@@ -83,7 +83,7 @@
                 axis.min = ranges.yaxis.from
                 axis.max = ranges.yaxis.to
             })
-
+            
             plot.setupGrid()
             plot.draw()
             plot.clearSelection()
@@ -123,7 +123,7 @@
             tooltip.appendTo($container);
             console.log(currentSettings.zoom, currentSettings.zoom == "")
 
-            var options = {
+            var options = { 
                 grid: {
                     borderWidth: 0,
                     hoverable: currentSettings.tooltip,
@@ -165,7 +165,6 @@
             if (currentSettings.zoom != "") options.selection = { mode: currentSettings.zoom };
 
             if (currentSettings.x_timestamp) options.xaxis.mode = "time";
-            if (currentSettings.logscale) options.yaxis.mode = "log";
             plot = $.plot($holder, currentData, options);
         };
 
@@ -270,11 +269,6 @@
                                     display_name:   "Show Points",
                                     type:           "boolean"
                                 },
-                                {
-                                    name:           "logscale",
-                                    display_name:   "Log Scale",
-                                    type:           "boolean"
-                                },
                                 {
                                     name:           "tooltip",
                                     display_name:   "Show Tooltip",
-- 
GitLab