Feedback processed: - pagesize comcol changed to 50 &

- loadCommunities inside ngZone.runOutsideAngular
- Chevron size small unexpanded and large expanded when logged in fixed
This commit is contained in:
Marie Verdonck
2020-06-19 13:17:46 +02:00
parent 53779cf69e
commit 94e3f2d5e0
4 changed files with 17 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
::ng-deep { :host ::ng-deep {
.fa-chevron-right { .fa-chevron-right {
padding-left: $spacer/2; padding-left: $spacer/2;
font-size: 0.5rem; font-size: 0.5rem;
@@ -16,4 +16,4 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
} }

View File

@@ -1,3 +1,4 @@
import { NgZone } from '@angular/core';
import { FindListOptions } from '../core/data/request.models'; import { FindListOptions } from '../core/data/request.models';
import { CommunityListService, FlatNode } from './community-list-service'; import { CommunityListService, FlatNode } from './community-list-service';
import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections'; import { CollectionViewer, DataSource } from '@angular/cdk/typings/collections';
@@ -15,7 +16,8 @@ export class CommunityListDatasource implements DataSource<FlatNode> {
private communityList$ = new BehaviorSubject<FlatNode[]>([]); private communityList$ = new BehaviorSubject<FlatNode[]>([]);
public loading$ = new BehaviorSubject<boolean>(false); public loading$ = new BehaviorSubject<boolean>(false);
constructor(private communityListService: CommunityListService) { constructor(private communityListService: CommunityListService,
private zone: NgZone) {
} }
connect(collectionViewer: CollectionViewer): Observable<FlatNode[]> { connect(collectionViewer: CollectionViewer): Observable<FlatNode[]> {
@@ -25,11 +27,13 @@ export class CommunityListDatasource implements DataSource<FlatNode> {
loadCommunities(findOptions: FindListOptions, expandedNodes: FlatNode[]) { loadCommunities(findOptions: FindListOptions, expandedNodes: FlatNode[]) {
this.loading$.next(true); this.loading$.next(true);
this.communityListService.loadCommunities(findOptions, expandedNodes).pipe( this.zone.runOutsideAngular(() => {
take(1), this.communityListService.loadCommunities(findOptions, expandedNodes).pipe(
finalize(() => this.loading$.next(false)), take(1),
).subscribe((flatNodes: FlatNode[]) => { finalize(() => this.loading$.next(false)),
this.communityList$.next(flatNodes); ).subscribe((flatNodes: FlatNode[]) => {
this.communityList$.next(flatNodes);
});
}); });
} }

View File

@@ -99,7 +99,7 @@ const communityListStateSelector = (state: AppState) => state.communityList;
const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes); const expandedNodesSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.expandedNodes);
const loadingNodeSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.loadingNode); const loadingNodeSelector = createSelector(communityListStateSelector, (communityList: CommunityListState) => communityList.loadingNode);
export const MAX_COMCOLS_PER_PAGE = 2; export const MAX_COMCOLS_PER_PAGE = 50;
/** /**
* Service class for the community list, responsible for the creating of the flat list used by communityList dataSource * Service class for the community list, responsible for the creating of the flat list used by communityList dataSource

View File

@@ -1,4 +1,4 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, NgZone, OnDestroy, OnInit } from '@angular/core';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { FindListOptions } from '../../core/data/request.models'; import { FindListOptions } from '../../core/data/request.models';
@@ -31,7 +31,8 @@ export class CommunityListComponent implements OnInit, OnDestroy {
paginationConfig: FindListOptions; paginationConfig: FindListOptions;
constructor(private communityListService: CommunityListService) { constructor(private communityListService: CommunityListService,
private zone: NgZone) {
this.paginationConfig = new FindListOptions(); this.paginationConfig = new FindListOptions();
this.paginationConfig.elementsPerPage = 2; this.paginationConfig.elementsPerPage = 2;
this.paginationConfig.currentPage = 1; this.paginationConfig.currentPage = 1;
@@ -39,7 +40,7 @@ export class CommunityListComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.dataSource = new CommunityListDatasource(this.communityListService); this.dataSource = new CommunityListDatasource(this.communityListService, this.zone);
this.communityListService.getLoadingNodeFromStore().pipe(take(1)).subscribe((result) => { this.communityListService.getLoadingNodeFromStore().pipe(take(1)).subscribe((result) => {
this.loadingNode = result; this.loadingNode = result;
}); });