mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
d1e52d4788
* type fixes * couple more * just a couple more * small fixes to prometheus typings * improve some more datasource types
16 lines
571 B
TypeScript
16 lines
571 B
TypeScript
import { TypedVariableModel } from '@grafana/data';
|
|
|
|
import { getPreloadedState } from '../../app/features/variables/state/helpers';
|
|
import { VariablesState } from '../../app/features/variables/state/types';
|
|
import { StoreState } from '../../app/types';
|
|
|
|
export const convertToStoreState = (key: string, models: TypedVariableModel[]): StoreState => {
|
|
const variables = models.reduce<VariablesState>((byName, variable) => {
|
|
byName[variable.name] = variable;
|
|
return byName;
|
|
}, {});
|
|
return {
|
|
...getPreloadedState(key, { variables }),
|
|
} as StoreState;
|
|
};
|