Skip to content

Commit

Permalink
document thumbnailUrl should be the sipi baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed May 21, 2024
1 parent 70b6aa5 commit 70ace42
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild }
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import {
CreateArchiveFileValue,
CreateAudioFileValue,
CreateDocumentFileValue,
CreateFileValue,
CreateMovingImageFileValue,
CreateStillImageFileValue,
CreateTextFileValue,
UpdateArchiveFileValue,
UpdateAudioFileValue,
UpdateDocumentFileValue,
UpdateFileValue,
UpdateMovingImageFileValue,
UpdateStillImageFileValue,
UpdateTextFileValue,
CreateArchiveFileValue,

Check failure on line 5 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 5 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 5 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 5 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 5 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
CreateAudioFileValue,

Check failure on line 6 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 6 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 6 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 6 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 6 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
CreateDocumentFileValue,

Check failure on line 7 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 7 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 7 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 7 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 7 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
CreateFileValue,

Check failure on line 8 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 8 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 8 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 8 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 8 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`
CreateMovingImageFileValue,

Check failure on line 9 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 9 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 9 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 9 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 9 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
CreateStillImageFileValue,

Check failure on line 10 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 10 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 10 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 10 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`

Check failure on line 10 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Replace `····` with `··`
CreateTextFileValue,

Check failure on line 11 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 11 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 11 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 11 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 11 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
UpdateArchiveFileValue,

Check failure on line 12 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 12 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 12 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 12 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 12 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
UpdateAudioFileValue,

Check failure on line 13 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 13 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 13 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 13 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 13 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
UpdateDocumentFileValue,

Check failure on line 14 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 14 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 14 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 14 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`

Check failure on line 14 in apps/dsp-app/src/app/workspace/resource/representation/upload/upload.component.ts

View workflow job for this annotation

GitHub Actions / DSP-APP

Delete `··`
UpdateFileValue,
UpdateMovingImageFileValue,
UpdateStillImageFileValue,
UpdateTextFileValue,
} from '@dasch-swiss/dsp-js';
import { NotificationService } from '@dasch-swiss/vre/shared/app-notification';
import { UploadedFile, UploadFileService } from '@dasch-swiss/vre/shared/app-resource-properties';
import {Store} from "@ngxs/store";
import {ProjectsSelectors} from "@dasch-swiss/vre/shared/app-state";
import {filter, map, mergeMap} from "rxjs/operators";
import { Store } from '@ngxs/store';
import { ProjectsSelectors } from '@dasch-swiss/vre/shared/app-state';
import { filter, map, mergeMap } from 'rxjs/operators';
import { AppConfigService } from '@dasch-swiss/vre/shared/app-config';

// https://stackoverflow.com/questions/45661010/dynamic-nested-reactive-form-expressionchangedafterithasbeencheckederror
Expand Down Expand Up @@ -104,22 +104,21 @@ export class UploadComponent implements OnInit {
).subscribe(
(res: UploadedFile) => {
// prepare thumbnail url to display something after upload
const thumbnailUri = res.thumbnailUrl;
switch (this.representation) {
case 'stillImage':
this.thumbnailUrl = this._sanitizer.bypassSecurityTrustUrl( thumbnailUri);
this.thumbnailUrl = this._sanitizer.bypassSecurityTrustUrl( res.thumbnailUrl);
break;

case 'document':
this.thumbnailUrl = thumbnailUri;
this.thumbnailUrl = res.baseUrl;
break;

default:
this.thumbnailUrl = undefined;
break;
}

this.fileControl.setValue(res.internalFilename);
this.fileControl.setValue(res);
const fileValue = this.getNewValue();

if (fileValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface UploadedFileResponse {
export interface UploadedFile {
internalFilename: string;
thumbnailUrl: string;
baseUrl: string;
}

@Injectable({
Expand Down Expand Up @@ -47,9 +48,11 @@ export class UploadFileService {
const url = `${this._acs.dspIngestConfig.url}/projects/${shortcode}/assets/ingest/${file.name}`;
return this._http.post<UploadedFileResponse>(url, file, options).pipe(
map((res: UploadedFileResponse) => {
let baseUrl = `${this._acs.dspIiifConfig.iiifUrl}/${shortcode}/${res.internalFilename}`;
return {
internalFilename: res.internalFilename,
thumbnailUrl: `${this._acs.dspIiifConfig.iiifUrl}/${shortcode}/${res.internalFilename}/full/256,/0/default.jpg`,
thumbnailUrl: `${baseUrl}/full/256,/0/default.jpg`,
baseUrl: baseUrl,
};
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Upload2Component implements ControlValueAccessor {
this.previewUrl = this._sanitizer.bypassSecurityTrustUrl( res.thumbnailUrl );
break;
case Constants.HasDocumentFileValue:
this.previewUrl = res.thumbnailUrl;
this.previewUrl = res.baseUrl;
break;
}

Expand Down

0 comments on commit 70ace42

Please sign in to comment.