Skip to content
Snippets Groups Projects
Commit 644f870d authored by OZGCloud's avatar OZGCloud
Browse files

Merge branch 'master' into OZG-5718-reset-bescheid-upload-in-progress

parents 0251fc9a 64db91a5
No related branches found
No related tags found
No related merge requests found
......@@ -315,6 +315,17 @@ describe('VorgangDetailBescheidenResultAttachmentsComponent', () => {
expect(component.uploadedAttachments).toEqual([]);
});
it('should leave errors in uploaded', () => {
const error: StateResource<BinaryFileResource> = createStateResource(
createBinaryFileResource(),
);
component.uploadedAttachments = [error];
component.deleteFile(uploadedAttachmentStateResource.resource);
expect(component.uploadedAttachments).toEqual([error]);
});
it('should not delete attachment from existing', () => {
component.uploadedAttachments = [uploadedAttachmentStateResource];
component.existingAttachments = [existingAttachment];
......
import { BescheidService, UploadFileInProgress } from '@alfa-client/bescheid-shared';
import { BinaryFileResource } from '@alfa-client/binary-file-shared';
import {
StateResource,
containsLoading,
getSuccessfullyLoaded,
hasStateResourceError,
isLoaded,
isNotNil,
StateResource,
} from '@alfa-client/tech-shared';
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { getUrl } from '@ngxp/rest';
import { Observable, Subscription, first } from 'rxjs';
import { first, Observable, Subscription } from 'rxjs';
import { BescheidenFormService } from '../../bescheiden.formservice';
@Component({
......@@ -76,10 +76,11 @@ export class VorgangDetailBescheidenResultAttachmentsComponent implements OnDest
deleteFile(file: BinaryFileResource): void {
this.formService.deleteFile(file);
this.uploadedAttachments = this.uploadedAttachments.filter(
(attachment) => getUrl(attachment.resource) !== getUrl(file),
(attachment: StateResource<BinaryFileResource>) =>
!hasStateResourceError(attachment) && getUrl(attachment.resource) !== getUrl(file),
);
this.existingAttachments = this.existingAttachments.filter(
(attachment) => getUrl(attachment) !== getUrl(file),
(attachment: BinaryFileResource) => getUrl(attachment) !== getUrl(file),
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment