Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent Alarm naming convention between Alarm Table and Alarm Log Table #3242

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,33 @@ public AlarmLogTableController(HttpClient client) {
setClient(client);
}

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 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
public void initialize() {
resize.setText("<");
Expand Down Expand Up @@ -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(
Expand All @@ -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 -> {
Expand Down Expand Up @@ -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<AlarmLogTableItem> alarmMessages) {
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
#

Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
max_block_ms=10000
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private TableView<AlarmInfoRow> createTable(final ObservableList<AlarmInfoRow> 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);
Expand Down Expand Up @@ -470,7 +470,7 @@ private TableView<AlarmInfoRow> createTable(final ObservableList<AlarmInfoRow> 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);
Expand Down
Loading