diff --git a/frontend/app/features/content/pages/schemas/schemas-page.component.html b/frontend/app/features/content/pages/schemas/schemas-page.component.html index b81a955b6..d5343b587 100644 --- a/frontend/app/features/content/pages/schemas/schemas-page.component.html +++ b/frontend/app/features/content/pages/schemas/schemas-page.component.html @@ -18,11 +18,9 @@ - - + + diff --git a/frontend/app/features/content/pages/schemas/schemas-page.component.ts b/frontend/app/features/content/pages/schemas/schemas-page.component.ts index 54e39143f..12b52c2d5 100644 --- a/frontend/app/features/content/pages/schemas/schemas-page.component.ts +++ b/frontend/app/features/content/pages/schemas/schemas-page.component.ts @@ -7,7 +7,8 @@ import { Component } from '@angular/core'; import { FormControl } from '@angular/forms'; -import { buildSchemaFilterFunction, LocalStoreService, SchemaCategory, SchemasState, Settings } from '@app/shared'; +import { AppsState, getCategoryTree, LocalStoreService, SchemaCategory, SchemasState, Settings, value$ } from '@app/shared'; +import { combineLatest } from 'rxjs'; import { map } from 'rxjs/operators'; @Component({ @@ -18,9 +19,26 @@ import { map } from 'rxjs/operators'; export class SchemasPageComponent { public schemasFilter = new FormControl(); - public schemaFilterFunction = - this.schemasFilter.valueChanges.pipe( - map(buildSchemaFilterFunction)); + public schemas = + this.schemasState.schemas.pipe( + map(schemas => { + const app = this.appsState.snapshot.selectedApp!; + + return schemas.filter(schema => + schema.canReadContents && + schema.isPublished && + !app.roleProperties[Settings.AppProperties.HIDE_CONTENTS(schema.name)], + ); + })); + + public categories = + combineLatest([ + value$(this.schemasFilter), + this.schemas, + this.schemasState.categoryNames, + ], (filter, schemas, categories) => { + return getCategoryTree(schemas, categories, filter); + }); public isCollapsed: boolean; @@ -30,6 +48,7 @@ export class SchemasPageComponent { constructor( public readonly schemasState: SchemasState, + private readonly appsState: AppsState, private readonly localStore: LocalStoreService, ) { this.isCollapsed = localStore.getBoolean(Settings.Local.SCHEMAS_COLLAPSED); diff --git a/frontend/app/features/schemas/pages/schemas/schemas-page.component.html b/frontend/app/features/schemas/pages/schemas/schemas-page.component.html index 6b04c1d2d..2a77525bc 100644 --- a/frontend/app/features/schemas/pages/schemas/schemas-page.component.html +++ b/frontend/app/features/schemas/pages/schemas/schemas-page.component.html @@ -21,10 +21,8 @@
- +
diff --git a/frontend/app/features/schemas/pages/schemas/schemas-page.component.ts b/frontend/app/features/schemas/pages/schemas/schemas-page.component.ts index 3e7058447..bbaf98258 100644 --- a/frontend/app/features/schemas/pages/schemas/schemas-page.component.ts +++ b/frontend/app/features/schemas/pages/schemas/schemas-page.component.ts @@ -8,7 +8,8 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; -import { buildSchemaFilterFunction, CreateCategoryForm, DialogModel, MessageBus, ResourceOwner, SchemaCategory, SchemaDto, SchemasState } from '@app/shared'; +import { CreateCategoryForm, DialogModel, getCategoryTree, MessageBus, ResourceOwner, SchemaCategory, SchemaDto, SchemasState, value$ } from '@app/shared'; +import { combineLatest } from 'rxjs'; import { map } from 'rxjs/operators'; import { SchemaCloning } from './../messages'; @@ -23,9 +24,14 @@ export class SchemasPageComponent extends ResourceOwner implements OnInit { public schemasFilter = new FormControl(); - public schemaFilterFunction = - this.schemasFilter.valueChanges.pipe( - map(buildSchemaFilterFunction)); + public categories = + combineLatest([ + value$(this.schemasFilter), + this.schemasState.schemas, + this.schemasState.categoryNames, + ], (filter, schemas, categories) => { + return getCategoryTree(schemas, categories, filter); + }); public import: any; diff --git a/frontend/app/shared/components/schema-category.component.html b/frontend/app/shared/components/schema-category.component.html index a2566845a..ff4f909ac 100644 --- a/frontend/app/shared/components/schema-category.component.html +++ b/frontend/app/shared/components/schema-category.component.html @@ -1,4 +1,4 @@ -