Skip to content

Commit c3daa37

Browse files
author
Erwin Dondorp
committed
upgrade to ES2016 and documented the new versioning policy
1 parent 885bc3a commit c3daa37

6 files changed

Lines changed: 15 additions & 19 deletions

File tree

docs/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SaltGUI
22

3-
SaltGUI is an open source web interface for managing a SaltStack server and its minions. Built using vanilla ES6 and implemented as a wrapper around the rest_cherrypy server a.k.a. salt-api.
3+
SaltGUI is an open source web interface for managing a SaltStack server and its minions. Built using plain ES2016 and implemented as a wrapper around the rest_cherrypy server a.k.a. salt-api.
44

55
**Security Note**: For production deployments, TLS encryption is strongly recommended. See [TLS Configuration](#tls-configuration) for complete setup instructions.
66

@@ -16,6 +16,11 @@ IMPORTANT: The SaltGUI team can only support SaltStack versions 3006 and higher.
1616
That makes it very hard to perform proper testing for SaltGUI releases.
1717
We suggest to upgrade the SaltStack installation when you are still using a version that is older than that.
1818

19+
IMPORTANT: Since the start of SaltGUI in 2016 and until early 2026, the SaltGUI team used ES6/ES2015 only.
20+
As time passes, that has now become an old version. We now upgrade SaltGUI to use the ES version that was current 5 years ago.
21+
That means we do not force that the latest browser is used.
22+
But note that browsers that are older than that are not detected and failures may then occur.
23+
1924
[![CodeQL](https://github.com/erwindon/SaltGUI/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/erwindon/SaltGUI/actions/workflows/codeql-analysis.yml)
2025

2126
## Screenshots
@@ -696,7 +701,7 @@ So the simple advice is to upgrade when this occurs.
696701

697702

698703
## Contributing
699-
Open a PR! Try to use no dependencies where possible, as vanilla JS is the aim. Any libraries will need to be heavily considered first. Please see the section above as PRs won't be reviewed if they don't pass the tests.
704+
Open a PR! Try to use no dependencies where possible, as plain JS is the aim. Any libraries will need to be heavily considered first. Please see the section above as PRs won't be reviewed if they don't pass the tests.
700705

701706

702707
## Credits

saltgui/static/scripts/CommandBox.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,10 @@ export class CommandBox {
381381
for (const panel of Router.currentPage.panels) {
382382
if (readOnlyScreens.includes(panel.key)) {
383383
// nothing changed on this screen
384-
} else if (screenModifyingCommands[command].indexOf(panel.key) >= 0) {
385-
// Arrays.includes() is only available from ES7/2016
384+
} else if (screenModifyingCommands[command].includes(panel.key)) {
386385
// the command may have changed a specific panel
387386
panel.needsRefresh = true;
388-
} else if (screenModifyingCommands[command].indexOf("*") >= 0) {
389-
// Arrays.includes() is only available from ES7/2016
387+
} else if (screenModifyingCommands[command].includes("*")) {
390388
// the command may have changed any panel
391389
panel.needsRefresh = true;
392390
}

saltgui/static/scripts/Router.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ export class Router {
142142
document.getElementById("button-" + pButtonId + nr).
143143
addEventListener("click", (pClickEvent) => {
144144
const pages = Router._getPagesList();
145-
// Arrays.includes() is only available from ES7/2016
146-
if (pUrl && (pButtonId === "logout" || pages.length === 0 || pages.indexOf(pButtonId) >= 0)) {
145+
if (pUrl && (pButtonId === "logout" || pages.length === 0 || pages.includes(pButtonId))) {
147146
this.goTo(pUrl);
148147
}
149148
// hide the menu, it will stay hidden when the mouse is not over it
@@ -244,8 +243,7 @@ export class Router {
244243
let visible = true;
245244

246245
// do not show unwanted menu items
247-
// Arrays.includes() is only available from ES7/2016
248-
if (pPages.length && pPages.indexOf(pPage.path) < 0) {
246+
if (pPages.length && !pPages.includes(pPage.path)) {
249247
visible = false;
250248
}
251249

@@ -262,8 +260,7 @@ export class Router {
262260
// still show a menu item when a child is visible
263261
let hasVisibleChild = false;
264262
for (const page of pChildren) {
265-
// Arrays.includes() is only available from ES7/2016
266-
if (pPages.indexOf(page) >= 0) {
263+
if (pPages.includes(page)) {
267264
hasVisibleChild = true;
268265
break;
269266
}

saltgui/static/scripts/pages/Page.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ export class Page {
7878

7979
const pages = Router._getPagesList();
8080
const page = Utils.getStorageItem("session", "menu_" + keyUpEvent.key, "");
81-
// Arrays.includes() is only available from ES7/2016
82-
if (page && (pages.length === 0 || pages.indexOf(page) >= 0)) {
81+
if (page && (pages.length === 0 || pages.includes(page))) {
8382
this.router.goTo(page);
8483
return true;
8584
}

saltgui/static/scripts/panels/Keys.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@ export class KeysPanel extends Panel {
241241
if (!Object.keys(pMinionsDict).length) {
242242
// list of well-known minion is empty
243243
// assume we actually don't known
244-
245-
// Arrays.includes() is only available from ES7/2016
246-
} else if (!pIsMissing && Object.keys(pMinionsDict).indexOf(pMinionId) >= 0) {
244+
} else if (!pIsMissing && Object.keys(pMinionsDict).includes(pMinionId)) {
247245
// this is a known minion
248246
} else {
249247
// this is an unknown minion

saltgui/static/scripts/panels/Options.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,7 @@ export class OptionsPanel extends Panel {
377377
}
378378
const id = "option-" + name + "-value-" + valueArr[0] + "-" + label;
379379
const thisElement = document.getElementById(id);
380-
// Arrays.includes() is only available from ES7/2016
381-
if (value && varr.indexOf(label) >= 0) {
380+
if (value && varr.includes(label)) {
382381
thisElement.checked = true;
383382
}
384383
}

0 commit comments

Comments
 (0)