Skip to content

Commit

Permalink
Merge pull request #7607 from petrovic-d/instruct-user-to-set-cloud-r…
Browse files Browse the repository at this point in the history
…esources

Instruct users on setting up cloud resources when opening SSH session and running container image
  • Loading branch information
jhorvath authored Aug 5, 2024
2 parents a5fa02d + 2383962 commit 3502830
Show file tree
Hide file tree
Showing 11 changed files with 866 additions and 6 deletions.
103 changes: 103 additions & 0 deletions java/java.lsp.server/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 21 additions & 3 deletions java/java.lsp.server/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,23 @@
"default": 999,
"minimum": 1
},
"netbeans.guides.notified": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ocid": {
"format": "string"
},
"actionType": {
"format": "string"
}
}
},
"default": null,
"description": "Specifies the OCIDs of resources for which guides are already shown",
"scope": "machine-overridable"
},
"java+.runConfig.arguments": {
"type": "string",
"default": "",
Expand Down Expand Up @@ -486,19 +503,19 @@
"command": "nbls.cloud.publicIp.copy",
"title": "Copy the public IP address"
},
{
{
"command": "nbls.cloud.imageUrl.copy",
"title": "Copy pull command"
},
{
"command": "nbls.cloud.computeInstance.ssh",
"title": "Start SSH session",
"icon": "$(terminal)"
"icon": "$(terminal)"
},
{
"command": "nbls.cloud.container.docker",
"title": "Run in Compute Instance",
"icon": "$(play)"
"icon": "$(play)"
},
{
"command": "nbls.workspace.compile",
Expand Down Expand Up @@ -1339,6 +1356,7 @@
"dependencies": {
"@vscode/debugadapter": "1.55.1",
"@vscode/webview-ui-toolkit": "^1.2.2",
"handlebars": "^4.7.8",
"jdk-utils": "^0.4.4",
"jsonc-parser": "3.0.0",
"vscode-languageclient": "8.0.1",
Expand Down
25 changes: 22 additions & 3 deletions java/java.lsp.server/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ import { PropertiesView } from './propertiesView/propertiesView';
import * as configuration from './jdk/configuration';
import * as jdk from './jdk/jdk';
import { validateJDKCompatibility } from './jdk/validation/validation';
import * as sshGuide from './panels/SshGuidePanel';
import * as runImageGuide from './panels/RunImageGuidePanel';
import { shouldHideGuideFor } from './panels/guidesUtil';

const API_VERSION : string = "1.0";
export const COMMAND_PREFIX : string = "nbls";
Expand Down Expand Up @@ -365,7 +368,7 @@ function getValueAfterPrefix(input: string | undefined, prefix: string): string
return '';
}

export function activate(context: ExtensionContext): VSNetBeansAPI {
export function activate(context: ExtensionContext): VSNetBeansAPI {
const provider = new StringContentProvider();
const scheme = 'in-memory';
const providerRegistration = vscode.workspace.registerTextDocumentContentProvider(scheme, provider);
Expand Down Expand Up @@ -843,7 +846,15 @@ export function activate(context: ExtensionContext): VSNetBeansAPI {
context.subscriptions.push(commands.registerCommand(COMMAND_PREFIX + '.cloud.computeInstance.ssh',
async (node) => {
const publicIp = getValueAfterPrefix(node.contextValue, 'publicIp:');
//TODO: For the first invocation for a given OCID, show instructions on how to set up SSH for a Compute Instance.
const ocid = getValueAfterPrefix(node.contextValue, 'ocid:');

if (!shouldHideGuideFor(sshGuide.viewType, ocid)) {
sshGuide.SshGuidePanel.createOrShow(context, {
publicIp,
ocid
});
}

openSSHSession("opc", publicIp, node.label);
}
));
Expand All @@ -852,7 +863,15 @@ export function activate(context: ExtensionContext): VSNetBeansAPI {
async (node) => {
const publicIp = getValueAfterPrefix(node.contextValue, 'publicIp:');
const imageUrl = getValueAfterPrefix(node.contextValue, 'imageUrl:');
//TODO: For the first invocation for a given OCID, show instructions on how to set up a Compute Instance.
const ocid = getValueAfterPrefix(node.contextValue, 'ocid:');

if (!shouldHideGuideFor(runImageGuide.viewType, ocid)){
runImageGuide.RunImageGuidePanel.createOrShow(context, {
publicIp,
ocid
});
}

runDockerSSH("opc", publicIp, imageUrl);
}
));
Expand Down
Loading

0 comments on commit 3502830

Please sign in to comment.