Skip to content

Commit

Permalink
Fix Issue with opening Shortcuts Dialog
Browse files Browse the repository at this point in the history
fixes #853

Signed-off-by: hriday-panchasara <hriday.panchasara@ericsson.com>
  • Loading branch information
hriday-panchasara committed Feb 9, 2023
1 parent 5ee3267 commit b139865
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { inject, injectable, postConstruct } from 'inversify';
import { Dialog, DialogProps } from '@theia/core/lib/browser/dialogs';
import { inject, injectable } from 'inversify';
import { DialogProps } from '@theia/core/lib/browser/dialogs';
import { ReactDialog } from '@theia/core/lib/browser/dialogs/react-dialog';
import { Message } from '@theia/core/lib/browser/widgets/widget';
import { EssentialShortcutsTable } from './essential-shortcuts-table';
Expand All @@ -14,21 +14,13 @@ export class ChartShortcutsDialogProps extends DialogProps {
}

@injectable()
export class ChartShortcutsDialog extends ReactDialog<void> {
export class ChartShortcutsDialog extends ReactDialog<undefined> {

constructor(
@inject(ChartShortcutsDialogProps) protected readonly props: ChartShortcutsDialogProps
) {
super({
title: 'Trace Viewer Keyboard and Mouse Shortcuts',
});
this.appendAcceptButton(Dialog.OK);
}

@postConstruct()
protected async init(): Promise<void> {
this.title.label = 'Trace Viewer Keyboard and Mouse Shortcuts';
this.update();
super(props);
this.appendAcceptButton();
}

protected render(): React.ReactNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class TraceViewerContribution extends WidgetOpenHandler<TraceViewerWidget
@inject(TracePreferences) protected tracePreferences: TracePreferences;
@inject(TraceServerConfigService) protected readonly traceServerConfigService: TraceServerConfigService;
@inject(MessageService) protected readonly messageService: MessageService;
@inject(ChartShortcutsDialog) protected readonly chartShortcuts: ChartShortcutsDialog;

readonly id = TraceViewerWidget.ID;
readonly label = 'Trace Viewer';
Expand Down Expand Up @@ -248,8 +247,8 @@ export class TraceViewerContribution extends WidgetOpenHandler<TraceViewerWidget
}
});
registry.registerCommand(KeyboardShortcutsCommand, {
execute: () => {
this.chartShortcuts.open();
execute: async () => {
await new ChartShortcutsDialog({title: 'Trace Viewer Keyboard and Mouse Shortcuts'}).open();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar
import { TraceViewerToolbarContribution } from './trace-viewer-toolbar-contribution';
import { LazyTspClientFactory } from 'traceviewer-base/lib/lazy-tsp-client';
import { BackendFileService, backendFileServicePath } from '../../common/backend-file-service';
import { ChartShortcutsDialog, ChartShortcutsDialogProps } from '../trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component';
import { TraceServerConnectionStatusService } from '../trace-server-status';
import { bindTraceOverviewPreferences } from '../trace-overview-binding';

Expand All @@ -30,8 +29,6 @@ export default new ContainerModule(bind => {
bind(TraceServerUrlProvider).toService(TraceServerUrlProviderImpl);
bind(LazyTspClientFactory).toFunction(LazyTspClientFactory);
bind(TspClientProvider).toSelf().inSingletonScope();
bind(ChartShortcutsDialog).toSelf().inSingletonScope();
bind(ChartShortcutsDialogProps).toConstantValue({ title: 'Trace Viewer Keyboard and Mouse Shortcuts' });
bind(TheiaMessageManager).toSelf().inSingletonScope();

bind(TraceViewerToolbarContribution).toSelf().inSingletonScope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution
@inject(TspClientProvider) protected readonly tspClientProvider!: TspClientProvider;
@inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry;
@inject(CommandRegistry) protected readonly commands: CommandRegistry;
@inject(ChartShortcutsDialog) protected readonly chartShortcuts: ChartShortcutsDialog;

private onMarkerCategoriesFetchedSignal = () => this.doHandleMarkerCategoriesFetchedSignal();
private onMarkerSetsFetchedSignal = () => this.doHandleMarkerSetsFetchedSignal();
Expand Down Expand Up @@ -141,8 +140,8 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution
}
return false;
},
execute: () => {
this.chartShortcuts.open();
execute: async () => {
await new ChartShortcutsDialog({title: 'Trace Viewer Keyboard and Mouse Shortcuts'}).open();
}
});
}
Expand Down

0 comments on commit b139865

Please sign in to comment.