feat: unify pin actions - #13417
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes “pin/unpin” UI actions across multiple frontend views and adds backend + frontend support for pinning Container Compose items so pinned entries appear at the top of the Compose list (refs #13408).
Changes:
- Replaces “favorite/star” interactions with a unified pushpin-style “pin/unpin” action (tooltip keys, icons, button styling) across Website/Container/App/Node views.
- Adds Compose pin API (
POST /containers/compose/pin), persists pinned state, and sorts Compose results with pinned items first. - Updates i18n keys (
commons.table.pin/unpin) and iconfont assets to include a pushpin glyph.
Reviewed changes
Copilot reviewed 31 out of 36 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/website/website/index.vue | Removes hover-driven favorite behavior and simplifies Domain action rendering. |
| frontend/src/views/website/website/domain/index.vue | Unifies pin/unpin tooltip + pushpin icon/button styling for websites. |
| frontend/src/views/container/image/index.vue | Unifies image pin/unpin UI and removes hover-only visibility logic. |
| frontend/src/views/container/container/index.vue | Unifies container pin/unpin UI and refines detail icon styling class usage. |
| frontend/src/views/container/compose/index.vue | Adds compose pin/unpin button and wires it to new composePin API call. |
| frontend/src/views/app-store/installed/app/header.vue | Unifies installed-app pin/unpin UI and tooltip key usage. |
| frontend/src/layout/components/Sidebar/components/node-drawer/index.vue | Unifies node pin/unpin UI and switches to pushpin icon rendering. |
| frontend/src/lang/modules/zh.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/zh-Hant.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/tr.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/ru.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/pt-br.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/ms.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/lo.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/ko.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/ja.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/fa.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/es-es.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/lang/modules/en.ts | Adds commons.table.pin/unpin; removes website favorite strings. |
| frontend/src/assets/iconfont/iconfont.svg | Adds pushpin glyph. |
| frontend/src/assets/iconfont/iconfont.json | Registers pushpin icon metadata. |
| frontend/src/assets/iconfont/iconfont.css | Updates font asset timestamps and adds .p-pushpin mapping. |
| frontend/src/api/modules/container.ts | Adds composePin API wrapper. |
| frontend/src/api/interface/container.ts | Adds ComposeInfo.isPinned and ComposePin request type. |
| agent/router/ro_container.go | Registers /containers/compose/pin route. |
| agent/init/migration/migrations/init.go | Adds migration to auto-migrate Compose schema (pinned field). |
| agent/init/migration/migrate.go | Includes new migration in agent DB initialization. |
| agent/app/service/container.go | Skips empty-path compose records when counting unique composes. |
| agent/app/service/container_compose.go | Tracks/persists compose pinned state; returns isPinned; sorts pinned first; adds ComposePin service method. |
| agent/app/model/compose_template.go | Extends Compose model to include IsPinned. |
| agent/app/dto/container.go | Adds isPinned to ComposeInfo and introduces ComposePin DTO. |
| agent/app/api/v2/container.go | Adds ComposePin API endpoint handler. |
Comments suppressed due to low confidence (2)
agent/app/service/container_compose.go:360
ComposePinusesreq.Namedirectly for DB lookups/updates, but elsewhere compose records are stored with a lower-cased name (recordName := strings.ToLower(req.Name)inCreateCompose). This can cause pin/unpin to fail to find the existing record (or create a second record differing only by case), andPageComposemay not reflect the pinned state reliably. Normalize the name before all repo operations.
func (u *ContainerService) ComposePin(req dto.ComposePin) error {
record, _ := composeRepo.GetRecord(repo.WithByName(req.Name))
if record.ID == 0 {
if !req.IsPinned {
return nil
}
return composeRepo.CreateRecord(&model.Compose{Name: req.Name, IsPinned: true})
}
if !req.IsPinned && len(record.Path) == 0 {
return composeRepo.DeleteRecord(repo.WithByName(req.Name))
}
return composeRepo.UpdateRecord(req.Name, map[string]interface{}{"is_pinned": req.IsPinned})
}
agent/app/service/container_compose.go:147
- Pin state lookup should use the same canonical key as
pinnedByName(e.g., lower-cased compose name). Otherwise,IsPinnedmay remain false even when a record exists with a different case.
value.IsPinned = pinnedByName[key]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+63
| for _, record := range composeRecords { | ||
| pinnedByName[record.Name] = record.IsPinned | ||
| if len(record.Path) != 0 { | ||
| composeCreatedByLocal = append(composeCreatedByLocal, record) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #13408 #13383