Skip to content

Commit

Permalink
Disable context menu options for Nodes with Mirror/Aviso attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Jun 5, 2024
1 parent 120d7a7 commit f36b64e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 8 additions & 4 deletions Viewer/ecflowUI/src/NodeExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ bool NodeExpressionParser::isEnvVar(const std::string& str) const {
}

bool NodeExpressionParser::isNodeHasAttribute(const std::string& str) const {
if (str == "has_triggers" || str == "has_time" || str == "has_date" || str == "locked")
return true;

return false;
constexpr std::array searchable = {"has_triggers", "has_time", "has_date", "locked", "has_aviso", "has_mirror"};
return std::find(searchable.begin(), searchable.end(), str) != searchable.end();
}

bool NodeExpressionParser::isNodeFlag(const std::string& str) const {
Expand Down Expand Up @@ -819,6 +817,12 @@ bool NodeAttributeCondition::execute(VItem* item) {
else if (nodeAttrName_ == "has_triggers") {
return (node->triggerAst() || node->completeAst());
}
else if (nodeAttrName_ == "has_aviso") {
return !node->avisos().empty();
}
else if (nodeAttrName_ == "has_mirror") {
return !node->mirrors().empty();
}
}

return false;
Expand Down
16 changes: 8 additions & 8 deletions share/ecflow/etc/ecflowview_menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
{
"menu" : "Node",
"name" : "Suspend",
"visible_for" : "not suspended and node",
"visible_for" : "not suspended and node and (not has_mirror)",
"command" : "ecflow_client --suspend <full_name>",
"status_tip" : "__cmd__",
"shortcut" : "Ctrl+S"
Expand All @@ -110,7 +110,7 @@
{
"menu" : "Node",
"name" : "Resume",
"visible_for" : "suspended and node",
"visible_for" : "suspended and node and (not has_mirror)",
"command" : "ecflow_client --resume <full_name>",
"status_tip" : "__cmd__",
"shortcut" : "Ctrl+R"
Expand All @@ -120,7 +120,7 @@
"menu" : "Node",
"name" : "Rerun",
"visible_for" : "task",
"enabled_for" : "(not active) and (not submitted)",
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
"command" : "ecflow_client --force queued <full_name>",
"status_tip" : "__cmd__",
"shortcut" : "Ctrl+U"
Expand All @@ -130,7 +130,7 @@
"menu" : "Node",
"name" : "Set complete",
"visible_for" : "task or alias",
"enabled_for" : "submitted or active or unknown or queued or aborted or suspended",
"enabled_for" : "(submitted or active or unknown or queued or aborted or suspended) and (not has_mirror)",
"command" : "ecflow_client --force=complete <full_name>",
"question_for" : "submitted or active",
"question" : "Have you checked that the job is not active anymore (jobstatus)?",
Expand All @@ -143,7 +143,7 @@
"menu" : "Node",
"name" : "Set aborted",
"visible_for" : "task or alias",
"enabled_for" : "submitted or active or unknown or queued or complete or suspended",
"enabled_for" : "(submitted or active or unknown or queued or complete or suspended) and (not has_mirror)",
"command" : "ecflow_client --force=aborted <full_name>",
"question_for" : "submitted or active",
"question" : "Have you checked that the job is not active anymore (jobstatus)?",
Expand All @@ -156,7 +156,7 @@
"menu" : "Node",
"name" : "Execute",
"visible_for" : "task or alias",
"enabled_for" : "(not active) and (not submitted)",
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
"command" : "ecflow_client --run <full_name>",
"status_tip" : "__cmd__",
"shortcut" : "Ctrl+E"
Expand All @@ -166,7 +166,7 @@
"menu" : "Node",
"name" : "Requeue",
"visible_for" : "task or suite or family",
"enabled_for" : "(not active) and (not submitted)",
"enabled_for" : "(not active) and (not submitted) and (not has_mirror)",
"command" : "ecflow_client --requeue=force <full_name>",
"warning" : "This command can potentially lead to creating zombies when active nodes are present in the current subtree.",
"question" : "Confirm requeuing of <full_name>",
Expand All @@ -179,7 +179,7 @@
"menu" : "Node",
"name" : "Requeue aborted",
"visible_for" : "suite or family",
"enabled_for" : "aborted or suspended",
"enabled_for" : "aborted or suspended and (not has_mirror)",
"command" : "ecflow_client --requeue=abort <full_name>",
"question" : "Confirm requeuing of aborted tasks from <full_name>",
"question_control" : "menu.confirm.confirmRequeueAborted",
Expand Down

0 comments on commit f36b64e

Please sign in to comment.