diff --git a/saltgui/static/scripts/Character.js b/saltgui/static/scripts/Character.js
index d5d9005fe..b7ef58677 100644
--- a/saltgui/static/scripts/Character.js
+++ b/saltgui/static/scripts/Character.js
@@ -26,6 +26,7 @@ export class Character {
Character.BLACK_RIGHT_POINTING_POINTER = "\u25BA";
Character.WHITE_DOWN_POINTING_TRIANGLE = "\u25BD";
Character.BLACK_DIAMOND = "\u25C6";
+ Character.WHITE_CIRCLE = "\u25CB";
Character.BLACK_CIRCLE = "\u25CF";
Character.BALLOT_BOX_UNCHECKED = "\u2610";
Character.BALLOT_BOX_WITH_CHECK = "\u2611";
diff --git a/saltgui/static/scripts/CommandBox.js b/saltgui/static/scripts/CommandBox.js
index f4ec759fc..4764ef295 100644
--- a/saltgui/static/scripts/CommandBox.js
+++ b/saltgui/static/scripts/CommandBox.js
@@ -2,7 +2,7 @@
import {Character} from "./Character.js";
import {Documentation} from "./Documentation.js";
-import {DropDownMenu} from "./DropDown.js";
+import {DropDownMenuCmd} from "./DropDownCmd.js";
import {Output} from "./output/Output.js";
import {ParseCommandLine} from "./ParseCommandLine.js";
import {Router} from "./Router.js";
@@ -18,14 +18,15 @@ export class CommandBox {
this.api = pApi;
const cmdbox = document.getElementById("cmd-box");
- this.cmdmenu = new DropDownMenu(cmdbox);
+ this.cmdmenu = new DropDownMenuCmd(cmdbox);
- this.documentation = new Documentation(this.router, this);
this._registerCommandBoxEventListeners();
RunType.createMenu();
TargetType.createMenu();
+ this.documentation = new Documentation(pRouter, this);
+
const manualRun = document.getElementById("popup-run-command");
Utils.addTableHelp(manualRun, "Click for help", "bottom-center");
const helpButton = manualRun.querySelector("#help");
@@ -58,7 +59,7 @@ export class CommandBox {
CommandBox.templateCatMenu.setTitle("");
return;
}
- const menu = new DropDownMenu(titleElement);
+ const menu = new DropDownMenuCmd(titleElement);
menu.setTitle("");
menu.menuButton.classList.add("small-button-left");
CommandBox.templateCatMenu = menu;
@@ -70,7 +71,7 @@ export class CommandBox {
}
categories.unshift(null);
for (const category of categories) {
- menu.addMenuItem(
+ menu.addMenuItemCmd(
() => CommandBox._templateCatMenuItemTitle(category),
() => {
CommandBox.templateTmplMenu._templateCategory = category;
@@ -120,7 +121,7 @@ export class CommandBox {
CommandBox.templateTmplMenu._templateCategory = null;
return;
}
- const menu = new DropDownMenu(titleElement);
+ const menu = new DropDownMenuCmd(titleElement);
menu.menuButton.classList.add("small-button-left");
CommandBox.templateTmplMenu = menu;
CommandBox.templateTmplMenu._templateCategory = null;
@@ -132,7 +133,7 @@ export class CommandBox {
if (!description) {
description = "(" + key + ")";
}
- menu.addMenuItem(
+ menu.addMenuItemCmd(
() => CommandBox._templateTmplMenuItemTitle(template),
() => {
CommandBox._applyTemplateByTemplate(template);
@@ -267,7 +268,7 @@ export class CommandBox {
TargetType.setTargetType(pTargetType);
} else {
// not in the template, revert to default
- TargetType.setTargetTypeDefault();
+ TargetType.setTargetType(null);
}
if (pTarget) {
@@ -356,7 +357,7 @@ export class CommandBox {
const commandField = document.getElementById("command");
const commandValue = commandField.value;
- const targetType = TargetType.menuTargetType._value;
+ const targetType = TargetType.menuTargetType.getValue();
const patWhitespaceAll = /\s/g;
const commandValueNoTabs = commandValue.replace(patWhitespaceAll, " ");
@@ -650,7 +651,7 @@ export class CommandBox {
// reset to default, so that its value is initially hidden
RunType.setRunTypeDefault();
- TargetType.setTargetTypeDefault();
+ TargetType.setTargetType(null);
if (Router.currentPage) {
Router.currentPage.refreshPage();
diff --git a/saltgui/static/scripts/Documentation.js b/saltgui/static/scripts/Documentation.js
index d9a6ea32f..aae300ad2 100644
--- a/saltgui/static/scripts/Documentation.js
+++ b/saltgui/static/scripts/Documentation.js
@@ -17,23 +17,23 @@ export class Documentation {
this.router = pRouter;
this.commandbox = pCommandBox;
- pCommandBox.cmdmenu.addMenuItem(
+ Documentation.DOCUMENTATION_URL = "https://docs.saltproject.io/en/latest/ref/";
+ Documentation.EXTERNAL_LINK = Character.NO_BREAK_SPACE + "" + Character.HEAVY_NORTH_EAST_ARROW + "";
+
+ Documentation.PROVIDERS = { };
+
+ pCommandBox.cmdmenu.addMenuItemCmd(
() => Documentation._manualRunMenuSysDocPrepare(),
() => this._manualRunMenuSysDocRun());
- pCommandBox.cmdmenu.addMenuItem(
+ pCommandBox.cmdmenu.addMenuItemCmd(
() => Documentation._manualRunMenuHtmlDocPrepare(),
() => Documentation._manualRunMenuHtmlDocRun());
- pCommandBox.cmdmenu.addMenuItem(
+ pCommandBox.cmdmenu.addMenuItemCmd(
() => Documentation._manualRunMenuBeaconNamePrepare(),
() => Documentation._manualRunMenuBeaconNameRun());
- pCommandBox.cmdmenu.addMenuItem(
+ pCommandBox.cmdmenu.addMenuItemCmd(
() => Documentation._manualRunMenuCustomHelpPrepare(),
() => Documentation._manualRunMenuCustomHelpRun());
-
- Documentation.DOCUMENTATION_URL = "https://docs.saltproject.io/en/latest/ref/";
- Documentation.EXTERNAL_LINK = Character.NO_BREAK_SPACE + "" + Character.HEAVY_NORTH_EAST_ARROW + "";
-
- Documentation.PROVIDERS = { };
}
// INTERNAL DOCUMENTATION
@@ -120,7 +120,7 @@ export class Documentation {
dummyCommand = "sys.doc " + cmd;
}
- const targetType = TargetType.menuTargetType._value;
+ const targetType = TargetType.menuTargetType.getValue();
const func = this.commandbox.getRunParams(targetType, target, docCommand, true, false);
if (func === null) {
diff --git a/saltgui/static/scripts/DropDown.js b/saltgui/static/scripts/DropDown.js
index 01dd379ec..7211ab71a 100644
--- a/saltgui/static/scripts/DropDown.js
+++ b/saltgui/static/scripts/DropDown.js
@@ -10,7 +10,7 @@ import {Utils} from "./Utils.js";
// a) sets the title using pMenuItem.innerText = "xyz"
// b) arranges the visibility using pMenuItem.style.display = true/false
// 2: the callback function
-// called when the menu item is selected: (pClickEvent) => { ... }
+// called when the menu item is selected: () => { ... }
// all menu items are re-validated when the menu pops up
// when all menu items are invisible, the menu-button must be made invisible
// since this can happen at any time, this cannot be done when the menu is shown
@@ -20,6 +20,8 @@ import {Utils} from "./Utils.js";
// the menu. when at least one item is visible, the menu is visible
// remember to call verifyApp() when that is potentially the case
+// superclass for DropDownMenuRadio, DropDownMenuCheckBox and DropDownMenuCmd
+
export class DropDownMenu {
// Creates an empty dropdown menu
@@ -81,7 +83,19 @@ export class DropDownMenu {
// Phase 1: handle regular menu items
let visibleCount = 0;
for (const chld of this.menuDropdownContent.children) {
- if (!chld.isSeparator && DropDownMenu._verifyMenuItem(chld)) {
+ if (chld.isSeparator) {
+ continue;
+ }
+ const titleCallBack = chld._titleCallBack;
+ if (titleCallBack) {
+ const title = titleCallBack(chld);
+ if (!title) {
+ chld.style.display = "none";
+ continue;
+ }
+ chld.innerText = DropDownMenu._sanitizeMenuItemTitle(title);
+ }
+ if (DropDownMenu._verifyMenuItem(chld)) {
visibleCount += 1;
}
}
@@ -106,7 +120,6 @@ export class DropDownMenu {
visibleItemsSinceLastShownSeparator += 1;
}
}
-
// hide the menu when it has no visible menu-items
const displayVisible = this.menuDropdown.tagName === "TD" ? "table-cell" : "inline-block";
this.menuDropdown.style.display = visibleCount > 0 ? displayVisible : "none";
@@ -153,25 +166,49 @@ export class DropDownMenu {
// function is called each time the menu opens
// This allows dynamic menuitem titles (use menuitem.innerText)
// or visibility (use menuitem.style.display = "none"/"inline-block")
- addMenuItem (pTitle, pCallBack, pValue) {
+ addMenuItem (pValue, pTitle, pSystemCallBack, pUserCallBack) {
+
const button = Utils.createDiv("run-command-button", Character.HORIZONTAL_ELLIPSIS);
- if (pValue) {
- button._value = pValue;
- }
+
+ button._value = pValue;
+
if (typeof pTitle === "string") {
button.innerText = DropDownMenu._sanitizeMenuItemTitle(pTitle);
} else {
- button.verifyCallBack = pTitle;
+ button._titleCallBack = pTitle;
}
+
button.addEventListener("click", (pClickEvent) => {
+
+ // hide the menu
pClickEvent.target.parentElement.style.display = "none";
+
+ // "show" the menu again after a short delay
+ // but because the mouse is no longer hovering it,
+ // it will actually remain invisible
window.setTimeout(() => {
pClickEvent.target.parentElement.style.display = "";
}, 500);
- this._callback(pClickEvent, pCallBack, pValue);
+
+ this._value = pValue;
+
+ if (pSystemCallBack) {
+ pSystemCallBack(pClickEvent.target);
+ }
+
+ if (pUserCallBack) {
+ pUserCallBack(pClickEvent);
+ }
+
+ // all menu items may have become invisible
+ this.verifyAll();
+
pClickEvent.stopPropagation();
});
+
this.menuDropdownContent.appendChild(button);
+
+ // the menu might have become populated enough to get visible
this.verifyAll();
return button;
}
@@ -185,11 +222,6 @@ export class DropDownMenu {
this.menuDropdownContent.appendChild(div);
}
- _callback (pClickEvent, pCallBack, pValue) {
- this._value = pValue;
- pCallBack(pClickEvent);
- }
-
setTitle (pTitle) {
// Setting the title implies that we are interested
// in the menu values, rather than their actions.
diff --git a/saltgui/static/scripts/DropDownCheckBox.js b/saltgui/static/scripts/DropDownCheckBox.js
new file mode 100644
index 000000000..f3b356f7b
--- /dev/null
+++ b/saltgui/static/scripts/DropDownCheckBox.js
@@ -0,0 +1,38 @@
+/* global */
+
+import {Character} from "./Character.js";
+import {DropDownMenu} from "./DropDown.js";
+
+export class DropDownMenuCheckBox extends DropDownMenu {
+
+ static _menuItemTitleCallBack (pMenuItem) {
+ let prefix = "";
+ if (pMenuItem._selected === true) {
+ prefix = Character.HEAVY_CHECK_MARK + Character.NO_BREAK_SPACE;
+ }
+ return prefix + pMenuItem._title;
+ }
+
+ static _menuItemActionCallBack (pMenuItem) {
+ pMenuItem._selected = !pMenuItem._selected;
+ }
+
+ addMenuItemCheckBox (pValue, pTitle, pUserCallBack) {
+ const menuItem = super.addMenuItem(
+ pValue,
+ (pMenuItem) => DropDownMenuCheckBox._menuItemTitleCallBack(pMenuItem),
+ (pMenuItem) => DropDownMenuCheckBox._menuItemActionCallBack(pMenuItem),
+ pUserCallBack);
+ menuItem._title = pTitle;
+ return menuItem;
+ }
+
+ isSet (pValue) {
+ for (const menuItem of this.menuDropdownContent.childNodes) {
+ if (menuItem._selected === true && menuItem._value === pValue) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/saltgui/static/scripts/DropDownCmd.js b/saltgui/static/scripts/DropDownCmd.js
new file mode 100644
index 000000000..633d061cd
--- /dev/null
+++ b/saltgui/static/scripts/DropDownCmd.js
@@ -0,0 +1,15 @@
+/* global */
+
+import {DropDownMenu} from "./DropDown.js";
+
+export class DropDownMenuCmd extends DropDownMenu {
+
+ addMenuItemCmd (pTitle, pUserCallBack) {
+ return super.addMenuItem(
+ null,
+ pTitle,
+ null,
+ pUserCallBack
+ );
+ }
+}
diff --git a/saltgui/static/scripts/DropDownRadio.js b/saltgui/static/scripts/DropDownRadio.js
new file mode 100644
index 000000000..5e544214e
--- /dev/null
+++ b/saltgui/static/scripts/DropDownRadio.js
@@ -0,0 +1,67 @@
+/* global */
+
+import {Character} from "./Character.js";
+import {DropDownMenu} from "./DropDown.js";
+
+export class DropDownMenuRadio extends DropDownMenu {
+ constructor (pParentElement) {
+ super(pParentElement);
+ this._value = null;
+ this._defaultValue = null;
+ }
+
+ getValue () {
+ if (this._value === null) {
+ return this._defaultValue;
+ }
+ return this._value;
+ }
+
+ setValue (pValue) {
+ this._value = pValue;
+ }
+
+ setDefaultValue (pDefaultValue) {
+ this._defaultValue = pDefaultValue;
+ }
+
+ _menuItemTitleCallBack (pMenuItem) {
+ let title;
+ if (!pMenuItem._title) {
+ title = "...";
+ } else if (typeof pMenuItem._title === "string") {
+ title = pMenuItem._title;
+ } else {
+ title = pMenuItem._title.bind(this)(pMenuItem);
+ }
+
+ if (title === null) {
+ // menu item will be hidden
+ } else if (pMenuItem._value === this._value) {
+ title = Character.BLACK_CIRCLE + Character.NO_BREAK_SPACE + title;
+ } else if (this._value === null && pMenuItem._value === this._defaultValue) {
+ title = Character.WHITE_CIRCLE + Character.NO_BREAK_SPACE + title;
+ }
+ return title;
+ }
+
+ _menuItemActionCallBack (pMenuItem) {
+ this._value = pMenuItem._value;
+ let menuTitle = pMenuItem._title;
+ if (menuTitle && typeof menuTitle !== "string") {
+ menuTitle = menuTitle.bind(this)(pMenuItem);
+ }
+ this.setTitle(menuTitle);
+ }
+
+ addMenuItemRadio (pValue, pTitle, pUserCallBack) {
+ const menuItem = super.addMenuItem(
+ pValue,
+ (pMenuItem) => this._menuItemTitleCallBack(pMenuItem),
+ (pMenuItem) => this._menuItemActionCallBack(pMenuItem),
+ pUserCallBack);
+ menuItem._value = pValue;
+ menuItem._title = pTitle;
+ return menuItem;
+ }
+}
diff --git a/saltgui/static/scripts/RunType.js b/saltgui/static/scripts/RunType.js
index d9fe5f23d..2fad30722 100644
--- a/saltgui/static/scripts/RunType.js
+++ b/saltgui/static/scripts/RunType.js
@@ -1,65 +1,36 @@
/* global document */
-import {Character} from "./Character.js";
-import {DropDownMenu} from "./DropDown.js";
+import {DropDownMenuRadio} from "./DropDownRadio.js";
import {Utils} from "./Utils.js";
export class RunType {
static createMenu () {
const runblock = document.getElementById("run-block");
- RunType.menuRunType = new DropDownMenu(runblock);
+ RunType.menuRunType = new DropDownMenuRadio(runblock);
// do not show the menu title at first
RunType.menuRunType.setTitle("");
- RunType.menuRunType.addMenuItem("Normal", RunType._updateRunTypeText, "normal");
- RunType.menuRunType.addMenuItem("Async", RunType._updateRunTypeText, "async");
- RunType._updateRunTypeText();
- }
-
- static _updateRunTypeText () {
- const runType = RunType.getRunType();
-
- switch (runType) {
- case "normal":
- // now that the menu is used show the menu title
- RunType.menuRunType.setTitle("Normal");
- break;
- case "async":
- RunType.menuRunType.setTitle("Async");
- break;
- default:
- Utils.error("runType", runType);
- }
-
- // Store last used runType
- Utils.setStorageItem("local", "runtype", runType);
-
- const menuItems = RunType.menuRunType.menuDropdownContent.children;
- for (const menuItem of menuItems) {
- let menuItemText = menuItem.innerText;
- menuItemText = menuItemText.replace(/^. /, "");
- if (menuItem._value === runType) {
- menuItemText = Character.BLACK_CIRCLE + " " + menuItemText;
- }
- menuItem.innerText = menuItemText;
- }
+ RunType.menuRunType.setDefaultValue("normal");
+ RunType.menuRunType.addMenuItemRadio("normal", "Normal");
+ RunType.menuRunType.addMenuItemRadio("async", "Async");
}
static setRunTypeDefault () {
+ RunType.menuRunType.setValue(null);
// Retrieve last used runType
let runType = Utils.getStorageItem("local", "runtype");
// Set default if previous runtype not stored
if (runType !== "normal" && runType !== "async") {
Utils.setStorageItem("local", "runtype", "normal");
}
- RunType._updateRunTypeText();
+ RunType.menuRunType.setDefaultValue(runType);
// reset the title to the absolute minimum
// so that the menu does not stand out in trivial situations
RunType.menuRunType.setTitle("");
}
static getRunType () {
- let runType = RunType.menuRunType._value;
+ let runType = RunType.menuRunType.getValue();
if (runType === undefined || runType === "") {
runType = Utils.getStorageItem("local", "runtype", "normal");
}
diff --git a/saltgui/static/scripts/Search.js b/saltgui/static/scripts/Search.js
new file mode 100644
index 000000000..46854749f
--- /dev/null
+++ b/saltgui/static/scripts/Search.js
@@ -0,0 +1,80 @@
+/* global document */
+
+import {Character} from "./Character.js";
+import {DropDownMenuCheckBox} from "./DropDownCheckBox.js";
+import {Utils} from "./Utils.js";
+
+export class Search {
+
+ static makeSearchBox (pSearchButton, pTable, pFieldList = null) {
+
+ const div = Utils.createDiv("search-box", "");
+ div.style.display = "none";
+
+ const menuAndFieldDiv = Utils.createDiv("search-menu-and-field", "");
+
+ const searchOptionsMenu = new DropDownMenuCheckBox(menuAndFieldDiv, "smaller");
+
+ const input = document.createElement("input");
+ input.type = "text";
+ input.classList.add("filter-text");
+ input.placeholder = Character.LEFT_POINTING_MAGNIFYING_GLASS;
+ if (pFieldList) {
+ input.setAttribute("list", pFieldList);
+ }
+ menuAndFieldDiv.append(input);
+
+ div.append(menuAndFieldDiv);
+
+ const errorDiv = Utils.createDiv("search-error", "");
+ errorDiv.style.display = "none";
+ div.append(errorDiv);
+
+ searchOptionsMenu.addMenuItemCheckBox(
+ "cs",
+ "Case sensitive",
+ () => {
+ Search._updateSearchOption(pTable, searchOptionsMenu, input);
+ });
+ searchOptionsMenu.addMenuItemCheckBox(
+ "re",
+ "Regular expression",
+ () => {
+ Search._updateSearchOption(pTable, searchOptionsMenu, input);
+ });
+ searchOptionsMenu.addMenuItemCheckBox(
+ "is",
+ "Invert search",
+ () => {
+ Search._updateSearchOption(pTable, searchOptionsMenu, input);
+ });
+
+ // make the search function active
+ pSearchButton.onclick = () => {
+ Utils.hideShowTableSearchBar(div, pTable);
+ };
+
+ div.searchOptionsMenu = searchOptionsMenu;
+
+ return div;
+ }
+
+ static _updateSearchOption (pTable, pSearchOptionsMenu, pInput) {
+ Utils._updateTableFilter(
+ pTable,
+ pInput.value,
+ pSearchOptionsMenu);
+
+ let placeholder = Character.LEFT_POINTING_MAGNIFYING_GLASS;
+ if (pSearchOptionsMenu.isSet("cs")) {
+ placeholder += " caseSensitive";
+ }
+ if (pSearchOptionsMenu.isSet("re")) {
+ placeholder += " regExp";
+ }
+ if (pSearchOptionsMenu.isSet("is")) {
+ placeholder += " invertSearch";
+ }
+ pInput.placeholder = placeholder;
+ }
+}
diff --git a/saltgui/static/scripts/TargetType.js b/saltgui/static/scripts/TargetType.js
index 7e2353772..78753a507 100644
--- a/saltgui/static/scripts/TargetType.js
+++ b/saltgui/static/scripts/TargetType.js
@@ -1,34 +1,32 @@
/* global document */
import {Character} from "./Character.js";
-import {DropDownMenu} from "./DropDown.js";
+import {DropDownMenuRadio} from "./DropDownRadio.js";
import {Utils} from "./Utils.js";
export class TargetType {
static createMenu () {
const targetbox = document.getElementById("target-box");
- TargetType.menuTargetType = new DropDownMenu(targetbox);
+ TargetType.menuTargetType = new DropDownMenuRadio(targetbox);
// do not show the menu title at first
- TargetType.menuTargetType.addMenuItem("Normal", TargetType._manualUpdateTargetTypeText, "glob");
- TargetType.menuTargetType.addMenuItem("List", TargetType._manualUpdateTargetTypeText, "list");
- TargetType.menuTargetType.addMenuItem(TargetType._targetTypeNodeGroupPrepare, TargetType._manualUpdateTargetTypeText, "nodegroup");
- TargetType.menuTargetType.addMenuItem("Compound", TargetType._manualUpdateTargetTypeText, "compound");
- TargetType.setTargetTypeDefault();
+ TargetType.menuTargetType.setTitle("");
+ TargetType.menuTargetType.setDefaultValue("glob");
+ TargetType.menuTargetType.addMenuItemRadio("glob", "Normal");
+ TargetType.menuTargetType.addMenuItemRadio("list", "List");
+ TargetType.menuTargetType.addMenuItemRadio("nodegroup", () => TargetType._targetTypeNodeGroupPrepare());
+ TargetType.menuTargetType.addMenuItemRadio("compound", "Compound");
+ TargetType.autoSelectTargetType("");
}
// It takes a while before we known the list of nodegroups
// so this conclusion must be re-evaluated each time
- static _targetTypeNodeGroupPrepare (pMenuItem) {
+ static _targetTypeNodeGroupPrepare () {
const nodeGroups = Utils.getStorageItemObject("session", "nodegroups");
if (!nodeGroups || Object.keys(nodeGroups).length === 0) {
return null;
}
- // optimization as the list of nodegroups will not change until the next login
- // but mainly to preserve the highlight marker
- pMenuItem.verifyCallBack = null;
-
return "Nodegroup";
}
@@ -85,6 +83,7 @@ export class TargetType {
}
menuItem.innerText = menuItemText;
}
+ return null;
}
static getTargetTypeFromTarget (pTarget) {
@@ -110,31 +109,36 @@ export class TargetType {
}
static autoSelectTargetType (pTarget) {
-
if (!TargetType.menuTargetType._system) {
// user has selected the value, do not touch it
return;
}
- const targetType = TargetType.getTargetTypeFromTarget (pTarget);
- TargetType.menuTargetType._value = targetType;
-
- // show the new title
- TargetType._updateTargetTypeText();
+ if (Array.isArray(pTarget)) {
+ TargetType.menuTargetType._value = "list";
+ } else if (pTarget.includes("@") || pTarget.includes(" ") ||
+ pTarget.includes("(") || pTarget.includes(")")) {
+ // "@" is a strong indicator for compound target
+ // but "space", "(" and ")" are also typical for compound target
+ TargetType.menuTargetType.setDefaultValue("compound");
+ } else if (pTarget.includes(",")) {
+ // "," is a strong indicator for list target (when it is also not compound)
+ TargetType.menuTargetType.setDefaultValue("list");
+ } else if (pTarget.startsWith("#")) {
+ // "#" at the start of a line is a strong indicator for nodegroup target
+ // this is not a SALTSTACK standard, but our own invention
+ TargetType.menuTargetType.setDefaultValue("nodegroup");
+ } else {
+ TargetType.menuTargetType.setDefaultValue("glob");
+ }
}
static setTargetType (pTargetType) {
- TargetType.menuTargetType._value = pTargetType;
- TargetType.menuTargetType._system = true;
- TargetType._updateTargetTypeText();
+ TargetType.menuTargetType.setValue(pTargetType);
}
static _getTargetType () {
- const targetType = TargetType.menuTargetType._value;
- if (targetType === undefined || targetType === "") {
- return "glob";
- }
- return targetType;
+ return TargetType.menuTargetType.getValue();
}
static makeTargetText (pObj) {
diff --git a/saltgui/static/scripts/Utils.js b/saltgui/static/scripts/Utils.js
index 418c64d53..60dd0aa2e 100644
--- a/saltgui/static/scripts/Utils.js
+++ b/saltgui/static/scripts/Utils.js
@@ -1,7 +1,6 @@
/* global console document Hilitor window */
import {Character} from "./Character.js";
-import {DropDownMenu} from "./DropDown.js";
export class Utils {
@@ -283,80 +282,6 @@ export class Utils {
return regs[0].length > 0 ? 1 : 2;
}
- static makeSearchBox (pSearchButton, pTable, pFieldList = null) {
-
- const div = Utils.createDiv("search-box", "");
- div.style.display = "none";
-
- const menuAndFieldDiv = Utils.createDiv("search-menu-and-field", "");
-
- const searchOptionsMenu = new DropDownMenu(menuAndFieldDiv, "smaller");
-
- const input = Utils.createElem("input", "filter-text");
- input.type = "text";
- input.spellcheck = false;
- input.placeholder = Character.LEFT_POINTING_MAGNIFYING_GLASS;
- if (pFieldList) {
- input.setAttribute("list", pFieldList);
- }
- menuAndFieldDiv.append(input);
-
- div.append(menuAndFieldDiv);
-
- const errorDiv = Utils.createDiv("search-error", "");
- errorDiv.style.display = "none";
- div.append(errorDiv);
-
- searchOptionsMenu.addMenuItem(
- "Case sensitive", (ev) => {
- Utils._updateSearchOption(ev, pTable, searchOptionsMenu, input);
- });
- searchOptionsMenu.addMenuItem(
- "Regular expression", (ev) => {
- Utils._updateSearchOption(ev, pTable, searchOptionsMenu, input);
- });
- searchOptionsMenu.addMenuItem(
- "Invert search", (ev) => {
- Utils._updateSearchOption(ev, pTable, searchOptionsMenu, input);
- });
-
- // make the search function active
- pSearchButton.addEventListener("click", (pClickEvent) => {
- Utils.hideShowTableSearchBar(div, pTable);
- pClickEvent.stopPropagation();
- });
-
- return div;
- }
-
- static _updateSearchOption (ev, pTable, pSearchOptionsMenu, pInput) {
- ev.target._value = !ev.target._value;
-
- let menuItemText = ev.target.innerText;
- menuItemText = menuItemText.replace(/^. /, "");
- if (ev.target._value === true) {
- menuItemText = Character.HEAVY_CHECK_MARK + " " + menuItemText;
- }
- ev.target.innerText = menuItemText;
-
- Utils._updateTableFilter(
- pTable,
- pInput.value,
- pSearchOptionsMenu.menuDropdownContent);
-
- let placeholder = Character.LEFT_POINTING_MAGNIFYING_GLASS;
- if (pSearchOptionsMenu.menuDropdownContent.childNodes[0]._value === true) {
- placeholder += " caseSensitive";
- }
- if (pSearchOptionsMenu.menuDropdownContent.childNodes[1]._value === true) {
- placeholder += " regExp";
- }
- if (pSearchOptionsMenu.menuDropdownContent.childNodes[2]._value === true) {
- placeholder += " invertSearch";
- }
- pInput.placeholder = placeholder;
- }
-
static addTableHelp (pStartElement, pHelpText, pStyle = "bottom-right") {
const helpButton = pStartElement.querySelector("#help");
helpButton.classList.add("search-button");
@@ -364,7 +289,6 @@ export class Utils {
}
static hideShowTableSearchBar (pSearchBlock, pTable, pAction = "toggle") {
- const startElement = pTable.parentElement;
// remove all highlights
const searchInSelector = pTable.tagName === "TABLE" ? "tbody" : "";
@@ -377,7 +301,7 @@ export class Utils {
fm.classList.remove("no-filter-match");
}
- const menuItems = startElement.querySelector(".search-box .menu-dropdown-content");
+ const menuItems = pSearchBlock.searchOptionsMenu;
// hide/show search box (the block may become more complicated later)
const input = pSearchBlock.querySelector("input");
@@ -410,14 +334,14 @@ export class Utils {
input.focus();
}
- static _updateTableFilter (pTable, pSearchText, pMenuItems) {
+ static _updateTableFilter (pTable, pSearchText, pSearchMenu) {
// remove highlighting before re-comparing
// as it affects the texts
const searchInSelector = pTable.tagName === "TABLE" ? "tbody" : "";
const hilitor = new Hilitor(pTable, searchInSelector);
hilitor.remove();
- const flags = Utils._extractSearchFlags(pMenuItems, pSearchText);
+ const flags = Utils._extractSearchFlags(pSearchMenu, pSearchText);
// find text
if (!flags.caseSensitiveFlag && !flags.regExpFlag) {
@@ -449,11 +373,11 @@ export class Utils {
hilitor.apply(pattern, flags.caseSensitiveFlag);
}
- static _extractSearchFlags (pMenuItems, pSearchText) {
+ static _extractSearchFlags (pSearchMenu, pSearchText) {
// values may be undefined, so convert to proper boolean
- const caseSensitiveFlag = pMenuItems.childNodes[0]._value === true;
- const regExpFlag = pMenuItems.childNodes[1]._value === true;
- let invertFlag = pMenuItems.childNodes[2]._value === true;
+ const caseSensitiveFlag = pSearchMenu.isSet("cs");
+ const regExpFlag = pSearchMenu.isSet("re");
+ let invertFlag = pSearchMenu.isSet("is");
// otherwise everything is immediatelly hidden
if (invertFlag && !pSearchText) {
diff --git a/saltgui/static/scripts/issues/Issues.js b/saltgui/static/scripts/issues/Issues.js
index e65542ecd..836786ed2 100644
--- a/saltgui/static/scripts/issues/Issues.js
+++ b/saltgui/static/scripts/issues/Issues.js
@@ -1,7 +1,7 @@
/* global window */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Utils} from "../Utils.js";
export class Issues {
@@ -121,7 +121,7 @@ export class Issues {
static _renderIssue (pPanel, pCatName, pIssueName, pIssueData) {
const theTr = Utils.createTr();
- const menu = new DropDownMenu(theTr, "smaller");
+ const menu = new DropDownMenuCmd(theTr, "smaller");
theTr.menu = menu;
const descTd = Utils.createTd();
diff --git a/saltgui/static/scripts/panels/Beacons.js b/saltgui/static/scripts/panels/Beacons.js
index 81b440e73..0d827cecb 100644
--- a/saltgui/static/scripts/panels/Beacons.js
+++ b/saltgui/static/scripts/panels/Beacons.js
@@ -143,7 +143,7 @@ export class BeaconsPanel extends Panel {
}
_addMenuItemShowBeacons (pMenu, pMinionId) {
- pMenu.addMenuItem("Show beacons", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show beacons", (pClickEvent) => {
this.router.goTo("beacons-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/BeaconsMinion.js b/saltgui/static/scripts/panels/BeaconsMinion.js
index 31ad8418f..f1289b3ca 100644
--- a/saltgui/static/scripts/panels/BeaconsMinion.js
+++ b/saltgui/static/scripts/panels/BeaconsMinion.js
@@ -2,7 +2,7 @@
import {BeaconsPanel} from "./Beacons.js";
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {Utils} from "../Utils.js";
@@ -144,7 +144,7 @@ export class BeaconsMinionPanel extends Panel {
for (const beaconName of keys) {
const tr = Utils.createTr("", "", "beacon-" + beaconName);
- const beaconMenu = new DropDownMenu(tr, "smaller");
+ const beaconMenu = new DropDownMenuCmd(tr, "smaller");
const nameTd = Utils.createTd("beacon-name", beaconName);
tr.appendChild(nameTd);
@@ -217,7 +217,7 @@ export class BeaconsMinionPanel extends Panel {
}
_addPanelMenuItemBeaconsDisableWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.beaconsEnabled) {
return null;
}
@@ -230,7 +230,7 @@ export class BeaconsMinionPanel extends Panel {
}
_addPanelMenuItemBeaconsEnableWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.beaconsEnabled) {
return null;
}
@@ -243,7 +243,7 @@ export class BeaconsMinionPanel extends Panel {
}
_addPanelMenuItemBeaconsAdd () {
- this.panelMenu.addMenuItem("Add beacon...", () => {
+ this.panelMenu.addMenuItemCmd("Add beacon...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["beacons.add", "", ""];
this.runCommand("", minionId, cmdArr);
@@ -251,7 +251,7 @@ export class BeaconsMinionPanel extends Panel {
}
_addPanelMenuItemBeaconsReset () {
- this.panelMenu.addMenuItem("Reset beacons...", () => {
+ this.panelMenu.addMenuItemCmd("Reset beacons...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["beacons.reset"];
this.runCommand("", minionId, cmdArr);
@@ -259,7 +259,7 @@ export class BeaconsMinionPanel extends Panel {
}
_addPanelMenuItemBeaconsSave () {
- this.panelMenu.addMenuItem("Save beacons...", () => {
+ this.panelMenu.addMenuItemCmd("Save beacons...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["beacons.save"];
this.runCommand("", minionId, cmdArr);
@@ -270,7 +270,7 @@ export class BeaconsMinionPanel extends Panel {
if (beacon.enabled === false) {
return;
}
- pMenu.addMenuItem("Disable beacon...", () => {
+ pMenu.addMenuItemCmd("Disable beacon...", () => {
const cmdArr = ["beacons.disable_beacon", key];
this.runCommand("", pMinionId, cmdArr);
});
@@ -280,14 +280,14 @@ export class BeaconsMinionPanel extends Panel {
if (beacon.enabled !== false) {
return;
}
- pMenu.addMenuItem("Enable beacon...", () => {
+ pMenu.addMenuItemCmd("Enable beacon...", () => {
const cmdArr = ["beacons.enable_beacon", key];
this.runCommand("", pMinionId, cmdArr);
});
}
_addMenuItemBeaconsDelete (pMenu, pMinionId, key) {
- pMenu.addMenuItem("Delete beacon...", () => {
+ pMenu.addMenuItemCmd("Delete beacon...", () => {
const cmdArr = ["beacons.delete", key];
this.runCommand("", pMinionId, cmdArr);
});
diff --git a/saltgui/static/scripts/panels/Grains.js b/saltgui/static/scripts/panels/Grains.js
index fc83b9bb2..8bb8cd644 100644
--- a/saltgui/static/scripts/panels/Grains.js
+++ b/saltgui/static/scripts/panels/Grains.js
@@ -188,7 +188,7 @@ export class GrainsPanel extends Panel {
}
_addMenuItemShowGrains (pMenu, pMinionId) {
- pMenu.addMenuItem("Show grains", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show grains", (pClickEvent) => {
this.router.goTo("grains-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/GrainsMinion.js b/saltgui/static/scripts/panels/GrainsMinion.js
index 805ad6d5e..bb9f5f88d 100644
--- a/saltgui/static/scripts/panels/GrainsMinion.js
+++ b/saltgui/static/scripts/panels/GrainsMinion.js
@@ -1,7 +1,7 @@
/* global */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {Utils} from "../Utils.js";
@@ -69,7 +69,7 @@ export class GrainsMinionPanel extends Panel {
for (const grainName of grainNames) {
const grainTr = Utils.createTr();
- const grainMenu = new DropDownMenu(grainTr, "smaller");
+ const grainMenu = new DropDownMenuCmd(grainTr, "smaller");
const grainNameTd = Utils.createTd("grain-name", grainName);
grainTr.appendChild(grainNameTd);
@@ -101,7 +101,7 @@ export class GrainsMinionPanel extends Panel {
}
_addPanelMenuItemGrainsSetValAdd () {
- this.panelMenu.addMenuItem("Add grain...", () => {
+ this.panelMenu.addMenuItemCmd("Add grain...", () => {
// use placeholders for name and value
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["grains.setval", "", ""];
@@ -110,7 +110,7 @@ export class GrainsMinionPanel extends Panel {
}
_addPanelMenuItemSaltUtilRefreshGrains () {
- this.panelMenu.addMenuItem("Refresh grains...", () => {
+ this.panelMenu.addMenuItemCmd("Refresh grains...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["saltutil.refresh_grains"];
this.runCommand("", minionId, cmdArr);
@@ -118,7 +118,7 @@ export class GrainsMinionPanel extends Panel {
}
_addMenuItemGrainsSetValUpdate (pMenu, pMinionId, key, grains) {
- pMenu.addMenuItem("Edit grain...", () => {
+ pMenu.addMenuItemCmd("Edit grain...", () => {
const cmdArr = ["grains.setval", key, grains[key]];
this.runCommand("", pMinionId, cmdArr);
});
@@ -128,7 +128,7 @@ export class GrainsMinionPanel extends Panel {
if (!pGrainValue.startsWith("[")) {
return;
}
- pMenu.addMenuItem("Add value...", () => {
+ pMenu.addMenuItemCmd("Add value...", () => {
const cmdArr = ["grains.append", key, ""];
this.runCommand("", pMinionId, cmdArr);
});
@@ -140,7 +140,7 @@ export class GrainsMinionPanel extends Panel {
cmdArr.push("force=", true);
}
cmdArr.push(pKey);
- pMenu.addMenuItem("Delete key...", () => {
+ pMenu.addMenuItemCmd("Delete key...", () => {
this.runCommand("", pMinionId, cmdArr);
});
}
@@ -151,7 +151,7 @@ export class GrainsMinionPanel extends Panel {
cmdArr.push("force=", true);
}
cmdArr.push(pKey);
- pMenu.addMenuItem("Delete value...", () => {
+ pMenu.addMenuItemCmd("Delete value...", () => {
this.runCommand("", pMinionId, cmdArr);
});
}
diff --git a/saltgui/static/scripts/panels/HighState.js b/saltgui/static/scripts/panels/HighState.js
index ad86a4d71..b9773b05c 100644
--- a/saltgui/static/scripts/panels/HighState.js
+++ b/saltgui/static/scripts/panels/HighState.js
@@ -89,21 +89,21 @@ export class HighStatePanel extends Panel {
}
_addMenuItemStateApply (pMenu, pMinionId) {
- pMenu.addMenuItem("Apply state...", () => {
+ pMenu.addMenuItemCmd("Apply state...", () => {
const cmdArr = ["state.apply"];
this.runCommand("", pMinionId, cmdArr, ["select_minions"]);
});
}
_addMenuItemStateApplyTest (pMenu, pMinionId) {
- pMenu.addMenuItem("Test state...", () => {
+ pMenu.addMenuItemCmd("Test state...", () => {
const cmdArr = ["state.apply", "test=", true];
this.runCommand("", pMinionId, cmdArr, ["select_minions"]);
});
}
_addMenuItemUseStateHighstate () {
- this.settingsMenu.addMenuItem(
+ this.settingsMenu.addMenuItemCmd(
() => {
const stateHighstateFlag = Utils.getStorageItem("local", "use_state_highstate", "true");
return (stateHighstateFlag === "true" ? Character.HEAVY_CHECK_MARK + Character.NO_BREAK_SPACE : "") + "Include state.highstate";
@@ -116,7 +116,7 @@ export class HighStatePanel extends Panel {
}
_addMenuItemUseStateApply () {
- this.settingsMenu.addMenuItem(
+ this.settingsMenu.addMenuItemCmd(
() => {
const stateApplyFlag = Utils.getStorageItem("local", "use_state_apply", "true");
return (stateApplyFlag === "true" ? Character.HEAVY_CHECK_MARK + Character.NO_BREAK_SPACE : "") + "Include state.apply";
@@ -534,7 +534,7 @@ export class HighStatePanel extends Panel {
}
_addJobsMenuItemShowDetails (pMenu, pJob, pMinionId) {
- pMenu.addMenuItem("Show details", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show details", (pClickEvent) => {
this.router.goTo("job", {"id": pJob.jid, "minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/Job.js b/saltgui/static/scripts/panels/Job.js
index 88e98b17b..32845a970 100644
--- a/saltgui/static/scripts/panels/Job.js
+++ b/saltgui/static/scripts/panels/Job.js
@@ -1,10 +1,11 @@
/* global document window */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {ParseCommandLine} from "../ParseCommandLine.js";
+import {Search} from "../Search.js";
import {TargetType} from "../TargetType.js";
import {Utils} from "../Utils.js";
@@ -52,7 +53,7 @@ export class JobPanel extends Panel {
const output = Utils.createElem("pre", "output", "", "job-table");
this.output = output;
- const searchBox = Utils.makeSearchBox(this.searchButton, this.output, "data-list-job");
+ const searchBox = Search.makeSearchBox(this.searchButton, this.output, "data-list-job");
this.div.appendChild(searchBox);
this.div.append(this.output);
@@ -386,7 +387,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemJobRerunJob () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.target && !this.commandtext) {
return null;
}
@@ -421,7 +422,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemRerunJobOnAllMinionsWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
const lst = this._listForRerunJobOnAllMinions();
if (!lst) {
return null;
@@ -469,7 +470,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemRerunJobOnUnsuccessfulMinionsWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
const lst = this._listForRerunJobOnUnsuccessfulMinions();
if (!lst) {
return null;
@@ -503,7 +504,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemRerunJobOnFailedMinionsWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
const lst = this._listForRerunJobOnFailedMinions();
if (!lst) {
return null;
@@ -537,7 +538,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemRerunJobOnNonRespondingMinionsWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
const lst = this._listForRerunJobOnNonRespondingMinions();
if (!lst) {
return null;
@@ -550,7 +551,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemTerminateJob () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.jobIsTerminated !== false) {
return null;
}
@@ -562,7 +563,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemKillJob () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.jobIsTerminated !== false) {
return null;
}
@@ -574,7 +575,7 @@ export class JobPanel extends Panel {
}
_addPanelMenuItemSignalJob () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.jobIsTerminated !== false) {
return null;
}
@@ -633,20 +634,20 @@ export class JobPanel extends Panel {
// show that this minion is still active on the request
noResponseSpan.innerText = "(active) ";
- const menu = new DropDownMenu(noResponseSpan, "verysmall");
- menu.addMenuItem("Show process info...", () => {
+ const menu = new DropDownMenuCmd(noResponseSpan, "verysmall");
+ menu.addMenuItemCmd("Show process info...", () => {
const cmdArr = ["ps.proc_info", pid];
this.runCommand("", minionId, cmdArr);
});
- menu.addMenuItem("Terminate process...", () => {
+ menu.addMenuItemCmd("Terminate process...", () => {
const cmdArr = ["ps.kill_pid", pid, "signal=", 15];
this.runCommand("", minionId, cmdArr);
});
- menu.addMenuItem("Kill process...", () => {
+ menu.addMenuItemCmd("Kill process...", () => {
const cmdArr = ["ps.kill_pid", pid, "signal=", 9];
this.runCommand("", minionId, cmdArr);
});
- menu.addMenuItem("Signal process...", () => {
+ menu.addMenuItemCmd("Signal process...", () => {
const cmdArr = ["ps.kill_pid", pid, "signal=", ""];
this.runCommand("", minionId, cmdArr);
});
diff --git a/saltgui/static/scripts/panels/JobsDetails.js b/saltgui/static/scripts/panels/JobsDetails.js
index f6c787691..5bc01f8e1 100644
--- a/saltgui/static/scripts/panels/JobsDetails.js
+++ b/saltgui/static/scripts/panels/JobsDetails.js
@@ -1,7 +1,7 @@
/* global document window */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {JobPanel} from "./Job.js";
import {JobsPanel} from "./Jobs.js";
import {Output} from "../output/Output.js";
@@ -90,7 +90,7 @@ export class JobsDetailsPanel extends JobsPanel {
}
_addSettingsMenuItemShowSome () {
- this.settingsMenu.addMenuItem(() => {
+ this.settingsMenu.addMenuItemCmd(() => {
let title = "Show first " + MAX_JOBS_DETAILS + " jobs";
const cnt = decodeURIComponent(Utils.getQueryParam("cnt"));
if (cnt === "undefined" || cnt === String(MAX_JOBS_DETAILS)) {
@@ -103,7 +103,7 @@ export class JobsDetailsPanel extends JobsPanel {
}
_addSettingsMenuItemShowEligible () {
- this.settingsMenu.addMenuItem(() => {
+ this.settingsMenu.addMenuItemCmd(() => {
const cnt = decodeURIComponent(Utils.getQueryParam("cnt"));
let title = "Show eligible jobs";
if (cnt === "eligible") {
@@ -116,7 +116,7 @@ export class JobsDetailsPanel extends JobsPanel {
}
_addSettingsMenuItemShowAll () {
- this.settingsMenu.addMenuItem(() => {
+ this.settingsMenu.addMenuItemCmd(() => {
const cnt = decodeURIComponent(Utils.getQueryParam("cnt"));
let title = "Show all jobs";
if (cnt === "all") {
@@ -422,7 +422,7 @@ export class JobsDetailsPanel extends JobsPanel {
tr.id = Utils.getIdFromJobId(job.id);
tr.dataset.jobid = job.id;
- const menu = new DropDownMenu(tr, "smaller");
+ const menu = new DropDownMenuCmd(tr, "smaller");
tr.appendChild(Utils.createTd("", job.id));
@@ -495,20 +495,20 @@ export class JobsDetailsPanel extends JobsPanel {
}
_addJobsMenuItemShowDetails (pMenu, job) {
- pMenu.addMenuItem("Show details", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show details", (pClickEvent) => {
this.router.goTo("job", {"id": job.id}, undefined, pClickEvent);
});
}
_addMenuItemJobsRerunJob (pMenu, job, argumentsText) {
- pMenu.addMenuItem("Re-run job...", () => {
+ pMenu.addMenuItemCmd("Re-run job...", () => {
const cmdStr = job.Function + argumentsText;
this.runCommand(job["Target-type"], job.Target, cmdStr);
});
}
_addJobsMenuItemUpdateStatus (pMenu, pStatusSpan) {
- pMenu.addMenuItem("Update status", () => {
+ pMenu.addMenuItemCmd("Update status", () => {
pStatusSpan.classList.add("no-job-status");
pStatusSpan.innerText = "loading" + Character.HORIZONTAL_ELLIPSIS;
this.startRunningJobs();
@@ -516,7 +516,7 @@ export class JobsDetailsPanel extends JobsPanel {
}
_addMenuItemUpdateDetails (pMenu, pDetailsSpan, job) {
- pMenu.addMenuItem("Update details", () => {
+ pMenu.addMenuItemCmd("Update details", () => {
pDetailsSpan.classList.add("no-job-details");
pDetailsSpan.innerText = "loading" + Character.HORIZONTAL_ELLIPSIS;
this._getJobDetails(job.id);
diff --git a/saltgui/static/scripts/panels/JobsSummary.js b/saltgui/static/scripts/panels/JobsSummary.js
index 7abef4ef0..a2ca4e2f8 100644
--- a/saltgui/static/scripts/panels/JobsSummary.js
+++ b/saltgui/static/scripts/panels/JobsSummary.js
@@ -1,7 +1,7 @@
/* global */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {JobsPanel} from "./Jobs.js";
import {Output} from "../output/Output.js";
import {TargetType} from "../TargetType.js";
@@ -37,7 +37,7 @@ export class JobsSummaryPanel extends JobsPanel {
tr.id = Utils.getIdFromJobId(job.id);
// menu on left side to prevent it from going past end of window
- const menu = new DropDownMenu(tr, "smaller");
+ const menu = new DropDownMenuCmd(tr, "smaller");
const td = Utils.createTd();
@@ -87,13 +87,13 @@ export class JobsSummaryPanel extends JobsPanel {
}
_addMenuItemShowDetails (pMenu, job) {
- pMenu.addMenuItem("Show details", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show details", (pClickEvent) => {
this.router.goTo("job", {"id": job.id}, undefined, pClickEvent);
});
}
_addMenuItemUpdateStatus (pMenu, statusSpan) {
- pMenu.addMenuItem("Update status", () => {
+ pMenu.addMenuItemCmd("Update status", () => {
statusSpan.classList.add("no-job-status");
statusSpan.innerText = "loading" + Character.HORIZONTAL_ELLIPSIS;
this.startRunningJobs();
diff --git a/saltgui/static/scripts/panels/Keys.js b/saltgui/static/scripts/panels/Keys.js
index 0aa5eed00..73851da3a 100644
--- a/saltgui/static/scripts/panels/Keys.js
+++ b/saltgui/static/scripts/panels/Keys.js
@@ -511,7 +511,7 @@ export class KeysPanel extends Panel {
}
_addMenuItemWheelKeyAccept1 (pMenu, pMinionId, pStatusField) {
- pMenu.addMenuItem(() => {
+ pMenu.addMenuItemCmd(() => {
const status = pStatusField.innerText;
if (status === "denied" || status === "unaccepted") {
return "Accept key...";
@@ -530,7 +530,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptAllUnaccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -545,7 +545,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptSelectedUnaccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected > 0) {
return "Accept selected unaccepted keys...";
}
@@ -557,7 +557,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptAllUnacceptedRejected () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -575,7 +575,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptSelectedUnacceptedRejected () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrRejectedSelected) {
return null;
}
@@ -590,7 +590,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptAllUnacceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -608,7 +608,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptSelectedUnacceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrDeniedSelected) {
return null;
}
@@ -623,7 +623,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptAllUnacceptedRejectedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -641,7 +641,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyAcceptSelectedUnacceptedRejectedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrRejectedSelected || !this.nrDeniedSelected) {
return null;
}
@@ -656,7 +656,7 @@ export class KeysPanel extends Panel {
}
_addMenuItemWheelKeyAccept2 (pMenu, pMinionId, pStatusField) {
- pMenu.addMenuItem(() => {
+ pMenu.addMenuItemCmd(() => {
const status = pStatusField.innerText;
if (status === "rejected") {
return "Accept key...";
@@ -675,7 +675,7 @@ export class KeysPanel extends Panel {
}
_addMenuItemWheelKeyReject (pMenu, pMinionId, pStatusField) {
- pMenu.addMenuItem(() => {
+ pMenu.addMenuItemCmd(() => {
const status = pStatusField.innerText;
if (status === "accepted" || status === "denied" || status === "unaccepted") {
return "Reject key...";
@@ -694,7 +694,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectAllUnaccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -709,7 +709,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectSelectedUnaccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelectd > 0) {
return "Reject selected unaccepted keys...";
}
@@ -721,7 +721,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectAllUnacceptedAccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -739,7 +739,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectSelectedUnacceptedAccepted () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrAcceptedSelected) {
return null;
}
@@ -754,7 +754,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectAllUnacceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -772,7 +772,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectSelectedUnacceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrDeniedSelected) {
return null;
}
@@ -787,7 +787,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectAllUnacceptedAcceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -805,7 +805,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyRejectSelectedUnacceptedAcceptedDenied () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.nrAcceptedSelected || !this.nrDeniedSelected) {
return null;
}
@@ -820,7 +820,7 @@ export class KeysPanel extends Panel {
}
_addMenuItemWheelKeyDelete (pMenu, pMinionId, pStatusField) {
- pMenu.addMenuItem(() => {
+ pMenu.addMenuItemCmd(() => {
const status = pStatusField.innerText;
if (status === "accepted" || status === "rejected" || status === "unaccepted" || status === "denied") {
return "Delete key...";
@@ -833,7 +833,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyDeleteAll () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrUnacceptedSelected || this.nrAcceptedSelected || this.nrDeniedSelected || this.nrRejectedSelected) {
return null;
}
@@ -848,7 +848,7 @@ export class KeysPanel extends Panel {
}
_addPanelMenuItemWheelKeyDeleteSelected () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.nrAcceptedSelected > 0 || this.nrUnacceptedSelected > 0 || this.nrRejectedSelected > 0 || this.nrDeniedSelected > 0) {
return "Delete selected keys...";
}
diff --git a/saltgui/static/scripts/panels/Mine.js b/saltgui/static/scripts/panels/Mine.js
index 3c033cdf5..1e78043c1 100644
--- a/saltgui/static/scripts/panels/Mine.js
+++ b/saltgui/static/scripts/panels/Mine.js
@@ -101,7 +101,7 @@ export class MinePanel extends Panel {
}
_addMenuItemShowMine (pMenu, pMinionId) {
- pMenu.addMenuItem("Show functions", () => {
+ pMenu.addMenuItemCmd("Show functions", () => {
this.router.goTo("mine-minion", {"minionid": pMinionId});
});
}
diff --git a/saltgui/static/scripts/panels/MineMinion.js b/saltgui/static/scripts/panels/MineMinion.js
index 8e8451861..b1dbde118 100644
--- a/saltgui/static/scripts/panels/MineMinion.js
+++ b/saltgui/static/scripts/panels/MineMinion.js
@@ -1,7 +1,7 @@
/* global document */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {Utils} from "../Utils.js";
@@ -116,7 +116,7 @@ export class MineMinionPanel extends Panel {
mineTr.id = "mine." + mineName;
const menuTd = Utils.createTd();
- const menu = new DropDownMenu(menuTd, "smaller");
+ const menu = new DropDownMenuCmd(menuTd, "smaller");
mineTr.dropdownmenu = menu;
mineTr.appendChild(menuTd);
@@ -146,7 +146,7 @@ export class MineMinionPanel extends Panel {
}
_addMenuItemMineFlush () {
- this.panelMenu.addMenuItem("Flush...", () => {
+ this.panelMenu.addMenuItemCmd("Flush...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["mine.flush"];
this.runCommand("", minionId, cmdArr);
@@ -154,7 +154,7 @@ export class MineMinionPanel extends Panel {
}
_addMenuItemMineUpdate () {
- this.panelMenu.addMenuItem("Update...", () => {
+ this.panelMenu.addMenuItemCmd("Update...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["mine.update"];
this.runCommand("", minionId, cmdArr);
@@ -162,7 +162,7 @@ export class MineMinionPanel extends Panel {
}
_addMenuItemMineDelete (pMenu, pMinionId, pKey) {
- pMenu.addMenuItem("Delete key...", () => {
+ pMenu.addMenuItemCmd("Delete key...", () => {
const cmdArr = ["mine.delete", pKey];
this.runCommand("", pMinionId, cmdArr);
});
diff --git a/saltgui/static/scripts/panels/Minions.js b/saltgui/static/scripts/panels/Minions.js
index 5df551dce..bde334232 100644
--- a/saltgui/static/scripts/panels/Minions.js
+++ b/saltgui/static/scripts/panels/Minions.js
@@ -213,45 +213,45 @@ export class MinionsPanel extends Panel {
}
_addMenuItemStateApply (pMenu, pMinionId) {
- pMenu.addMenuItem("Apply state...", () => {
+ pMenu.addMenuItemCmd("Apply state...", () => {
const cmdArr = ["state.apply"];
this.runCommand("", pMinionId, cmdArr, ["select_minions"]);
});
}
_addMenuItemStateApplyTest (pMenu, pMinionId) {
- pMenu.addMenuItem("Test state...", () => {
+ pMenu.addMenuItemCmd("Test state...", () => {
const cmdArr = ["state.apply", "test=", true];
this.runCommand("", pMinionId, cmdArr, ["select_minions"]);
});
}
_addMenuItemShowGrains (pMenu, pMinionId) {
- pMenu.addMenuItem("Show grains", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show grains", (pClickEvent) => {
this.router.goTo("grains-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowPillars (pMenu, pMinionId) {
- pMenu.addMenuItem("Show pillars", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show pillars", (pClickEvent) => {
this.router.goTo("pillars-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowMine (pMenu, pMinionId) {
- pMenu.addMenuItem("Show mine", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show mine", (pClickEvent) => {
this.router.goTo("mine-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowBeacons (pMenu, pMinionId) {
- pMenu.addMenuItem("Show beacons", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show beacons", (pClickEvent) => {
this.router.goTo("beacons-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowSchedules (pMenu, pMinionId) {
- pMenu.addMenuItem("Show schedules", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show schedules", (pClickEvent) => {
this.router.goTo("schedules-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/Nodegroups.js b/saltgui/static/scripts/panels/Nodegroups.js
index cd4b5cb2e..a1295d559 100644
--- a/saltgui/static/scripts/panels/Nodegroups.js
+++ b/saltgui/static/scripts/panels/Nodegroups.js
@@ -1,7 +1,7 @@
/* global document */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Panel} from "./Panel.js";
import {Utils} from "../Utils.js";
@@ -188,7 +188,7 @@ export class NodegroupsPanel extends Panel {
}
const newMenuButton = Utils.createTd();
minionTr.insertBefore(newMenuButton, minionTr.firstChild.nextSibling);
- minionTr.dropdownmenu = new DropDownMenu(newMenuButton, "smaller");
+ minionTr.dropdownmenu = new DropDownMenuCmd(newMenuButton, "smaller");
if (minionIsOk) {
this._addMenuItemStateApplyMinion(minionTr.dropdownmenu, pMinionId);
this._addMenuItemStateApplyTestMinion(minionTr.dropdownmenu, pMinionId);
@@ -327,7 +327,7 @@ export class NodegroupsPanel extends Panel {
this.addSelectionCheckbox (tr, "select_nodegroups");
const menuTd = Utils.createTd();
- tr.dropdownmenu = new DropDownMenu(menuTd, "smaller");
+ tr.dropdownmenu = new DropDownMenuCmd(menuTd, "smaller");
tr.appendChild(menuTd);
const titleTd = Utils.createTd();
@@ -417,65 +417,65 @@ export class NodegroupsPanel extends Panel {
}
_addMenuItemStateApplyGroup (pMenu, pNodegroup, pAllNodegroups) {
- pMenu.addMenuItem("Apply state...", () => {
+ pMenu.addMenuItemCmd("Apply state...", () => {
const cmdArr = ["state.apply"];
this.runCommand("", NodegroupsPanel._getGroupTarget(pNodegroup, pAllNodegroups), cmdArr);
});
}
_addMenuItemStateApplyTestGroup (pMenu, pNodegroup, pAllNodegroups) {
- pMenu.addMenuItem("Test state...", () => {
+ pMenu.addMenuItemCmd("Test state...", () => {
const cmdArr = ["state.apply", "test=", true];
this.runCommand("", NodegroupsPanel._getGroupTarget(pNodegroup, pAllNodegroups), cmdArr);
});
}
_addMenuItemStateApplyMinion (pMenu, pMinionId) {
- pMenu.addMenuItem("Apply state...", () => {
+ pMenu.addMenuItemCmd("Apply state...", () => {
const cmdArr = ["state.apply"];
this.runCommand("", pMinionId, cmdArr, ["select_minions", "select_nodegroups"]);
});
}
_addMenuItemStateApplyTestMinion (pMenu, pMinionId) {
- pMenu.addMenuItem("Test state...", () => {
+ pMenu.addMenuItemCmd("Test state...", () => {
const cmdArr = ["state.apply", "test=", true];
this.runCommand("", pMinionId, cmdArr, ["select_minions", "select_nodegroups"]);
});
}
_addMenuItemShowKeys (pMenu) {
- pMenu.addMenuItem("Show keys", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show keys", (pClickEvent) => {
this.router.goTo("keys", undefined, undefined, pClickEvent);
});
}
_addMenuItemShowGrains (pMenu, pMinionId) {
- pMenu.addMenuItem("Show grains", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show grains", (pClickEvent) => {
this.router.goTo("grains-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowPillars (pMenu, pMinionId) {
- pMenu.addMenuItem("Show pillars", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show pillars", (pClickEvent) => {
this.router.goTo("pillars-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowMine (pMenu, pMinionId) {
- pMenu.addMenuItem("Show mine", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show mine", (pClickEvent) => {
this.router.goTo("mine-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowBeacons (pMenu, pMinionId) {
- pMenu.addMenuItem("Show beacons", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show beacons", (pClickEvent) => {
this.router.goTo("beacons-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
_addMenuItemShowSchedules (pMenu, pMinionId) {
- pMenu.addMenuItem("Show schedules", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show schedules", (pClickEvent) => {
this.router.goTo("schedules-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/Orchestrations.js b/saltgui/static/scripts/panels/Orchestrations.js
index c93e237cf..a2b4cef68 100644
--- a/saltgui/static/scripts/panels/Orchestrations.js
+++ b/saltgui/static/scripts/panels/Orchestrations.js
@@ -1,7 +1,7 @@
/* global */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {Utils} from "../Utils.js";
@@ -119,7 +119,7 @@ export class OrchestrationsPanel extends Panel {
_addOrchestrationHeaderRow (pOrchestrationName) {
const tr0 = Utils.createTr();
- const menu = new DropDownMenu(tr0, "smaller");
+ const menu = new DropDownMenuCmd(tr0, "smaller");
this._addMenuItemApplyOrchestration(menu, pOrchestrationName);
this._addMenuItemApplyOrchestrationTest(menu, pOrchestrationName);
@@ -145,7 +145,7 @@ export class OrchestrationsPanel extends Panel {
const tr1 = Utils.createTr();
// menu per item
- const smenu = new DropDownMenu(tr1, "smaller");
+ const smenu = new DropDownMenuCmd(tr1, "smaller");
this._addMenuItemApplyOrchestrationStep(smenu, step);
this._addMenuItemApplyOrchestrationStepTest(smenu, step);
@@ -221,14 +221,14 @@ export class OrchestrationsPanel extends Panel {
}
_addMenuItemApplyOrchestration (pMenu, pOrchestrationName) {
- pMenu.addMenuItem("Apply orchestration...", () => {
+ pMenu.addMenuItemCmd("Apply orchestration...", () => {
const cmdArr = ["runners.state.orchestrate", pOrchestrationName];
this.runCommand("", "", cmdArr);
});
}
_addMenuItemApplyOrchestrationTest (pMenu, pOrchestrationName) {
- pMenu.addMenuItem("Test orchestration...", () => {
+ pMenu.addMenuItemCmd("Test orchestration...", () => {
const cmdArr = ["runners.state.orchestrate", "test=", true, pOrchestrationName];
this.runCommand("", "", cmdArr);
});
@@ -260,14 +260,14 @@ export class OrchestrationsPanel extends Panel {
_addMenuItemApplyOrchestrationStep (pMenu, pSteps) {
const cmdArr = OrchestrationsPanel._makeCmdArr(pSteps, false);
- pMenu.addMenuItem("Apply orchestration step...", () => {
+ pMenu.addMenuItemCmd("Apply orchestration step...", () => {
this.runCommand("", "", cmdArr);
});
}
_addMenuItemApplyOrchestrationStepTest (pMenu, pSteps) {
const cmdArr = OrchestrationsPanel._makeCmdArr(pSteps, true);
- pMenu.addMenuItem("Test orchestration step...", () => {
+ pMenu.addMenuItemCmd("Test orchestration step...", () => {
this.runCommand("", "", cmdArr);
});
}
diff --git a/saltgui/static/scripts/panels/Panel.js b/saltgui/static/scripts/panels/Panel.js
index 418ec1b04..bb04cc851 100644
--- a/saltgui/static/scripts/panels/Panel.js
+++ b/saltgui/static/scripts/panels/Panel.js
@@ -2,7 +2,8 @@
import {Character} from "../Character.js";
import {CommandBox} from "../CommandBox.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
+import {Search} from "../Search.js";
import {SortTable} from "../../sorttable/sorttable.js";
import {TargetType} from "../TargetType.js";
import {Utils} from "../Utils.js";
@@ -47,7 +48,7 @@ export class Panel {
addPanelMenu () {
const span = Utils.createSpan();
span.id = this.key + "-menu";
- const menu = new DropDownMenu(span);
+ const menu = new DropDownMenuCmd(span);
menu.menuButton.classList.add("small-button-left", "no-print");
this.div.appendChild(span);
this.panelMenu = menu;
@@ -56,7 +57,7 @@ export class Panel {
addSettingsMenu () {
const span = Utils.createSpan();
span.id = this.key + "-settings";
- const menu = new DropDownMenu(span);
+ const menu = new DropDownMenuCmd(span);
menu.menuButton.classList.add("small-button-left");
this.div.appendChild(span);
this.settingsMenu = menu;
@@ -315,7 +316,7 @@ export class Panel {
// most tables are searchable (but not all)
// when it is, we already prepared the search button for it
if (this.div.querySelector(".search-button") !== null) {
- const searchBox = Utils.makeSearchBox(this.searchButton, table, pFieldList);
+ const searchBox = Search.makeSearchBox(this.searchButton, table, pFieldList);
this.div.appendChild(searchBox);
this.searchBox = searchBox;
}
@@ -510,7 +511,7 @@ export class Panel {
// drop down menu
const menuTd = Utils.createTd();
- const menu = new DropDownMenu(menuTd, "smaller");
+ const menu = new DropDownMenuCmd(menuTd, "smaller");
minionTr.dropdownmenu = menu;
minionTr.appendChild(menuTd);
@@ -617,7 +618,7 @@ export class Panel {
// drop down menu
const menuTd = Utils.createTd();
- const menu = new DropDownMenu(menuTd, "smaller");
+ const menu = new DropDownMenuCmd(menuTd, "smaller");
minionTr.dropdownmenu = menu;
minionTr.appendChild(menuTd);
diff --git a/saltgui/static/scripts/panels/Pillars.js b/saltgui/static/scripts/panels/Pillars.js
index 560c9dcab..efc9eb717 100644
--- a/saltgui/static/scripts/panels/Pillars.js
+++ b/saltgui/static/scripts/panels/Pillars.js
@@ -107,7 +107,7 @@ export class PillarsPanel extends Panel {
}
_addMenuItemShowPillars (pMenu, pMinionId) {
- pMenu.addMenuItem("Show pillars", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show pillars", (pClickEvent) => {
this.router.goTo("pillars-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/PillarsMinion.js b/saltgui/static/scripts/panels/PillarsMinion.js
index 9b9fb861c..90ae43e42 100644
--- a/saltgui/static/scripts/panels/PillarsMinion.js
+++ b/saltgui/static/scripts/panels/PillarsMinion.js
@@ -139,7 +139,7 @@ export class PillarsMinionPanel extends Panel {
}
_addPanelMenuItemSaltUtilRefreshPillar () {
- this.panelMenu.addMenuItem("Refresh pillar...", () => {
+ this.panelMenu.addMenuItemCmd("Refresh pillar...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = ["saltutil.refresh_pillar"];
this.runCommand("", minionId, cmdArr);
diff --git a/saltgui/static/scripts/panels/Schedules.js b/saltgui/static/scripts/panels/Schedules.js
index e600f9eb9..5a76db58e 100644
--- a/saltgui/static/scripts/panels/Schedules.js
+++ b/saltgui/static/scripts/panels/Schedules.js
@@ -150,7 +150,7 @@ export class SchedulesPanel extends Panel {
}
_addMenuItemShowSchedules (pMenu, pMinionId) {
- pMenu.addMenuItem("Show schedules", (pClickEvent) => {
+ pMenu.addMenuItemCmd("Show schedules", (pClickEvent) => {
this.router.goTo("schedules-minion", {"minionid": pMinionId}, undefined, pClickEvent);
});
}
diff --git a/saltgui/static/scripts/panels/SchedulesMinion.js b/saltgui/static/scripts/panels/SchedulesMinion.js
index 93bca2896..53b2c1259 100644
--- a/saltgui/static/scripts/panels/SchedulesMinion.js
+++ b/saltgui/static/scripts/panels/SchedulesMinion.js
@@ -1,7 +1,7 @@
/* global */
import {Character} from "../Character.js";
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Output} from "../output/Output.js";
import {Panel} from "./Panel.js";
import {SchedulesPanel} from "./Schedules.js";
@@ -101,7 +101,7 @@ export class SchedulesMinionPanel extends Panel {
}
const tr = Utils.createTr();
- const scheduleMenu = new DropDownMenu(tr, "smaller");
+ const scheduleMenu = new DropDownMenuCmd(tr, "smaller");
const nameTd = Utils.createTd("schedule-name", scheduleName);
tr.appendChild(nameTd);
@@ -135,7 +135,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addPanelMenuItemScheduleEnableWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (this.schedulesEnabled) {
return null;
}
@@ -148,7 +148,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addPanelMenuItemScheduleDisableWhenNeeded () {
- this.panelMenu.addMenuItem(() => {
+ this.panelMenu.addMenuItemCmd(() => {
if (!this.schedulesEnabled) {
return null;
}
@@ -161,7 +161,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addPanelMenuItemScheduleAddInterval () {
- this.panelMenu.addMenuItem("Add interval schedule...", () => {
+ this.panelMenu.addMenuItemCmd("Add interval schedule...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = [
"schedule.add",
@@ -177,7 +177,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addPanelMenuItemScheduleAddCron () {
- this.panelMenu.addMenuItem("Add cron schedule...", () => {
+ this.panelMenu.addMenuItemCmd("Add cron schedule...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = [
"schedule.add",
@@ -190,7 +190,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addPanelMenuItemScheduleAddOnce () {
- this.panelMenu.addMenuItem("Add once schedule...", () => {
+ this.panelMenu.addMenuItemCmd("Add once schedule...", () => {
const minionId = decodeURIComponent(Utils.getQueryParam("minionid"));
const cmdArr = [
"schedule.add",
@@ -205,7 +205,7 @@ export class SchedulesMinionPanel extends Panel {
}
_addMenuItemModifyJob (pMenu, pMinionId, scheduleModifyCmdArr) {
- pMenu.addMenuItem("Modify job...", () => {
+ pMenu.addMenuItemCmd("Modify job...", () => {
this.runCommand("", pMinionId, scheduleModifyCmdArr);
});
}
@@ -214,7 +214,7 @@ export class SchedulesMinionPanel extends Panel {
if (schedule.enabled !== false) {
return;
}
- pMenu.addMenuItem("Enable job...", () => {
+ pMenu.addMenuItemCmd("Enable job...", () => {
const cmdArr = ["schedule.enable_job", pJobName];
this.runCommand("", pMinionId, cmdArr);
});
@@ -224,21 +224,21 @@ export class SchedulesMinionPanel extends Panel {
if (schedule.enabled === false) {
return;
}
- pMenu.addMenuItem("Disable job...", () => {
+ pMenu.addMenuItemCmd("Disable job...", () => {
const cmdArr = ["schedule.disable_job", pJobName];
this.runCommand("", pMinionId, cmdArr);
});
}
_addMenuItemScheduleDeleteJob (pMenu, pMinionId, pJobName) {
- pMenu.addMenuItem("Delete job...", () => {
+ pMenu.addMenuItemCmd("Delete job...", () => {
const cmdArr = ["schedule.delete", pJobName];
this.runCommand("", pMinionId, cmdArr);
});
}
_addMenuItemScheduleRunJob (pMenu, pMinionId, pJobName, schedule) {
- pMenu.addMenuItem("Run job...", () => {
+ pMenu.addMenuItemCmd("Run job...", () => {
const scheduleRunJobCmdArr = ["schedule.run_job"];
if (schedule.enabled === false) {
scheduleRunJobCmdArr.push("force=", true);
diff --git a/saltgui/static/scripts/panels/Templates.js b/saltgui/static/scripts/panels/Templates.js
index 713596087..44c63f2d8 100644
--- a/saltgui/static/scripts/panels/Templates.js
+++ b/saltgui/static/scripts/panels/Templates.js
@@ -1,6 +1,6 @@
/* global document */
-import {DropDownMenu} from "../DropDown.js";
+import {DropDownMenuCmd} from "../DropDownCmd.js";
import {Panel} from "./Panel.js";
import {Router} from "../Router.js";
import {Utils} from "../Utils.js";
@@ -113,7 +113,7 @@ export class TemplatesPanel extends Panel {
_addTemplate (pTemplateName, template) {
const tr = Utils.createTr();
- const menu = new DropDownMenu(tr, "smaller");
+ const menu = new DropDownMenuCmd(tr, "smaller");
tr.appendChild(Utils.createTd("name", pTemplateName));
@@ -180,7 +180,7 @@ export class TemplatesPanel extends Panel {
}
_addMenuItemApplyTemplate (pMenu, pTargetType, target, pCommand) {
- pMenu.addMenuItem("Apply template...", () => {
+ pMenu.addMenuItemCmd("Apply template...", () => {
this.runCommand(pTargetType, target, pCommand);
});
}
diff --git a/tests/unit/RunType.test.js b/tests/unit/RunType.test.js
index c85587c96..e146e630b 100644
--- a/tests/unit/RunType.test.js
+++ b/tests/unit/RunType.test.js
@@ -9,9 +9,22 @@ describe("Unittests for RunType.js", () => {
beforeEach(() => {
Utils.clearStorage("local");
RunType.menuRunType = {
- _value: undefined,
+ _defaultValue: undefined,
+ _value: null,
+ getValue () {
+ if (this._value === null) {
+ return this._defaultValue;
+ }
+ return this._value;
+ },
menuDropdownContent: {children: []},
- setTitle: () => {}
+ setDefaultValue (pDefaultValue) {
+ this._defaultValue = pDefaultValue;
+ },
+ setTitle: () => {},
+ setValue (pValue) {
+ this._value = pValue;
+ }
};
});