Query History: Refactor persistence layer (#44545)

* Extract Rich History storage into two separate implementations

Implement getting all entries and adding a new entry

* Add deleting rich history items

* Add editing rich history

* Simplify RichHistoryStorage API

* Reorganize methods

* Rename variable

* Remove feature toggle

* Fix TS errors

* Fix tests

* Clean up

* Clean up only when adding new entry

* Fix showing a warning message

* Use enum instead of a string

* Update public/app/core/history/richHistoryLocalStorage.ts

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Update public/app/core/history/richHistoryLocalStorage.ts

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Improve readability

* Rename files and remove inferred return types

* Use const over a var

* Remove unsed files

* Remove redundant null check

* Update public/app/core/history/richHistoryLocalStorageUtils.ts

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Fix linting issues

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
This commit is contained in:
Piotr Jamróz
2022-02-04 12:46:27 +01:00
committed by GitHub
parent 9e52361c1e
commit 6bb6b13379
18 changed files with 683 additions and 364 deletions

View File

@@ -48,10 +48,10 @@ export interface ExploreState {
richHistory: RichHistoryQuery[];
/**
* True if local storage quota was exceeded when a new item was added. This is to prevent showing
* True if local storage quota was exceeded when a rich history item was added. This is to prevent showing
* multiple errors when local storage is full.
*/
localStorageFull: boolean;
richHistoryStorageFull: boolean;
/**
* True if a warning message of hitting the exceeded number of items has been shown already.