Skip to content

Commit a5121f0

Browse files
committed
Extra links for server
1 parent 70db8d2 commit a5121f0

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@
477477
"type": "boolean",
478478
"default": false
479479
},
480+
"objectscript.conn.docker-compose": {
481+
"description": "Connect to server running in docker-compose",
482+
"type": "object"
483+
},
480484
"objectscript.conn.docker-compose.service": {
481485
"description": "Name of service in docker-compose",
482486
"type": "string"
@@ -491,8 +495,8 @@
491495
"type": "string",
492496
"default": "docker-compose.yml"
493497
},
494-
"objectscript.conn.docker-compose": {
495-
"description": "Connect to server running in docker-compose",
498+
"objectscript.conn.links": {
499+
"description": "Extra links for the server",
496500
"type": "object"
497501
},
498502
"objectscript.export": {

src/commands/serverActions.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { config, workspaceState, checkConnection } from "../extension";
33
import { currentWorkspaceFolder, terminalWithDocker } from "../utils";
44

55
export async function serverActions(): Promise<void> {
6-
const { active, host, ns, https, port: defaultPort, username, password } = config("conn");
6+
const { active, host, ns, https, port: defaultPort, username, password, links } = config("conn");
77
const workspaceFolder = currentWorkspaceFolder();
88
const port = workspaceState.get(workspaceFolder + ":port", defaultPort);
99
const nsEncoded = encodeURIComponent(ns);
@@ -17,7 +17,17 @@ export async function serverActions(): Promise<void> {
1717
const auth = iris
1818
? `&IRISUsername=${usernameEncoded}&IRISPassword=${passwordEncoded}`
1919
: `&CacheUserName=${usernameEncoded}&CachePassword=${passwordEncoded}`;
20-
20+
const extraLinks = [];
21+
for (const title in links) {
22+
const link = String(links[title])
23+
.replace("${host}", host)
24+
.replace("${port}", port);
25+
extraLinks.push({
26+
id: "extraLink" + extraLinks.length,
27+
label: title,
28+
detail: link,
29+
});
30+
}
2131
const terminal = [];
2232
if (workspaceState.get(workspaceFolder + ":docker", true)) {
2333
terminal.push({
@@ -29,6 +39,7 @@ export async function serverActions(): Promise<void> {
2939
return vscode.window
3040
.showQuickPick(
3141
[
42+
...extraLinks,
3243
{
3344
id: "refreshConnection",
3445
label: "Refresh connection",
@@ -77,6 +88,10 @@ export async function serverActions(): Promise<void> {
7788
}
7889
case "openDockerTerminal": {
7990
terminalWithDocker();
91+
break;
92+
}
93+
default: {
94+
vscode.env.openExternal(vscode.Uri.parse(action.detail));
8095
}
8196
}
8297
});

0 commit comments

Comments
 (0)