Skip to content

Commit

Permalink
Remove 'Deploy to Openshift' command
Browse files Browse the repository at this point in the history
- 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
- Switch to the new package-lock.json format

Fixes #605, Closes #609

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Jul 6, 2023
1 parent a026163 commit c61922a
Show file tree
Hide file tree
Showing 9 changed files with 11,251 additions and 237 deletions.
11,210 changes: 11,190 additions & 20 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 1 addition & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,6 @@
"command": "quarkusTools.welcome",
"title": "Quarkus: Welcome"
},
{
"command": "quarkusTools.deployToOpenShift",
"title": "Quarkus: Deploy current Quarkus project to OpenShift (odo)"
},
{
"command": "quarkusTools.deployToOpenShift.short",
"title": "Deploy to OpenShift",
"icon": "icons/openshift.png"
},
{
"command": "qute.validation.enabled.toggle.off",
"title": "Disable Qute Validation",
Expand Down Expand Up @@ -341,10 +332,6 @@
"command": "quarkusTools.debugQuarkusProject",
"when": "quarkusProjectExistsOrLightWeight"
},
{
"command": "quarkusTools.deployToOpenShift",
"when": "quarkusProjectExistsOrLightWeight"
},
{
"command": "qute.validation.enabled.toggle.off",
"when": "false"
Expand All @@ -367,11 +354,6 @@
}
],
"editor/title": [
{
"command": "quarkusTools.deployToOpenShift.short",
"when": "quarkusProjectExistsOrLightWeight && resourceExtname == .java",
"group": "navigation@10"
},
{
"command": "qute.validation.enabled.toggle.off",
"when": "quarkusProjectExistsOrLightWeight && editorLangIdSupportsQute && editorQuteValidationEnabled",
Expand All @@ -389,13 +371,6 @@
"when": "quarkusProjectExistsOrLightWeight && resourceExtname == .java",
"group": "quarkus@1"
}
],
"view/title": [
{
"command": "quarkusTools.deployToOpenShift.short",
"when": "quarkusProjectExistsOrLightWeight",
"group": "quarkus@1"
}
]
},
"grammars": [
Expand Down Expand Up @@ -493,6 +468,7 @@
"webpack-cli": "^4.9.1"
},
"dependencies": {
"@redhat-developer/vscode-extension-proposals": "^0.0.21",
"@redhat-developer/vscode-redhat-telemetry": "^0.6.1",
"ejs": "^3.1.7",
"expand-home-dir": "0.0.3",
Expand Down
7 changes: 0 additions & 7 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { WelcomeWebview } from "../webviews/WelcomeWebview";
import { addExtensionsWizard } from "../wizards/addExtensions/addExtensionsWizard";
import { buildBinary } from "../wizards/binary/buildBinary";
import { startDebugging } from "../wizards/debugging/startDebugging";
import { deployToOpenShift } from "../wizards/deployToOpenShift/deployToOpenShift";
import { generateProjectWizard } from "../wizards/generateProject/generationWizard";

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

/**
* Command for deploying current Quarkus project to OpenShift with OpenShift Connector
*/
registerCommandWithTelemetry(context, VSCodeCommands.DEPLOY_TO_OPENSHIFT, withStandardMode(deployToOpenShift, "Deploying to OpenShift"));
registerCommandWithTelemetry(context, VSCodeCommands.DEPLOY_TO_OPENSHIFT + VSCodeCommands.SHORT_SUFFIX, withStandardMode(deployToOpenShift, "Deploying to OpenShift"));

/**
* Command for building a binary
*/
Expand Down
1 change: 0 additions & 1 deletion src/definitions/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export namespace VSCodeCommands {
export const DEBUG_QUARKUS_PROJECT = 'quarkusTools.debugQuarkusProject';
export const BUILD_BINARY = 'quarkusTools.buildBinary';
export const QUARKUS_WELCOME = 'quarkusTools.welcome';
export const DEPLOY_TO_OPENSHIFT = 'quarkusTools.deployToOpenShift';

export const SHORT_SUFFIX = '.short';
}
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { readFile } from 'fs-extra';
import * as path from 'path';
import { commands, Disposable, ExtensionContext, extensions, Terminal, TextDocument, window, workspace } from 'vscode';
import { LanguageClient } from 'vscode-languageclient/node';
Expand All @@ -23,12 +24,12 @@ import quarkusProjectListener from './QuarkusProjectListener';
import { connectToQuteLS } from './qute/languageServer/client';
import { terminalCommandRunner } from './terminal/terminalCommandRunner';
import { tryToForceLanguageId } from './utils/languageMismatch';
import { initRecommendationService } from './utils/recommendationUtils';
import { JAVA_EXTENSION_ID } from './utils/requestStandardMode';
import { initTelemetryService } from './utils/telemetryUtils';
import { getFilePathsFromWorkspace } from './utils/workspaceUtils';
import { WelcomeWebview } from './webviews/WelcomeWebview';
import { createTerminateDebugListener } from './wizards/debugging/terminateProcess';
import { readFile } from 'fs-extra';

// alias for vscode-java's ExtensionAPI
export type JavaExtensionAPI = any;
Expand All @@ -38,6 +39,7 @@ let quteLanguageClient: LanguageClient | null = null;
export async function activate(context: ExtensionContext) {

await initTelemetryService(context);
initRecommendationService(context);

QuarkusContext.setContext(context);

Expand Down
97 changes: 0 additions & 97 deletions src/utils/openShiftConnectorUtils.ts

This file was deleted.

54 changes: 54 additions & 0 deletions src/utils/recommendationUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright 2023 Red Hat, Inc. and others.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
IRecommendationService,
RecommendationCore,
} from "@redhat-developer/vscode-extension-proposals";
import { ExtensionContext } from "vscode";

let recommendationService: IRecommendationService;

/**
* Initialize the recommendation service
*
* @param context the extension context
*/
export function initRecommendationService(context: ExtensionContext) {
if (!recommendationService) {
recommendationService = RecommendationCore.getService(context);
const recommendations = [
recommendationService.create(
"redhat.vscode-openshift-connector",
"OpenShift Toolkit",
"Debug your Quarkus application on an OpenShift or Kubernetes cluster from within VS Code",
false
),
];
recommendationService.register(recommendations);
}
}

/**
* Show a recommendation message for OpenShift Toolkit.
*
* @throws Error if the recommendation service has not been initialized
*/
export function recommendOpenShiftToolkit() {
if (!recommendationService) {
throw new Error('recommendation service has not been initialized');
}
void recommendationService.show('redhat.vscode-openshift-connector');
}
21 changes: 3 additions & 18 deletions src/wizards/debugging/startDebugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { debug, DebugConfiguration, Uri, window, workspace, WorkspaceFolder } from 'vscode';
import { debug, DebugConfiguration, Uri, workspace, WorkspaceFolder } from 'vscode';
import { BuildSupport } from '../../buildSupport/BuildSupport';
import { ProjectLabelInfo } from '../../definitions/ProjectLabelInfo';
import { getQuarkusDevDebugConfig } from '../../utils/launchConfigUtils';
import { recommendOpenShiftToolkit } from '../../utils/recommendationUtils';
import { getQuarkusProject } from '../getQuarkusProject';
import { DebugConfigCreator } from './DebugConfigCreator';
import { QuarkusContext } from '../../QuarkusContext';

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

if (!hasShownDeployToOpenShiftPopUp()) {
showDeployToOpenShiftPopUp();
}
recommendOpenShiftToolkit();

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

await debug.startDebugging(workspaceFolder, debugConfig);
}

const DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO = 'deployToOpenshift.advertisementShown';

function hasShownDeployToOpenShiftPopUp(): boolean {
return QuarkusContext.getExtensionContext().globalState.get(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO, false);
}

function showDeployToOpenShiftPopUp(): void {
const DEPLOY_TO_OPENSHIFT_ADVERTISEMENT = 'You can deploy to OpenShift right from VS Code using ' + //
'"Quarkus: Deploy Current project to OpenShift (odo)" from the command palette';
window.showInformationMessage(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT);
QuarkusContext.getExtensionContext().globalState.update(DEPLOY_TO_OPENSHIFT_ADVERTISEMENT_MEMENTO, 'true');
}
68 changes: 0 additions & 68 deletions src/wizards/deployToOpenShift/deployToOpenShift.ts

This file was deleted.

0 comments on commit c61922a

Please sign in to comment.