webapp: shopfloor sub-menu tab + nav rename (the edits dropped by a failed git add)
The prior 'nest shopfloor menu as a tab' commit only captured the shopfloor_menu.html deletion - the git add also named the just-removed file, which errored the add and staged nothing else. This commits the actual integration that was already deployed to preview and prod: startnet_editor GET passes shopfloor_items/shopfloor_available, the Shopfloor Sub-Menu tab pane + sf-prefixed JS in startnet_editor.html, /shopfloor-menu redirects into the tab, and the sidebar 'startnet.cmd' -> 'Boot Menu' rename.
This commit is contained in:
@@ -1026,6 +1026,8 @@ def startnet_editor():
|
||||
boot_menu=boot_menu,
|
||||
lint=lint,
|
||||
snapshots=snapshots,
|
||||
shopfloor_items=read_shopfloor_menu(),
|
||||
shopfloor_available=available_pctypes(),
|
||||
image_types=config.IMAGE_TYPES,
|
||||
friendly_names=config.FRIENDLY_NAMES,
|
||||
)
|
||||
@@ -1225,7 +1227,7 @@ def shopfloor_menu():
|
||||
items = json.loads(request.form.get("items", "[]"))
|
||||
except json.JSONDecodeError:
|
||||
flash("Invalid menu payload.", "danger")
|
||||
return redirect(url_for("shopfloor_menu"))
|
||||
return redirect(url_for("startnet_editor") + "#tab-shopfloor")
|
||||
valid = set(available_pctypes())
|
||||
clean = []
|
||||
for it in items:
|
||||
@@ -1246,7 +1248,7 @@ def shopfloor_menu():
|
||||
})
|
||||
if not clean:
|
||||
flash("Refused to save an empty menu.", "danger")
|
||||
return redirect(url_for("shopfloor_menu"))
|
||||
return redirect(url_for("startnet_editor") + "#tab-shopfloor")
|
||||
try:
|
||||
os.makedirs(SHOPFLOOR_SETUP_DIR, exist_ok=True)
|
||||
with open(SHOPFLOOR_MENU_JSON, "w") as fh:
|
||||
@@ -1255,15 +1257,9 @@ def shopfloor_menu():
|
||||
flash("Shopfloor boot menu saved - WinPE reads it at next boot.", "success")
|
||||
except OSError as exc:
|
||||
flash(f"Could not write menu.json: {exc}", "danger")
|
||||
return redirect(url_for("shopfloor_menu"))
|
||||
return redirect(url_for("startnet_editor") + "#tab-shopfloor")
|
||||
|
||||
return render_template(
|
||||
"shopfloor_menu.html",
|
||||
items=read_shopfloor_menu(),
|
||||
available=available_pctypes(),
|
||||
image_types=config.IMAGE_TYPES,
|
||||
friendly_names=config.FRIENDLY_NAMES,
|
||||
)
|
||||
return redirect(url_for("startnet_editor") + "#tab-shopfloor")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user