(apps/ecommerce/inventory) Performance improvements, decreased the mockApi delay

This commit is contained in:
sercan 2021-05-24 09:22:18 +03:00
parent cfca19dc68
commit 95bc7dc4db
3 changed files with 11 additions and 6 deletions

View File

@ -50,7 +50,7 @@ export class ECommerceInventoryMockApi
// @ Products - GET // @ Products - GET
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
this._fuseMockApiService this._fuseMockApiService
.onGet('api/apps/ecommerce/inventory/products', 625) .onGet('api/apps/ecommerce/inventory/products', 300)
.reply(({request}) => { .reply(({request}) => {
// Get available queries // Get available queries

View File

@ -221,6 +221,14 @@
mat-cell mat-cell
*matCellDef="let product" *matCellDef="let product"
[attr.colspan]="productsTableColumns.length"> [attr.colspan]="productsTableColumns.length">
<ng-container *ngIf="selectedProduct?.id === product.id">
<ng-container *ngTemplateOutlet="rowDetailsTemplate; context: {$implicit: product}"></ng-container>
</ng-container>
</td>
<ng-template
#rowDetailsTemplate
let-product>
<div <div
class="shadow-lg overflow-hidden" class="shadow-lg overflow-hidden"
[@expandCollapse]="selectedProduct?.id === product.id ? 'expanded' : 'collapsed'"> [@expandCollapse]="selectedProduct?.id === product.id ? 'expanded' : 'collapsed'">
@ -403,7 +411,7 @@
<!-- Tags --> <!-- Tags -->
<ng-container *ngIf="selectedProduct && selectedProduct.tags.length"> <ng-container *ngIf="selectedProduct && selectedProduct.tags.length">
<span class="font-semibold">Tags</span> <span class="font-semibold">Tags</span>
<div class="mt-1 rounded-md border shadow-sm overflow-hidden"> <div class="mt-1 rounded-md border border-gray-300 shadow-sm overflow-hidden">
<!-- Header --> <!-- Header -->
<div class="flex items-center my-2 mx-3"> <div class="flex items-center my-2 mx-3">
<div class="flex items-center flex-auto min-w-0"> <div class="flex items-center flex-auto min-w-0">
@ -525,7 +533,7 @@
</form> </form>
</div> </div>
</div> </div>
</td> </ng-template>
</ng-container> </ng-container>
<tr <tr

View File

@ -239,9 +239,6 @@ export class InventoryListComponent implements OnInit, AfterViewInit, OnDestroy
// Set the selected product // Set the selected product
this.selectedProduct = product; this.selectedProduct = product;
// Mark for check
this._changeDetectorRef.markForCheck();
// Fill the form // Fill the form
this.selectedProductForm.patchValue(product); this.selectedProductForm.patchValue(product);