Skip to content

Commit dfd0e83

Browse files
committed
Refactor the Checkpoints command quick pick to use a dedicated button for clearing all checkpoints and clarify the tooltip for running preset groups
1 parent a82ade7 commit dfd0e83

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

‎packages/ui/src/components/editor/panel/Presets/Presets.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ export const Presets: React.FC<Presets.Props> = (props) => {
597597
>
598598
<IconButton
599599
codicon_icon="run-all-coverage"
600-
title="Run"
600+
title="Run selected presets"
601601
on_click={(e) => {
602602
e.stopPropagation()
603603
props.on_group_click('Ungrouped')
@@ -763,7 +763,7 @@ export const Presets: React.FC<Presets.Props> = (props) => {
763763
{!preset.chatbot && (
764764
<IconButton
765765
codicon_icon="run-all-coverage"
766-
title="Run"
766+
title="Run selected presets"
767767
on_click={(e) => {
768768
e.stopPropagation()
769769
props.on_group_click(preset.name)

‎packages/vscode/src/commands/checkpoints-command/checkpoints-command.ts‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export const checkpoints_command = (
6868
quick_pick.placeholder =
6969
'Select a checkpoint to restore or add a new one'
7070

71+
const clear_all_button: vscode.QuickInputButton = {
72+
iconPath: new vscode.ThemeIcon('trash'),
73+
tooltip: 'Delete all checkpoints'
74+
}
75+
7176
let notification_count = 0
7277
let checkpoints: Checkpoint[] = []
7378

@@ -107,6 +112,12 @@ export const checkpoints_command = (
107112

108113
const visible_checkpoints = checkpoints.filter((c) => !c.is_temporary)
109114

115+
if (visible_checkpoints.length > 0) {
116+
quick_pick.buttons = [clear_all_button]
117+
} else {
118+
quick_pick.buttons = []
119+
}
120+
110121
visible_checkpoints.sort((a, b) => {
111122
return b.timestamp - a.timestamp
112123
})
@@ -117,15 +128,6 @@ export const checkpoints_command = (
117128
label: '$(add) New checkpoint...',
118129
alwaysShow: true
119130
},
120-
...(visible_checkpoints.length > 0
121-
? [
122-
{
123-
id: 'clear-all',
124-
label: '$(trash) Clear all checkpoints...',
125-
alwaysShow: true
126-
}
127-
]
128-
: []),
129131
...(revert_item ? [revert_item] : []),
130132
...(visible_checkpoints.length > 0
131133
? [
@@ -200,7 +202,18 @@ export const checkpoints_command = (
200202
TEMPORARY_CHECKPOINT_STATE_KEY,
201203
undefined
202204
)
203-
} else if (selected.id == 'clear-all') {
205+
} else if (selected.checkpoint) {
206+
quick_pick.hide()
207+
await restore_checkpoint({
208+
checkpoint: selected.checkpoint,
209+
workspace_provider,
210+
context
211+
})
212+
}
213+
})
214+
215+
quick_pick.onDidTriggerButton(async (button) => {
216+
if (button === clear_all_button) {
204217
quick_pick.hide()
205218
const confirmation = await vscode.window.showWarningMessage(
206219
'Are you sure you want to clear all checkpoints? This operation cannot be undone.',
@@ -219,13 +232,6 @@ export const checkpoints_command = (
219232
undefined
220233
)
221234
await show_quick_pick()
222-
} else if (selected.checkpoint) {
223-
quick_pick.hide()
224-
await restore_checkpoint({
225-
checkpoint: selected.checkpoint,
226-
workspace_provider,
227-
context
228-
})
229235
}
230236
})
231237

0 commit comments

Comments
 (0)