Hide links when opening policy, show policy when navigated after load

This commit is contained in:
Danila Fedorin 2021-08-25 15:06:13 -07:00
parent c25a9dae4d
commit f862ed1403
1 changed files with 9 additions and 0 deletions

View File

@ -50,13 +50,22 @@ export class RootViewModel extends ViewModel {
this.emitChange();
}
_hideLinks() {
this.link = null;
this.openLinkViewModel = null;
this.createLinkViewModel = null;
}
updateHash(hash) {
if (hash.startsWith("#/policy/")) {
const server = hash.substr(9);
this._hideLinks();
this.loadServerPolicyViewModel = new LoadServerPolicyViewModel(this.childOptions({server}));
this.loadServerPolicyViewModel.load();
this.emitChange();
} else {
const oldLink = this.link;
this.loadServerPolicyViewModel = null;
this.link = Link.parse(hash);
this._updateChildVMs(oldLink);
}