Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix - incorrect base uri document download #987

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
DocumentenApiMetadata,
ViewType,
} from '@valtimo/components';
import {ConfigService} from '@valtimo/config';
import {BaseApiService, ConfigService} from '@valtimo/config';
import {FileSortService} from '@valtimo/document';
import {DownloadService, UploadProviderService} from '@valtimo/resource';
import {UserProviderService} from '@valtimo/security';
Expand All @@ -33,9 +33,10 @@ import moment from 'moment';
import {BehaviorSubject, combineLatest, Observable, of, Subject} from 'rxjs';
import {catchError, filter, map, switchMap, take, tap} from 'rxjs/operators';
import {DocumentenApiRelatedFile, DocumentenApiRelatedFileListItem} from '../../models';
import {DocumentenApiDocumentService} from '../../services/documenten-api-document.service';
import {DocumentenApiDocumentService} from '../../services';
import {DocumentenApiMetadataModalComponent} from '../documenten-api-metadata-modal/documenten-api-metadata-modal.component';
import {CommonModule} from '@angular/common';
import {HttpClient} from '@angular/common/http';

@Component({
selector: 'valtimo-dossier-detail-tab-documenten-api-documents',
Expand All @@ -51,7 +52,7 @@ import {CommonModule} from '@angular/common';
TranslateModule,
],
})
export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit, AfterViewInit {
export class DossierDetailTabDocumentenApiDocumentsComponent extends BaseApiService implements OnInit, AfterViewInit {
@ViewChild('fileInput') fileInput: ElementRef;
@ViewChild('sizeTemplate') public sizeTemplate: TemplateRef<any>;

Expand Down Expand Up @@ -160,12 +161,15 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit,
private readonly uploadProviderService: UploadProviderService,
private readonly downloadService: DownloadService,
private readonly translateService: TranslateService,
private readonly configService: ConfigService,
private readonly userProviderService: UserProviderService,
private readonly fileSortService: FileSortService,
private readonly iconService: IconService,
private readonly documentenApiDocumentService: DocumentenApiDocumentService
) {}
private readonly documentenApiDocumentService: DocumentenApiDocumentService,
public readonly configService: ConfigService,
public readonly httpClient: HttpClient,
) {
super(httpClient, configService)
}

ngOnInit(): void {
this.refetchDocuments();
Expand All @@ -192,11 +196,11 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit,
{key: 'keywords', label: 'document.trefwoorden'},
{key: 'informatieobjecttype', label: 'document.informatieobjecttype'},
{key: 'language', label: 'document.language'},
{key: 'identification', label: 'document.id'},
{key: 'confidentialityLevel', label: 'document.confidentialityLevel'},
{key: 'receiptDate', label: 'document.receiptDate'},
{key: 'sendDate', label: 'document.sendDate'},
{key: 'status', label: 'document.status'},
{key: 'identification', label: 'document.id'},
];

this.fields = [...this.getFields(fieldOptions, this.fieldsConfig)];
Expand Down Expand Up @@ -228,7 +232,7 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit,
userIdentity => {
this.isAdmin = userIdentity.roles.includes('ROLE_ADMIN');
},
error => {
() => {
this.isAdmin = false;
}
);
Expand Down Expand Up @@ -293,7 +297,7 @@ export class DossierDetailTabDocumentenApiDocumentsComponent implements OnInit,

private downloadDocument(relatedFile: DocumentenApiRelatedFile, forceDownload: boolean): void {
this.downloadService.downloadFile(
`/api/v1/documenten-api/${relatedFile.pluginConfigurationId}/files/${relatedFile.fileId}/download`,
this.getApiUrl(`/v1/documenten-api/${relatedFile.pluginConfigurationId}/files/${relatedFile.fileId}/download`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You now solved it in the component, but can you solve this in DownloadService itself?

relatedFile.fileName,
forceDownload
);
Expand Down
Loading