feat: Implement assigning colors to environments#3792
feat: Implement assigning colors to environments#3792jirkavrba wants to merge 9 commits intoDokploy:canaryfrom
Conversation
apps/dokploy/pages/dashboard/project/[projectId]/environment/[environmentId].tsx
Outdated
Show resolved
Hide resolved
apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx
Show resolved
Hide resolved
apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx
Show resolved
Hide resolved
apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx
Show resolved
Hide resolved
Additional Comments (1)
Same issue as the create dialog - use empty string: |
…environmentId].tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…-selector.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…ironment-selector.tsx" This reverts commit a3a06fb.
…onment/[environmentId].tsx" This reverts commit 6a5f8ff.
| /> | ||
| </div> | ||
| <div className="space-y-1"> | ||
| <Label htmlFor="description">Color</Label> |
There was a problem hiding this comment.
incorrect htmlFor attribute
The label's htmlFor should be "color", not "description"
| <Label htmlFor="description">Color</Label> | |
| <Label htmlFor="color">Color</Label> |
| /> | ||
| </div> | ||
| <div className="space-y-1"> | ||
| <Label htmlFor="description">Color</Label> |
There was a problem hiding this comment.
incorrect htmlFor attribute
The label's htmlFor should be "edit-color", not "description"
| <Label htmlFor="description">Color</Label> | |
| <Label htmlFor="edit-color">Color</Label> |
| .notNull() | ||
| .references(() => projects.projectId, { onDelete: "cascade" }), | ||
| isDefault: boolean("isDefault").notNull().default(false), | ||
| color: text("color"), |
There was a problem hiding this comment.
missing validation for color field
No validation exists for the color field. Consider adding a regex pattern to ensure only valid hex color codes are accepted (e.g., #[0-9a-fA-F]{6}). This prevents invalid color values from being stored in the database.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| <SelectItem value=" ">No color</SelectItem> | ||
| <SelectItem value="#0091ff"> | ||
| <span className="bg-[#0091ff] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Blue | ||
| </SelectItem> | ||
| <SelectItem value="#e5484d"> | ||
| <span className="bg-[#e5484d] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Red | ||
| </SelectItem> | ||
| <SelectItem value="#e79c13"> | ||
| <span className="bg-[#e79c13] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Yellow | ||
| </SelectItem> | ||
| <SelectItem value="#1a9338"> | ||
| <span className="bg-[#1a9338] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Green | ||
| </SelectItem> | ||
| <SelectItem value="#0c9784"> | ||
| <span className="bg-[#0c9784] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Teal | ||
| </SelectItem> | ||
| <SelectItem value="#8e4ec6"> | ||
| <span className="bg-[#8e4ec6] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Purple | ||
| </SelectItem> | ||
| <SelectItem value="#e93d82"> | ||
| <span className="bg-[#e93d82] size-2.5 rounded-full inline-block mr-2" />{" "} | ||
| Pink | ||
| </SelectItem> |
There was a problem hiding this comment.
duplicated color selection component
The same color selection UI is duplicated in both the create and edit dialogs (lines 322-350 and 419-447). Extract this into a reusable component to avoid duplication and simplify maintenance.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
What is this PR about?
This PR adds an option to assign color to specific environment. This makes it clear that you're working for example on a production environment.
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
Screenshots (if applicable)
Here's a video:
dokploy-environments.webm
Environment without a color:

Environment with a red color assigned to it:

Dialog for selecting colors:
Greptile Summary
This PR adds the ability to assign colors to environments, making it easier to distinguish between different environments (e.g., production, staging). The implementation includes database schema changes, API router updates, and UI components for color selection.
Key changes:
colorfield to theenvironmenttable with a new migrationdokploy-restart.tsnotification file (unrelated to feature)Issues found:
htmlForattributes on color labelsConfidence Score: 3/5
advanced-environment-selector.tsxfor the space trimming bug and duplicated codeLast reviewed commit: 1216549