Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the busy overlay when loading blocked hash list [#1036] #1049

Merged
merged 1 commit into from Oct 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -31,7 +31,10 @@ import { Store } from '@ngrx/store';
import { LoggerService } from '@angular-ru/logger';
import { Subscription } from 'rxjs';
import { MatTableDataSource } from '@angular/material/table';
import { selectBlockedPageList } from '@app/comic-pages/selectors/blocked-hash-list.selectors';
import {
selectBlockedPageList,
selectBlockedPageListState
} from '@app/comic-pages/selectors/blocked-hash-list.selectors';
import { MatPaginator } from '@angular/material/paginator';
import { Router } from '@angular/router';
import { downloadBlockedPages } from '@app/comic-pages/actions/download-blocked-pages.actions';
Expand All @@ -42,6 +45,7 @@ import { BlockedHash } from '@app/comic-pages/models/blocked-hash';
import { SelectableListItem } from '@app/core/models/ui/selectable-list-item';
import { ConfirmationService } from '@app/core/services/confirmation.service';
import { TitleService } from '@app/core/services/title.service';
import { setBusyState } from '@app/core/actions/busy.actions';

@Component({
selector: 'cx-blocked-hash-list',
Expand All @@ -53,6 +57,7 @@ export class BlockedHashListPageComponent
{
@ViewChild('MatPagination') paginator: MatPaginator;

hashStateSubscription: Subscription;
pageSubscription: Subscription;
langChangeSubscription: Subscription;
dataSource = new MatTableDataSource<SelectableListItem<BlockedHash>>([]);
Expand All @@ -75,6 +80,11 @@ export class BlockedHashListPageComponent
private translateService: TranslateService,
private titleService: TitleService
) {
this.hashStateSubscription = this.store
.select(selectBlockedPageListState)
.subscribe(state => {
this.store.dispatch(setBusyState({ enabled: state.busy }));
});
this.pageSubscription = this.store
.select(selectBlockedPageList)
.subscribe(entries => (this.entries = entries));
Expand All @@ -94,6 +104,8 @@ export class BlockedHashListPageComponent
}

ngOnDestroy(): void {
this.logger.trace('Unsubscribing from hash state updates');
this.hashStateSubscription.unsubscribe();
this.logger.trace('Unsubscribing from blocked page list updates');
this.pageSubscription.unsubscribe();
this.logger.trace('Unsubscribing from language changes');
Expand Down