Skip to content

Commit 06237b1

Browse files
committed
Add link to change custom web instance
1 parent 50a25dd commit 06237b1

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/open/ClientView.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,41 @@ class InstallClientView extends TemplateView {
112112
}
113113
}
114114

115+
export class SetCustomWebInstanceView extends TemplateView {
116+
render(t, vm) {
117+
return t.div({className: "SetCustomWebInstanceView"}, [
118+
t.p([
119+
"Use a custom web instance for the ", t.strong(vm.name), " client:",
120+
]),
121+
t.form({action: "#", id: "setCustomWebInstanceForm", onSubmit: evt => this._onSubmit(evt)}, [
122+
t.label([
123+
"Host name:",
124+
t.input({
125+
type: "text",
126+
className: "line",
127+
placeholder: "chat.example.org",
128+
name: "instanceHostname",
129+
})
130+
])
131+
])
132+
]);
133+
}
134+
135+
_onSubmit(evt) {
136+
evt.preventDefault();
137+
this.value.continueWithSelection(this._askEveryTimeChecked);
138+
}
139+
}
140+
115141
function showBack(t, vm) {
116142
return t.p({className: {caption: true, "back": true, hidden: vm => !vm.showBack}}, [
117143
`Continue with ${vm.name} · `,
118144
t.button({className: "text", onClick: () => vm.back()}, "Change"),
145+
t.span({hidden: vm => !vm.showSetWebInstance}, [
146+
' · ',
147+
t.button({className: "text", onClick: () => vm.setCustomWebInstance()}, "Use Custom Web Instance"),
148+
])
149+
119150
]);
120151
}
121152

src/open/ClientViewModel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ export class ClientViewModel extends ViewModel {
231231
return !!this._clientListViewModel;
232232
}
233233

234+
get showSetWebInstance() {
235+
return !!this._client.supportsCustomInstances;
236+
}
237+
234238
back() {
235239
if (this._clientListViewModel) {
236240
const vm = this._clientListViewModel;
@@ -239,6 +243,7 @@ export class ClientViewModel extends ViewModel {
239243
// in the list with all clients, and also if we refresh, we get the list with
240244
// all clients rather than having our "change client" click reverted.
241245
this.preferences.setClient(undefined, undefined);
246+
this.preferences.setPreferredWebInstance(this._client.id, undefined);
242247
this._update();
243248
this.emitChange();
244249
vm.showAll();

0 commit comments

Comments
 (0)