Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
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 @@ -61,9 +61,8 @@
</div>
<div [style]="'max-height: 500px; padding: 0px; overflow: scroll'" class="panel-body">
<ul class="treeview collapse show">
<!-- Loading Spinner -->
<div *ngIf="fileInput.fileInfo.length === 0" class="d-flex justify-content-center align-items-center my-3">
<div>{{'item.preview.no-preview' | translate}}
<div *ngIf="hasNoPreview()" class="d-flex justify-content-center align-items-center my-3">
<div>{{ 'item.preview.no-preview' | translate }}
<a *ngIf="emailToContact" [href]="'mailto:' + emailToContact" class="email-text">{{ emailToContact }}</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MetadataBitstream } from 'src/app/core/metadata/metadata-bitstream.mode
import { HALEndpointService } from '../../../../../core/shared/hal-endpoint.service';
import { Router } from '@angular/router';
import { ConfigurationDataService } from '../../../../../core/data/configuration-data.service';
import { getFirstSucceededRemoteData } from '../../../../../core/shared/operators';

const allowedPreviewFormats = ['text/plain', 'text/html', 'application/zip', 'application/x-tar'];
@Component({
Expand All @@ -24,8 +25,10 @@ export class FileDescriptionComponent implements OnInit {
private configService: ConfigurationDataService) { }

ngOnInit(): void {
this.configService.findByPropertyName('lr.help.mail').subscribe(remoteData => {
this.emailToContact = remoteData.payload.values[0];
this.configService.findByPropertyName('lr.help.mail')
.pipe(getFirstSucceededRemoteData())
.subscribe(remoteData => {
this.emailToContact = remoteData?.payload?.values?.[0];
});
}

Expand Down Expand Up @@ -61,4 +64,8 @@ export class FileDescriptionComponent implements OnInit {
return format === 'application/zip' || format === 'application/x-tar';
}

hasNoPreview() {
// this.fileInput.fileInfo.length === 0 means that the file has no preview
return this.fileInput?.fileInfo?.length === 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PreviewSectionComponent implements OnInit {
this.listOfFiles.next(data);
});
this.configService.findByPropertyName('lr.help.mail')?.subscribe(remoteData => {
this.emailToContact = remoteData.payload.values[0];
this.emailToContact = remoteData.payload?.values?.[0];
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3382,8 +3382,8 @@
"item.preview.authors.et.al": "; et al.",
// "item.preview.loading-files": "Loading files... This may take a few seconds as file previews are being generated. If the process takes too long, please contact the system administrator",
"item.preview.loading-files": "Načítání souborů... Může to trvat několik sekund, protože se generují náhledy souborů. Pokud proces trvá příliš dlouho, kontaktujte prosím správce systému",
// "item.preview.no-preview": "The file preview wasn't successfully generated, please contact the system administrator",
"item.preview.no-preview": "Náhled souboru nebyl úspěšně vygenerován, kontaktujte prosím správce systému",
// "item.preview.no-preview": "The file preview has not been generated yet. Please try again later or contact the system administrator",
"item.preview.no-preview": "Náhled souboru zatím nebyl vygenerován. Zkuste to prosím znovu později, nebo kontaktujte správce systému",
// "item.refbox.modal.copy.instruction": ["Press", "ctrl + c", "to copy"],
"item.refbox.modal.copy.instruction": ["Stiskněte", "ctrl + c", "pro kopírování"],
// "item.refbox.modal.submit": "Ok",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@

"item.preview.loading-files": "Loading files... This may take a few seconds as file previews are being generated. If the process takes too long, please contact the system administrator",

"item.preview.no-preview": "The file preview wasn't successfully generated, please contact the system administrator",
"item.preview.no-preview": "The file preview has not been generated yet. Please try again later or contact the system administrator",

"item.refbox.modal.copy.instruction": ["Press", "ctrl + c", "to copy"],

Expand Down