Skip to content

Commit bbf67bc

Browse files
datho7561rgrunber
authored andcommitted
Remove 'Deploy to Openshift' command
- Remove the 'Deploy to OpenShift' command, since it doesn't work and isn't being used. - Replace our existing system to recommend OpenShift Toolkit with vscode-extension-proposals Fixes #605, Closes #609 Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent a026163 commit bbf67bc

File tree

10 files changed

+91
-220
lines changed

10 files changed

+91
-220
lines changed

package-lock.json

Lines changed: 23 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: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,6 @@
158158
"command": "quarkusTools.welcome",
159159
"title": "Quarkus: Welcome"
160160
},
161-
{
162-
"command": "quarkusTools.deployToOpenShift",
163-
"title": "Quarkus: Deploy current Quarkus project to OpenShift (odo)"
164-
},
165-
{
166-
"command": "quarkusTools.deployToOpenShift.short",
167-
"title": "Deploy to OpenShift",
168-
"icon": "icons/openshift.png"
169-
},
170161
{
171162
"command": "qute.validation.enabled.toggle.off",
172163
"title": "Disable Qute Validation",
@@ -341,10 +332,6 @@
341332
"command": "quarkusTools.debugQuarkusProject",
342333
"when": "quarkusProjectExistsOrLightWeight"
343334
},
344-
{
345-
"command": "quarkusTools.deployToOpenShift",
346-
"when": "quarkusProjectExistsOrLightWeight"
347-
},
348335
{
349336
"command": "qute.validation.enabled.toggle.off",
350337
"when": "false"
@@ -367,11 +354,6 @@
367354
}
368355
],
369356
"editor/title": [
370-
{
371-
"command": "quarkusTools.deployToOpenShift.short",
372-
"when": "quarkusProjectExistsOrLightWeight && resourceExtname == .java",
373-
"group": "navigation@10"
374-
},
375357
{
376358
"command": "qute.validation.enabled.toggle.off",
377359
"when": "quarkusProjectExistsOrLightWeight && editorLangIdSupportsQute && editorQuteValidationEnabled",
@@ -389,13 +371,6 @@
389371
"when": "quarkusProjectExistsOrLightWeight && resourceExtname == .java",
390372
"group": "quarkus@1"
391373
}
392-
],
393-
"view/title": [
394-
{
395-
"command": "quarkusTools.deployToOpenShift.short",
396-
"when": "quarkusProjectExistsOrLightWeight",
397-
"group": "quarkus@1"
398-
}
399374
]
400375
},
401376
"grammars": [
@@ -493,6 +468,7 @@
493468
"webpack-cli": "^4.9.1"
494469
},
495470
"dependencies": {
471+
"@redhat-developer/vscode-extension-proposals": "^0.0.21",
496472
"@redhat-developer/vscode-redhat-telemetry": "^0.6.1",
497473
"ejs": "^3.1.7",
498474
"expand-home-dir": "0.0.3",

src/commands/registerCommands.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { WelcomeWebview } from "../webviews/WelcomeWebview";
77
import { addExtensionsWizard } from "../wizards/addExtensions/addExtensionsWizard";
88
import { buildBinary } from "../wizards/binary/buildBinary";
99
import { startDebugging } from "../wizards/debugging/startDebugging";
10-
import { deployToOpenShift } from "../wizards/deployToOpenShift/deployToOpenShift";
1110
import { generateProjectWizard } from "../wizards/generateProject/generationWizard";
1211

1312
const NOT_A_QUARKUS_PROJECT = new Error('No Quarkus projects were detected in this folder');
@@ -44,12 +43,6 @@ export function registerVSCodeCommands(context: ExtensionContext): void {
4443
registerCommandWithTelemetry(context, VSCodeCommands.DEBUG_QUARKUS_PROJECT, withStandardMode(startDebugging, "Debugging the extension"));
4544
registerCommandWithTelemetry(context, VSCodeCommands.DEBUG_QUARKUS_PROJECT + VSCodeCommands.SHORT_SUFFIX, withStandardMode(startDebugging, "Debugging the extension"));
4645

47-
/**
48-
* Command for deploying current Quarkus project to OpenShift with OpenShift Connector
49-
*/
50-
registerCommandWithTelemetry(context, VSCodeCommands.DEPLOY_TO_OPENSHIFT, withStandardMode(deployToOpenShift, "Deploying to OpenShift"));
51-
registerCommandWithTelemetry(context, VSCodeCommands.DEPLOY_TO_OPENSHIFT + VSCodeCommands.SHORT_SUFFIX, withStandardMode(deployToOpenShift, "Deploying to OpenShift"));
52-
5346
/**
5447
* Command for building a binary
5548
*/

src/definitions/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export namespace VSCodeCommands {
2121
export const DEBUG_QUARKUS_PROJECT = 'quarkusTools.debugQuarkusProject';
2222
export const BUILD_BINARY = 'quarkusTools.buildBinary';
2323
export const QUARKUS_WELCOME = 'quarkusTools.welcome';
24-
export const DEPLOY_TO_OPENSHIFT = 'quarkusTools.deployToOpenShift';
2524

2625
export const SHORT_SUFFIX = '.short';
2726
}

src/extension.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
import { readFile } from 'fs-extra';
1617
import * as path from 'path';
1718
import { commands, Disposable, ExtensionContext, extensions, Terminal, TextDocument, window, workspace } from 'vscode';
1819
import { LanguageClient } from 'vscode-languageclient/node';
@@ -23,12 +24,12 @@ import quarkusProjectListener from './QuarkusProjectListener';
2324
import { connectToQuteLS } from './qute/languageServer/client';
2425
import { terminalCommandRunner } from './terminal/terminalCommandRunner';
2526
import { tryToForceLanguageId } from './utils/languageMismatch';
27+
import { initRecommendationService } from './utils/recommendationUtils';
2628
import { JAVA_EXTENSION_ID } from './utils/requestStandardMode';
2729
import { initTelemetryService } from './utils/telemetryUtils';
2830
import { getFilePathsFromWorkspace } from './utils/workspaceUtils';
2931
import { WelcomeWebview } from './webviews/WelcomeWebview';
3032
import { createTerminateDebugListener } from './wizards/debugging/terminateProcess';
31-
import { readFile } from 'fs-extra';
3233

3334
// alias for vscode-java's ExtensionAPI
3435
export type JavaExtensionAPI = any;
@@ -37,7 +38,8 @@ let quteLanguageClient: LanguageClient | null = null;
3738

3839
export async function activate(context: ExtensionContext) {
3940

40-
await initTelemetryService(context);
41+
const telemetryService = await initTelemetryService(context);
42+
initRecommendationService(context, telemetryService);
4143

4244
QuarkusContext.setContext(context);
4345

src/utils/openShiftConnectorUtils.ts

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/utils/recommendationUtils.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright 2023 Red Hat, Inc. and others.
3+
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import {
17+
IRecommendationService,
18+
RecommendationCore,
19+
} from "@redhat-developer/vscode-extension-proposals";
20+
import { TelemetryService } from "@redhat-developer/vscode-redhat-telemetry";
21+
import { ExtensionContext } from "vscode";
22+
23+
const OPENSHIFT_TOOLKIT_ID = "redhat.vscode-openshift-connector";
24+
25+
let recommendationService: IRecommendationService;
26+
27+
/**
28+
* Initialize the recommendation service
29+
*
30+
* @param context the extension context
31+
*/
32+
export function initRecommendationService(context: ExtensionContext, telemetryService: TelemetryService) {
33+
if (!recommendationService) {
34+
recommendationService = RecommendationCore.getService(context, telemetryService);
35+
const recommendations = [
36+
recommendationService.create(
37+
OPENSHIFT_TOOLKIT_ID,
38+
"OpenShift Toolkit",
39+
"Debug your Quarkus application on an OpenShift or Kubernetes cluster from within VS Code",
40+
false
41+
),
42+
];
43+
recommendationService.register(recommendations);
44+
}
45+
}
46+
47+
/**
48+
* Show a recommendation message for OpenShift Toolkit.
49+
*
50+
* @throws Error if the recommendation service has not been initialized
51+
*/
52+
export function recommendOpenShiftToolkit() {
53+
if (!recommendationService) {
54+
throw new Error("recommendation service has not been initialized");
55+
}
56+
void recommendationService.show("redhat.vscode-openshift-connector");
57+
}

src/utils/telemetryUtils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ const CMD_FAIL_VALUE = "failed";
77
let telemetryService: TelemetryService;
88
let isTelemetryInit = false;
99

10-
export async function initTelemetryService(context: ExtensionContext): Promise<void> {
10+
export async function initTelemetryService(context: ExtensionContext): Promise<TelemetryService> {
1111
if (isTelemetryInit) {
1212
throw new Error('Telemetry already initialized');
1313
}
1414
telemetryService = await (await getRedHatService(context)).getTelemetryService();
1515
telemetryService.sendStartupEvent();
1616
isTelemetryInit = true;
17+
return telemetryService;
1718
}
1819

1920
/**
@@ -66,7 +67,7 @@ async function sendCommandTelemetry(commandName: string, succeeded: boolean, msg
6667
* @throws if the telemetry service has not been initialized yet
6768
* @returns when the telemetry event has been sent
6869
*/
69-
export async function sendTelemetry(commandName: string, data: any): Promise<void> {
70+
export async function sendTelemetry(commandName: string, data: any): Promise<void> {
7071
if (!isTelemetryInit) {
7172
throw new Error('Telemetry has not been initialized yet');
7273
}

src/wizards/debugging/startDebugging.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import { debug, DebugConfiguration, Uri, window, workspace, WorkspaceFolder } from 'vscode';
16+
import { debug, DebugConfiguration, Uri, workspace, WorkspaceFolder } from 'vscode';
1717
import { BuildSupport } from '../../buildSupport/BuildSupport';
1818
import { ProjectLabelInfo } from '../../definitions/ProjectLabelInfo';
1919
import { getQuarkusDevDebugConfig } from '../../utils/launchConfigUtils';
20+
import { recommendOpenShiftToolkit } from '../../utils/recommendationUtils';
2021
import { getQuarkusProject } from '../getQuarkusProject';
2122
import { DebugConfigCreator } from './DebugConfigCreator';
22-
import { QuarkusContext } from '../../QuarkusContext';
2323

2424
/**
2525
* Start debugging a Quarkus project
@@ -31,9 +31,7 @@ import { QuarkusContext } from '../../QuarkusContext';
3131
*/
3232
export async function startDebugging(): Promise<void> {
3333

34-
if (!hasShownDeployToOpenShiftPopUp()) {
35-
showDeployToOpenShiftPopUp();
36-
}
34+
recommendOpenShiftToolkit();
3735

3836
const projectToDebug: ProjectLabelInfo = (await getQuarkusProject());
3937
const workspaceFolder: WorkspaceFolder | undefined = workspace.getWorkspaceFolder(Uri.file(projectToDebug.uri));
@@ -53,16 +51,3 @@ export async function startDebugging(): Promise<void> {
5351

5452
await debug.startDebugging(workspaceFolder, debugConfig);
5553
}
56-
57-
const DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO = 'deployToOpenshift.advertisementShown';
58-
59-
function hasShownDeployToOpenShiftPopUp(): boolean {
60-
return QuarkusContext.getExtensionContext().globalState.get(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO, false);
61-
}
62-
63-
function showDeployToOpenShiftPopUp(): void {
64-
const DEPLOY_TO_OPENSHIFT_ADVERTISEMENT = 'You can deploy to OpenShift right from VS Code using ' + //
65-
'"Quarkus: Deploy Current project to OpenShift (odo)" from the command palette';
66-
window.showInformationMessage(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT);
67-
QuarkusContext.getExtensionContext().globalState.update(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO, 'true');
68-
}

0 commit comments

Comments
 (0)