Skip to content

Commit 3cf134f

Browse files
committed
Add unpin command
1 parent cb2ba2c commit 3cf134f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

typescript/packages/jumble/src/components/commands.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,28 @@ export function getCommands(deps: CommandContext): CommandItem[] {
705705
deps.setOpen(false);
706706
},
707707
},
708+
{
709+
id: "unpin-charm",
710+
type: "action",
711+
title: "Unpin Charm",
712+
group: "View",
713+
predicate: !!deps.focusedCharmId,
714+
handler: async () => {
715+
if (!deps.focusedCharmId || !deps.focusedReplicaId) {
716+
deps.setOpen(false);
717+
return;
718+
}
719+
720+
const charm = await deps.charmManager.get(deps.focusedCharmId);
721+
if (!charm) {
722+
console.error("Failed to load charm", deps.focusedCharmId);
723+
return;
724+
}
725+
726+
await deps.charmManager.unpin(charm);
727+
deps.setOpen(false);
728+
},
729+
},
708730
{
709731
id: "view-detail",
710732
type: "action",

0 commit comments

Comments
 (0)