Skip to content

Commit

Permalink
Merge branch 'master' into ozyx-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
unlikelyzero authored Jul 14, 2023
2 parents 9dfe381 + 7a2dbec commit 68f3058
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ export default function installYamcsPlugin(configuration) {
key: 'spacecraft'
});

const formatThumbnail = {
format: function (url) {
return url.replace(/\/images\//,'/rescaled-images/').replace(/.png$/, '_thumb.jpeg');
}
};

openmct.telemetry.addFormat({
key: 'yamcs-thumbnail',
...formatThumbnail
});

openmct.objects.addProvider('taxonomy', objectProvider);

openmct.types.addType(OBJECT_TYPES.AGGREGATE_TELEMETRY_TYPE, {
Expand Down
19 changes: 18 additions & 1 deletion src/providers/object-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,19 @@ export default class YamcsObjectProvider {
}]
}
};

if (this.#isImage(obj)) {
obj.telemetry.values.push({
name: 'Image Thumbnail',
key: 'yamcs-thumbnail-url',
format: 'yamcs-thumbnail',
hints: {
thumbnail: 1
},
source: 'value'
});
}

const isAggregate = this.#isAggregate(parameter);
let aggregateHasMembers = false;

Expand Down Expand Up @@ -440,7 +453,7 @@ export default class YamcsObjectProvider {

if (obj.type === OBJECT_TYPES.STRING_OBJECT_TYPE) {
metadatum.hints = {};
} else if (obj.type === OBJECT_TYPES.IMAGE_OBJECT_TYPE) {
} else if (this.#isImage(obj)) {
metadatum.hints = { image: 1 };
metadatum.format = 'image';
}
Expand All @@ -451,6 +464,10 @@ export default class YamcsObjectProvider {
return parameter?.type?.engType === 'aggregate';
}

#isImage(obj) {
return (obj.type === OBJECT_TYPES.IMAGE_OBJECT_TYPE);
}

#isEnumeration(parameter) {
return parameter?.type?.engType === 'enumeration';
}
Expand Down

0 comments on commit 68f3058

Please sign in to comment.