Add link to change custom web instance
This commit is contained in:
@@ -112,10 +112,41 @@ class InstallClientView extends TemplateView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SetCustomWebInstanceView extends TemplateView {
|
||||||
|
render(t, vm) {
|
||||||
|
return t.div({className: "SetCustomWebInstanceView"}, [
|
||||||
|
t.p([
|
||||||
|
"Use a custom web instance for the ", t.strong(vm.name), " client:",
|
||||||
|
]),
|
||||||
|
t.form({action: "#", id: "setCustomWebInstanceForm", onSubmit: evt => this._onSubmit(evt)}, [
|
||||||
|
t.label([
|
||||||
|
"Host name:",
|
||||||
|
t.input({
|
||||||
|
type: "text",
|
||||||
|
className: "line",
|
||||||
|
placeholder: "chat.example.org",
|
||||||
|
name: "instanceHostname",
|
||||||
|
})
|
||||||
|
])
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
_onSubmit(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.value.continueWithSelection(this._askEveryTimeChecked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function showBack(t, vm) {
|
function showBack(t, vm) {
|
||||||
return t.p({className: {caption: true, "back": true, hidden: vm => !vm.showBack}}, [
|
return t.p({className: {caption: true, "back": true, hidden: vm => !vm.showBack}}, [
|
||||||
`Continue with ${vm.name} · `,
|
`Continue with ${vm.name} · `,
|
||||||
t.button({className: "text", onClick: () => vm.back()}, "Change"),
|
t.button({className: "text", onClick: () => vm.back()}, "Change"),
|
||||||
|
t.span({hidden: vm => !vm.showSetWebInstance}, [
|
||||||
|
' · ',
|
||||||
|
t.button({className: "text", onClick: () => vm.setCustomWebInstance()}, "Use Custom Web Instance"),
|
||||||
|
])
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,10 @@ export class ClientViewModel extends ViewModel {
|
|||||||
return !!this._clientListViewModel;
|
return !!this._clientListViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showSetWebInstance() {
|
||||||
|
return !!this._client.supportsCustomInstances;
|
||||||
|
}
|
||||||
|
|
||||||
back() {
|
back() {
|
||||||
if (this._clientListViewModel) {
|
if (this._clientListViewModel) {
|
||||||
const vm = this._clientListViewModel;
|
const vm = this._clientListViewModel;
|
||||||
@@ -239,6 +243,7 @@ export class ClientViewModel extends ViewModel {
|
|||||||
// in the list with all clients, and also if we refresh, we get the list with
|
// in the list with all clients, and also if we refresh, we get the list with
|
||||||
// all clients rather than having our "change client" click reverted.
|
// all clients rather than having our "change client" click reverted.
|
||||||
this.preferences.setClient(undefined, undefined);
|
this.preferences.setClient(undefined, undefined);
|
||||||
|
this.preferences.setPreferredWebInstance(this._client.id, undefined);
|
||||||
this._update();
|
this._update();
|
||||||
this.emitChange();
|
this.emitChange();
|
||||||
vm.showAll();
|
vm.showAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user