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: rollbar fixes (DEV-1324) #817

Merged
merged 7 commits into from Sep 8, 2022
Expand Up @@ -87,7 +87,8 @@ export class OntologyClassInstanceComponent implements OnChanges {
// find ontology of current resource class to get the class label
const classes = ontologies[ontologies.findIndex(onto => onto.id === this.ontoId)].getAllClassDefinitions();
this.resClass = <ResourceClassDefinition>classes[classes.findIndex(res => res.id === this.classId)];
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);
}

Expand Down
Expand Up @@ -138,7 +138,8 @@ export class OntologyFormComponent implements OnInit {
const name = this._ontologyService.getOntologyName(onto.id);
this.existingOntologyNames.push(name);
});
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/app/project/ontology/ontology.component.ts
Expand Up @@ -383,7 +383,8 @@ export class OntologyComponent implements OnInit {
// update current list of project ontologies
ontologies[ontologies.findIndex(onto => onto.id === ontology.id)] = ontology;
this._cache.set('currentProjectOntologies', ontologies);
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);

// grab the onto class information to display
Expand Down
3 changes: 2 additions & 1 deletion src/app/project/ontology/ontology.service.ts
Expand Up @@ -116,7 +116,8 @@ export class OntologyService {
(ontologies: ReadOntology[]) => {
const onto = ontologies.find(i => i.id === baseOntoIri);
superPropIri = onto.properties[subProp].subPropertyOf[0];
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);
}

Expand Down
Expand Up @@ -191,7 +191,8 @@ export class PropertyFormComponent implements OnInit {
this.ontologyClasses.push(ontoClasses);
}
});
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);

// b) in case of list value:
Expand Down
Expand Up @@ -214,7 +214,8 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
this.propAttribute = onto.classes[this.propDef.objectType].label;
this.propAttributeComment = onto.classes[this.propDef.objectType].comment;
}
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);
} else {
this.propAttribute = this.ontology.classes[this.propDef.objectType].label;
Expand Down Expand Up @@ -256,7 +257,8 @@ export class PropertyInfoComponent implements OnChanges, AfterContentInit {
}
});
});
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);
}
}
Expand Down
Expand Up @@ -124,7 +124,8 @@ export class ResourceClassInfoComponent implements OnInit {
};
this.ontoProperties.push(prepareList);
});
}
},
() => {} // don't log error to rollbar if 'currentProjectOntologies' does not exist in the cache
);

// get currently selected ontology
Expand Down
2 changes: 1 addition & 1 deletion src/app/project/project.component.html
Expand Up @@ -18,7 +18,7 @@
<mat-sidenav-container class="project-view">
<mat-sidenav mode="side" opened class="project-nav">
<!-- Project label -->
<div class="link project-title" [routerLink]="'/beta/project/' + project.shortcode">
<div *ngIf="project !== undefined" class="link project-title" [routerLink]="'/beta/project/' + project.shortcode">
<p #projectTitle matTooltip="{{project.longname}}" matTooltipShowDelay="500"
[matTooltipDisabled]="compareElementHeights(projectTitle)" matTooltipPosition="right">
{{project.longname}}
Expand Down
4 changes: 2 additions & 2 deletions src/app/workspace/resource/resource.component.html
Expand Up @@ -2,7 +2,7 @@
<div class="resource-view" *ngIf="resource">

<!-- dsp-resource-representation -->
<div class="representation-container center" *ngIf="representationsToDisplay.length && representationsToDisplay[0].fileValue"
<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 stillimage" *ngSwitchCase="representationConstants.stillImage"
Expand Down Expand Up @@ -88,7 +88,7 @@

<!-- annotations -->
<mat-tab label="annotations"
*ngIf="representationsToDisplay.length && representationsToDisplay[0].fileValue && 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
2 changes: 1 addition & 1 deletion src/app/workspace/results/results.component.ts
Expand Up @@ -63,7 +63,7 @@ export class ResultsComponent {

onSelectionChange(res: FilteredResources) {
this.selectedResources = res;
this.resourceIri = this.selectedResources.resInfo[0].id;
this.resourceIri = this.selectedResources.resInfo[0] ? this.selectedResources.resInfo[0].id : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
this.resourceIri = this.selectedResources.resInfo[0] ? this.selectedResources.resInfo[0].id : undefined;
this.resourceIri = this.selectedResources.resInfo[0]?.id;

Isn't it enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you are correct, changed in b53ec4f


if (!res || res.count <= 1) {
this.viewMode = 'single';
Expand Down