Skip to content

Commit

Permalink
Merge pull request #2785 from SCADA-LTS/fix/#2769_Risk_of_duplicate_r…
Browse files Browse the repository at this point in the history
…ange_formats_when_applying_format_from_another_datapoint

Fix/ Risk of duplicate range formats when applying format from another datapoint #2769
  • Loading branch information
Limraj authored Feb 14, 2024
2 parents 4b8c899 + 2d2fbc8 commit 1c3ad18
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions WebContent/WEB-INF/jsp/dataPointEdit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,22 @@
if (properties.eventTextRenderer.def.name == "eventTextRendererRange") {
if (checkGetAlertError()) {
let thisEventRangeValues = this.eventTextRendererEditor.getRangeEventValues();
try {
var alert_old = alert;
alert = function (message) {
console.log(message);
}
for (var range in properties.eventTextRenderer.rangeEventValues) {
for (let i = 0; i < thisEventRangeValues.length; i++){
if(
parseFloat(thisEventRangeValues[i].from) === parseFloat(properties.eventTextRenderer.rangeEventValues[range].from) &&
parseFloat(thisEventRangeValues[i].to) === parseFloat(properties.eventTextRenderer.rangeEventValues[range].to))
{
eventTextRendererEditor.removeRangeEventValue(parseFloat(properties.eventTextRenderer.rangeEventValues[range].from),
parseFloat(properties.eventTextRenderer.rangeEventValues[range].to))
}
}
eventTextRendererEditor.addRangeEventValue(
String( properties.eventTextRenderer.rangeEventValues[range].from ),
String( properties.eventTextRenderer.rangeEventValues[range].to ),
Expand Down Expand Up @@ -319,11 +329,20 @@
if (checkGetAlertError()) {
try {
let thisRangeValues = this.textRendererEditor.getRangeValues();
var alert_old = alert;
alert = function (message) {
console.log(message);
}
for (var range in properties.textRenderer.rangeValues) {
for (let i = 0; i < thisRangeValues.length; i++) {
if (
parseFloat(thisRangeValues[i].from) === parseFloat(properties.textRenderer.rangeValues[range].from) &&
parseFloat(thisRangeValues[i].to) === parseFloat(properties.textRenderer.rangeValues[range].to))
{
textRendererEditor.removeRangeValue(parseFloat(properties.textRenderer.rangeValues[range].from), parseFloat(properties.textRenderer.rangeValues[range].to));
}
}
textRendererEditor.addRangeValue(
String( properties.textRenderer.rangeValues[range].from ),
String( properties.textRenderer.rangeValues[range].to ),
Expand Down
3 changes: 3 additions & 0 deletions WebContent/WEB-INF/jsp/pointEdit/eventTextRenderer.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@
}
], null);
};
this.getRangeEventValues = function(){
return rangeEventValues;
}
}
var eventTextRendererEditor = new EventTextRendererEditor();
dojo.addOnLoad(eventTextRendererEditor, "init");
Expand Down
3 changes: 3 additions & 0 deletions WebContent/WEB-INF/jsp/pointEdit/textRenderer.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@
dojo.widget.byId("textRendererBinaryOneColour").selectedColour = colour;
$("textRendererBinaryOne").style.color = colour;
};
this.getRangeValues = function(){
return rangeValues;
}
}
var textRendererEditor = new TextRendererEditor();
dojo.addOnLoad(textRendererEditor, "init");
Expand Down

0 comments on commit 1c3ad18

Please sign in to comment.