Răsfoiți Sursa

fix(admin-ui): Fix errors caused by lists greater than 1000 items

Fixes #807
Michael Bromley 4 ani în urmă
părinte
comite
5844715e0b

+ 1 - 1
packages/admin-ui/src/lib/catalog/src/components/collection-list/collection-list.component.ts

@@ -35,7 +35,7 @@ export class CollectionListComponent implements OnInit, OnDestroy {
     ) {}
 
     ngOnInit() {
-        this.queryResult = this.dataService.collection.getCollections(99999, 0).refetchOnChannelChange();
+        this.queryResult = this.dataService.collection.getCollections(1000, 0).refetchOnChannelChange();
         this.items$ = this.queryResult.mapStream(data => data.collections.items).pipe(shareReplay(1));
         this.activeCollectionId$ = this.route.paramMap.pipe(
             map(pm => pm.get('contents')),

+ 1 - 1
packages/admin-ui/src/lib/catalog/src/components/variant-price-detail/variant-price-detail.component.ts

@@ -25,7 +25,7 @@ export class VariantPriceDetailComponent implements OnInit, OnChanges {
 
     ngOnInit() {
         const taxRates$ = this.dataService.settings
-            .getTaxRates(99999, 0, 'cache-first')
+            .getTaxRates(999, 0, 'cache-first')
             .mapStream(data => data.taxRates.items);
         const activeChannel$ = this.dataService.settings
             .getActiveChannel('cache-first')

+ 1 - 1
packages/admin-ui/src/lib/settings/src/components/add-country-to-zone-dialog/add-country-to-zone-dialog.component.ts

@@ -21,7 +21,7 @@ export class AddCountryToZoneDialogComponent implements Dialog<string[]>, OnInit
     ngOnInit(): void {
         const currentMemberIds = this.currentMembers.map(m => m.id);
         this.availableCountries$ = this.dataService.settings
-            .getCountries(99999)
+            .getCountries(999)
             .mapStream(data => data.countries.items)
             .pipe(map(countries => countries.filter(c => !currentMemberIds.includes(c.id))));
     }

+ 1 - 1
packages/admin-ui/src/lib/settings/src/components/admin-detail/admin-detail.component.ts

@@ -73,7 +73,7 @@ export class AdminDetailComponent
     ngOnInit() {
         this.init();
         this.administrator$ = this.entity$;
-        this.allRoles$ = this.dataService.administrator.getRoles(99999).mapStream(item => item.roles.items);
+        this.allRoles$ = this.dataService.administrator.getRoles(999).mapStream(item => item.roles.items);
         this.dataService.client.userStatus().single$.subscribe(({ userStatus }) => {
             if (!userStatus.permissions.includes(Permission.UpdateAdministrator)) {
                 const rolesSelect = this.detailForm.get('roles');

+ 2 - 2
packages/admin-ui/src/lib/settings/src/components/country-list/country-list.component.ts

@@ -36,7 +36,7 @@ export class CountryListComponent implements OnInit, OnDestroy {
     ngOnInit() {
         const countries$ = this.searchTerm.valueChanges.pipe(
             startWith(null),
-            switchMap(term => this.dataService.settings.getCountries(9999, 0, term).stream$),
+            switchMap(term => this.dataService.settings.getCountries(999, 0, term).stream$),
             tap(data => (this.countries = data.countries.items)),
             map(data => data.countries.items),
         );
@@ -76,7 +76,7 @@ export class CountryListComponent implements OnInit, OnDestroy {
                         this.notificationService.success(_('common.notify-delete-success'), {
                             entity: 'Country',
                         });
-                        this.dataService.settings.getCountries(9999, 0).single$.subscribe();
+                        this.dataService.settings.getCountries(999, 0).single$.subscribe();
                     } else {
                         this.notificationService.error(response.deleteCountry.message || '');
                     }