Skip to content

fix(desktop): add native client workspace quota endpoint - #7402

Merged
cuisongliu merged 1 commit into
labring:release-v5.1from
mlhiter:dallas/pasted-text-issue
Oct 21, 2026
Merged

cuisongliu merged 1 commit into
labring:release-v5.1from
mlhiter:dallas/pasted-text-issue

Conversation

@mlhiter

@mlhiter mlhiter commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

Native desktop billing overviews fail when the missing /api/workspace/getQuota route returns 404, causing the combined balance/quota request to reject.
Add a read-only adapter that authenticates regional tokens, reads the token workspace's ResourceQuota using user RBAC, and returns CPU, memory, storage, Pod and NodePort quotas in the existing client contract, with documented units and error behavior.

Sequence Diagram

sequenceDiagram
    participant Client as Native desktop
    participant API as GET /api/workspace/getQuota
    participant Auth as Regional token verification
    participant K8s as Kubernetes API
    Client->>API: Request quota with regional token
    API->>Auth: Verify token and workspace
    alt Invalid token
        Auth-->>API: Reject
        API-->>Client: Envelope code 401
    else Valid token
        Auth-->>API: User identity and workspaceId
        API->>K8s: Read quota-workspaceId with user credentials
        alt Read and normalization succeed
            K8s-->>API: ResourceQuota status
            API-->>Client: data.quota in millicores, Mi and counts
        else Read or normalization fails
            API-->>Client: Error envelope with data null
        end
    end
Loading

Validation

Passed 27 targeted quota/balance tests, ESLint for all changed TypeScript files, and a focused TypeScript check for quota normalization; deployment and authenticated live-client acceptance remain unverified.

@mlhiter
mlhiter requested a review from a team as a code owner October 21, 2026 09:39
@cuisongliu cuisongliu added this to the v5.2 milestone Oct 21, 2026
@cuisongliu
cuisongliu merged commit d665855 into labring:release-v5.1 Oct 21, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants