Skip to content

Commit

Permalink
Revert "Do not store state of Welcome page (eclipse-che#848)"
Browse files Browse the repository at this point in the history
See eclipse-che/che#16563

Signed-off-by: Eric Williams <ericwill@redhat.com>
  • Loading branch information
ericwill committed Sep 22, 2020
1 parent f2d1ca6 commit 825738f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions plugins/welcome-plugin/src/welcome-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export async function addPanel(context: theia.PluginContext): Promise<void> {
export function start(context: theia.PluginContext): void {
let showWelcomePage: boolean | undefined = true;

theia.window.registerWebviewPanelSerializer(welcomePageViewType, new WelcomePageSerializer(context));

const configuration = theia.workspace.getConfiguration(Settings.CHE_CONFIGURATION);
if (configuration) {
showWelcomePage = configuration.get(Settings.SHOW_WELCOME_PAGE);
Expand All @@ -128,3 +130,14 @@ export function start(context: theia.PluginContext): void {

export function stop(): void {
}

export class WelcomePageSerializer implements theia.WebviewPanelSerializer {

constructor(readonly context: theia.PluginContext) {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async deserializeWebviewPanel(webviewPanel: theia.WebviewPanel, state: any): Promise<void> {
webviewPanel.webview.html = await getHtmlForWebview(this.context);
}
}

0 comments on commit 825738f

Please sign in to comment.