mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
control applying saved state and when to show groupings
This commit is contained in:
@@ -56,6 +56,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
private selectedTimeout: number;
|
||||
private preventSelected = false;
|
||||
private pageSize = 100;
|
||||
private applySavedState = true;
|
||||
|
||||
constructor(searchService: SearchService, private route: ActivatedRoute,
|
||||
private router: Router, private location: Location,
|
||||
@@ -66,6 +67,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) {
|
||||
super(searchService);
|
||||
this.pageSize = platformUtilsService.isEdge() ? 25 : 100;
|
||||
this.applySavedState = (window as any).previousPopupUrl != null &&
|
||||
!(window as any).previousPopupUrl.startsWith('/ciphers');
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -120,11 +123,14 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
}
|
||||
|
||||
this.loadMore();
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText) {
|
||||
this.searchText = this.state.searchText;
|
||||
if (this.applySavedState) {
|
||||
this.state = (await this.stateService.get<any>(ComponentId)) || {};
|
||||
if (this.state.searchText) {
|
||||
this.searchText = this.state.searchText;
|
||||
}
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||
}
|
||||
window.setTimeout(() => this.popupUtils.setContentScrollY(window, this.state.scrollY), 0);
|
||||
this.stateService.remove(ComponentId);
|
||||
});
|
||||
|
||||
this.broadcasterService.subscribe(ComponentId, (message: any) => {
|
||||
@@ -209,6 +215,12 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
||||
this.didScroll = this.pagedCiphers.length > this.pageSize;
|
||||
}
|
||||
|
||||
showGroupings() {
|
||||
return !this.isSearching() &&
|
||||
((this.nestedFolders && this.nestedFolders.length) ||
|
||||
(this.nestedCollections && this.nestedCollections.length));
|
||||
}
|
||||
|
||||
isSearching() {
|
||||
return !this.searchPending && this.searchService.isSearchable(this.searchText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user