Skip to content

Commit

Permalink
Support of selection of data provider in overview view
Browse files Browse the repository at this point in the history
Contributes to eclipse-cdt-cloud#55

Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
bhufmann committed Sep 23, 2022
1 parent f17d5da commit 22f29a5
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TspClient } from 'tsp-typescript-client/lib/protocol/tsp-client';
import { VsCodeMessageManager } from '../common/vscode-message-manager';
import '../style/trace-viewer.css';
import JSONBigConfig from 'json-bigint';
import { signalManager, Signals } from 'traceviewer-base/lib/signals/signal-manager';

const JSONBig = JSONBigConfig({
useNativeBigInt: true,
Expand All @@ -35,6 +36,8 @@ class App extends React.Component<{}, VscodeAppState> {
private selectedMarkerCategoriesMap: Map<string, string[]> = new Map<string, string[]>();
private selectedMarkerSetId = '';

private _onOverviewSelected = (payload: {traceId: string, outputDescriptor: OutputDescriptor}): void => this.doHandleOverviewSelectedSignal(payload);

constructor(props: {}) {
super(props);
this.state = {
Expand Down Expand Up @@ -66,12 +69,17 @@ class App extends React.Component<{}, VscodeAppState> {
});
this.onOutputRemoved = this.onOutputRemoved.bind(this);
this.onOverviewRemoved = this.onOverviewRemoved.bind(this);
signalManager().on(Signals.OVERVIEW_OUTPUT_SELECTED, this._onOverviewSelected);
}

componentDidMount(): void {
this._signalHandler.notifyReady();
}

componentWillUnmount(): void {
signalManager().off(Signals.OVERVIEW_OUTPUT_SELECTED, this._onOverviewSelected);
}

private onOutputRemoved(outputId: string) {
const outputToKeep = this.state.outputs.filter(output => output.id !== outputId);
this.setState({outputs: outputToKeep});
Expand All @@ -90,6 +98,12 @@ class App extends React.Component<{}, VscodeAppState> {
}
}

protected doHandleOverviewSelectedSignal(payload: {traceId: string, outputDescriptor: OutputDescriptor}): void {
if (this.state.experiment && payload && payload?.traceId === this.state.experiment.UUID && payload.outputDescriptor){
this.setState({overviewOutputDescriptor: payload.outputDescriptor});
}
}

protected async getDefaultTraceOverviewOutputDescriptor(experiment: Experiment| undefined): Promise<OutputDescriptor | undefined> {
const availableDescriptors = await this.getAvailableTraceOverviewOutputDescriptor(experiment);
return availableDescriptors?.find(output => output.id === this.DEFAULT_OVERVIEW_DATA_PROVIDER_ID);
Expand Down

0 comments on commit 22f29a5

Please sign in to comment.