mirror of
https://github.com/grafana/grafana.git
synced 2025-01-02 12:17:01 -06:00
e0448513eb
* Add configuration in ConfigEditor and default to 1000 * Show data in explore if any even if there is an error * Update pkg/tsdb/influxdb/flux/executor.go * Better handling of defaults * Add test for runQuery to show data even with error * Update public/app/store/configureStore.ts Co-authored-by: Giordano Ricci <gio.ricci@grafana.com> * Update public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> * Update tooltip * Update input * Lint fixes * Update snapshots * Update decorator tests Co-authored-by: Giordano Ricci <gio.ricci@grafana.com> Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
83 lines
2.5 KiB
TypeScript
83 lines
2.5 KiB
TypeScript
import { configureStore as reduxConfigureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
|
|
import { createLogger } from 'redux-logger';
|
|
import { ThunkMiddleware } from 'redux-thunk';
|
|
import { setStore } from './store';
|
|
import { StoreState } from 'app/types/store';
|
|
import { toggleLogActionsMiddleware } from 'app/core/middlewares/application';
|
|
import { addReducer, createRootReducer } from '../core/reducers/root';
|
|
import { buildInitialState } from '../core/reducers/navModel';
|
|
|
|
export function addRootReducer(reducers: any) {
|
|
// this is ok now because we add reducers before configureStore is called
|
|
// in the future if we want to add reducers during runtime
|
|
// we'll have to solve this in a more dynamic way
|
|
addReducer(reducers);
|
|
}
|
|
|
|
export function configureStore(initialState?: Partial<StoreState>) {
|
|
const logger = createLogger({
|
|
predicate: (getState) => {
|
|
return getState().application.logActions;
|
|
},
|
|
});
|
|
|
|
const middleware = process.env.NODE_ENV !== 'production' ? [toggleLogActionsMiddleware, logger] : [];
|
|
|
|
const reduxDefaultMiddleware = getDefaultMiddleware<StoreState>({
|
|
thunk: true,
|
|
serializableCheck: false,
|
|
immutableCheck: false,
|
|
} as any);
|
|
|
|
const store = reduxConfigureStore<StoreState>({
|
|
reducer: createRootReducer(),
|
|
middleware: [...reduxDefaultMiddleware, ...middleware] as [ThunkMiddleware<StoreState>],
|
|
devTools: process.env.NODE_ENV !== 'production',
|
|
preloadedState: {
|
|
navIndex: buildInitialState(),
|
|
...initialState,
|
|
},
|
|
});
|
|
|
|
setStore(store);
|
|
return store;
|
|
}
|
|
|
|
/*
|
|
function getActionsToIgnoreSerializableCheckOn() {
|
|
return [
|
|
'dashboard/setPanelAngularComponent',
|
|
'dashboard/panelModelAndPluginReady',
|
|
'dashboard/dashboardInitCompleted',
|
|
'plugins/panelPluginLoaded',
|
|
'explore/initializeExplore',
|
|
'explore/changeRange',
|
|
'explore/updateDatasourceInstance',
|
|
'explore/queryStoreSubscription',
|
|
'explore/queryStreamUpdated',
|
|
];
|
|
}
|
|
|
|
function getPathsToIgnoreMutationAndSerializableCheckOn() {
|
|
return [
|
|
'plugins.panels',
|
|
'dashboard.panels',
|
|
'dashboard.getModel',
|
|
'payload.plugin',
|
|
'panelEditorNew.getPanel',
|
|
'panelEditorNew.getSourcePanel',
|
|
'panelEditorNew.getData',
|
|
'explore.left.queryResponse',
|
|
'explore.right.queryResponse',
|
|
'explore.left.datasourceInstance',
|
|
'explore.right.datasourceInstance',
|
|
'explore.left.range',
|
|
'explore.left.eventBridge',
|
|
'explore.right.eventBridge',
|
|
'explore.right.range',
|
|
'explore.left.querySubscription',
|
|
'explore.right.querySubscription',
|
|
];
|
|
}
|
|
*/
|