Implement Branch Management UI adhering to Sztab Visual Grammar (SZ-48)
rk@tigase.net opened 1 week ago

This issue tracks the implementation of the Branch Management UI for Sztab.
The backend REST endpoints for Branch entities already exist (create, update, list, delete), but the frontend has no corresponding UI. This task brings Branches to parity with the existing Users, Git Repos, and Projects management screens.

Scope

Implement a complete Branch Management feature in the Sztab frontend, including:

  • Listing branches
  • Creating a new branch
  • Editing an existing branch
  • Deleting a branch
  • Displaying related project and creator information in human-friendly form (not raw IDs)

This UI will follow the same patterns and visual grammar established in SZ-44 (Project Management UI).

Deliverables

1. Type Definitions

Create src/types/branch.ts:

  • BranchDto
  • BranchCreateDto
  • BranchUpdateDto

Fields must reflect the backend model:

  • id
  • name
  • description
  • projectId + projectName
  • creatorId + creatorUsername
  • parentId + parentName (nullable)
  • createdAt / updatedAt
  • any additional fields present in the backend entity

2. API Wrapper

Create src/api/branches.ts:

  • getBranches(page, size, sort, order) → paginated list
  • getBranchById(id)
  • createBranch(dto)
  • updateBranch(id, dto)
  • deleteBranch(id)

API must consume/produce paginated responses similar to users, repos, and projects.

3. Branch List Page

Create src/pages/BranchListPage.tsx:

  • Uses paginated list from /api/branches
  • Displays:
    • Branch name
    • Description
    • Project (name)
    • Creator (username)
    • Parent (name or “—”)
    • Created / updated timestamps
  • Includes “Add Branch” button
  • Includes Edit/Delete actions
  • Uses consistent table formatting with Users/GitRepos/Projects pages

4. Create Branch Modal

Create src/components/branch/CreateBranchModal.tsx:

  • Dropdown: select project (API: /api/projects)
  • Dropdown: select creator (API: /api/users)
  • Optional dropdown: select parent branch (API: /api/branches but paged; show only first N or client-filter)
  • Fields: name, description
  • Submit via createBranch()

Must match the UI style used for Project Create modal.

5. Edit Branch Modal

Create src/components/branch/EditBranchModal.tsx:

  • Pre-populates all fields using getBranchById(id)
  • Allows editing name, description, project, parent, creator
  • Submit via updateBranch()

6. Delete Flow

  • Use standard browser confirm() for now
  • Replace later with shared ConfirmDialog component (separate issue)

7. Routing

Add Branch Management to admin navigation and routing:

  • /branches → BranchListPage

Acceptance Criteria

  • UI compiles with no TypeScript errors
  • Branch list loads correctly
  • Create, edit, delete all work end-to-end
  • Dropdowns show human-friendly names (project name, username, parent branch name)
  • Consistency with visual grammar introduced in SZ-44
  • No console errors
  • Production npm run build passes cleanly

Notes

Backend entities and services for Branch are already present but may require minor DTO adjustments during integration (e.g., exposing project/creator names). Any necessary backend tweaks should be included in this issue.

  • rk@tigase.net commented 1 week ago

    Worklog — SZ-44: Implement Branch Management UI (Phase 1)

    Scope

    Implement the core CRUD user interface for managing branches:

    • List branches
    • Create branch
    • Edit branch
    • Delete branch
    • Associate a branch with a project
    • Paginated backend integration

    Lineage visualization is explicitly excluded and deferred to a follow-up issue.


    Tasks Completed

    1. Type Definitions (src/types/branch.ts)

    • Added BranchDto with id, name, description, createdAt, updatedAt, projectId, etc.
    • Added BranchCreateDto and BranchUpdateDto.
    • Ensured consistency with Project and GitRepo type patterns.

    Time: 0.3h


    2. API Layer (src/api/branches.ts)

    • Added GET paginated branches.
    • Added POST create branch.
    • Added PUT update branch.
    • Added DELETE branch.
    • All endpoints tested against backend controller.

    Time: 0.4h


    3. Branch List Page (src/pages/BranchListPage.tsx)

    • Implemented table listing branches.
    • Show project name instead of projectId.
    • Added pagination controls.
    • Added action buttons for edit/delete.
    • Integrated with toast notifications.

    Time: 1.0h


    4. CreateBranchModal

    • Modal with validated inputs.
    • Dropdown for selecting Project.
    • Auto-fill defaults and error handling.
    • WIP badge for consistency with other UI modules.

    Time: 0.6h


    5. EditBranchModal

    • Preload selected branch data.
    • Allow updating name/description/project.
    • Null-safe logic matching ProjectEditor patterns.

    Time: 0.6h


    6. Integrations & Walkthrough Testing

    • Added route in App.tsx sidebar.
    • Verified navigation from sidebar → branches.
    • Verified backend links for project → branches.
    • Verified delete workflows.

    Time: 0.7h


    Total Time

    4.0h – 5.0h


    Notes

    • Branch lineage visualization will be implemented as a separate issue (SZ-XX).
    • UI is stable and consistent with established Sztab design grammar.
    • Backend model supports all required CRUD operations.
  • rk@tigase.net changed state to 'In Progress' 18 hours ago
    Previous Value Current Value
    Open
    In Progress
  • rk@tigase.net commented 18 hours ago

    Work Log — SZ-48: Branch Management UI

    Date: 2025-12-10

    Summary of Work Completed

    • Implemented full Branch Management UI under /projects/:id/branches.
    • Added dark-mode Create Branch and Edit Branch modals, consistent with Project modals.
    • Integrated BranchIcon into modal headers for unified visual grammar.
    • Added parent-branch dropdown in Create and Edit modals.
    • Implemented validation to prevent selecting a branch as its own parent.
    • Added status editing in Edit Branch modal.
    • Added delete-branch function with confirmation dialog.
    • Disabled delete button for default branches (parentId = null) with tooltip “Default branch cannot be deleted”.
    • Standardized typography in modals (bold/italic labels, regular input fields).
    • Refined toaster styling: smaller font, cleaner UI.
    • Added onUpdated wiring to refresh branch list after Create or Edit.
    • Updated frontend DTO types (ProjectDto, BranchDto, create/update request interfaces).
    • Updated App.tsx wiring for toaster and modal consistency.
    • Verified behavior across Create, Edit, Delete, and validation scenarios.
    • Merged the entire feature into main branch wolnosc.

    Testing Performed

    • Verified listing of project branches.
    • Created new branches with/without parents.
    • Ensured invalid parent choices (branch as its own parent) are rejected.
    • Verified parent dropdown population.
    • Confirmed default branches cannot be deleted.
    • Verified toaster messages throughout success/error flows.
    • Ensured UI reloads immediately after Create/Edit/Delete.
    • Confirmed no regressions to Project management UI.

    Outcome

    SZ-48 Branch Management UI is fully implemented, stable, and merged into wolnosc.
    Feature branch feature/SZ-48-Branch-Management-UI is no longer required.

    Branch Cleanup (optional)

    To delete the feature branch:

    Local: git branch -d feature/SZ-48-Branch-Management-UI

    Remote: git push origin –delete feature/SZ-48-Branch-Management-UI

    Closing Note

    Branch Management UI (SZ-48) is now complete and merged into wolnosc.
    This issue may be safely closed.

  • rk@tigase.net changed state to 'Closed' 18 hours ago
    Previous Value Current Value
    In Progress
    Closed
  • rk@tigase.net commented 18 hours ago

    rksuma@Ramakrishnans-MacBook-Pro sztab % git branch -d feature/SZ-48-Branch-Management-UI Deleted branch feature/SZ-48-Branch-Management-UI (was 651690a). rksuma@Ramakrishnans-MacBook-Pro sztab %

  • rk@tigase.net referenced from other issue 18 hours ago
issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Version
none
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-48
Please wait...
Page is in error, reload to recover