diff --git a/src/app/modules/admin/member/partner/components/list.component.ts b/src/app/modules/admin/member/partner/components/list.component.ts index cac2312..52d8ea3 100644 --- a/src/app/modules/admin/member/partner/components/list.component.ts +++ b/src/app/modules/admin/member/partner/components/list.component.ts @@ -8,13 +8,8 @@ import { ViewChild, ViewEncapsulation, } from '@angular/core'; -import { - FormBuilder, - FormControl, - FormGroup, - Validators, -} from '@angular/forms'; -import { MatCheckboxChange } from '@angular/material/checkbox'; +import { FormBuilder, FormControl } from '@angular/forms'; + import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { @@ -40,11 +35,12 @@ import { MatDialog } from '@angular/material/dialog'; import { SiteService } from 'app/modules/polyglot/domain/services/site.service'; import { Site } from 'app/modules/protobuf/models/domain/site_pb'; import { MemberService } from 'app/modules/polyglot/member/services/member.service'; +import { MemberModel } from 'app/modules/protobuf/models/member/member_pb'; import { - Member, - MemberModel, -} from 'app/modules/protobuf/models/member/member_pb'; -import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb'; + ListMembersRequest, + ListMembersResponse, +} from 'app/modules/protobuf/c2se/backend/member_pb'; +import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb'; @Component({ selector: 'partner-list', templateUrl: './list.component.html', @@ -130,23 +126,14 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { this._changeDetectorRef.markForCheck(); }); - // Get the products - /* this.partners$ = this._partnerService.partners$; */ - - /* this._siteService + this._siteService .listSites() .then((result) => { this.sites = result.getSitesList(); }) .catch((reson) => console.log(reson)); + // Get the products - this.__memberService - .listMembers() - .then((result) => { - this.__members = result.getMembersList(); - console.log('member list', this.__members); - }) - .catch((reson) => console.log(reson)); */ this._activatedRoute.data.subscribe((data) => { let listMemberResult: ListMembersResponse.Result = data['listPartner']; this.listPartner$ = of(listMemberResult.getMembersList()); @@ -186,12 +173,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { .pipe( switchMap(() => { this.isLoading = true; - return this._partnerService.getPartners( - this._paginator.pageIndex, - this._paginator.pageSize, - this._sort.active, - this._sort.direction - ); + + let req = new ListMembersRequest(); + let paging = new Pagination(); + paging.setPage(this._paginator.pageIndex); + paging.setPageSize(this._paginator.pageSize); + + req.setPagination(paging); + req.setMemberClassId('4b014ef5-3bab-4413-aaf9-b0040a70ec77'); + return of(this.__memberService.listMembers(req)); }), map(() => { this.isLoading = false; diff --git a/src/app/modules/admin/member/partner/resolvers/partner.resolver.ts b/src/app/modules/admin/member/partner/resolvers/partner.resolver.ts index 464dda2..be8fc94 100644 --- a/src/app/modules/admin/member/partner/resolvers/partner.resolver.ts +++ b/src/app/modules/admin/member/partner/resolvers/partner.resolver.ts @@ -6,7 +6,11 @@ import { RouterStateSnapshot, } from '@angular/router'; import { MemberService } from 'app/modules/polyglot/member/services/member.service'; -import { ListMembersResponse } from 'app/modules/protobuf/c2se/backend/member_pb'; +import { + ListMembersRequest, + ListMembersResponse, +} from 'app/modules/protobuf/c2se/backend/member_pb'; +import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb'; import { catchError, Observable, throwError } from 'rxjs'; import { Partner } from '../models/partner'; @@ -116,6 +120,10 @@ export class PartnerListResolver implements Resolve { | Observable | Promise | ListMembersResponse.Result { - return this.__memberService.listMembers(); + let req = new ListMembersRequest(); + + req.setMemberClassId('4b014ef5-3bab-4413-aaf9-b0040a70ec77'); + + return this.__memberService.listMembers(req); } } diff --git a/src/app/modules/polyglot/member/services/member.service.ts b/src/app/modules/polyglot/member/services/member.service.ts index 5aed537..241b22e 100644 --- a/src/app/modules/polyglot/member/services/member.service.ts +++ b/src/app/modules/polyglot/member/services/member.service.ts @@ -15,6 +15,7 @@ import { SUBJECT_GET_MEMBER, SUBJECT_GET_MEMBER_BY_USERNAME, } from 'app/modules/protobuf/c2se/backend/member_pb'; +import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb'; @Injectable({ providedIn: 'root', @@ -33,9 +34,19 @@ export class MemberService { // @ Public methods // ----------------------------------------------------------------------------------------------------- - listMembers(): Promise { + listMembers(req?: ListMembersRequest): Promise { return new Promise((resolve, reject) => { - let req = new ListMembersRequest(); + if (!req) { + req = new ListMembersRequest(); + } + + if (!req.getPagination()) { + let paging = new Pagination(); + paging.setPageSize(10); + paging.setPage(0); + + req.setPagination(paging); + } this.__natsService .request(