-
Notifications
You must be signed in to change notification settings - Fork 4
Fix/control panel refresh #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Caution Review failedThe pull request is closed. WalkthroughRefactors control panel caching and eVault retrieval with lazy server-only LowDB initialization, background cache refresh, and improved error/UI states. Updates Kubernetes service IP discovery for NodePort URLs. Adds group-aware access control for polls and voting, and exposes poll-group data in API and UI. Also adds a “Group” column in the eVoting app. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as EVaultList.svelte
participant ES as evaultService
participant CS as cacheService
participant API as /api/evaults
UI->>ES: getEVaults()
ES->>CS: isCacheStale()
CS-->>ES: stale?: Promise<boolean>
alt stale
ES->>ES: refreshCacheInBackground() async
ES-->>UI: return cached eVaults
par Background refresh
ES->>API: fetchEVaultsDirectly()
API-->>ES: eVaults[]
ES->>CS: updateCache(eVaults, fresh)
end
else fresh
ES-->>UI: return cached eVaults
end
UI->>ES: forceRefresh()
ES->>API: fetchEVaultsDirectly()
API-->>ES: eVaults[]
ES->>CS: updateCache(eVaults, fresh)
ES-->>UI: eVaults[]
sequenceDiagram
autonumber
participant S as Server
participant B as Browser
participant C as CacheService
participant DB as LowDB
Note over B,C: Browser guards
B->>C: getCachedEVaults()
C-->>B: [] (no-op)
B->>C: getCacheStatus()
C-->>B: {lastUpdated:0,isStale:true,itemCount:0}
Note over S,C: Lazy init on server
S->>C: updateCache(data)
C->>C: init() if needed
C->>DB: read/write
DB-->>C: ok
C-->>S: done
sequenceDiagram
autonumber
participant Route as +server.ts
participant K8s as kubectl
participant Nodes as Kubernetes Nodes
Route->>K8s: get nodes -o json
K8s-->>Route: nodes list
alt find ExternalIP
Route->>Nodes: scan addresses
Nodes-->>Route: externalIP
else fallback InternalIP
Route->>Nodes: scan InternalIP (exclude localhost)
Nodes-->>Route: internalIP
else minikube/config
Route->>K8s: minikube ip or config host
K8s-->>Route: fallback IP
end
Route->>Route: build NodePort URLs with chosen IP
Route-->>Client: EVaults with service URLs
sequenceDiagram
autonumber
participant Client
participant Controller as PollController
participant PS as PollService
participant VS as VoteService
participant DB as DB
Client->>Controller: GET /polls/:id (auth?)
Controller->>PS: getPollByIdWithAccessCheck(id, userId)
PS->>DB: load poll + creator
alt public poll
PS-->>Controller: poll
else group poll
alt userId provided and member
PS-->>Controller: poll
else
PS-->>Controller: null
end
end
Controller-->>Client: 200 or 404
Client->>VS: create/submit vote (pollId, userId)
VS->>VS: canUserVote(pollId,userId)
VS->>DB: check poll/group membership
alt allowed
VS-->>Client: proceed
else denied
VS-->>Client: error
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60–90 minutes Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Description of change
Issue Number
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit