The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/store/store.ts

26 lines
634 B

import { Store } from 'redux';
import { initialKeyedVariablesState } from 'app/features/variables/state/keyedVariablesReducer';
import { StoreState } from 'app/types';
export let store: Store<StoreState>;
export function setStore(newStore: Store<StoreState>) {
store = newStore;
}
export function getState(): StoreState {
if (!store || !store.getState) {
return { templating: { ...initialKeyedVariablesState, lastKey: 'key' } } as StoreState; // used by tests
}
return store.getState();
}
export function dispatch(action: any) {
if (!store || !store.getState) {
return;
}
return store.dispatch(action);
}