58789: Clear index cache and reload lists after adding metadata schema

This commit is contained in:
Kristof De Langhe
2019-01-22 13:35:15 +01:00
parent 8be40c31f6
commit 5fb5aad408
4 changed files with 13 additions and 1 deletions

View File

@@ -7,7 +7,7 @@
<p id="description" class="pb-2">{{'admin.registries.metadata.description' | translate}}</p>
<ds-metadata-schema-form
></ds-metadata-schema-form>
(submitForm)="createdSchema($event)"></ds-metadata-schema-form>
<ds-pagination
*ngIf="(metadataSchemas | async)?.payload?.totalElements > 0"

View File

@@ -62,6 +62,11 @@ export class MetadataRegistryComponent {
);
}
createdSchema(event) {
this.registryService.clearMetadataSchemaRequests().subscribe((value) => console.log('cleared for substring: ' + value));
this.updateSchemas();
}
deleteSchemas() {
this.registryService.getSelectedMetadataSchemas().subscribe(
(schemas) => {

View File

@@ -104,6 +104,7 @@ export class MetadataSchemaFormComponent implements OnInit {
if (schema == null) {
this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), values)).subscribe((newSchema) => {
console.log(newSchema);
this.submitForm.emit(newSchema);
// TODO: Reload the list of schemas
});
} else {

View File

@@ -370,4 +370,10 @@ export class RegistryService {
getResponseFromEntry()
);
}
public clearMetadataSchemaRequests(): Observable<string> {
return this.halService.getEndpoint(this.metadataSchemasPath).pipe(
tap((href: string) => this.requestService.removeByHrefSubstring(href))
)
}
}