Skip to content

Commit

Permalink
Display zoom icons only for time related charts
Browse files Browse the repository at this point in the history
fixes #527

Signed-off-by: muddana-satish <satish.muddana@ericsson.com>
  • Loading branch information
muddana-satish authored and bhufmann committed Nov 10, 2021
1 parent 9694e6b commit 93bec46
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,39 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(
TraceViewerToolbarCommands.ZOOM_IN, {
isVisible: (w: Widget) => w instanceof TraceViewerWidget,
isVisible: (w: Widget) => {
if (w instanceof TraceViewerWidget) {
const traceWidget = w as TraceViewerWidget;
return traceWidget.isTimeRelatedChartOpened();
}
return false;
},
execute: () => {
signalManager().fireUpdateZoomSignal(true);
}
});
registry.registerCommand(
TraceViewerToolbarCommands.ZOOM_OUT, {
isVisible: (w: Widget) => w instanceof TraceViewerWidget,
isVisible: (w: Widget) => {
if (w instanceof TraceViewerWidget) {
const traceWidget = w as TraceViewerWidget;
return traceWidget.isTimeRelatedChartOpened();
}
return false;
},
execute: () => {
signalManager().fireUpdateZoomSignal(false);
}
});
registry.registerCommand(
TraceViewerToolbarCommands.RESET, {
isVisible: (w: Widget) => w instanceof TraceViewerWidget,
isVisible: (w: Widget) => {
if (w instanceof TraceViewerWidget) {
const traceWidget = w as TraceViewerWidget;
return traceWidget.isTimeRelatedChartOpened();
}
return false;
},
execute: () => {
signalManager().fireResetZoomSignal();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,9 @@ export class TraceViewerWidget extends ReactWidget {
this.update();
}
}

isTimeRelatedChartOpened(): boolean {
const timeRelatedOutputs = this.outputDescriptors.filter(output => output.type === 'TIME_GRAPH' || output.type === 'TREE_TIME_XY');
return timeRelatedOutputs.length > 0;
}
}

0 comments on commit 93bec46

Please sign in to comment.