@@ -24,6 +24,7 @@ import {
2424 SelectValueText ,
2525 SelectContent ,
2626 SelectItem ,
27+ SelectHiddenSelect ,
2728} from "../ui/select" ;
2829import {
2930 MenuContent ,
@@ -72,10 +73,36 @@ export const hooksListTooltipText = (
7273 </ Text >
7374) ;
7475
76+ const hookConditionDescriptions : Record < string , string > = {
77+ CONDITION_SNAPSHOT_START :
78+ "Triggered when a backup operation begins and must complete successfully before the snapshot will begin." ,
79+ CONDITION_SNAPSHOT_END :
80+ "Triggered when a backup operation completes (regardless of success/failure)" ,
81+ CONDITION_SNAPSHOT_SUCCESS :
82+ "Triggered when a backup operation completes successfully" ,
83+ CONDITION_SNAPSHOT_ERROR : "Triggered when a backup operation fails" ,
84+ CONDITION_SNAPSHOT_WARNING :
85+ "Triggered when a backup operation encounters non-fatal issues" ,
86+ CONDITION_PRUNE_START : "Triggered when a prune operation begins" ,
87+ CONDITION_PRUNE_SUCCESS :
88+ "Triggered when a prune operation completes successfully" ,
89+ CONDITION_PRUNE_ERROR : "Triggered when a prune operation fails" ,
90+ CONDITION_CHECK_START : "Triggered when a check operation begins" ,
91+ CONDITION_CHECK_SUCCESS :
92+ "Triggered when a check operation completes successfully" ,
93+ CONDITION_CHECK_ERROR : "Triggered when a check operation fails" ,
94+ CONDITION_FORGET_START : "Triggered when a forget operation begins" ,
95+ CONDITION_FORGET_SUCCESS :
96+ "Triggered when a forget operation completes successfully" ,
97+ CONDITION_FORGET_ERROR : "Triggered when a forget operation fails" ,
98+ CONDITION_ANY_ERROR : "Triggered when any operation fails" ,
99+ } ;
100+
75101const conditionCollection = createListCollection ( {
76102 items : Hook_ConditionSchema . values . map ( ( v ) => ( {
77103 label : v . name ,
78104 value : v . name ,
105+ description : hookConditionDescriptions [ v . name ] ,
79106 } ) ) ,
80107} ) ;
81108
@@ -210,15 +237,29 @@ const HookItem = ({
210237 onValueChange = { handleConditionChange }
211238 size = "sm"
212239 >
240+ { /* @ts -ignore */ }
241+ < SelectHiddenSelect />
213242 < SelectTrigger >
214- { /* @ts -ignore */ }
215- < SelectValueText placeholder = "Runs when..." />
243+ < Box flex = "1" textAlign = "left" >
244+ { hook . conditions && hook . conditions . length > 0 ? (
245+ hook . conditions . join ( ", " )
246+ ) : (
247+ < Text color = "fg.muted" > Runs when...</ Text >
248+ ) }
249+ </ Box >
216250 </ SelectTrigger >
217251 < SelectContent zIndex = { 2000 } >
218252 { conditionCollection . items . map ( ( item : any ) => (
219253 // @ts -ignore
220254 < SelectItem item = { item } key = { item . value } >
221- { item . label }
255+ < span >
256+ { item . label }
257+ { item . description && (
258+ < Text as = "span" color = "fg.muted" ml = { 2 } >
259+ - { item . description }
260+ </ Text >
261+ ) }
262+ </ span >
222263 </ SelectItem >
223264 ) ) }
224265 </ SelectContent >
@@ -419,6 +460,8 @@ const hookTypes: {
419460 }
420461 size = "sm"
421462 >
463+ { /* @ts -ignore */ }
464+ < SelectHiddenSelect />
422465 < SelectTrigger >
423466 { /* @ts -ignore */ }
424467 < SelectValueText placeholder = "Priority" />
@@ -639,6 +682,8 @@ const ItemOnErrorSelector = ({
639682 onValueChange = { ( e ) => onChange ( { ...hook , onError : e . value [ 0 ] } ) }
640683 size = "sm"
641684 >
685+ { /* @ts -ignore */ }
686+ < SelectHiddenSelect />
642687 < SelectTrigger >
643688 { /* @ts -ignore */ }
644689 < SelectValueText placeholder = "Error behavior..." />
0 commit comments