Skip to content

Commit

Permalink
Add support for https projects
Browse files Browse the repository at this point in the history
eclipse-archived/codewind#408

Signed-off-by: Tim Etchells <timetchells@ibm.com>
  • Loading branch information
Tim Etchells committed Sep 11, 2019
1 parent 1f6e6fe commit 74ed262
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions dev/src/codewind/project/Project.ts
Expand Up @@ -71,6 +71,7 @@ export default class Project implements vscode.QuickPickItem {
private _contextRoot: string;
private readonly _ports: IProjectPorts;
private _autoBuildEnabled: boolean;
private _usesHttps: boolean;
// Dates below will always be set, but might be "invalid date"s
private _lastBuild: Date;
private _lastImgBuild: Date;
Expand Down Expand Up @@ -104,6 +105,7 @@ export default class Project implements vscode.QuickPickItem {
this.language = projectInfo.language || "Unknown";
this.localPath = vscode.Uri.file(path.join(connection.workspacePath.fsPath, projectInfo.directory));
this._contextRoot = projectInfo.contextRoot || projectInfo.contextroot || "";
this._usesHttps = projectInfo.isHttps === true;

if (projectInfo.extension && projectInfo.extension.config) {
this.containerAppRoot = projectInfo.extension.config.containerAppRoot;
Expand Down Expand Up @@ -184,8 +186,13 @@ export default class Project implements vscode.QuickPickItem {
changed = this.setLastImgBuild(Number(projectInfo.appImageLastBuild)) || changed;
changed = this.setAutoBuild(projectInfo.autoBuild) || changed;

if (projectInfo.isHttps && this._usesHttps !== projectInfo.isHttps) {
this._usesHttps = projectInfo.isHttps === true;
changed = true;
}

if (projectInfo.contextRoot && projectInfo.contextRoot !== this.contextRoot) {
Log.d(`Context root for ${this.name} changed from ${this.contextRoot} to ${projectInfo.contextRoot}`);
// Log.d(`Context root for ${this.name} changed from ${this.contextRoot} to ${projectInfo.contextRoot}`);
this._contextRoot = projectInfo.contextRoot;
changed = true;
}
Expand Down Expand Up @@ -517,8 +524,10 @@ export default class Project implements vscode.QuickPickItem {
return undefined;
}

const scheme = this._usesHttps ? "https" : "http"; // non-nls

return this.connection.url.with({
scheme: "http", // TODO :) // non-nls
scheme,
authority: `${this.connection.host}:${this._ports.appPort}`, // non-nls
path: this._contextRoot
});
Expand Down
2 changes: 1 addition & 1 deletion dev/src/command/webview/ProjectOverviewPage.ts
Expand Up @@ -124,7 +124,7 @@ export function generateHtml(project: Project): string {
undefined, true)}
${buildRow("Application Endpoint",
normalize(project.appBaseUrl, NOT_RUNNING),
(project.appBaseUrl != null ? OpenableTypes.FILE : undefined), true)}
(project.appBaseUrl != null ? OpenableTypes.WEB : undefined), true)}
${emptyRow}
<!-- buildDebugSection must also close the <table> -->
${buildDebugSection(project)}
Expand Down

0 comments on commit 74ed262

Please sign in to comment.