Skip to content

Commit 652e41b

Browse files
committed
Disable context menu options for Nodes with Mirror/Aviso attributes
Re ECFLOW-1931
1 parent b367447 commit 652e41b

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Viewer/ecflowUI/src/NodeExpression.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ bool NodeExpressionParser::isEnvVar(const std::string& str) const {
110110
}
111111

112112
bool NodeExpressionParser::isNodeHasAttribute(const std::string& str) const {
113-
if (str == "has_triggers" || str == "has_time" || str == "has_date" || str == "locked")
114-
return true;
115-
116-
return false;
113+
constexpr std::array searchable = {"has_triggers", "has_time", "has_date", "locked", "has_aviso", "has_mirror"};
114+
return std::find(searchable.begin(), searchable.end(), str) != searchable.end();
117115
}
118116

119117
bool NodeExpressionParser::isNodeFlag(const std::string& str) const {
@@ -819,6 +817,12 @@ bool NodeAttributeCondition::execute(VItem* item) {
819817
else if (nodeAttrName_ == "has_triggers") {
820818
return (node->triggerAst() || node->completeAst());
821819
}
820+
else if (nodeAttrName_ == "has_aviso") {
821+
return !node->avisos().empty();
822+
}
823+
else if (nodeAttrName_ == "has_mirror") {
824+
return !node->mirrors().empty();
825+
}
822826
}
823827

824828
return false;

share/ecflow/etc/ecflowview_menus.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
{
102102
"menu" : "Node",
103103
"name" : "Suspend",
104-
"visible_for" : "not suspended and node",
104+
"visible_for" : "not suspended and node and (not has_mirror)",
105105
"command" : "ecflow_client --suspend <full_name>",
106106
"status_tip" : "__cmd__",
107107
"shortcut" : "Ctrl+S"
@@ -110,7 +110,7 @@
110110
{
111111
"menu" : "Node",
112112
"name" : "Resume",
113-
"visible_for" : "suspended and node",
113+
"visible_for" : "suspended and node and (not has_mirror)",
114114
"command" : "ecflow_client --resume <full_name>",
115115
"status_tip" : "__cmd__",
116116
"shortcut" : "Ctrl+R"
@@ -120,7 +120,7 @@
120120
"menu" : "Node",
121121
"name" : "Rerun",
122122
"visible_for" : "task",
123-
"enabled_for" : "(not active) and (not submitted)",
123+
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
124124
"command" : "ecflow_client --force queued <full_name>",
125125
"status_tip" : "__cmd__",
126126
"shortcut" : "Ctrl+U"
@@ -130,7 +130,7 @@
130130
"menu" : "Node",
131131
"name" : "Set complete",
132132
"visible_for" : "task or alias",
133-
"enabled_for" : "submitted or active or unknown or queued or aborted or suspended",
133+
"enabled_for" : "(submitted or active or unknown or queued or aborted or suspended) and (not has_mirror)",
134134
"command" : "ecflow_client --force=complete <full_name>",
135135
"question_for" : "submitted or active",
136136
"question" : "Have you checked that the job is not active anymore (jobstatus)?",
@@ -143,7 +143,7 @@
143143
"menu" : "Node",
144144
"name" : "Set aborted",
145145
"visible_for" : "task or alias",
146-
"enabled_for" : "submitted or active or unknown or queued or complete or suspended",
146+
"enabled_for" : "(submitted or active or unknown or queued or complete or suspended) and (not has_mirror)",
147147
"command" : "ecflow_client --force=aborted <full_name>",
148148
"question_for" : "submitted or active",
149149
"question" : "Have you checked that the job is not active anymore (jobstatus)?",
@@ -156,7 +156,7 @@
156156
"menu" : "Node",
157157
"name" : "Execute",
158158
"visible_for" : "task or alias",
159-
"enabled_for" : "(not active) and (not submitted)",
159+
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
160160
"command" : "ecflow_client --run <full_name>",
161161
"status_tip" : "__cmd__",
162162
"shortcut" : "Ctrl+E"
@@ -166,7 +166,7 @@
166166
"menu" : "Node",
167167
"name" : "Requeue",
168168
"visible_for" : "task or suite or family",
169-
"enabled_for" : "(not active) and (not submitted)",
169+
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
170170
"command" : "ecflow_client --requeue=force <full_name>",
171171
"warning" : "This command can potentially lead to creating zombies when active nodes are present in the current subtree.",
172172
"question" : "Confirm requeuing of <full_name>",
@@ -179,7 +179,7 @@
179179
"menu" : "Node",
180180
"name" : "Requeue aborted",
181181
"visible_for" : "suite or family",
182-
"enabled_for" : "aborted or suspended",
182+
"enabled_for" : "aborted or suspended and (not has_mirror)",
183183
"command" : "ecflow_client --requeue=abort <full_name>",
184184
"question" : "Confirm requeuing of aborted tasks from <full_name>",
185185
"question_control" : "menu.confirm.confirmRequeueAborted",

0 commit comments

Comments
 (0)