Change action name

This commit is contained in:
Piotr Jamróz
2021-08-13 09:38:19 +02:00
parent 50a91b2f1f
commit beffbb89db
3 changed files with 10 additions and 5 deletions
@@ -8,7 +8,12 @@ import { TimeRange } from '@grafana/data';
*/
const init = createAction<GraphiteQueryEditorDependencies>('init');
const updateTimeRange = createAction<TimeRange | undefined>('update-time-range');
/**
* Used only to sync it with selected range from Explore/Panel. This action
* does not allow to modify the currently selected range.
*/
const timeRangeChanged = createAction<TimeRange | undefined>('time-range-changed');
// Metrics & Tags
const segmentValueChanged = createAction<{ segment: GraphiteSegment | string; index: number }>('segment-value-changed');
@@ -31,7 +36,7 @@ const toggleEditorMode = createAction('toggle-editor');
export const actions = {
init,
updateTimeRange,
timeRangeChanged,
segmentValueChanged,
tagChanged,
addNewTag,
@@ -37,8 +37,8 @@ export const GraphiteQueryEditorContext = ({
}, []);
useEffect(() => {
dispatch(actions.updateTimeRange(range));
}, [range]);
dispatch(actions.timeRangeChanged(range));
}, [dispatch, range]);
if (!state) {
dispatch(
@@ -72,7 +72,7 @@ const reducer = async (action: Action, state: GraphiteQueryEditorState): Promise
await buildSegments(state, false);
}
if (actions.updateTimeRange.match(action)) {
if (actions.timeRangeChanged.match(action)) {
state.range = action.payload;
}
if (actions.segmentValueChanged.match(action)) {