-
-
Notifications
You must be signed in to change notification settings - Fork 49
feat: add labels to projects #366
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughIntroduces application labels across backend and frontend: database migration adds a labels column and index; API gains a PUT endpoint to update labels; service/storage implement update; types extended. Frontend displays and edits labels via new component and Redux mutation. Also updates api version timestamp and adjusts Go module dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant UI as Frontend UI (Labels)
participant RTK as Redux RTK Query
participant API as API Router
participant C as DeployController
participant S as DeployService
participant ST as DeployStorage
participant DB as PostgreSQL
U->>UI: Add/Edit label
UI->>RTK: invoke updateApplicationLabels({id, labels})
RTK->>API: PUT /v1/deploy/application/labels?id={id}\nBody: { labels }
API->>C: route to UpdateApplicationLabels
C->>C: validate body, id, auth/org
C->>S: UpdateApplicationLabels(appID, labels, orgID)
S->>ST: UpdateApplicationLabels(appID, labels, orgID)
ST->>DB: UPDATE applications SET labels = ARRAY[...], updated_at=now()\nWHERE id=? AND organization_id=?
DB-->>ST: ok
ST-->>S: ok
S-->>C: ok
C-->>RTK: 200 { status:"success", data: labels }
RTK-->>UI: labels array
UI-->>U: Render updated labels
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, minor suggestions
fuego.Get(f, "/logs/{application_id}", deployController.GetLogs) | ||
fuego.Get(f, "/deployments/{deployment_id}/logs", deployController.GetDeploymentLogs) | ||
fuego.Get(f, "/deployments", deployController.GetApplicationDeployments) | ||
fuego.Put(f, "/labels", deployController.UpdateApplicationLabels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally better to keep it as /application/{appID}/labels
right?
query string would make sense if it was optional value, but in our case this is mandatory
) | ||
|
||
func (s *DeployService) UpdateApplicationLabels(applicationID uuid.UUID, labels []string, organizationID uuid.UUID) error { | ||
return s.storage.UpdateApplicationLabels(applicationID, labels, organizationID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove duplicate strings just incase if its there in labels array? Like sanity before storing in db? In FE, should we keep max character limit otherwise might be able to add a big string, looking odd in the UI?
setNewLabel(''); | ||
return; | ||
} | ||
const updated = [...localLabels, value]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const updated = [...localLabels, value]; | |
const updated = [...new Set([...localLabels, value])]; |
removes duplication
api/internal/types/task.go
Outdated
type UpdateOptions struct { | ||
Force bool | ||
ForceWithoutCache bool | ||
} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
|
||
generatePorts := "seq 49152 65535" | ||
|
||
getUsedPorts := "command -v ss >/dev/null 2>&1 && ss -tan | awk '{print $4}' | cut -d':' -f2 | grep '[0-9]\\{1,5\\}' | sort -u || netstat -tan | awk '{print $4}' | grep ':[0-9]' | cut -d':' -f2 | sort -u" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we move this to utils?
reopened accidental closure of this PR, @zhravan for your notice |
92e753e
to
871021e
Compare
871021e
to
7230676
Compare
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
Summary by CodeRabbit