Auth for submodule ops, revision checkout, central confirm dialog, unified sidebar sizing #46

Merged
Christoph merged 0 commits from refs/pull/46/head into main 2026-09-18 08:26:46 +00:00
Christoph commented 2026-09-17 21:12:47 +00:00 (Migrated from git.cbsk-tech.de)

This change combines several UI/UX and submodule-related updates:

  • Submodule authentication and revision checkout:

    • Submodule actions (add, action commands) now accept optional username/password and forward them to submodule Git commands. The low-level helper submodule_git was extended to call run_git_authenticated when credentials are provided.
    • Auth failures from Git are classified: non-success output is inspected and returned with an "AUTH_FAILED:" prefix for authentication-specific errors.
    • A new checkout flow for submodules was added (checkout_revision + checkout_submodule_revision Tauri command). It supports selecting a local tag or entering a commit hash, validates the input, ensures the submodule is initialized and clean (no local changes or conflicts), checks refs locally, and performs a detached checkout without changing the parent index.
    • add_submodule and submodule_action endpoints were extended to accept username/password; README updated to document choosing a tag/commit and fetching remote revisions.
    • Unit tests were added for authenticated submodule command handling, classification of auth failures, and submodule revision checkout behavior.
  • Frontend: centralized confirmation dialog and submodule UI state

    • App.svelte now imports and wires a centralized ConfirmDialog and provides a small API around it: askConfirmation / requestConfirmation / answerConfirmation and a ConfirmAnswer shape (confirmed, value, checked). This enables confirmations that include an input field and a checkbox (used for several flows such as branch delete and discard confirmations).
    • Helper builders for common confirmation variants were added (branchDeleteConfirmRequest and discardConfirmRequest) that use i18n t(...).
    • Added front-end state for submodule authentication prompts (submoduleAuthRequest, submoduleAuthError, submoduleAuthSaving) and exposed checkoutSubmoduleRevision in the client command imports.
    • setLanguage from i18n is invoked when applying language preferences.
  • Sidebar panel sizing refactor

    • The left sidebar panel sizing was unified: multiple per-panel height keys and handlers were replaced with a single model describing panel order, per-panel min/default heights, a SIDEBAR_PANEL_HEIGHTS_KEY (v2) localStorage entry, and functions to load/persist heights and compute clamp/resize behavior.
    • Previous per-panel storage keys and individual resize state were removed in favor of a single sidebarPanelHeights record and shared resize handling.

Notes on scope and implementation details:

  • Back-end: changes live in src-tauri/src/git/submodules.rs. Key additions are operate_authenticated, submodule_git accepting credentials, checkout_revision, checkout_submodule_revision Tauri command, and tests in the same module.
  • Front-end: changes live in src/App.svelte: confirm dialog plumbing, i18n setLanguage usage, sidebar sizing constants and persistence, and submodule auth UI state.
  • The README change documents the new revision selection and fetch behavior for submodules.

Testing

  • Tests were added in src-tauri/src/git/submodules.rs (unit tests covering authenticated command handling, auth failure classification, and checkout behavior). No test execution results were provided.
  • Recommended reviewer checks (manual / local):
    1. Run the repository unit tests (cargo test) to exercise the new submodule tests.
    2. Verify a submodule flow in the app: initialize a submodule, use "Fetch tags & commits", then use the "Change commit or tag" flow to select a tag and a commit and confirm the parent index is not staged.
    3. Confirm auth behavior: trigger a submodule Git operation against a repo that requires credentials and verify the AUTH_FAILED classification leads to the expected login prompt in the UI.
    4. Verify sidebar behavior: resize panels, reload the app, and confirm sizes persist to localStorage under gitlite.sidebarPanelHeights.v2 and that older per-panel keys are ignored.
    5. Check confirm dialog variations (simple yes/no, with input, with checkbox) and i18n strings render via t(...).

Compatibility and reviewer notes

  • LocalStorage migration: the previous per-panel height keys have been replaced by SIDEBAR_PANEL_HEIGHTS_KEY (gitlite.sidebarPanelHeights.v2). Existing stored values for the old keys will not be read; reviewers should note that sidebar sizes will fall back to defaults on upgrade unless migration is intentionally added.
  • Error string prefix: authentication errors are returned with an "AUTH_FAILED:" prefix. Consumers should treat that prefix as a signal to show credential prompts; it is used by the added tests.
  • New Tauri command: checkout_submodule_revision is exported from src-tauri/src/main.rs and imported in the frontend (checkoutSubmoduleRevision). Reviewers should verify Tauri command registration and any frontend code that invokes this command.
  • No claims are made about test runs or CI; the description only reports added tests and code changes. No test execution results were provided.
This change combines several UI/UX and submodule-related updates: - Submodule authentication and revision checkout: - Submodule actions (add, action commands) now accept optional username/password and forward them to submodule Git commands. The low-level helper submodule_git was extended to call run_git_authenticated when credentials are provided. - Auth failures from Git are classified: non-success output is inspected and returned with an "AUTH_FAILED:" prefix for authentication-specific errors. - A new checkout flow for submodules was added (checkout_revision + checkout_submodule_revision Tauri command). It supports selecting a local tag or entering a commit hash, validates the input, ensures the submodule is initialized and clean (no local changes or conflicts), checks refs locally, and performs a detached checkout without changing the parent index. - add_submodule and submodule_action endpoints were extended to accept username/password; README updated to document choosing a tag/commit and fetching remote revisions. - Unit tests were added for authenticated submodule command handling, classification of auth failures, and submodule revision checkout behavior. - Frontend: centralized confirmation dialog and submodule UI state - App.svelte now imports and wires a centralized ConfirmDialog and provides a small API around it: askConfirmation / requestConfirmation / answerConfirmation and a ConfirmAnswer shape (confirmed, value, checked). This enables confirmations that include an input field and a checkbox (used for several flows such as branch delete and discard confirmations). - Helper builders for common confirmation variants were added (branchDeleteConfirmRequest and discardConfirmRequest) that use i18n t(...). - Added front-end state for submodule authentication prompts (submoduleAuthRequest, submoduleAuthError, submoduleAuthSaving) and exposed checkoutSubmoduleRevision in the client command imports. - setLanguage from i18n is invoked when applying language preferences. - Sidebar panel sizing refactor - The left sidebar panel sizing was unified: multiple per-panel height keys and handlers were replaced with a single model describing panel order, per-panel min/default heights, a SIDEBAR_PANEL_HEIGHTS_KEY (v2) localStorage entry, and functions to load/persist heights and compute clamp/resize behavior. - Previous per-panel storage keys and individual resize state were removed in favor of a single sidebarPanelHeights record and shared resize handling. Notes on scope and implementation details: - Back-end: changes live in src-tauri/src/git/submodules.rs. Key additions are operate_authenticated, submodule_git accepting credentials, checkout_revision, checkout_submodule_revision Tauri command, and tests in the same module. - Front-end: changes live in src/App.svelte: confirm dialog plumbing, i18n setLanguage usage, sidebar sizing constants and persistence, and submodule auth UI state. - The README change documents the new revision selection and fetch behavior for submodules. Testing - Tests were added in src-tauri/src/git/submodules.rs (unit tests covering authenticated command handling, auth failure classification, and checkout behavior). No test execution results were provided. - Recommended reviewer checks (manual / local): 1) Run the repository unit tests (cargo test) to exercise the new submodule tests. 2) Verify a submodule flow in the app: initialize a submodule, use "Fetch tags & commits", then use the "Change commit or tag" flow to select a tag and a commit and confirm the parent index is not staged. 3) Confirm auth behavior: trigger a submodule Git operation against a repo that requires credentials and verify the AUTH_FAILED classification leads to the expected login prompt in the UI. 4) Verify sidebar behavior: resize panels, reload the app, and confirm sizes persist to localStorage under gitlite.sidebarPanelHeights.v2 and that older per-panel keys are ignored. 5) Check confirm dialog variations (simple yes/no, with input, with checkbox) and i18n strings render via t(...). Compatibility and reviewer notes - LocalStorage migration: the previous per-panel height keys have been replaced by SIDEBAR_PANEL_HEIGHTS_KEY (gitlite.sidebarPanelHeights.v2). Existing stored values for the old keys will not be read; reviewers should note that sidebar sizes will fall back to defaults on upgrade unless migration is intentionally added. - Error string prefix: authentication errors are returned with an "AUTH_FAILED:" prefix. Consumers should treat that prefix as a signal to show credential prompts; it is used by the added tests. - New Tauri command: checkout_submodule_revision is exported from src-tauri/src/main.rs and imported in the frontend (checkoutSubmoduleRevision). Reviewers should verify Tauri command registration and any frontend code that invokes this command. - No claims are made about test runs or CI; the description only reports added tests and code changes. No test execution results were provided.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Christoph/Gitty!46
No description provided.