offer back button when session loading fails
This commit is contained in:
parent
d567664d8b
commit
c3ef801566
5 changed files with 12 additions and 6 deletions
|
@ -46,7 +46,7 @@ export class LoginViewModel extends ViewModel {
|
||||||
if (this._loadViewModel) {
|
if (this._loadViewModel) {
|
||||||
this._loadViewModel = this.disposeTracked(this._loadViewModel);
|
this._loadViewModel = this.disposeTracked(this._loadViewModel);
|
||||||
}
|
}
|
||||||
this._loadViewModel = this.track(new SessionLoadViewModel({
|
this._loadViewModel = this.track(new SessionLoadViewModel(this.childOptions({
|
||||||
createAndStartSessionContainer: () => {
|
createAndStartSessionContainer: () => {
|
||||||
this._sessionContainer = this._createSessionContainer();
|
this._sessionContainer = this._createSessionContainer();
|
||||||
this._sessionContainer.startWithLogin(homeserver, username, password);
|
this._sessionContainer.startWithLogin(homeserver, username, password);
|
||||||
|
@ -58,7 +58,7 @@ export class LoginViewModel extends ViewModel {
|
||||||
this._ready(sessionContainer);
|
this._ready(sessionContainer);
|
||||||
},
|
},
|
||||||
homeserver,
|
homeserver,
|
||||||
}));
|
})));
|
||||||
this._loadViewModel.start();
|
this._loadViewModel.start();
|
||||||
this.emitChange("loadViewModel");
|
this.emitChange("loadViewModel");
|
||||||
this._loadViewModelSubscription = this.track(this._loadViewModel.disposableOn("change", () => {
|
this._loadViewModelSubscription = this.track(this._loadViewModel.disposableOn("change", () => {
|
||||||
|
|
|
@ -124,14 +124,14 @@ export class RootViewModel extends ViewModel {
|
||||||
|
|
||||||
_showSessionLoader(sessionId) {
|
_showSessionLoader(sessionId) {
|
||||||
this._setSection(() => {
|
this._setSection(() => {
|
||||||
this._sessionLoadViewModel = new SessionLoadViewModel({
|
this._sessionLoadViewModel = new SessionLoadViewModel(this.childOptions({
|
||||||
createAndStartSessionContainer: () => {
|
createAndStartSessionContainer: () => {
|
||||||
const sessionContainer = this._createSessionContainer();
|
const sessionContainer = this._createSessionContainer();
|
||||||
sessionContainer.startWithExistingSession(sessionId);
|
sessionContainer.startWithExistingSession(sessionId);
|
||||||
return sessionContainer;
|
return sessionContainer;
|
||||||
},
|
},
|
||||||
ready: sessionContainer => this._showSession(sessionContainer)
|
ready: sessionContainer => this._showSession(sessionContainer)
|
||||||
});
|
}));
|
||||||
this._sessionLoadViewModel.start();
|
this._sessionLoadViewModel.start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class SessionLoadViewModel extends ViewModel {
|
||||||
this._deleteSessionOnCancel = deleteSessionOnCancel;
|
this._deleteSessionOnCancel = deleteSessionOnCancel;
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
this._error = null;
|
this._error = null;
|
||||||
|
this.backUrl = this.urlCreator.urlForSegment("session", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
|
|
@ -215,6 +215,10 @@ a.button-action {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.SessionLoadView {
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 600px) {
|
@media screen and (min-width: 600px) {
|
||||||
.PreSessionScreen {
|
.PreSessionScreen {
|
||||||
box-shadow: 0px 6px 32px rgba(0, 0, 0, 0.1);
|
box-shadow: 0px 6px 32px rgba(0, 0, 0, 0.1);
|
||||||
|
|
|
@ -22,9 +22,10 @@ export class SessionLoadView extends TemplateView {
|
||||||
return t.div({className: "PreSessionScreen"}, [
|
return t.div({className: "PreSessionScreen"}, [
|
||||||
t.div({className: "logo"}),
|
t.div({className: "logo"}),
|
||||||
t.div({className: "SessionLoadView"}, [
|
t.div({className: "SessionLoadView"}, [
|
||||||
t.h1(vm.i18n`Loading…`),
|
|
||||||
t.view(new SessionLoadStatusView(vm))
|
t.view(new SessionLoadStatusView(vm))
|
||||||
])
|
]),
|
||||||
|
t.div({className: {"button-row": true, hidden: vm => vm.loading}},
|
||||||
|
t.a({className: "button-action primary", href: vm.backUrl}, vm.i18n`Go back`))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue