Skip to content

Commit 0f4cda6

Browse files
committed
Add OpenShift: Welcome command to open welcome page
This PR fixes #2093. Signed-off-by: Denis Golovin dgolovin@redhat.com
1 parent f989e31 commit 0f4cda6

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,11 @@
812812
"dark": "images/title/dark/icon-refresh.svg",
813813
"light": "images/title/light/icon-refresh.svg"
814814
}
815+
},
816+
{
817+
"command": "openshift.welcome",
818+
"title": "Welcome",
819+
"category": "OpenShift"
815820
}
816821
],
817822
"keybindings": [

src/extension.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ import { extendClusterExplorer } from './k8s/clusterExplorer';
2727
import { WatchSessionsView } from './watch';
2828
import { DebugSessionsView } from './debug';
2929
import { ComponentTypesView } from './componentTypesView';
30-
import { WelcomeWebview } from 'vscode-welcome-view';
30+
import { WelcomePage } from './welcomePage';
3131
import { ComponentsTreeDataProvider } from './componentsView';
3232

3333
import fsx = require('fs-extra');
34-
import { ExtenisonID } from './util/constants';
3534

3635

3736
// eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -58,9 +57,7 @@ async function verifyBundledBinaries(): Promise<{odoPath: string, ocPath: string
5857
}
5958

6059
export async function activate(extensionContext: ExtensionContext): Promise<any> {
61-
if(workspace.getConfiguration('openshiftConnector').get('showWelcomePage')) {
62-
WelcomeWebview.createOrShow(ExtenisonID, extensionContext.extensionPath, path.join('welcome', 'app', 'assets'), 'openshiftConnector.showWelcomePage');
63-
}
60+
WelcomePage.createOrShow();
6461
commands.executeCommand('setContext', 'isVSCode', env.uiKind);
6562
// UIKind.Desktop ==1 & UIKind.Web ==2. These conditions are checked for browser based & electron based IDE.
6663
migrateFromOdo018();

src/welcomePage.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*-----------------------------------------------------------------------------------------------
2+
* Copyright (c) Red Hat, Inc. All rights reserved.
3+
* Licensed under the MIT License. See LICENSE file in the project root for license information.
4+
*-----------------------------------------------------------------------------------------------*/
5+
6+
import { workspace } from 'vscode';
7+
import { ExtenisonID } from './util/constants';
8+
import { WelcomeWebview } from 'vscode-welcome-view';
9+
import path = require('path');
10+
import { vsCommand } from './vscommand';
11+
12+
export class WelcomePage {
13+
14+
@vsCommand('openshift.welcome')
15+
static createOrShow(): void {
16+
if(workspace.getConfiguration('openshiftConnector').get('showWelcomePage')) {
17+
WelcomeWebview.createOrShow(ExtenisonID, path.resolve(__dirname, '..', '..'), path.join('welcome', 'app', 'assets'), 'openshiftConnector.showWelcomePage');
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)