Skip to content

Commit

Permalink
Merge pull request #3184 from jeonghanlee/latched_enabled_to_command_…
Browse files Browse the repository at this point in the history
…alarmLogTable

Add the missing Latch status  into the Alarm Logger History
  • Loading branch information
shroffk authored Nov 21, 2024
2 parents 7ce4a9d + e98ae67 commit a296786
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.phoebus.applications.alarm.logging.ui;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.sun.jersey.api.client.WebResource;
Expand Down Expand Up @@ -40,6 +41,7 @@
import org.phoebus.applications.alarm.AlarmSystem;
import org.phoebus.applications.alarm.logging.ui.AlarmLogTableQueryUtil.Keys;
import org.phoebus.applications.alarm.model.SeverityLevel;
import org.phoebus.applications.alarm.model.json.JsonModelReader;
import org.phoebus.applications.alarm.ui.AlarmUI;
import org.phoebus.framework.jobs.Job;
import org.phoebus.framework.selection.SelectionService;
Expand Down Expand Up @@ -249,7 +251,17 @@ protected void updateItem(String item, boolean empty) {
if (!en) {
return new SimpleStringProperty("Disabled");
} else {
return new SimpleStringProperty("Enabled");
try {
final JsonNode jsonNode = (JsonNode) JsonModelReader.parseJsonText(alarmMessage.getValue().getConfig_msg());
if (jsonNode == null) {
logger.log(Level.WARNING, "There is no JasonNode");
return null;
}
final boolean latching = jsonNode.get("latching").asBoolean();
return new SimpleStringProperty(latching ? "Enabled:Latched" : "Enabled:Unlatch");
} catch (Exception e) {
logger.log(Level.SEVERE, "Unexpected error in alarmMessage" + e);
}
}
}
return null;
Expand Down

0 comments on commit a296786

Please sign in to comment.