mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 01:12:22 +08:00
Variables: move state tree into a keyed state (#44642)
* Variables: move state tree into a keyed state * Update public/app/features/variables/state/transactionReducer.ts Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> * Chore: fix prettier error * Chore: renamed slices and lastUid * Chore: rename toUidAction * Chore: rename dashboardVariableReducer * Chore: rename state prop back to templating * Chore renames variable.dashboardUid * Chore: rename toDashboardVariableIdentifier * Chore: rename getDashboardVariable * Chore: rename getDashboardVariablesState * Chore: rename getDashboardVariables * Chore: some more renames * Chore: small clean up * Chore: small rename * Chore: removes unused function * Chore: rename VariableModel.stateKey * Chore: rename KeyedVariableIdentifier.stateKey * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> Co-authored-by: kay delaney <kay@grafana.com> Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { connect, MapStateToProps } from 'react-redux';
|
||||
import { StoreState } from '../../../../types';
|
||||
import { getSubMenuVariables } from '../../../variables/state/selectors';
|
||||
import { getSubMenuVariables, getVariablesState } from '../../../variables/state/selectors';
|
||||
import { VariableModel } from '../../../variables/types';
|
||||
import { DashboardModel } from '../../state';
|
||||
import { DashboardLinks } from './DashboardLinks';
|
||||
@ -64,9 +64,11 @@ class SubMenuUnConnected extends PureComponent<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (state) => {
|
||||
const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (state, ownProps) => {
|
||||
const { uid } = ownProps.dashboard;
|
||||
const templatingState = getVariablesState(uid, state);
|
||||
return {
|
||||
variables: getSubMenuVariables(state.templating.variables),
|
||||
variables: getSubMenuVariables(uid, templatingState.variables),
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user