Skip to content

Commit f0e929b

Browse files
committed
Make Vote Review the Toolbox metadata SSoT - PR_26160_065-toolbox-vote-review-ssot
1 parent d4361f7 commit f0e929b

27 files changed

Lines changed: 516 additions & 807 deletions

admin/tool-votes.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ <h2>Vote Review</h2>
5454
<span class="pill">Selected Group: <span data-toolbox-votes-selected-group>None</span></span>
5555
<span class="pill">Selected Path: <span data-toolbox-votes-selected-path>None</span></span>
5656
</div>
57+
<div class="content-cluster" aria-label="Selected Toolbox metadata editor">
58+
<label>Group <select data-toolbox-votes-group-edit disabled></select></label>
59+
<label>Path <input type="text" data-toolbox-votes-path-edit disabled></label>
60+
<label>Status <select data-toolbox-votes-status-edit disabled></select></label>
61+
<button class="btn btn--compact" type="button" data-toolbox-votes-metadata-save disabled>Update Metadata</button>
62+
</div>
5763
<div class="table-wrapper">
5864
<table class="data-table" aria-label="Toolbox vote totals">
5965
<caption>Toolbox Vote Totals</caption>

admin/tool-votes.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
readToolboxVoteSnapshot,
33
reorderToolboxVoteRows,
4+
updateToolboxVoteMetadata,
45
} from "../src/engine/api/toolbox-votes-api-client.js";
56

67
const status = document.querySelector("[data-toolbox-votes-status]");
@@ -14,11 +15,22 @@ const sortHeaders = Array.from(document.querySelectorAll("[data-toolbox-votes-so
1415
const widthLayout = document.querySelector("[data-toolbox-votes-layout]");
1516
const widthToggle = document.querySelector("[data-toolbox-votes-width-toggle]");
1617
const widthStatus = document.querySelector("[data-toolbox-votes-width-status]");
18+
const groupEdit = document.querySelector("[data-toolbox-votes-group-edit]");
19+
const pathEdit = document.querySelector("[data-toolbox-votes-path-edit]");
20+
const statusEdit = document.querySelector("[data-toolbox-votes-status-edit]");
21+
const metadataSave = document.querySelector("[data-toolbox-votes-metadata-save]");
1722
const sortButtonLabels = new Map(sortButtons.map((button) => [
1823
button.dataset.toolboxVotesSort,
1924
button.textContent.trim(),
2025
]));
2126

27+
const RELEASE_CHANNEL_OPTIONS = Object.freeze([
28+
["planned", "Planned"],
29+
["wireframe", "Wireframe"],
30+
["beta", "Beta"],
31+
["complete", "Complete"],
32+
]);
33+
2234
const SORT_TYPES = Object.freeze({
2335
down: "number",
2436
downPercent: "number",
@@ -143,6 +155,58 @@ function setSelectedDetails(voteRow) {
143155
if (selectedPath) {
144156
selectedPath.textContent = voteRow?.path || "None";
145157
}
158+
setMetadataEditor(voteRow);
159+
}
160+
161+
function option(value, label = value) {
162+
const node = document.createElement("option");
163+
node.value = value;
164+
node.textContent = label;
165+
return node;
166+
}
167+
168+
function populateGroupOptions(rows) {
169+
if (!groupEdit) {
170+
return;
171+
}
172+
const selectedValue = groupEdit.value;
173+
const groups = [...new Set(rows.map((row) => row.group).filter(Boolean))].sort((left, right) => left.localeCompare(right));
174+
groupEdit.replaceChildren(...groups.map((group) => option(group)));
175+
if (groups.includes(selectedValue)) {
176+
groupEdit.value = selectedValue;
177+
}
178+
}
179+
180+
function populateStatusOptions() {
181+
if (!statusEdit || statusEdit.childElementCount) {
182+
return;
183+
}
184+
statusEdit.replaceChildren(...RELEASE_CHANNEL_OPTIONS.map(([value, label]) => option(value, label)));
185+
}
186+
187+
function setMetadataEditor(voteRow) {
188+
populateStatusOptions();
189+
const disabled = !voteRow;
190+
[groupEdit, pathEdit, statusEdit, metadataSave].forEach((control) => {
191+
if (control) {
192+
control.disabled = disabled;
193+
}
194+
});
195+
if (!voteRow) {
196+
if (groupEdit) groupEdit.value = "";
197+
if (pathEdit) pathEdit.value = "";
198+
if (statusEdit) statusEdit.value = "planned";
199+
return;
200+
}
201+
if (groupEdit) {
202+
groupEdit.value = voteRow.group || "";
203+
}
204+
if (pathEdit) {
205+
pathEdit.value = voteRow.path || "";
206+
}
207+
if (statusEdit) {
208+
statusEdit.value = voteRow.releaseChannel || "planned";
209+
}
146210
}
147211

148212
function selectRow(toolId) {
@@ -216,6 +280,7 @@ function renderRows(rows) {
216280
return;
217281
}
218282
snapshotRows = rows;
283+
populateGroupOptions(snapshotRows);
219284
updateSortHeaders();
220285
updateDragStatus();
221286
const displayRows = sortedRows();
@@ -320,4 +385,23 @@ widthToggle?.addEventListener("click", () => {
320385
}
321386
});
322387

388+
metadataSave?.addEventListener("click", () => {
389+
if (!selectedToolId) {
390+
setStatus("Select a Toolbox row before updating metadata.");
391+
return;
392+
}
393+
try {
394+
const snapshot = updateToolboxVoteMetadata(selectedToolId, {
395+
group: groupEdit?.value || "",
396+
path: pathEdit?.value || "",
397+
releaseChannel: statusEdit?.value || "planned",
398+
});
399+
renderSnapshot(snapshot, "Toolbox metadata updated. Reload Toolbox Build Path to see the SSoT values.");
400+
selectRow(selectedToolId);
401+
} catch (error) {
402+
const message = error instanceof Error ? error.message : String(error || "Toolbox metadata update unavailable.");
403+
setStatus(`Toolbox metadata could not be updated. ${message}`);
404+
}
405+
});
406+
323407
renderToolboxVotes();

admin/tools-progress.html

Lines changed: 0 additions & 72 deletions
This file was deleted.

admin/tools-progress.js

Lines changed: 0 additions & 158 deletions
This file was deleted.

assets/theme-v2/js/gamefoundry-partials.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"admin-tool-votes": "admin/tool-votes.html",
106106
"admin-moderation": "admin/moderation.html",
107107
"admin-analytics": "admin/analytics.html",
108-
"admin-tools-progress": "admin/tools-progress.html",
109108
"cookie-policy": "legal/cookie-policy.html",
110109
disclaimer: "legal/disclaimer.html",
111110
"privacy-policy": "legal/privacy-policy.html",
@@ -154,8 +153,7 @@
154153
Object.freeze({ label: "Environments", route: "environments" }),
155154
Object.freeze({ label: "Game Migration", route: "game-migration" }),
156155
Object.freeze({ label: "Grouping Colors", route: "admin-grouping-colors" }),
157-
Object.freeze({ label: "Notes", href: "/admin/admin-notes.html", localNotes: true }),
158-
Object.freeze({ label: "Tools Progress", route: "admin-tools-progress" })
156+
Object.freeze({ label: "Notes", href: "/admin/admin-notes.html", localNotes: true })
159157
]);
160158

161159
function assetUrl(path) {

0 commit comments

Comments
 (0)