FIX: Remove empty bracketed strings in hover menu#454
Conversation
OverviewThis changes the dynamic-macro substitution so that any // before (master)
return Object.prototype.hasOwnProperty.call(oMacros, name) ? oMacros[name] : match;
// after (this PR)
return Object.prototype.hasOwnProperty.call(oMacros, name) ? oMacros[name] : "";The real problem it targets: optional state macros like Critical issue: this reintroduces a bug that was just fixed 🔴The changed line is the exact one added by commit
The comment immediately above the changed line still says "Keep the original Recommended approachBoth requirements are satisfiable at once — the two cases only look the same. The distinction is: known NagVis macro that is currently unset (drop it) vs. arbitrary bracketed text in data (keep it). Pre-seed every optional macro with a default of // defaults so unset optional macros collapse to "" instead of showing "[obj_...]"
const oMacros = {
obj_summary_acknowledged: "", obj_acknowledged: "",
obj_summary_in_downtime: "", obj_in_downtime: "",
obj_summary_stale: "", obj_stale: "",
};…then keep the Other notes
VerdictRequest changes. The intent is valid (unset optional macros shouldn't leak |
loocars
left a comment
There was a problem hiding this comment.
const oMacros = {
obj_summary_acknowledged: "", obj_acknowledged: "",
obj_summary_in_downtime: "", obj_in_downtime: "",
obj_summary_stale: "", obj_stale: "",
};
Fixes the empty bracket variables in hover menu:

To this:

It still shows downtimes etc.