-
+

{{'PLAN-LISTING.TEXT-INFO' | translate}}

{{'PLAN-LISTING.TEXT-INFO-QUESTION' | translate}} {{'PLAN-LISTING.LINK-ZENODO' | translate}} {{'PLAN-LISTING.GET-IDEA' | translate}}

@@ -11,18 +11,18 @@
-
+
-
+
-
-
+
+
@@ -50,36 +50,40 @@ {{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}
- + +
-
-
- -
-
- -
-
-
- {{'PLAN-LISTING.EMPTY-LIST' | translate}} -
-
- {{'PLAN-LISTING.FILTERS.NO-ITEMS-FOUND' | translate}} -
-
+ @if(!isLoading){ +
+
+ +
+
+ +
+
+
+ {{'PLAN-LISTING.EMPTY-LIST' | translate}} +
+
+ {{'PLAN-LISTING.FILTERS.NO-ITEMS-FOUND' | translate}} +
+ } +
+
diff --git a/frontend/src/app/ui/plan/listing/plan-listing.component.ts b/frontend/src/app/ui/plan/listing/plan-listing.component.ts index d892f0b4e..ed0839169 100644 --- a/frontend/src/app/ui/plan/listing/plan-listing.component.ts +++ b/frontend/src/app/ui/plan/listing/plan-listing.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; -import { MatDialog } from '@angular/material/dialog'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { ActivatedRoute, Params, Router } from '@angular/router'; @@ -25,9 +25,8 @@ import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/ import { PageLoadEvent, SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component'; import { TranslateService } from '@ngx-translate/core'; import { NgDialogAnimationService } from "ng-dialog-animation"; -import { debounceTime, takeUntil, tap } from 'rxjs/operators'; +import { takeUntil, tap } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { PlanFilterDialogComponent } from './filtering/plan-filter-dialog/plan-filter-dialog.component'; import { BaseListingComponent } from '@common/base/base-listing-component'; import { QueryResult } from '@common/model/query-result'; import { Observable } from 'rxjs'; @@ -41,7 +40,8 @@ import { BaseHttpParams } from '@common/http/base-http-params'; import { InterceptorType } from '@common/http/interceptors/interceptor-type'; import { PrincipalService } from '@app/core/services/http/principal.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; -import { PlanStatusEnum } from '@app/core/common/enum/plan-status'; +import { PlanFilterDialogComponent } from './filtering/plan-filter-dialog/plan-filter-dialog.component'; +import { PlanListingFilters } from './filtering/plan-filter.component'; @Component({ selector: 'app-plan-listing-component', @@ -58,7 +58,7 @@ export class PlanListingComponent extends BaseListingComponent this.controlModified()); + // this.formGroup.get('like').valueChanges + // .pipe(takeUntil(this._destroyed), debounceTime(500)) + // .subscribe(x => this.controlModified()); } public dashboardTour: GuidedTour = { @@ -201,10 +201,13 @@ export class PlanListingComponent extends BaseListingComponent> { + this.isLoading = true; if (this.isPublic) { return this.planService.publicQuery(this.lookup).pipe(takeUntil(this._destroyed)) .pipe(tap(result => { + this.isLoading = false; if (this.versionsModeEnabled) { const latestVersionPlan: BasePlan = this._getLatestVersion(result.items); this.breadcrumbService.addIdResolvedValue(this.groupId.toString(), latestVersionPlan.label); @@ -214,11 +217,11 @@ export class PlanListingComponent extends BaseListingComponent { + this.isLoading = false; if (this.versionsModeEnabled) { const latestVersionPlan: BasePlan = this._getLatestVersion(result.items); this.breadcrumbService.addIdResolvedValue(this.groupId.toString(), latestVersionPlan.label); @@ -229,7 +232,6 @@ export class PlanListingComponent extends BaseListingComponent = this.dialog.open(PlanFilterDialogComponent, { width: '456px', height: '100%', id: 'filters', @@ -314,7 +316,8 @@ export class PlanListingComponent extends BaseListingComponent t.code && t.code?.toString() == this.authService.selectedTenant()); if (tenant && tenant?.code) { - lookup.tenantSubQuery = PlanFilterService.initializeTenantLookup(); - lookup.tenantSubQuery.codes = [tenant.code] + this.lookup.tenantSubQuery = PlanFilterService.initializeTenantLookup(); + this.lookup.tenantSubQuery.codes = [tenant.code] } - else lookup.tenantSubQuery = null; - } else lookup.tenantSubQuery = null; + else this.lookup.tenantSubQuery = null; + } else this.lookup.tenantSubQuery = null; // Description Templates - let descriptionTemplates = formGroup.get("descriptionTemplates")?.value ?? null; + let descriptionTemplates = filters.descriptionTemplates ?? null; if (descriptionTemplates && descriptionTemplates?.length > 0) { - lookup.planDescriptionTemplateSubQuery = PlanFilterService.initializePlanDescriptionTemplateLookup(); - lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds = descriptionTemplates; - } else lookup.planDescriptionTemplateSubQuery = null; + this.lookup.planDescriptionTemplateSubQuery = PlanFilterService.initializePlanDescriptionTemplateLookup(); + this.lookup.planDescriptionTemplateSubQuery.descriptionTemplateGroupIds = descriptionTemplates; + } else this.lookup.planDescriptionTemplateSubQuery = null; // Blueprints - let planBlueprints = formGroup.get("planBlueprints")?.value ?? null; + let planBlueprints = filters.planBlueprints ?? null; if (planBlueprints && planBlueprints?.length > 0) { - lookup.planBlueprintSubQuery = PlanFilterService.initializePlanBlueprintLookup(); - lookup.planBlueprintSubQuery.ids = planBlueprints; - } else lookup.planBlueprintSubQuery = null; + this.lookup.planBlueprintSubQuery = PlanFilterService.initializePlanBlueprintLookup(); + this.lookup.planBlueprintSubQuery.ids = planBlueprints; + } else this.lookup.planBlueprintSubQuery = null; // plans - let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; + let roles = filters.role !== null ? [filters.role] : null; if (roles && roles?.length > 0) { - lookup.planUserSubQuery = PlanFilterService.initializePlanUserLookup(); - lookup.planUserSubQuery.userRoles = roles; - } else lookup.planUserSubQuery = null; + this.lookup.planUserSubQuery = PlanFilterService.initializePlanUserLookup(); + this.lookup.planUserSubQuery.userRoles = roles; + } else this.lookup.planUserSubQuery = null; - let references: Guid[] = formGroup.get("references")?.value + let references: Guid[] = filters.references ?.filter((reference: ReferencesWithType) => reference.referenceTypeId != null && reference.referenceIds?.length > 0) ?.flatMap((referencesWithType: ReferencesWithType) => referencesWithType.referenceIds) as Guid[]; if (references && references?.length > 0) { - lookup.planReferenceSubQuery = PlanFilterService.initializePlanReferenceLookup(); - lookup.planReferenceSubQuery.referenceIds = references; - } else lookup.planReferenceSubQuery = null; + this.lookup.planReferenceSubQuery = PlanFilterService.initializePlanReferenceLookup(); + this.lookup.planReferenceSubQuery.referenceIds = references; + } else this.lookup.planReferenceSubQuery = null; - return lookup; + return this.lookup; } - _patchReferenceFiltersFromForm(formGroup: UntypedFormGroup): ReferencesWithType[] { - return formGroup?.get("references")?.value?.filter(( referencesWithType: ReferencesWithType ) => referencesWithType != null && referencesWithType.referenceIds?.length > 0) ?? null; + _patchReferenceFilters(filters: PlanListingFilters): ReferencesWithType[] { + return filters?.references?.filter(( referencesWithType: ReferencesWithType ) => referencesWithType != null && referencesWithType.referenceIds?.length > 0) ?? null; } - private _buildFormFromLookup(lookup: PlanLookup): UntypedFormGroup { - return (new UntypedFormBuilder()).group({ - like: lookup.like ?? null, - status: [lookup.statuses?.length > 0 ? lookup.statuses[0] : null], - viewOnlyTenant: [lookup.tenantSubQuery?.codes?.length > 0 ? true : false], - descriptionTemplates: lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds ? [lookup.planDescriptionTemplateSubQuery?.descriptionTemplateGroupIds] : [], - planBlueprints: lookup.planBlueprintSubQuery?.ids ? [lookup.planBlueprintSubQuery?.ids]: [], - role: lookup.planUserSubQuery?.userRoles ? lookup.planUserSubQuery?.userRoles[0] : null, - }); - } + private _countFilters(lookup: PlanLookup): number { let count = 0; diff --git a/frontend/src/app/ui/plan/listing/plan-listing.module.ts b/frontend/src/app/ui/plan/listing/plan-listing.module.ts index d693f896b..a304ead36 100644 --- a/frontend/src/app/ui/plan/listing/plan-listing.module.ts +++ b/frontend/src/app/ui/plan/listing/plan-listing.module.ts @@ -12,6 +12,7 @@ import { ClonePlanDialogModule } from '../clone-dialog/plan-clone-dialog.module' import { PlanListingComponent } from './plan-listing.component'; import { PlanListingItemComponent } from './listing-item/plan-listing-item.component'; import { PlanListingRoutingModule } from './plan-listing.routing'; +import { TextFilterModule } from '@common/modules/text-filter/text-filter.module'; @NgModule({ imports: [ @@ -22,7 +23,8 @@ import { PlanListingRoutingModule } from './plan-listing.routing'; ClonePlanDialogModule, NewVersionPlanDialogModule, PlanInvitationDialogModule, - PlanListingRoutingModule + PlanListingRoutingModule, + TextFilterModule ], declarations: [ PlanListingComponent,