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

fix(resource): resource viewer is broken if fileRepresentation has restricted view (DEV-455) #666

Merged
merged 3 commits into from Feb 18, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -5,6 +5,7 @@
background: white;
padding: 8px 16px;
@include mat-box-shadow();
border-radius: $border-radius;

table {
border-collapse: collapse;
Expand Down
6 changes: 3 additions & 3 deletions src/app/workspace/resource/resource.component.html
Expand Up @@ -2,8 +2,8 @@
<div class="resource-view" *ngIf="resource && !loading">

<!-- dsp-resource-representation -->
<div class="representation-container center" *ngIf="representationsToDisplay.length"
[ngSwitch]="representationsToDisplay[0].fileValue.type">
<div class="representation-container center" *ngIf="representationsToDisplay.length && representationsToDisplay[0].fileValue"
[ngSwitch]="representationsToDisplay[0].fileValue?.type">
<!-- still image view -->
<app-still-image #stillImage class="dsp-representation" *ngSwitchCase="representationConstants.stillImage"
[images]="representationsToDisplay"
Expand Down Expand Up @@ -52,7 +52,7 @@

<!-- annotations -->
<mat-tab label="annotations"
*ngIf="representationsToDisplay.length && representationsToDisplay[0].fileValue.type === representationConstants.stillImage">
*ngIf="representationsToDisplay.length && representationsToDisplay[0].fileValue && representationsToDisplay[0].fileValue.type === representationConstants.stillImage">
<ng-template matTabLabel class="annotations">
<span [matBadge]="representationsToDisplay[0]?.annotations.length"
[matBadgeHidden]="representationsToDisplay[0]?.annotations.length === 0" matBadgeColor="primary"
Expand Down
3 changes: 1 addition & 2 deletions src/app/workspace/resource/resource.component.ts
Expand Up @@ -299,7 +299,7 @@ export class ResourceComponent implements OnInit, OnChanges, OnDestroy {

this.collectRepresentationsAndAnnotations(this.incomingResource);

if (this.representationsToDisplay.length && this.compoundPosition) {
if (this.representationsToDisplay.length && this.representationsToDisplay[0].fileValue && this.compoundPosition) {
this.getIncomingRegions(this.incomingResource, 0);
}
},
Expand Down Expand Up @@ -340,7 +340,6 @@ export class ResourceComponent implements OnInit, OnChanges, OnDestroy {
];

this.representationsToDisplay = stillImageRepresentations;

// --> TODO: get regions here

break;
Expand Down