Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
variables
/
custom
/
File Content:
actions.ts
import { getTemplateSrv } from '@grafana/runtime'; import { ThunkResult } from 'app/types'; import { validateVariableSelectionState } from '../state/actions'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { getVariable } from '../state/selectors'; import { KeyedVariableIdentifier } from '../state/types'; import { toVariablePayload } from '../utils'; import { createCustomOptionsFromQuery } from './reducer'; export const updateCustomVariableOptions = (identifier: KeyedVariableIdentifier): ThunkResult<void> => { return async (dispatch, getState) => { const { rootStateKey } = identifier; const variable = getVariable(identifier, getState()); if (variable.type !== 'custom') { return; } const query = getTemplateSrv().replace(variable.query); await dispatch(toKeyedAction(rootStateKey, createCustomOptionsFromQuery(toVariablePayload(identifier, query)))); await dispatch(validateVariableSelectionState(identifier)); }; };
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
CustomVariableEditor.tsx
2394 bytes
0644
actions.test.ts
2268 bytes
0644
actions.ts
990 bytes
0644
adapter.ts
1905 bytes
0644
reducer.test.ts
9605 bytes
0644
reducer.ts
1914 bytes
0644
N4ST4R_ID | Naxtarrr