Save selected teams filter in local storage (#1613)
# What this PR does Selected teams filter is now saved in local storage ## Which issue(s) this PR fixes https://github.com/grafana/oncall/issues/1611 ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
This commit is contained in:
parent
11d62245e9
commit
2b3e269e28
2 changed files with 23 additions and 1 deletions
|
|
@ -42,6 +42,10 @@ Only some minor performance/developer setup changes to report in this version.
|
|||
|
||||
## v1.2.2 (2023-03-27)
|
||||
|
||||
### Added
|
||||
|
||||
- Save selected teams filter in local storage ([1611](https://github.com/grafana/oncall/issues/1611))
|
||||
|
||||
### Changed
|
||||
|
||||
- Drawers with Forms are not closing by clicking outside of the drawer. Only by clicking Cancel or X (by @Ukochka in [#1608](https://github.com/grafana/oncall/pull/1608))
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@ import { action, observable } from 'mobx';
|
|||
import BaseStore from 'models/base_store';
|
||||
import { makeRequest } from 'network';
|
||||
import { RootStore } from 'state';
|
||||
import { getItem, setItem } from 'utils/localStorage';
|
||||
|
||||
import { getApiPathByPage } from './filters.helpers';
|
||||
import { FilterOption, FiltersValues } from './filters.types';
|
||||
|
||||
const LOCAL_STORAGE_FILTERS_KEY = 'grafana.oncall.global-filters';
|
||||
|
||||
export class FiltersStore extends BaseStore {
|
||||
@observable.shallow
|
||||
public options: { [page: string]: FilterOption[] } = {};
|
||||
|
|
@ -14,10 +17,25 @@ export class FiltersStore extends BaseStore {
|
|||
@observable.shallow
|
||||
public values: { [page: string]: FiltersValues } = {};
|
||||
|
||||
public globalValues: FiltersValues = {};
|
||||
private _globalValues: FiltersValues = {};
|
||||
|
||||
constructor(rootStore: RootStore) {
|
||||
super(rootStore);
|
||||
|
||||
const savedFilters = getItem(LOCAL_STORAGE_FILTERS_KEY);
|
||||
if (savedFilters) {
|
||||
this._globalValues = { ...savedFilters };
|
||||
}
|
||||
}
|
||||
|
||||
set globalValues(value: any) {
|
||||
this._globalValues = value;
|
||||
|
||||
setItem(LOCAL_STORAGE_FILTERS_KEY, value);
|
||||
}
|
||||
|
||||
get globalValues() {
|
||||
return this._globalValues;
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue