Automations: add Archive action to hover actions of an automation history entry
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Description
Each run listed in the Automations history (`AutomationHistorySection` in `src/vs/sessions/contrib/sessions/browser/views/automationsView.ts`) shows a hover toolbar (`Menus.AutomationsHistoryItem`) with **Stop** and **Delete** actions, registered in `registerAutomationHistoryItemActions()`:
```ts
function registerAutomationHistoryItemActions(): IDisposable {
return combinedDisposable(
MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItem, {
command: { id: STOP_AUTOMATION_RUN_SESSION_COMMAND_ID, title: "Stop", icon: Codicon.stopCircle },
...
}),
MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItem, {
command: { id: DELETE_AUTOMATION_RUN_SESSION_COMMAND_ID, title: "Delete", icon: Codicon.trash },
...
}),
);
}
```
There is no way to archive the session behind a history entry directly from the list. Today the only way to archive a session is to open it and use the archive control in the session's own header, there's no quick action from the history row itself.
### Suggested fix
Add an **Archive** action (calling `sessionsManagementService.archiveSession(session)`, mirroring the existing Stop/Delete handling in `handleSessionToolbarAction`) to the `Menus.AutomationsHistoryItem` hover toolbar, gated by an appropriate `when` clause (e.g. not already archived, session created) similar to the existing `SessionIsArchivedContext` usage in `sessionsActions.ts`.
### Context
Raised internally:
> rob: How do automation sessions get archived, to clean up the worktree? Seems like they can only be deleted
> Ben Villalobos: currently you can only delete from the view directly. A quick way to do it would be to click into the session itself and click archive from the controls at the top
Contributor guide
Assessment
This issue has not been assessed yet.