Skip to content

Commit

Permalink
Merge pull request #536 from spankywetfish/master
Browse files Browse the repository at this point in the history
Make runtype switch from "normal" to "async" a sticky setting
  • Loading branch information
erwindon authored Aug 16, 2023
2 parents 442cc51 + 35a5e95 commit 33e2c9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion saltgui/static/scripts/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ export class API {
}

static _cleanStorage () {
// clear local storage except key 'eauth'
// clear local storage except key 'eauth' and 'runtype'
const eauth = Utils.getStorageItem("local", "eauth");
const runtype = Utils.getStorageItem("local", "runtype");
Utils.clearStorage("local");
Utils.setStorageItem("local", "eauth", eauth);
Utils.setStorageItem("local", "runtype", runtype);

// clear all of session storage
Utils.clearStorage("session");
Expand Down
14 changes: 11 additions & 3 deletions saltgui/static/scripts/RunType.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export class RunType {
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;
Expand All @@ -43,17 +46,22 @@ export class RunType {
}

static setRunTypeDefault () {
RunType.menuRunType._value = "normal";
// Retrieve last used runType
let runType = Utils.getStorageItem("local", "runtype");
// Set default if previous runtype not stored
if (runType !== "normal" && runType !== "async") {
runType = "normal";
}
RunType._updateRunTypeText();
// reset the title to the absolute minimum
// so that the menu does not stand out in trivial situations
RunType.menuRunType.setTitle("");
}

static getRunType () {
const runType = RunType.menuRunType._value;
let runType = RunType.menuRunType._value;
if (runType === undefined || runType === "") {
return "normal";
runType = Utils.getStorageItem("local", "runtype", "normal");
}
return runType;
}
Expand Down

0 comments on commit 33e2c9e

Please sign in to comment.