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 = []; diff --git a/hubigraph_time_line.groovy b/hubigraph_time_line.groovy index ff9f62c..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); @@ -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}", @@ -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); } 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 = """