[835] Auto-save in new Item Submission form breaks the form

Submission form Save button disabled when no pending operations are present
This commit is contained in:
Alessandro Martelli
2020-11-27 16:25:41 +01:00
parent d47f686b95
commit de372896e7
8 changed files with 95 additions and 4 deletions

View File

@@ -161,6 +161,18 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
return this.submitJsonPatchOperations(href$, resourceType);
}
/**
* Select the jsonPatch operation related to the specified resource type.
* @param resourceType
*/
public hasPendingOperations(resourceType: string): Observable<boolean> {
return this.store.select(jsonPatchOperationsByResourceType(resourceType)).pipe(
map((val) => !isEmpty(val) && Object.values(val.children)
.filter((section) => !isEmpty((section as any).body)).length > 0),
distinctUntilChanged(),
);
}
/**
* Make a new JSON Patch request with all operations related to the specified resource id
*