Implement "Destroy all data" button
All checks were successful
Build & Test / build-run (push) Successful in 49s
All checks were successful
Build & Test / build-run (push) Successful in 49s
Which resets the storage manager, not the entire localstorage. Not that localstorage should be touched outside of the storage manager, but it means I can keep my backups for debugging in there.
This commit is contained in:
parent
7a39fbd418
commit
f0617522e3
2 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,7 @@ const detailsDialog = findDialogOrFail(document.body, "#instanceDetails");
|
||||||
const instanceList = findOlOrFail(document.body, "#instanceList");
|
const instanceList = findOlOrFail(document.body, "#instanceList");
|
||||||
const saveButton = findButtonOrFail(document.body, "#save");
|
const saveButton = findButtonOrFail(document.body, "#save");
|
||||||
const reorderButton = findButtonOrFail(document.body, "#reorder");
|
const reorderButton = findButtonOrFail(document.body, "#reorder");
|
||||||
|
const resetButton = findButtonOrFail(document.body, "#reset");
|
||||||
|
|
||||||
let instanceDetailsDialog = new InstanceDetailsDialog(detailsDialog, true);
|
let instanceDetailsDialog = new InstanceDetailsDialog(detailsDialog, true);
|
||||||
let addInstanceFlow = new AddInstanceFlow(addDialog, spinnerDialog, instanceDetailsDialog);
|
let addInstanceFlow = new AddInstanceFlow(addDialog, spinnerDialog, instanceDetailsDialog);
|
||||||
|
@ -37,6 +38,12 @@ reorderButton.addEventListener("click", () => {
|
||||||
reorderButton.innerText = reordering ? "Finish reordering" : "Reorder";
|
reorderButton.innerText = reordering ? "Finish reordering" : "Reorder";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
resetButton.addEventListener("click", e => {
|
||||||
|
storageManager.reset();
|
||||||
|
updateInstanceList();
|
||||||
|
unsavedChanges();
|
||||||
|
});
|
||||||
|
|
||||||
updateInstanceList();
|
updateInstanceList();
|
||||||
storageManager.addSaveCallback(updateInstanceList);
|
storageManager.addSaveCallback(updateInstanceList);
|
||||||
|
|
||||||
|
|
|
@ -62,4 +62,8 @@ export default new class StorageManager {
|
||||||
addSaveCallback(callback: () => void) {
|
addSaveCallback(callback: () => void) {
|
||||||
this.saveCallbacks.push(callback);
|
this.saveCallbacks.push(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
this.storage = this.default();
|
||||||
|
}
|
||||||
}();
|
}();
|
Loading…
Add table
Reference in a new issue