-
Notifications
You must be signed in to change notification settings - Fork 61
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 Server Offline Landing to Placeholder Widget #1043
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,24 @@ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify' | |
import { ReactWidget } from '@theia/core/lib/browser'; | ||
import * as React from 'react'; | ||
import { CommandService } from '@theia/core'; | ||
import { OpenTraceCommand } from '../../trace-viewer/trace-viewer-commands'; | ||
import { OpenTraceCommand, StartServerCommand } from '../../trace-viewer/trace-viewer-commands'; | ||
import { ReactExplorerPlaceholderWidget } from 'traceviewer-react-components/lib/trace-explorer/trace-explorer-placeholder-widget'; | ||
import { TraceServerConnectionStatusClient } from '../../../common/trace-server-connection-status'; | ||
|
||
@injectable() | ||
export class TraceExplorerPlaceholderWidget extends ReactWidget { | ||
static ID = 'trace-explorer-placeholder-widget'; | ||
static LABEL = 'Trace Explorer Placeholder Widget'; | ||
|
||
state = { | ||
loading: false | ||
loading: false, | ||
serverStatus: false, | ||
tracesOpened: false | ||
}; | ||
|
||
@inject(CommandService) protected readonly commandService!: CommandService; | ||
@inject(TraceServerConnectionStatusClient) | ||
protected traceServerConnectionStatusProxy: TraceServerConnectionStatusClient; | ||
|
||
@postConstruct() | ||
protected init(): void { | ||
|
@@ -23,10 +28,17 @@ export class TraceExplorerPlaceholderWidget extends ReactWidget { | |
this.update(); | ||
} | ||
|
||
dispose(): void { | ||
super.dispose(); | ||
} | ||
|
||
render(): React.ReactNode { | ||
const { loading } = this.state; | ||
const { loading, serverStatus, tracesOpened } = this.state; | ||
return ( | ||
<ReactExplorerPlaceholderWidget | ||
tracesOpen={tracesOpened} | ||
serverOn={serverStatus} | ||
handleStartServer={this.handleStartServer} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, when porting this change to the |
||
loading={loading} | ||
handleOpenTrace={this.handleOpenTrace} | ||
></ReactExplorerPlaceholderWidget> | ||
|
@@ -42,4 +54,20 @@ export class TraceExplorerPlaceholderWidget extends ReactWidget { | |
this.state.loading = false; | ||
this.update(); | ||
} | ||
|
||
protected handleStartServer = async (): Promise<void> => this.doHandleStartServer(); | ||
|
||
private async doHandleStartServer() { | ||
this.state.loading = true; | ||
this.update(); | ||
await this.commandService.executeCommand(StartServerCommand.id); | ||
this.state.loading = false; | ||
this.update(); | ||
} | ||
|
||
public setStateAndShow(newState: { serverStatus: boolean; tracesOpened: boolean }): void { | ||
this.state = { ...this.state, ...newState }; | ||
this.show(); | ||
this.update(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be
Reconnect
instead ofResume Trace Extension
?