Skip to content

feat: unify pin actions - #13417

Merged
ssongliu merged 1 commit into
dev-v2from
feat/unify-pin-action
Jul 30, 2026
Merged

feat: unify pin actions#13417
ssongliu merged 1 commit into
dev-v2from
feat/unify-pin-action

Conversation

@ssongliu

@ssongliu ssongliu commented Jul 29, 2026

Copy link
Copy Markdown
Member

Refs #13408 #13383

Copilot AI review requested due to automatic review settings July 29, 2026 10:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • ComposePin uses req.Name directly for DB lookups/updates, but elsewhere compose records are stored with a lower-cased name (recordName := strings.ToLower(req.Name) in CreateCompose). This can cause pin/unpin to fail to find the existing record (or create a second record differing only by case), and PageCompose may 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, IsPinned may 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)
}
}
@ssongliu
ssongliu merged commit 33b3eec into dev-v2 Jul 30, 2026
4 checks passed
@ssongliu
ssongliu deleted the feat/unify-pin-action branch July 30, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants