Skip to content

[scanner] πŸ› [v5] Knowledge: inline required-field errors for Add Git Source / Add Sub / Import formsΒ #17587

Closed

Description

@hivecommons-hive

Part of #17583 (part 1 of 2).

Symptom

On the dashboard Knowledge panel, "Add Git Source" β†’ Clone & Index with an empty Display name (or URL) appears to do nothing. kbAddGitSource (src/pkg/dashboard/static-src/js/knowledge.js) does validate, but hiveAlert (tooltips-dialogs.js) routes short messages to a transient info toast far from the form, so the failure reads as "nothing happened". Same pattern in kbAddSub ("URL is required") and the hub-side Import form.

Fix

  • Add a small shared helper in knowledge.js that marks the offending <input> with a .field-invalid class (red border) and aria-invalid="true", focuses it, and renders the message in a <div class="field-error" role="alert"> directly under the input. Clear the state on input.
  • If a toast is kept, use showToast(msg, 'error') (sticky) rather than info.
  • Mark required inputs (required attribute + label/placeholder marker).
  • Apply to kbAddGitSource, kbAddSub, and the hub-side Import form.
  • Tests: JS validation helper test if a harness exists for knowledge.js; rebuild static/index.html from the manifest if that is how this repo ships static-src.

Acceptance

Clicking Clone & Index with an empty required field highlights the field, focuses it, and shows the message under it.

Decision taken by hive: #17583 is split into two children because inline validation (JS/CSS only) and the edit endpoint (server + UI) are independent concerns; this one lands first since both touch knowledge.js.

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/scannerCreated or modified by the scanner agentbugSomething isn't workinghelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions