From 7171f348f85927142f436eac0970901ba3ca3b16 Mon Sep 17 00:00:00 2001 From: Gorkem Ercan Date: Thu, 27 Oct 2022 09:35:46 -0400 Subject: [PATCH 1/5] initial implementation for cloud explorer Updates kubernetes tools cloud explorer with options to signup for Developer Sandbox and Local OpenShift --- package.json | 23 ++- src/cloud-provider/redhat-cloud-provider.ts | 156 ++++++++++++++++++++ src/extension.ts | 23 ++- 3 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 src/cloud-provider/redhat-cloud-provider.ts diff --git a/package.json b/package.json index b467b3fb3..d95e68ca9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "K8s", "Cloud", "podman", - "Helm" + "Helm", + "kubernetes-extension-cloud-provider" ], "icon": "images/openshift_extension.png", "main": "./out/src/extension", @@ -795,6 +796,16 @@ "command": "openshift.component.deleteSourceFolder", "title": "Delete Source Code Folder", "category": "OpenShift" + }, + { + "command": "openshift.sandbox.open.dashboard", + "title": "Open Console", + "category": "OpenShift" + }, + { + "command": "openshift.sandbox.signup", + "title": "Signup for Sandbox", + "category": "OpenShift" } ], "keybindings": [ @@ -1146,6 +1157,16 @@ } ], "view/item/context": [ + { + "command": "openshift.sandbox.signup", + "category": "1@1", + "when": "viewItem == openshift.sandbox.status.none" + }, + { + "command": "openshift.sandbox.open.dashboard", + "category": "1@1", + "when": "viewItem == openshift.sandbox.status.ready" + }, { "command": "clusters.openshift.csv.create", "group": "1@1", diff --git a/src/cloud-provider/redhat-cloud-provider.ts b/src/cloud-provider/redhat-cloud-provider.ts new file mode 100644 index 000000000..b1bb4e892 --- /dev/null +++ b/src/cloud-provider/redhat-cloud-provider.ts @@ -0,0 +1,156 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ +import * as k8s from 'vscode-kubernetes-tools-api'; +import * as vscode from 'vscode'; +import { vsCommand } from '../vscommand'; +import { createSandboxAPI, SBSignupResponse } from '../openshift/sandbox'; +import ClusterViewLoader from '../webview/cluster/clusterViewLoader'; + +const sandboxAPI = createSandboxAPI(); + +class RedHatCloudItem extends vscode.TreeItem{ + +} + +class RedHatTreeDataProvier implements vscode.TreeDataProvider { + private eventEmitter: vscode.EventEmitter = new vscode.EventEmitter() + readonly onDidChangeTreeData: vscode.Event = this.eventEmitter.event + + getTreeItem(element: RedHatCloudItem): vscode.TreeItem | Thenable { + return element + } + + getChildren(element?: RedHatCloudItem): vscode.ProviderResult { + if(!element){ + return this.getTopLevelItems(); + } + return []; + } + + getParent?(element: RedHatCloudItem): unknown { + throw new Error('Method not implemented.'); + } + + resolveTreeItem?(item: vscode.TreeItem, element: unknown, token: vscode.CancellationToken): vscode.ProviderResult { + throw new Error('Method not implemented.'); + } + + private async getTopLevelItems(): Promise { + const sessionCheck = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); + if(sessionCheck) { + const sandboxItem = await this.buildSandboxItem(); + sandboxItem.iconPath + const openshiftLocal = new RedHatCloudItem('OpenShift Local'); + openshiftLocal.tooltip = 'OpenShift Local' + openshiftLocal.command = { + command:'openshift.local.open.setup', + title: 'Install OpenShift Local', + } + return [sandboxItem,openshiftLocal]; + } + const loginItem = new RedHatCloudItem('Sign in to Red Hat'); + loginItem.iconPath = new vscode.ThemeIcon('account'); + loginItem.tooltip = 'Sign in to Red Hat'; + loginItem.command = { + command: 'cloud.redhat.login', + title: 'Sign in to Red Hat', + } + + const signUpItem = new RedHatCloudItem('Sign in to Red Hat'); + signUpItem.tooltip = 'Sign in to Red Hat'; + signUpItem.iconPath = new vscode.ThemeIcon('add'); + signUpItem.command = { + command: '_openshift.open.signup', + title: 'Create Red Hat Account', + tooltip: 'Create Red Hat Account' + } + return [loginItem, signUpItem]; + + } + + private async buildSandboxItem() { + const signupStatus = await RedHatTreeDataProvier.getSandboxSignupStatus() + const sandboxItem = new RedHatCloudItem('Developer Sandbox'); + sandboxItem.tooltip = 'Developer Sandbox' + + if (!signupStatus) { + sandboxItem.contextValue = 'openshift.sandbox.status.none'; + } + else if (signupStatus.status.ready) { + sandboxItem.contextValue = 'openshift.sandbox.status.ready'; + } + return sandboxItem; + } + + @vsCommand('openshift.sandbox.signup') + static async signupForSandbox() : Promise { + const authSession = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); + if(authSession){ + // eslint-disable-next-line dot-notation + const signupResponse = await sandboxAPI.signUp(authSession['idToken'] as string); + if( !signupResponse ){ + return 'Sign up request for OpenShift Sandbox failed, please try again.' + } + await RedHatTreeDataProvier.refreshView(); + + } + } + + @vsCommand('openshift.local.open.setup') + static async openCrCWizard(): Promise { + const webViewPanel: vscode.WebviewPanel = await ClusterViewLoader.loadView('Add OpenShift Cluster'); + await webViewPanel.webview.postMessage({data: {param:'crc'}}); + } + + @vsCommand('cloud.redhat.login', false) + static async loginToRedHatCloud(): Promise { + const session = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: true }); + if(session ){ + await RedHatTreeDataProvier.refreshView(); + } + } + + @vsCommand('_openshift.open.signup', false) + static async signupForRedHatAccount(): Promise { + return vscode.commands.executeCommand('vscode.open', 'https://red.ht/3MkQ54W'); + } + + @vsCommand('openshift.sandbox.open.dashboard', false) + static async openDashboard(): Promise { + const sandboxStatus = await RedHatTreeDataProvier.getSandboxSignupStatus(); + if(sandboxStatus) + { + return vscode.commands.executeCommand('vscode.open', sandboxStatus.consoleURL); + } + + } + + private static async getSandboxSignupStatus() : Promise { + const authSession = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); + if(authSession) { + // eslint-disable-next-line dot-notation + return await sandboxAPI.getSignUpStatus(authSession['idToken'] as string); + } + return undefined + } + private static async refreshView() { + const cloudExplorer = await k8s.extension.cloudExplorer.v1; + if (cloudExplorer.available) { + cloudExplorer.api.refresh(); + } + } + +} + +class RedHatCloudProvider implements k8s.CloudExplorerV1.CloudProvider { + getKubeconfigYaml(cluster: any): Promise { + throw new Error('Method not implemented.'); + } + readonly cloudName = 'Red Hat OpenShift' + readonly treeDataProvider = new RedHatTreeDataProvier(); + +} + +export const REDHAT_CLOUD_PROVIDER = new RedHatCloudProvider(); diff --git a/src/extension.ts b/src/extension.ts index 3743977d6..cc4e6ff9c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -15,6 +15,8 @@ import { window, workspace } from 'vscode'; +import * as k8s from 'vscode-kubernetes-tools-api'; +import { REDHAT_CLOUD_PROVIDER } from './cloud-provider/redhat-cloud-provider'; import { ComponentsTreeDataProvider } from './componentsView'; import { DebugSessionsView } from './debug'; import { OpenShiftExplorer } from './explorer'; @@ -56,7 +58,15 @@ async function verifyBundledBinaries(): Promise<{ odoPath: string, ocPath: strin }; } -export async function activate(extensionContext: ExtensionContext): Promise { +async function registerCloudProvider(): Promise { + const cloudProvider = await k8s.extension.cloudExplorer.v1 + if (cloudProvider.available) { + cloudProvider.api.registerCloudProvider(REDHAT_CLOUD_PROVIDER) + } + +} + +export async function activate(extensionContext: ExtensionContext): Promise { WelcomePage.createOrShow(); await commands.executeCommand('setContext', 'isVSCode', env.uiKind); // UIKind.Desktop ==1 & UIKind.Web ==2. These conditions are checked for browser based & electron based IDE. @@ -102,7 +112,7 @@ export async function activate(extensionContext: ExtensionContext): Promise kind: QuickPickItemKind.Separator }, { - label:'Add OpenShift Cluster' + label: 'Add OpenShift Cluster' }, { label: 'Login to Cluster' @@ -133,7 +143,7 @@ export async function activate(extensionContext: ExtensionContext): Promise { label: 'Getting Started Walkthrough' } - ]); + ]); switch (selection?.label) { case 'Add OpenShift Cluster': await commands.executeCommand('openshift.explorer.addCluster'); @@ -166,8 +176,7 @@ export async function activate(extensionContext: ExtensionContext): Promise }); } - function createStatusBarItem(context: ExtensionContext) - { + function createStatusBarItem(context: ExtensionContext) { const item = window.createStatusBarItem(StatusBarAlignment.Left, 1); item.command = 'openshift.openStatusBar'; context.subscriptions.push(item); @@ -176,7 +185,7 @@ export async function activate(extensionContext: ExtensionContext): Promise item.show(); } - createStatusBarItem(extensionContext) ; + createStatusBarItem(extensionContext); function updateStatusBarItem(statusBarItem: StatusBarItem, text: string): void { if (!workspace.getConfiguration('openshiftToolkit').get('crcBinaryLocation')) { @@ -192,6 +201,8 @@ export async function activate(extensionContext: ExtensionContext): Promise await ComponentTypesView.instance.getAllComponents(); + await registerCloudProvider(); + startTelemetry(extensionContext); await verifyBinariesInRemoteContainer(); From fd859897a7e8f3efa2862d46951cd9b17f088623 Mon Sep 17 00:00:00 2001 From: Denis Golovin Date: Mon, 12 Dec 2022 20:19:54 -0800 Subject: [PATCH 2/5] Rename tree item with + icon to 'Create Red Hat Account' Signed-off-by: Denis Golovin dgolovin@redhat.com --- src/cloud-provider/redhat-cloud-provider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cloud-provider/redhat-cloud-provider.ts b/src/cloud-provider/redhat-cloud-provider.ts index b1bb4e892..d2f04d68a 100644 --- a/src/cloud-provider/redhat-cloud-provider.ts +++ b/src/cloud-provider/redhat-cloud-provider.ts @@ -58,8 +58,8 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider title: 'Sign in to Red Hat', } - const signUpItem = new RedHatCloudItem('Sign in to Red Hat'); - signUpItem.tooltip = 'Sign in to Red Hat'; + const signUpItem = new RedHatCloudItem('Create Red Hat Account'); + signUpItem.tooltip = 'Create Red Hat Account'; signUpItem.iconPath = new vscode.ThemeIcon('add'); signUpItem.command = { command: '_openshift.open.signup', From 3c70c57b21a00d2b871313d5c90eabdf8c12bb96 Mon Sep 17 00:00:00 2001 From: Denis Golovin Date: Tue, 13 Dec 2022 12:58:50 -0800 Subject: [PATCH 3/5] Add "onView:kubernetes.cloudExplorer" activation event Signed-off-by: Denis Golovin dgolovin@redhat.com --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d95e68ca9..cfd5cf67c 100644 --- a/package.json +++ b/package.json @@ -215,6 +215,7 @@ "onView:openshiftProjectExplorer", "onView:extension.vsKubernetesExplorer", "onView:openshiftComponentTypesView", + "onView:kubernetes.cloudExplorer", "onCommand:openshift.welcome", "onCommand:openshift.getStarted", "onCommand:openshift.about", From 686c96ecc8ee495f4910d21a32de8287815199d2 Mon Sep 17 00:00:00 2001 From: Denis Golovin Date: Tue, 13 Dec 2022 13:45:16 -0800 Subject: [PATCH 4/5] Allow Cluster editor open on crc or sandbox page Signed-off-by: Denis Golovin dgolovin@redhat.com --- src/cloud-provider/redhat-cloud-provider.ts | 4 +--- src/webview/@types/windows/index.d.ts | 1 + src/webview/cluster/app/cluster.tsx | 1 + src/webview/cluster/app/index.html | 3 +++ src/webview/cluster/clusterViewLoader.ts | 3 +-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cloud-provider/redhat-cloud-provider.ts b/src/cloud-provider/redhat-cloud-provider.ts index d2f04d68a..17a03b4ac 100644 --- a/src/cloud-provider/redhat-cloud-provider.ts +++ b/src/cloud-provider/redhat-cloud-provider.ts @@ -100,8 +100,7 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider @vsCommand('openshift.local.open.setup') static async openCrCWizard(): Promise { - const webViewPanel: vscode.WebviewPanel = await ClusterViewLoader.loadView('Add OpenShift Cluster'); - await webViewPanel.webview.postMessage({data: {param:'crc'}}); + await ClusterViewLoader.loadView('Add OpenShift Cluster', 'crc'); } @vsCommand('cloud.redhat.login', false) @@ -124,7 +123,6 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider { return vscode.commands.executeCommand('vscode.open', sandboxStatus.consoleURL); } - } private static async getSandboxSignupStatus() : Promise { diff --git a/src/webview/@types/windows/index.d.ts b/src/webview/@types/windows/index.d.ts index 3bb2d802b..2b76c9291 100644 --- a/src/webview/@types/windows/index.d.ts +++ b/src/webview/@types/windows/index.d.ts @@ -13,6 +13,7 @@ interface VscodeAPI { interface Window { cmdText?: string; + startingPage?: string; vscodeApi: VscodeAPI; acquireVsCodeApi: () => VscodeAPI; } \ No newline at end of file diff --git a/src/webview/cluster/app/cluster.tsx b/src/webview/cluster/app/cluster.tsx index 69784dea8..9c88e8edf 100644 --- a/src/webview/cluster/app/cluster.tsx +++ b/src/webview/cluster/app/cluster.tsx @@ -55,6 +55,7 @@ export default function Header() { const [showWizard, setShowWizard] = React.useState(''); const [crcLatest, setCrcLatest] = React.useState(''); const [crcOpenShift, setCrcOpenShift] = React.useState(''); + const [showWizard, setShowWizard] = React.useState(window.startingPage); window.onmessage = (event: any) => { if (['crc', 'sandbox'].includes(event.data.param)) { diff --git a/src/webview/cluster/app/index.html b/src/webview/cluster/app/index.html index 734e400a2..7a7204f88 100644 --- a/src/webview/cluster/app/index.html +++ b/src/webview/cluster/app/index.html @@ -2,6 +2,9 @@ + Config View diff --git a/src/webview/cluster/clusterViewLoader.ts b/src/webview/cluster/clusterViewLoader.ts index 39c96eadf..e4b6c78f1 100644 --- a/src/webview/cluster/clusterViewLoader.ts +++ b/src/webview/cluster/clusterViewLoader.ts @@ -322,7 +322,7 @@ export default class ClusterViewLoader { } // eslint-disable-next-line @typescript-eslint/require-await - static async loadView(title: string): Promise { + static async loadView(title: string, initialPage: 'crc' | 'sandbox' | '' = ''): Promise { const localResourceRoot = vscode.Uri.file(path.join(ClusterViewLoader.extensionPath, 'out', 'clusterViewer')); if (panel) { // If we already have a panel, show it in the target column @@ -372,5 +372,4 @@ export default class ClusterViewLoader { } } } - } From c9c6da18c6f3b968eada6915d86ad27760a395d3 Mon Sep 17 00:00:00 2001 From: Jessica He Date: Mon, 12 Jun 2023 09:22:11 -0400 Subject: [PATCH 5/5] Rebase and clean up Signed-off-by: Jessica He --- package.json | 6 +- .../redhatCloudProvider.ts} | 81 +++++++++++-------- src/extension.ts | 11 ++- src/webview/@types/windows/index.d.ts | 3 +- src/webview/cluster/app/cluster.tsx | 1 - src/webview/cluster/app/index.html | 3 - src/webview/cluster/clusterViewLoader.ts | 2 +- 7 files changed, 57 insertions(+), 50 deletions(-) rename src/{cloud-provider/redhat-cloud-provider.ts => cloudProvider/redhatCloudProvider.ts} (67%) diff --git a/package.json b/package.json index cfd5cf67c..6a04aee7c 100644 --- a/package.json +++ b/package.json @@ -215,7 +215,7 @@ "onView:openshiftProjectExplorer", "onView:extension.vsKubernetesExplorer", "onView:openshiftComponentTypesView", - "onView:kubernetes.cloudExplorer", + "onView:kubernetes.cloudExplorer", "onCommand:openshift.welcome", "onCommand:openshift.getStarted", "onCommand:openshift.about", @@ -800,12 +800,12 @@ }, { "command": "openshift.sandbox.open.dashboard", - "title": "Open Console", + "title": "Open Developer Console", "category": "OpenShift" }, { "command": "openshift.sandbox.signup", - "title": "Signup for Sandbox", + "title": "Provision OpenShift Developer Sandbox", "category": "OpenShift" } ], diff --git a/src/cloud-provider/redhat-cloud-provider.ts b/src/cloudProvider/redhatCloudProvider.ts similarity index 67% rename from src/cloud-provider/redhat-cloud-provider.ts rename to src/cloudProvider/redhatCloudProvider.ts index 17a03b4ac..369264ebc 100644 --- a/src/cloud-provider/redhat-cloud-provider.ts +++ b/src/cloudProvider/redhatCloudProvider.ts @@ -7,10 +7,11 @@ import * as vscode from 'vscode'; import { vsCommand } from '../vscommand'; import { createSandboxAPI, SBSignupResponse } from '../openshift/sandbox'; import ClusterViewLoader from '../webview/cluster/clusterViewLoader'; +import path = require('path'); const sandboxAPI = createSandboxAPI(); -class RedHatCloudItem extends vscode.TreeItem{ +class RedHatCloudItem extends vscode.TreeItem { } @@ -23,7 +24,7 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider } getChildren(element?: RedHatCloudItem): vscode.ProviderResult { - if(!element){ + if (!element) { return this.getTopLevelItems(); } return []; @@ -39,23 +40,17 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider private async getTopLevelItems(): Promise { const sessionCheck = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); - if(sessionCheck) { - const sandboxItem = await this.buildSandboxItem(); - sandboxItem.iconPath - const openshiftLocal = new RedHatCloudItem('OpenShift Local'); - openshiftLocal.tooltip = 'OpenShift Local' - openshiftLocal.command = { - command:'openshift.local.open.setup', - title: 'Install OpenShift Local', - } - return [sandboxItem,openshiftLocal]; + if (sessionCheck) { + const sandboxItem = await this.buildDevSandboxItem(); + const openshiftLocalItem = this.buildOpenshiftLocalItem(); + return [sandboxItem, openshiftLocalItem]; } const loginItem = new RedHatCloudItem('Sign in to Red Hat'); loginItem.iconPath = new vscode.ThemeIcon('account'); loginItem.tooltip = 'Sign in to Red Hat'; loginItem.command = { - command: 'cloud.redhat.login', - title: 'Sign in to Red Hat', + command: 'cloud.redhat.login', + title: 'Sign in to Red Hat', } const signUpItem = new RedHatCloudItem('Create Red Hat Account'); @@ -67,31 +62,45 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider tooltip: 'Create Red Hat Account' } return [loginItem, signUpItem]; - } - private async buildSandboxItem() { - const signupStatus = await RedHatTreeDataProvier.getSandboxSignupStatus() + private async buildDevSandboxItem() { + const signupStatus = await RedHatTreeDataProvier.getSandboxSignupStatus(); const sandboxItem = new RedHatCloudItem('Developer Sandbox'); - sandboxItem.tooltip = 'Developer Sandbox' - + sandboxItem.tooltip = 'Get 30-days free access to a shared OpenShift and Kubernetes cluster.'; + sandboxItem.iconPath = vscode.Uri.file(path.join(__dirname, '..', '..', '..', 'images', 'title', 'logo.svg')); if (!signupStatus) { sandboxItem.contextValue = 'openshift.sandbox.status.none'; } else if (signupStatus.status.ready) { sandboxItem.contextValue = 'openshift.sandbox.status.ready'; } + sandboxItem.command = { + command: 'openshift.sandbox.open.setup', + title: 'Set up Developer Sandbox', + } return sandboxItem; } + private buildOpenshiftLocalItem() { + const openshiftLocalItem = new RedHatCloudItem('Openshift Local'); + openshiftLocalItem.tooltip = 'Provision OpenShift 4 cluster to your local computer.'; + openshiftLocalItem.iconPath = new vscode.ThemeIcon('vm'); + openshiftLocalItem.command = { + command: 'openshift.local.open.setup', + title: 'Install OpenShift Local', + } + return openshiftLocalItem; + } + @vsCommand('openshift.sandbox.signup') - static async signupForSandbox() : Promise { + static async signupForSandbox(): Promise { const authSession = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); - if(authSession){ + if (authSession) { // eslint-disable-next-line dot-notation const signupResponse = await sandboxAPI.signUp(authSession['idToken'] as string); - if( !signupResponse ){ - return 'Sign up request for OpenShift Sandbox failed, please try again.' + if (!signupResponse) { + return 'Sign up request for OpenShift Sandbox failed, please try again.'; } await RedHatTreeDataProvier.refreshView(); @@ -100,13 +109,20 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider @vsCommand('openshift.local.open.setup') static async openCrCWizard(): Promise { - await ClusterViewLoader.loadView('Add OpenShift Cluster', 'crc'); + const webViewPanel: vscode.WebviewPanel = await ClusterViewLoader.loadView('Add OpenShift Cluster'); + await webViewPanel.webview.postMessage({ action: 'openCluster', param: 'crc' }); + } + + @vsCommand('openshift.sandbox.open.setup') + static async openSandboxWizard(): Promise { + const webViewPanel: vscode.WebviewPanel = await ClusterViewLoader.loadView('Add OpenShift Cluster'); + await webViewPanel.webview.postMessage({ action: 'openCluster', param: 'sandbox' }); } @vsCommand('cloud.redhat.login', false) static async loginToRedHatCloud(): Promise { - const session = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: true }); - if(session ){ + const session = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: true }); + if (session) { await RedHatTreeDataProvier.refreshView(); } } @@ -119,19 +135,18 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider @vsCommand('openshift.sandbox.open.dashboard', false) static async openDashboard(): Promise { const sandboxStatus = await RedHatTreeDataProvier.getSandboxSignupStatus(); - if(sandboxStatus) - { + if (sandboxStatus) { return vscode.commands.executeCommand('vscode.open', sandboxStatus.consoleURL); } } - private static async getSandboxSignupStatus() : Promise { + private static async getSandboxSignupStatus(): Promise { const authSession = await vscode.authentication.getSession('redhat-account-auth', ['openid'], { createIfNone: false }); - if(authSession) { + if (authSession) { // eslint-disable-next-line dot-notation return await sandboxAPI.getSignUpStatus(authSession['idToken'] as string); } - return undefined + return undefined; } private static async refreshView() { const cloudExplorer = await k8s.extension.cloudExplorer.v1; @@ -139,16 +154,14 @@ class RedHatTreeDataProvier implements vscode.TreeDataProvider cloudExplorer.api.refresh(); } } - } class RedHatCloudProvider implements k8s.CloudExplorerV1.CloudProvider { getKubeconfigYaml(cluster: any): Promise { throw new Error('Method not implemented.'); } - readonly cloudName = 'Red Hat OpenShift' + readonly cloudName = 'Red Hat OpenShift'; readonly treeDataProvider = new RedHatTreeDataProvier(); - } export const REDHAT_CLOUD_PROVIDER = new RedHatCloudProvider(); diff --git a/src/extension.ts b/src/extension.ts index cc4e6ff9c..74d7fb6b3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -16,7 +16,7 @@ import { workspace } from 'vscode'; import * as k8s from 'vscode-kubernetes-tools-api'; -import { REDHAT_CLOUD_PROVIDER } from './cloud-provider/redhat-cloud-provider'; +import { REDHAT_CLOUD_PROVIDER } from './cloudProvider/redhatCloudProvider'; import { ComponentsTreeDataProvider } from './componentsView'; import { DebugSessionsView } from './debug'; import { OpenShiftExplorer } from './explorer'; @@ -58,12 +58,11 @@ async function verifyBundledBinaries(): Promise<{ odoPath: string, ocPath: strin }; } -async function registerCloudProvider(): Promise { - const cloudProvider = await k8s.extension.cloudExplorer.v1 +async function registerKubernetesCloudProvider(): Promise { + const cloudProvider = await k8s.extension.cloudExplorer.v1; if (cloudProvider.available) { - cloudProvider.api.registerCloudProvider(REDHAT_CLOUD_PROVIDER) + cloudProvider.api.registerCloudProvider(REDHAT_CLOUD_PROVIDER); } - } export async function activate(extensionContext: ExtensionContext): Promise { @@ -201,7 +200,7 @@ export async function activate(extensionContext: ExtensionContext): Promise VscodeAPI; -} \ No newline at end of file +} diff --git a/src/webview/cluster/app/cluster.tsx b/src/webview/cluster/app/cluster.tsx index 9c88e8edf..69784dea8 100644 --- a/src/webview/cluster/app/cluster.tsx +++ b/src/webview/cluster/app/cluster.tsx @@ -55,7 +55,6 @@ export default function Header() { const [showWizard, setShowWizard] = React.useState(''); const [crcLatest, setCrcLatest] = React.useState(''); const [crcOpenShift, setCrcOpenShift] = React.useState(''); - const [showWizard, setShowWizard] = React.useState(window.startingPage); window.onmessage = (event: any) => { if (['crc', 'sandbox'].includes(event.data.param)) { diff --git a/src/webview/cluster/app/index.html b/src/webview/cluster/app/index.html index 7a7204f88..734e400a2 100644 --- a/src/webview/cluster/app/index.html +++ b/src/webview/cluster/app/index.html @@ -2,9 +2,6 @@ - Config View diff --git a/src/webview/cluster/clusterViewLoader.ts b/src/webview/cluster/clusterViewLoader.ts index e4b6c78f1..d02e5f55d 100644 --- a/src/webview/cluster/clusterViewLoader.ts +++ b/src/webview/cluster/clusterViewLoader.ts @@ -322,7 +322,7 @@ export default class ClusterViewLoader { } // eslint-disable-next-line @typescript-eslint/require-await - static async loadView(title: string, initialPage: 'crc' | 'sandbox' | '' = ''): Promise { + static async loadView(title: string): Promise { const localResourceRoot = vscode.Uri.file(path.join(ClusterViewLoader.extensionPath, 'out', 'clusterViewer')); if (panel) { // If we already have a panel, show it in the target column