Skip to content

Commit

Permalink
Merge branch 'hotfix/0.15.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
einarhuseby committed Jun 10, 2024
2 parents 773adeb + 3fb4ebd commit 27b7fe0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nlf-client",
"version": "0.15.2",
"version": "0.15.3",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<td>{{ f.size | bytes : 2 }}</td>
<td>{{f.content_type}}&nbsp;</td>
<td>
<fa-icon class="pointer" [icon]="faDownload" (click)="download(f._id)" title="Last ned"></fa-icon>
<a target="_blank" href="{{ f.download }}" class="mx-1"><fa-icon class="pointer" [icon]="faDownload" title="Last ned"></fa-icon></a>
<!--
<fa-icon *ngIf="f.size<=10000000" class="pointer" [icon]="faDownload" (click)="download(f._id)" title="Last ned"></fa-icon>
<a *ngIf="f.size>10000000" target="_blank" [routerLink]="['/api', 'v1', 'files', f._id]"><fa-icon [icon]="faDownload" title="Last ned"></fa-icon></a>
Expand Down
22 changes: 19 additions & 3 deletions src/app/ors/ors-report/report-files/report-files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ApiFilesService } from 'app/api/api-files.service';
import { ApiObservationFileInterface, ApiFileItem, ApiOptionsInterface } from 'app/api/api.interface';
import { Component, Input, OnInit } from '@angular/core';
import { faDownload, faLock, faUnlock } from '@fortawesome/free-solid-svg-icons';
import { NlfAuthSubjectService } from 'app/services/auth/auth-subject.service';

@Component({
selector: 'nlf-ors-report-files',
Expand All @@ -19,14 +20,28 @@ export class NlfOrsReportFilesComponent implements OnInit {
faDownload = faDownload;
faLock = faLock;
faUnlock = faUnlock;
token: string;

constructor(private apiFile: ApiFilesService) { }
constructor(
private apiFile: ApiFilesService,
private authDataSubject: NlfAuthSubjectService
) {

this.authDataSubject.observableAuthData.subscribe(
data => {
if (!!data) {
this.token = data.token;
}
},
err => console.log('Problem getting token: ', err)
);
}

ngOnInit() {

if(this.doNotShowRestricted) {
if (this.doNotShowRestricted) {
console.log('Onlypublic');
this.files = this.files.filter(x => x['r']===false)
this.files = this.files.filter(x => x['r'] === false)
}

if (this.files.length > 0) {
Expand Down Expand Up @@ -57,6 +72,7 @@ export class NlfOrsReportFilesComponent implements OnInit {
this.apiFile.getFile(f.f, options).subscribe(
data => {
data['r'] = f.r;
data['download'] = this.apiFile.getDirectLink(data._id) + '?token=' + this.token;
this.filelist.push(data);
},
err => processed++,
Expand Down

0 comments on commit 27b7fe0

Please sign in to comment.