Automatically fix up arc controller URL (#11177)

This commit is contained in:
Charles Gagnon
2020-07-20 16:24:52 -07:00
committed by GitHub
parent d99201002d
commit 7fe3df8259
2 changed files with 16 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ export class PostgresOverviewPage extends DashboardPage {
this.disposables.push(
this._controllerModel.onEndpointsUpdated(() => this.eventuallyRunOnInitialized(() => this.handleEndpointsUpdated())),
this._controllerModel.onRegistrationsUpdated(() => this.eventuallyRunOnInitialized(() => this.handleRegistrationsUpdated())),
this._postgresModel.onServiceUpdated(() => this.eventuallyRunOnInitialized(() => this.hadleServiceUpdated())),
this._postgresModel.onServiceUpdated(() => this.eventuallyRunOnInitialized(() => this.handleServiceUpdated())),
this._postgresModel.onPodsUpdated(() => this.eventuallyRunOnInitialized(() => this.handlePodsUpdated())));
}
@@ -353,7 +353,7 @@ export class PostgresOverviewPage extends DashboardPage {
this.propertiesLoading!.loading = false;
}
private hadleServiceUpdated() {
private handleServiceUpdated() {
this.properties!.propertyItems = this.getProperties();
this.propertiesLoading!.loading = false;

View File

@@ -88,8 +88,21 @@ export class ConnectToControllerDialog {
if (!this.urlInputBox.value || !this.usernameInputBox.value || !this.passwordInputBox.value) {
return false;
}
let url = this.urlInputBox.value;
// Only support https connections
if (url.toLowerCase().startsWith('http://')) {
url = url.replace('http', 'https');
}
// Append https if they didn't type it in
if (!url.toLowerCase().startsWith('https://')) {
url = `https://${url}`;
}
// Append default port if one wasn't specified
if (!/.*:\d*$/.test(url)) {
url = `${url}:30080`;
}
const controllerInfo: ControllerInfo = {
url: this.urlInputBox.value,
url: url,
username: this.usernameInputBox.value,
rememberPassword: this.rememberPwCheckBox.checked ?? false,
resources: []