Browse Source

fix(admin-ui): Fix refresh issues with customer group list view

Michael Bromley 3 years ago
parent
commit
04b431c942

+ 1 - 10
packages/admin-ui/src/lib/customer/src/components/customer-group-list/customer-group-list.component.html

@@ -50,7 +50,7 @@
                         {{ 'common.edit' | translate }}
                     </button>
                 </td>
-                <td [class.active]="group.id === activeGroupId">
+                <td [class.active]="group.id === activeGroupId" class="align-middle">
                     <vdr-dropdown>
                         <button type="button" class="btn btn-link btn-sm" vdrDropdownTrigger>
                             {{ 'common.actions' | translate }}
@@ -71,15 +71,6 @@
                 </td>
             </ng-template>
         </vdr-data-table>
-
-        <table class="table mt0" *ngIf="!(listIsEmpty$ | async); else emptyPlaceholder">
-            <tbody>
-                <tr
-                    *ngFor="let group of items$ | async"
-                    [class.active]="group.id === (activeGroup$ | async)?.id"
-                ></tr>
-            </tbody>
-        </table>
     </div>
     <ng-template #emptyPlaceholder>
         <vdr-empty-placeholder></vdr-empty-placeholder>

+ 3 - 2
packages/admin-ui/src/lib/customer/src/components/customer-group-list/customer-group-list.component.ts

@@ -142,11 +142,10 @@ export class CustomerGroupListComponent
                         ? this.dataService.customer.createCustomerGroup({ ...result, customerIds: [] })
                         : EMPTY,
                 ),
-                // refresh list
-                switchMap(() => this.dataService.customer.getCustomerGroupList().single$),
             )
             .subscribe(
                 () => {
+                    this.refresh();
                     this.notificationService.success(_('common.notify-create-success'), {
                         entity: 'CustomerGroup',
                     });
@@ -189,6 +188,7 @@ export class CustomerGroupListComponent
                     if (typeof result.errorMessage === 'string') {
                         this.notificationService.error(result.errorMessage);
                     } else {
+                        this.refresh();
                         this.notificationService.success(_('common.notify-delete-success'), {
                             entity: 'CustomerGroup',
                         });
@@ -214,6 +214,7 @@ export class CustomerGroupListComponent
             )
             .subscribe(
                 () => {
+                    this.refresh();
                     this.notificationService.success(_('common.notify-update-success'), {
                         entity: 'CustomerGroup',
                     });