mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -20,7 +20,7 @@ export interface SyncTimesPayload {
|
||||
export const syncTimesAction = createAction<SyncTimesPayload>('explore/syncTimes');
|
||||
|
||||
export const richHistoryUpdatedAction = createAction<any>('explore/richHistoryUpdated');
|
||||
export const localStorageFullAction = createAction('explore/localStorageFullAction');
|
||||
export const richHistoryStorageFullAction = createAction('explore/richHistoryStorageFullAction');
|
||||
export const richHistoryLimitExceededAction = createAction('explore/richHistoryLimitExceededAction');
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ export const initialExploreState: ExploreState = {
|
||||
left: initialExploreItemState,
|
||||
right: undefined,
|
||||
richHistory: [],
|
||||
localStorageFull: false,
|
||||
richHistoryStorageFull: false,
|
||||
richHistoryLimitExceededWarningShown: false,
|
||||
};
|
||||
|
||||
@@ -214,10 +214,10 @@ export const exploreReducer = (state = initialExploreState, action: AnyAction):
|
||||
};
|
||||
}
|
||||
|
||||
if (localStorageFullAction.match(action)) {
|
||||
if (richHistoryStorageFullAction.match(action)) {
|
||||
return {
|
||||
...state,
|
||||
localStorageFull: true,
|
||||
richHistoryStorageFull: true,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user