feat: add index.html with test questions - #10
Merged
Merged
Conversation
Member
|
Form loads fine from http server, I was able to add values and generate json. There are no AC but I think that's the only requirement--there's no backend DB or any way to persist the generated json. There's a lot of fields so I just spot checked a handful, not all of them, but for what I did check, LGTM. Going to merge myself since Jackson is on PTO. |
There was a problem hiding this comment.
Pull request overview
Adds a standalone static HTML page that loads a CCDF/SECCDF release JSON and generates an interactive “answer form” UI for filling responses, validating basic field shapes, and exporting/copying the resulting JSON payload.
Changes:
- Adds
index.htmlwith inline CSS + JS to load a framework schema (URL or local file) and render steps/sections/fields dynamically. - Implements lightweight client-side collection/validation for booleans, options, arrays, tables, and JSON-typed fields.
- Adds JSON preview + clipboard copy + clear actions.
Comments suppressed due to low confidence (2)
index.html:399
- For array-with-options fields, the main field label targets
fieldId(field)but the checkboxes are created with ids like${fieldId(field)}_0, so the label’sforpoints at a non-existent id. Update the main label to point at the first checkbox id.
// Array with options → multi-checkbox group
if (type === "array" && hasOptions) {
const group = el("div", { class: "options-group", "data-role": "checkbox-array" });
field.options.forEach((o, i) => {
const cbId = `${fieldId(field)}_${i}`;
group.appendChild(el("label", { for: cbId },
el("input", { type: "checkbox", id: cbId, value: o }),
el("span", {}, o),
));
});
wrap.appendChild(group);
return wrap;
index.html:409
- For freeform array fields, the main field label targets
fieldId(field)but the generated row inputs have no id, so clicking the label won’t focus the field. AssignfieldId(field)to the first row’s input so the label points to a real control.
// Array (freeform) → repeatable rows
if (type === "array") {
const list = el("div", { class: "array-list", "data-role": "string-array" });
const addBtn = el("button", { type: "button", class: "mini", onclick: () => list.appendChild(makeArrayRow(list)) }, "+ Add item");
list.appendChild(makeArrayRow(list));
wrap.appendChild(list);
wrap.appendChild(addBtn);
return wrap;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| form.innerHTML = ""; | ||
| $("#result-panel").textContent = "// Answers appear here after validation"; | ||
| if (!state.schema) return; | ||
| const topic = state.schema.topic[state.topicIndex]; |
Comment on lines
+689
to
+696
| const topic = state.schema.topic[state.topicIndex]; | ||
| const output = { | ||
| $framework: state.schema.$framework, | ||
| frameworkName: state.schema.name, | ||
| frameworkVersion: state.schema.version, | ||
| topic: topic.name, | ||
| answers, | ||
| }; |
| </header> | ||
|
|
||
| <main> | ||
| <div id="status"></div> |
Comment on lines
+352
to
+357
| // Table (object with table schema) → dynamic rows | ||
| if (hasTable) { | ||
| const columns = field.table[0].columns || []; | ||
| wrap.appendChild(renderTable(field, columns)); | ||
| return wrap; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.