|
15 | 15 | IconDeviceFloppy as Save, |
16 | 16 | IconShieldCheck as ShieldCheck, |
17 | 17 | IconArchive as Archive, |
| 18 | + IconDots as MoreHorizontal, |
18 | 19 | } from '@tabler/icons-svelte-runes'; |
19 | 20 | import { agentBindings, agentRuns, agentSkills, api } from '../../api.js'; |
20 | 21 | import { updateQueryParams } from '../../router.js'; |
21 | 22 | import { workspacePermissions } from '../../stores'; |
22 | 23 | import PageHeader from '../../layout/PageHeader.svelte'; |
| 24 | + import DropdownMenu from '../../layout/DropdownMenu.svelte'; |
23 | 25 | import AlertBox from '../../components/AlertBox.svelte'; |
24 | 26 | import Avatar from '../../components/Avatar.svelte'; |
25 | 27 | import Badge from '../../components/Badge.svelte'; |
|
586 | 588 | .replace(/\b\w/g, (letter) => letter.toUpperCase()); |
587 | 589 | } |
588 | 590 |
|
| 591 | + function profileActionItems() { |
| 592 | + return [ |
| 593 | + { |
| 594 | + id: 'archive', |
| 595 | + type: 'regular', |
| 596 | + icon: Archive, |
| 597 | + title: 'Archive', |
| 598 | + color: 'var(--ds-text-danger)', |
| 599 | + hoverClass: 'hover-danger', |
| 600 | + testid: 'agent-archive', |
| 601 | + onClick: () => archiveDialogOpen = true, |
| 602 | + }, |
| 603 | + ]; |
| 604 | + } |
| 605 | +
|
589 | 606 | function changeTab({ tab }) { |
590 | 607 | activeTab = tab; |
591 | 608 | updateQueryParams({ tab: tab === 'overview' ? null : tab }, { push: true }); |
|
625 | 642 | subtitle={agent.purpose || 'Workspace specialist'} |
626 | 643 | > |
627 | 644 | {#snippet actions()} |
628 | | - <Badge variant={availabilityVariant(agent.availability)}> |
629 | | - {label(agent.availability)} |
630 | | - </Badge> |
631 | | - {#if canAdmin} |
632 | | - {#if agent.lifecycle === 'archived'} |
633 | | - <Button |
634 | | - variant="default" |
635 | | - size="small" |
636 | | - loading={lifecycleChanging} |
637 | | - onclick={restoreProfile} |
638 | | - dataTestid="agent-restore" |
639 | | - > |
640 | | - Restore as Draft |
641 | | - </Button> |
642 | | - {:else} |
643 | | - <Button |
644 | | - variant="danger" |
645 | | - size="small" |
646 | | - icon={Archive} |
647 | | - onclick={() => archiveDialogOpen = true} |
648 | | - dataTestid="agent-archive" |
649 | | - > |
650 | | - Archive |
651 | | - </Button> |
| 645 | + <div class="flex min-h-8 items-center gap-2"> |
| 646 | + <Badge variant={availabilityVariant(agent.availability)}> |
| 647 | + {label(agent.availability)} |
| 648 | + </Badge> |
| 649 | + {#if canAdmin} |
| 650 | + {#if agent.lifecycle === 'archived'} |
| 651 | + <Button |
| 652 | + variant="default" |
| 653 | + size="small" |
| 654 | + loading={lifecycleChanging} |
| 655 | + onclick={restoreProfile} |
| 656 | + dataTestid="agent-restore" |
| 657 | + > |
| 658 | + Restore as Draft |
| 659 | + </Button> |
| 660 | + {:else} |
| 661 | + <DropdownMenu |
| 662 | + triggerIcon={MoreHorizontal} |
| 663 | + triggerClass="w-8 h-8 flex items-center justify-center rounded-md transition-colors" |
| 664 | + triggerStyle="background-color: var(--ds-surface); color: var(--ds-text-subtle);" |
| 665 | + triggerTestid="agent-profile-actions" |
| 666 | + triggerLabel="Agent actions" |
| 667 | + items={profileActionItems()} |
| 668 | + maxWidth="max-w-48" |
| 669 | + showChevron={false} |
| 670 | + iconOnly={true} |
| 671 | + disabled={lifecycleChanging} |
| 672 | + /> |
| 673 | + {/if} |
652 | 674 | {/if} |
653 | | - {/if} |
| 675 | + </div> |
654 | 676 | {/snippet} |
655 | 677 | </PageHeader> |
656 | 678 |
|
|
0 commit comments