added restore button
Template tests / tests (push) Successful in 1m48s

This commit is contained in:
Iisyourdad
2026-06-11 11:35:57 -05:00
parent 33c421b746
commit 3df52e37fc
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -666,6 +666,14 @@ class StepForgeApp {
this.renderBulkBar(); this.renderBulkBar();
} }
async bulkRestoreTrash() {
const names = [...this.state.selectedTrash];
if (!names.length) return;
await Promise.all(names.map((name) => api.library.trashRestore({ name })));
this.state.selectedTrash = new Set();
await this.refreshLibrary();
}
async bulkPurgeTrash() { async bulkPurgeTrash() {
const names = [...this.state.selectedTrash]; const names = [...this.state.selectedTrash];
if (!names.length) return; if (!names.length) return;
@@ -685,12 +693,13 @@ class StepForgeApp {
const allSelected = this.state.trash.length > 0 && n === this.state.trash.length; const allSelected = this.state.trash.length > 0 && n === this.state.trash.length;
this.domBulkBar.append( this.domBulkBar.append(
el('div.bulk-bar', {}, el('div.bulk-bar', {},
el('span', {}, n ? `${n} selected` : 'Select items to delete forever'), el('span', {}, n ? `${n} selected` : 'Select items to act on them'),
el('span.spacer', {}), el('span.spacer', {}),
el('button', { el('button', {
type: 'button', type: 'button',
onClick: () => (allSelected ? this.clearTrashSelection() : this.selectAllTrash()), onClick: () => (allSelected ? this.clearTrashSelection() : this.selectAllTrash()),
}, allSelected ? 'Clear selection' : 'Select all'), }, allSelected ? 'Clear selection' : 'Select all'),
el('button', { type: 'button', disabled: !n, onClick: () => this.bulkRestoreTrash() }, 'Restore'),
el('button.danger', { type: 'button', disabled: !n, onClick: () => this.bulkPurgeTrash() }, 'Delete forever'), el('button.danger', { type: 'button', disabled: !n, onClick: () => this.bulkPurgeTrash() }, 'Delete forever'),
), ),
); );
+2 -2
View File
@@ -59,8 +59,8 @@ Initial release.
- Editor step list: a "Select" toggle enables multi-select (checkboxes) - Editor step list: a "Select" toggle enables multi-select (checkboxes)
with a "Select all" / "Delete" bar for removing several steps at once. with a "Select all" / "Delete" bar for removing several steps at once.
- The library's "Select" toggle and bulk action bar now also work in the - The library's "Select" toggle and bulk action bar now also work in the
Trash, with a "Delete forever" action that permanently removes the Trash, with "Restore" and "Delete forever" actions for the selected
selected items. items.
### Fixed ### Fixed