Skip to content

Commit ac00254

Browse files
committed
auto-auth to SMP, fixed port from docker-compose
1 parent 56fdb85 commit ac00254

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Explorer view, INC files now separate in own Includes folder
99
- Explorer view, option to show/hide generated items
1010
- Explorer view will be shown only when any folder open
11+
- When used docker-compose to run instance, it's now possible to get connected to a random port from service.
1112

1213
## [0.7.12]
1314

src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class AtelierAPI {
3838
if (wsOrFile instanceof vscode.Uri) {
3939
if (wsOrFile.scheme === FILESYSTEM_SCHEMA) {
4040
workspaceFolderName = wsOrFile.authority;
41-
const { query } = url.parse(wsOrFile.toString(), true);
41+
const { query } = url.parse(decodeURIComponent(wsOrFile.toString()), true);
4242
if (query) {
4343
if (query.ns && query.ns !== "") {
4444
const namespace = query.ns.toString();

src/commands/serverActions.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import * as vscode from "vscode";
2-
import { config } from "../extension";
2+
import { config, workspaceState } from "../extension";
3+
import { currentWorkspaceFolder } from "../utils";
34

45
export async function serverActions(): Promise<void> {
5-
const conn = config("conn");
6-
const connInfo = `${conn.host}:${conn.port}[${conn.ns}]`;
7-
const serverUrl = `${conn.https ? "https" : "http"}://${conn.host}:${conn.port}`;
8-
const portalUrl = `${serverUrl}/csp/sys/UtilHome.csp?$NAMESPACE=${conn.ns}`;
9-
const classRef = `${serverUrl}/csp/documatic/%25CSP.Documatic.cls?LIBRARY=${conn.ns}`;
6+
const { active, host, ns, https, port: defaultPort, username, password } = config("conn");
7+
const workspaceFolder = currentWorkspaceFolder();
8+
const port = workspaceState.get(workspaceFolder + ":port", defaultPort);
9+
const connInfo = `${host}:${port}[${ns}]`;
10+
const serverUrl = `${https ? "https" : "http"}://${host}:${port}`;
11+
const portalUrl = `${serverUrl}/csp/sys/UtilHome.csp?$NAMESPACE=${ns}`;
12+
const classRef = `${serverUrl}/csp/documatic/%25CSP.Documatic.cls?LIBRARY=${ns}`;
13+
const iris = workspaceState.get(workspaceFolder + ":iris", false);
14+
const auth = iris
15+
? `&IRISUsername=${username}&IRISPassword=${password}`
16+
: `&CacheUserName=${username}&CachePassword=${password}`;
1017
return vscode.window
1118
.showQuickPick(
1219
[
@@ -36,14 +43,14 @@ export async function serverActions(): Promise<void> {
3643
}
3744
switch (action.id) {
3845
case "toggleConnection": {
39-
return vscode.workspace.getConfiguration().update("objectscript.conn.active", !conn.active);
46+
return vscode.workspace.getConfiguration().update("objectscript.conn.active", !active);
4047
}
4148
case "openPortal": {
42-
vscode.env.openExternal(vscode.Uri.parse(portalUrl));
49+
vscode.env.openExternal(vscode.Uri.parse(portalUrl + auth));
4350
break;
4451
}
4552
case "openClassReference": {
46-
vscode.env.openExternal(vscode.Uri.parse(classRef));
53+
vscode.env.openExternal(vscode.Uri.parse(classRef + auth));
4754
break;
4855
}
4956
}

0 commit comments

Comments
 (0)