Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back and forward support for app actions #294

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/Explore/GroupBySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ALL, ignoredAttributes, maxOptions, MetricFunction, RESOURCE_ATTR, SPAN
import { AttributesBreakdownScene } from './TracesByService/Tabs/Breakdown/AttributesBreakdownScene';
import { AttributesComparisonScene } from './TracesByService/Tabs/Comparison/AttributesComparisonScene';
import { getFiltersVariable, getMetricVariable } from 'utils/utils';
import { locationService } from '@grafana/runtime';

type Props = {
options: Array<SelectableValue<string>>;
Expand Down Expand Up @@ -122,7 +123,11 @@ export function GroupBySelector({ options, radioAttributes, value, onChange, sho
value={value && getModifiedSelectOptions(otherAttrOptions).some((x) => x.value === value) ? value : null} // remove value from select when radio button clicked
placeholder={'Other attributes'}
options={getModifiedSelectOptions(otherAttrOptions)}
onChange={(selected) => onChange(selected?.value ?? defaultOnChangeValue)}
onChange={(selected) => {
const newSelected = selected?.value ?? defaultOnChangeValue;
locationService.partial({ 'var-groupBy': newSelected });
onChange(newSelected);
}}
className={styles.select}
isClearable
onInputChange={(value: string, { action }: InputActionMeta) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Explore/panels/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getTraceByServiceScene, shouldShowSelection } from '../../../utils/util
import { ComparisonSelection } from '../../../utils/shared';
import { reportAppInteraction, USER_EVENTS_ACTIONS, USER_EVENTS_PAGES } from '../../../utils/analytics';
import { PanelBuilders, SceneFlexItem, SceneFlexLayout, SceneObject } from '@grafana/scenes';
import { locationService } from '@grafana/runtime';

export function getHistogramVizPanel(scene: SceneObject, yBuckets: number[]) {
const parent = getTraceByServiceScene(scene);
Expand All @@ -22,6 +23,7 @@ export function getHistogramVizPanel(scene: SceneObject, yBuckets: number[]) {
const rawSelection = args[0];
// @ts-ignore
const newSelection: ComparisonSelection = { type: 'manual', raw: rawSelection };
locationService.partial({ 'selection': newSelection });

newSelection.timeRange = {
from: Math.round((rawSelection.x?.from || 0) / 1000),
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Explore/TraceExploration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import {
LocationService,
config,
locationService,
// @ts-ignore
sidecarServiceSingleton_EXPERIMENTAL,
} from '@grafana/runtime';
Expand Down Expand Up @@ -189,6 +190,8 @@ export class TraceExploration extends SceneObjectBase<TraceExplorationState> {
if (!signal || this.state.primarySignal === signal) {
return;
}

locationService.partial({ 'primarySignal': signal });
this.setState({ primarySignal: signal });
};

Expand All @@ -197,6 +200,8 @@ export class TraceExploration extends SceneObjectBase<TraceExplorationState> {
if (!metric || variable.getValue() === metric) {
return;
}

locationService.partial({ 'var-metric': metric });
variable.changeValueTo(metric);
};

Expand Down
Loading