@@ -5,15 +5,14 @@ Use of this software is governed by the Business Source License
55included in the LICENSE file.
66-->
77<script setup lang="ts">
8- import { vOnClickOutside } from ' @vueuse/components '
8+ import { PopoverContent , PopoverPortal , PopoverRoot , PopoverTrigger } from ' reka-ui '
99import { ref } from ' vue'
1010
1111import { Runtime } from ' @/api/common/omni.pb'
1212import { type Resource } from ' @/api/grpc'
1313import { KubernetesUpgradeStatusSpecPhase , type OngoingTaskSpec } from ' @/api/omni/specs/omni.pb'
1414import { EphemeralNamespace , OngoingTaskType } from ' @/api/resources'
1515import { itemID } from ' @/api/watch'
16- import TAnimation from ' @/components/common/Animation/TAnimation.vue'
1716import TIcon from ' @/components/common/Icon/TIcon.vue'
1817import { useWatch } from ' @/components/common/Watch/useWatch'
1918import IconHeaderDropdownLoading from ' @/components/icons/IconHeaderDropdownLoading.vue'
@@ -52,21 +51,12 @@ const getCurrentVersion = (item: Resource<OngoingTaskSpec>) => {
5251
5352 return item .spec .machine_upgrade ?.schematic_id
5453}
55-
56- const toggleDropdown = () => {
57- dropdownOpen .value = ! dropdownOpen .value
58- }
59-
60- const onClickOutside = () => {
61- dropdownOpen .value = false
62- }
6354 </script >
6455
6556<template >
66- <div v-on-click-outside =" onClickOutside" class =" relative flex items-center" >
67- <div
68- class =" flex cursor-pointer items-center gap-1 text-naturals-n11 transition-colors hover:text-naturals-n14"
69- @click =" () => toggleDropdown()"
57+ <PopoverRoot v-model:open =" dropdownOpen" >
58+ <PopoverTrigger
59+ class =" flex items-center gap-1 text-naturals-n11 transition-colors hover:text-naturals-n14"
7060 >
7161 <IconHeaderDropdownLoading :active =" data.length > 0" />
7262 <span class =" text-xs font-normal whitespace-nowrap select-none" >
@@ -78,44 +68,57 @@ const onClickOutside = () => {
7868 :class =" { '-rotate-180': dropdownOpen }"
7969 icon =" arrow-down"
8070 />
81- </div >
82-
83- <TAnimation >
84- <div
85- v-show =" dropdownOpen"
86- class =" absolute top-7 -right-2 z-30 rounded border border-naturals-n4 bg-naturals-n2"
71+ </PopoverTrigger >
72+
73+ <PopoverPortal >
74+ <PopoverContent
75+ class =" z-30 max-h-(--reka-popover-content-available-height) max-w-[min(--spacing(80),var(--reka-popover-content-available-width))] min-w-(--reka-popover-trigger-width) origin-(--reka-popover-content-transform-origin) overflow-auto rounded border border-naturals-n4 bg-naturals-n2 slide-in-from-top-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95"
76+ :side-offset =" 10"
77+ align =" end"
78+ side =" bottom"
8779 >
8880 <div
8981 v-for =" item in data"
9082 :key =" itemID(item)"
91- class =" flex flex-col gap-2 p-6 not-last:border-b not-last:border-naturals-n4 "
83+ class =" flex flex-col gap-2 border-naturals-n4 p-6 not-last:border-b"
9284 >
9385 <div class =" flex items-center justify-between gap-4" >
94- <h3 class =" w-9/12 text-xs whitespace-nowrap text-naturals-n13" >
86+ <h3 class =" truncate text-xs text-naturals-n13" >
9587 {{ item.spec.title }}
9688 </h3 >
9789
98- <span v-if =" item.metadata.created" class =" w-3/12 text-right text-xs text-naturals-n9" >
90+ <span
91+ v-if =" item.metadata.created"
92+ class =" shrink-0 text-right text-xs whitespace-nowrap text-naturals-n9"
93+ >
9994 {{ formatISO(item.metadata.created, 'HH:mm:ss') }}
10095 </span >
10196 </div >
10297
103- <div class =" truncate text-xs text-naturals-n9" >
104- <template v-if =" item .spec .destroy " >
98+ <div class =" text-xs text-naturals-n9" >
99+ <span v-if =" item.spec.destroy" class = " truncate " >
105100 {{ item.spec.destroy.phase }}
106- </template >
101+ </span >
107102
108103 <div v-else class =" flex items-center gap-2 text-xs" >
109104 <template v-if =" getCurrentVersion (item )" >
110- <span v-if =" item.spec.kubernetes_upgrade" >Upgrade Kubernetes</span >
111- <span v-else-if =" item.spec.machine_upgrade" >Upgrade Machine</span >
112- <span v-else >Upgrade Talos</span >
105+ <span v-if =" item.spec.kubernetes_upgrade" class =" whitespace-nowrap" >
106+ Upgrade Kubernetes
107+ </span >
108+ <span v-else-if =" item.spec.machine_upgrade" class =" whitespace-nowrap" >
109+ Upgrade Machine
110+ </span >
111+ <span v-else class =" whitespace-nowrap" >Upgrade Talos</span >
113112 <div class =" flex-1" />
114- <span class =" rounded bg-naturals-n4 px-2 text-xs font-bold text-naturals-n13" >
113+ <span
114+ class =" truncate rounded bg-naturals-n4 px-2 text-xs font-bold text-naturals-n13"
115+ >
115116 {{ getPreviousVersion(item) }}
116117 </span >
117118 <span >⇾</span >
118- <span class =" rounded bg-naturals-n4 px-2 text-xs font-bold text-naturals-n13" >
119+ <span
120+ class =" truncate rounded bg-naturals-n4 px-2 text-xs font-bold text-naturals-n13"
121+ >
119122 {{ getCurrentVersion(item) }}
120123 </span >
121124 </template >
@@ -126,16 +129,18 @@ const onClickOutside = () => {
126129 KubernetesUpgradeStatusSpecPhase .Reverting
127130 "
128131 >
129- <span >Reverting back to</span >
132+ <span class = " whitespace-nowrap " >Reverting back to</span >
130133 <div class =" flex-1" />
131- <span class =" rounded bg-naturals-n4 px-2 text-xs font-bold text-naturals-n13" >
134+ <span
135+ class =" rounded bg-naturals-n4 px-2 text-xs font-bold whitespace-nowrap text-naturals-n13"
136+ >
132137 {{
133138 (item.spec.kubernetes_upgrade ?? item.spec.talos_upgrade)?.last_upgrade_version
134139 }}
135140 </span >
136141 </template >
137142
138- <span v-else >Updating machine schematics</span >
143+ <span v-else class = " whitespace-nowrap " >Updating machine schematics</span >
139144 </div >
140145 </div >
141146 </div >
@@ -144,7 +149,7 @@ const onClickOutside = () => {
144149 <TIcon icon =" check" class =" h-4 w-4" />
145150 No tasks
146151 </div >
147- </div >
148- </TAnimation >
149- </div >
152+ </PopoverContent >
153+ </PopoverPortal >
154+ </PopoverRoot >
150155</template >
0 commit comments