grafana/public/app/plugins/datasource/elasticsearch/store/store.ts
Andreas Christou c1a46fdcb5
Elasticsearch: Decoupling from core (#115900)
* Complete decoupling of backend

- Replace usage of featuremgmt
- Copy simplejson
- Add standalone logic

* Complete frontend decoupling

- Fix imports
- Copy store and reducer logic

* Add required files for full decoupling

* Regen cue

* Prettier

* Remove unneeded script

* Jest fix

* Add jest config

* Lint

* Lit

* Prune suppresions
2026-01-14 12:54:21 +00:00

26 lines
588 B
TypeScript

import { Store } from 'redux';
import { StoreState } from '../types/store';
export let store: Store<StoreState>;
export function setStore(newStore: Store<StoreState>) {
store = newStore;
}
export function getState(): StoreState {
if (!store || !store.getState) {
return { defaultReducer: () => ({}), templating: { lastKey: 'key' } }; // used by tests
}
return store.getState();
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function dispatch(action: any) {
if (!store || !store.getState) {
return;
}
return store.dispatch(action);
}