From 23458798a920a7111439a6683aadde053308573a Mon Sep 17 00:00:00 2001 From: kennethxu Date: Fri, 14 Jan 2022 03:03:24 -0500 Subject: [PATCH 1/5] Fix device header missing issue when there is special char in name --- hubigraphs.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hubigraphs.groovy b/hubigraphs.groovy index 0e2bf2f..68770da 100644 --- a/hubigraphs.groovy +++ b/hubigraphs.groovy @@ -320,12 +320,11 @@ def hubiForm_page_button(child, title, page, width, icon=""){ -def hubiForm_section(child, title, pos, icon="", Closure code) { +def hubiForm_section(child, title, pos, icon="", suffix = "", Closure code) { child.call(){ - def id = title.replace(' ', '_').replace('(', '').replace(')',''); - def title_ = title.replace("'", "").replace("`", ""); - + def id = title.replaceAll("\\W", "_") + suffix; + title_ = groovy.xml.XmlUtil.escapeXml(title); def titleHTML = """
From 6c094a10318e8731271e48871d03b01ce1b3d100 Mon Sep 17 00:00:00 2001 From: kennethxu Date: Fri, 14 Jan 2022 03:06:05 -0500 Subject: [PATCH 2/5] Adding device Id to ensure the uniqueness of HTML element Id --- hubigraph_time_graph.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hubigraph_time_graph.groovy b/hubigraph_time_graph.groovy index b407b4a..b874348 100644 --- a/hubigraph_time_graph.groovy +++ b/hubigraph_time_graph.groovy @@ -451,7 +451,7 @@ def graphSetupPage(){ sensors.each { sensor -> settings["attributes_${sensor.id}"].each { attribute -> - parent.hubiForm_section(this,"${sensor.displayName} - ${attribute}", 1){ + parent.hubiForm_section(this,"${sensor.displayName} - ${attribute}", 1, "", sensor.id){ container = []; From ed4b50f151cc8f9f3e7b930c094d2df8f54421a1 Mon Sep 17 00:00:00 2001 From: kennethxu Date: Fri, 14 Jan 2022 03:07:10 -0500 Subject: [PATCH 3/5] Adding device Id to ensure the uniqueness of HTML element Id --- hubigraph_time_line.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hubigraph_time_line.groovy b/hubigraph_time_line.groovy index ff9f62c..b9170af 100644 --- a/hubigraph_time_line.groovy +++ b/hubigraph_time_line.groovy @@ -199,7 +199,7 @@ def attributeConfigurationPage() { def attributes = settings["attributes_${sensor.id}"]; attributes.each { attribute -> state.count_++; - parent.hubiForm_section(this, "${sensor.displayName} ${attribute}", 1, "directions"){ + parent.hubiForm_section(this, "${sensor.displayName} ${attribute}", 1, "directions", sensor.id){ container = []; container << parent.hubiForm_text_input(this, "Override Device Name
Use %deviceName% for DEVICE and %attributeName% for ATTRIBUTE
", "graph_name_override_${sensor.id}_${attribute}", From 374660c2d7e7258f4e6fca0b9b0297f3cf4a51c7 Mon Sep 17 00:00:00 2001 From: kennethxu Date: Fri, 14 Jan 2022 03:14:30 -0500 Subject: [PATCH 4/5] Make the link on timeline graph app clickable. --- hubigraph_time_line.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hubigraph_time_line.groovy b/hubigraph_time_line.groovy index b9170af..c673491 100644 --- a/hubigraph_time_line.groovy +++ b/hubigraph_time_line.groovy @@ -299,7 +299,8 @@ def mainPage() { } parent.hubiForm_section(this, "Local Graph URL", 1, "link"){ container = []; - container << parent.hubiForm_text(this, "${state.localEndpointURL}graph/?access_token=${state.endpointSecret}"); + container << parent.hubiForm_text(this, "${state.localEndpointURL}graph/?access_token=${state.endpointSecret}", + "${state.localEndpointURL}graph/?access_token=${state.endpointSecret}"); parent.hubiForm_container(this, container, 1); } From 331d996e15784adb60a6ea31600d7f8a9fc092f1 Mon Sep 17 00:00:00 2001 From: kennethxu Date: Fri, 14 Jan 2022 03:29:41 -0500 Subject: [PATCH 5/5] Time Line: Sort device attribute list and remove dups --- hubigraph_time_line.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hubigraph_time_line.groovy b/hubigraph_time_line.groovy index c673491..86b0d86 100644 --- a/hubigraph_time_line.groovy +++ b/hubigraph_time_line.groovy @@ -114,7 +114,7 @@ def deviceSelectionPage() { if (sensors) { sensors.each{sensor -> id = sensor.id; - sensor_attributes = sensor.getSupportedAttributes().collect { it.getName() }; + sensor_attributes = sensor.getSupportedAttributes().collect { it.getName() }.unique().sort(); def container = []; container << parent.hubiForm_sub_section(this, "${sensor.displayName}"); parent.hubiForm_container(this, container, 1);