Skip to content

Commit

Permalink
squash! Reintroduce source type in source metadata view, reformat (#37
Browse files Browse the repository at this point in the history
…#517)

types are bare strings without an @id
  • Loading branch information
jgonggrijp committed Mar 22, 2023
1 parent 54c7a90 commit efb6585
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/source-metadata/source-metadata-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default class SourceMetadataView extends CompositeView {
if (!this.model) return this;
for (let attribute in this.model.attributes) {
const values = this.model.get(attribute);
let valueId;
if (!values.length) continue;
if (attribute.startsWith(sourceOntologyPrefix)) {
const attributeLabel = getLabelFromId(attribute) as string;
Expand All @@ -154,12 +155,14 @@ export default class SourceMetadataView extends CompositeView {
const attributeLabel = 'sourceType';
let value = find(values, isSourceType);
if (!value) continue;
valueId = value;
} else continue;
const queryString = `[name="${attributeLabel}"]`;
const element = this.$(queryString);
if (!element.length) continue;
if (externalAttributes.includes(attributeLabel)) {
const nodeFromUri = ldChannel.request("obtain", value.id);
valueId = valueId || value.id;
const nodeFromUri = ldChannel.request("obtain", valueId);
value = typeof nodeFromUri === "string"
? nodeFromUri
: getLabel(nodeFromUri);
Expand Down

0 comments on commit efb6585

Please sign in to comment.