From 4e4f02ecc945eb2ca41510aa81772525f5f402a4 Mon Sep 17 00:00:00 2001 From: "Lee, Jeong Han" Date: Fri, 17 Jan 2025 11:20:21 -0800 Subject: [PATCH 1/4] use the consistent naming convention between alarm table and alarm log table --- .../alarm/logging/ui/messages.properties | 51 +++++++++++++------ .../resources/alarm_preferences.properties | 4 +- .../alarm/ui/table/AlarmTableUI.java | 4 +- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties b/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties index f844e93fc5..4b39bc9a53 100644 --- a/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties +++ b/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties @@ -16,35 +16,56 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # AlarmInformation=Alarm Information -Command=Command -Config=Config ConfigurationInfo=Configuration Info ConfigurationInfoNotFound=Configuration info not found. Configurations=Configurations: -CurrentMessage=Current Message -CurrentSeverity=Current Severity -EndTime=End Time +# +Config=Config +# +Severity=Alarm Severity +Message=Alarm Message +Time=Alarm Time +# +MessageTime=Alarm Log Time +CurrentSeverity=PV Severity +CurrentMessage=PV Message +# +Command=Command +# +User=User Host=Host -Message=Message -MessageTime=Message Time +# +Value=Alarm Value +# +TimeDelta=Time Delta +StartTime=Start Time +EndTime=End Time +# Mode=Mode +# NoSearchResults=No Search Results Query=Query: Search=Search Configuration=Configuration(s): -Severity=Severity -StartTime=Start Time -Time=Time -User=User -Value=Value -TimeDelta=Time Delta +# Table Column Visibility +# ConfigVisible=true +# PV : Always TRUE +# Severity : Alarm Severity Column +CSeverityVisible=true +# Message : Alarm Message Column +CMessageVisible=true +# Value : PV Value Column ValueVisible=false +# MessageTime : Alarm Log Time MTimeVisible=true +# Time Delta Column TimeDeltaVisible=false -CSeverityVisible=true -CMessageVisible=true +# Command Column CommandVisible=true +# Phoebus User Columm UserVisible=true +# Phoebus Host Column HostVisible=true +# diff --git a/app/alarm/model/src/main/resources/alarm_preferences.properties b/app/alarm/model/src/main/resources/alarm_preferences.properties index d2ba480fed..4f8c13e136 100644 --- a/app/alarm/model/src/main/resources/alarm_preferences.properties +++ b/app/alarm/model/src/main/resources/alarm_preferences.properties @@ -65,7 +65,7 @@ alarm_tree_startup_ms=2000 # Order of columns in alarm table # Allows re-ordering as well as omitting columns -alarm_table_columns=Icon, PV, Description, Alarm Severity, Alarm Status, Alarm Time, Alarm Value, PV Severity, PV Status +alarm_table_columns=Icon, PV, Description, Alarm Severity, Alarm Message, Alarm Time, Alarm Value, PV Severity, PV Message # By default, the alarm table uses the common alarm severity colors # for both the text color and the background of cells in the "Severity" column. @@ -142,4 +142,4 @@ shelving_options=1 hour, 6 hours, 12 hours, 1 day, 7 days, 30 days macros=TOP=/home/controls/displays,WEBROOT=http://localhost/controls/displays # Max time in ms a producer call will block. -max_block_ms=10000 \ No newline at end of file +max_block_ms=10000 diff --git a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java index c07c48981b..97899acdac 100644 --- a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java +++ b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java @@ -442,7 +442,7 @@ private TableView createTable(final ObservableList r sevcol.setCellFactory(c -> new SeverityLevelCell()); cols.add(sevcol); - col = new TableColumn<>("Alarm Status"); + col = new TableColumn<>("Alarm Message"); col.setPrefWidth(130); col.setReorderable(false); col.setCellValueFactory(cell -> cell.getValue().status); @@ -470,7 +470,7 @@ private TableView createTable(final ObservableList r sevcol.setCellFactory(c -> new SeverityLevelCell()); cols.add(sevcol); - col = new TableColumn<>("PV Status"); + col = new TableColumn<>("PV Message"); col.setPrefWidth(130); col.setReorderable(false); col.setCellValueFactory(cell -> cell.getValue().pv_status); From 77b1491fd5a76697d7619972d32c5038e2a84c1e Mon Sep 17 00:00:00 2001 From: Sangil Lee Date: Wed, 22 Jan 2025 11:43:03 +0900 Subject: [PATCH 2/4] Adjust to same column titles both alarm table and alarm log table --- .../alarm/logging/ui/messages.properties | 16 +++++++++------- .../main/resources/alarm_preferences.properties | 4 ++-- .../alarm/ui/table/AlarmTableUI.java | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties b/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties index f844e93fc5..e866778b5a 100644 --- a/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties +++ b/app/alarm/logging-ui/src/main/resources/org/phoebus/applications/alarm/logging/ui/messages.properties @@ -21,23 +21,25 @@ Config=Config ConfigurationInfo=Configuration Info ConfigurationInfoNotFound=Configuration info not found. Configurations=Configurations: -CurrentMessage=Current Message -CurrentSeverity=Current Severity +CurrentMessage=PV Message +CurrentSeverity=PV Severity EndTime=End Time Host=Host -Message=Message -MessageTime=Message Time +Message=Alarm Message +MessageTime=Alarm Log Time Mode=Mode NoSearchResults=No Search Results Query=Query: Search=Search Configuration=Configuration(s): -Severity=Severity +Severity=Alarm Severity StartTime=Start Time -Time=Time +Time=Alarm Time User=User -Value=Value +Value=Alarm Value TimeDelta=Time Delta + +#Default Column Visibility. ConfigVisible=true ValueVisible=false MTimeVisible=true diff --git a/app/alarm/model/src/main/resources/alarm_preferences.properties b/app/alarm/model/src/main/resources/alarm_preferences.properties index d2ba480fed..4f8c13e136 100644 --- a/app/alarm/model/src/main/resources/alarm_preferences.properties +++ b/app/alarm/model/src/main/resources/alarm_preferences.properties @@ -65,7 +65,7 @@ alarm_tree_startup_ms=2000 # Order of columns in alarm table # Allows re-ordering as well as omitting columns -alarm_table_columns=Icon, PV, Description, Alarm Severity, Alarm Status, Alarm Time, Alarm Value, PV Severity, PV Status +alarm_table_columns=Icon, PV, Description, Alarm Severity, Alarm Message, Alarm Time, Alarm Value, PV Severity, PV Message # By default, the alarm table uses the common alarm severity colors # for both the text color and the background of cells in the "Severity" column. @@ -142,4 +142,4 @@ shelving_options=1 hour, 6 hours, 12 hours, 1 day, 7 days, 30 days macros=TOP=/home/controls/displays,WEBROOT=http://localhost/controls/displays # Max time in ms a producer call will block. -max_block_ms=10000 \ No newline at end of file +max_block_ms=10000 diff --git a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java index c07c48981b..97899acdac 100644 --- a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java +++ b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java @@ -442,7 +442,7 @@ private TableView createTable(final ObservableList r sevcol.setCellFactory(c -> new SeverityLevelCell()); cols.add(sevcol); - col = new TableColumn<>("Alarm Status"); + col = new TableColumn<>("Alarm Message"); col.setPrefWidth(130); col.setReorderable(false); col.setCellValueFactory(cell -> cell.getValue().status); @@ -470,7 +470,7 @@ private TableView createTable(final ObservableList r sevcol.setCellFactory(c -> new SeverityLevelCell()); cols.add(sevcol); - col = new TableColumn<>("PV Status"); + col = new TableColumn<>("PV Message"); col.setPrefWidth(130); col.setReorderable(false); col.setCellValueFactory(cell -> cell.getValue().pv_status); From 3266efe995a2c02ec956c12cce72b02a0db15b2a Mon Sep 17 00:00:00 2001 From: Sangil Lee Date: Thu, 23 Jan 2025 13:30:05 +0900 Subject: [PATCH 3/4] AlarmLogTable query variables fixed for consistence naming --- .../logging/ui/AlarmLogTableController.java | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java b/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java index b8dfbf8297..1bddc5368d 100644 --- a/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java +++ b/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java @@ -148,6 +148,33 @@ public AlarmLogTableController(HttpClient client) { setClient(client); } + private final String replaceKey(final String source) { + String result = source; + if(source == Keys.SEVERITY.getName()) + result = "alarm_severity"; + else if(source == Keys.MESSAGE.getName()) + result = "alarm_message"; + else if(source == Keys.CURRENTSEVERITY.getName()) + result = "pv_severity"; + else if(source == Keys.CURRENTMESSAGE.getName()) + result = "pv_message"; + + return result; + } + + private String recoverKey(String source) { + if(source.contains("alarm_severity")) + source = "severity"; + else if(source.contains("alarm_message")) + source = "message"; + else if(source.contains("pv_severity")) + source = "current_severity"; + else if(source.contains("pv_message")) + source = "current_message"; + + return source; + } + @FXML public void initialize() { resize.setText("<"); @@ -294,7 +321,7 @@ protected void updateItem(String item, boolean empty) { searchParameters.entrySet().stream() .filter(e -> !e.getKey().getName().equals(Keys.ROOT.getName())) // Exclude alarm config (root) as selection is managed in drop-down .sorted(Map.Entry.comparingByKey()) - .map((e) -> e.getKey().getName().trim() + "=" + e.getValue().trim()) + .map((e) -> replaceKey(e.getKey().getName().trim()) + "=" + e.getValue().trim()) .collect(Collectors.joining("&"))); searchParameters.addListener( @@ -303,7 +330,7 @@ protected void updateItem(String item, boolean empty) { .sorted(Entry.comparingByKey()) .filter(e -> !e.getKey().getName().equals(Keys.ROOT.getName())) // Exclude alarm config (root) as selection is managed in drop-down .filter(e -> !e.getValue().equals("")) - .map((e) -> e.getKey().getName().trim() + "=" + e.getValue().trim()) + .map((e) -> replaceKey(e.getKey().getName().trim()) + "=" + e.getValue().trim()) .collect(Collectors.joining("&")))); query.setOnKeyPressed(keyEvent -> { @@ -398,7 +425,7 @@ public void setIsNodeTable(Boolean isNodeTable) { searchParameters.put(Keys.STARTTIME, TimeParser.format(java.time.Duration.ofDays(7))); searchParameters.put(Keys.ENDTIME, TimeParser.format(java.time.Duration.ZERO)); - query.setText(searchParameters.entrySet().stream().sorted(Map.Entry.comparingByKey()).map((e) -> e.getKey().getName().trim() + "=" + e.getValue().trim()).collect(Collectors.joining("&"))); + query.setText(searchParameters.entrySet().stream().sorted(Map.Entry.comparingByKey()).map((e) -> replaceKey(e.getKey().getName().trim()) + "=" + e.getValue().trim()).collect(Collectors.joining("&"))); } public void setAlarmMessages(List alarmMessages) { @@ -488,7 +515,7 @@ void updateQuery() { searchTerms.forEach(s -> { String[] splitString = s.split("="); if (splitString.length > 1) { - String key = splitString[0]; + String key = recoverKey(splitString[0]); searchKeywords.add(key); String value = splitString[1]; if (lookup.containsKey(key)) { From 786b0deb2139534ad05e9bfc60d01933f785cc7e Mon Sep 17 00:00:00 2001 From: Sangil Lee Date: Thu, 23 Jan 2025 17:26:30 +0900 Subject: [PATCH 4/4] changed parameter name to key --- .../logging/ui/AlarmLogTableController.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java b/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java index 1bddc5368d..c47725de21 100644 --- a/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java +++ b/app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTableController.java @@ -148,31 +148,31 @@ public AlarmLogTableController(HttpClient client) { setClient(client); } - private final String replaceKey(final String source) { - String result = source; - if(source == Keys.SEVERITY.getName()) - result = "alarm_severity"; - else if(source == Keys.MESSAGE.getName()) - result = "alarm_message"; - else if(source == Keys.CURRENTSEVERITY.getName()) - result = "pv_severity"; - else if(source == Keys.CURRENTMESSAGE.getName()) - result = "pv_message"; - - return result; + private final String replaceKey(final String key) { + String repKey = key; + if(key == Keys.SEVERITY.getName()) + repKey = "alarm_severity"; + else if(key == Keys.MESSAGE.getName()) + repKey = "alarm_message"; + else if(key == Keys.CURRENTSEVERITY.getName()) + repKey = "pv_severity"; + else if(key == Keys.CURRENTMESSAGE.getName()) + repKey = "pv_message"; + + return repKey; } - private String recoverKey(String source) { - if(source.contains("alarm_severity")) - source = "severity"; - else if(source.contains("alarm_message")) - source = "message"; - else if(source.contains("pv_severity")) - source = "current_severity"; - else if(source.contains("pv_message")) - source = "current_message"; - - return source; + private String recoverKey(String key) { + if(key.contains("alarm_severity")) + key = "severity"; + else if(key.contains("alarm_message")) + key = "message"; + else if(key.contains("pv_severity")) + key = "current_severity"; + else if(key.contains("pv_message")) + key = "current_message"; + + return key; } @FXML