From 470e09562903bfebf813c094fddaa16c5c86cbdf Mon Sep 17 00:00:00 2001 From: Shefali Date: Mon, 10 Jul 2023 14:17:10 -0700 Subject: [PATCH 1/8] Adding logging --- src/providers/object-provider.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/object-provider.js b/src/providers/object-provider.js index da08504c..f4e26b3f 100644 --- a/src/providers/object-provider.js +++ b/src/providers/object-provider.js @@ -441,6 +441,8 @@ export default class YamcsObjectProvider { if (obj.type === OBJECT_TYPES.STRING_OBJECT_TYPE) { metadatum.hints = {}; } else if (obj.type === OBJECT_TYPES.IMAGE_OBJECT_TYPE) { + console.log('adding hints for image', key, metadatum); + metadatum.hints = { image: 1 }; metadatum.format = 'image'; } From ed20208aef93b78800fc7a9faeedbae8b9983ece Mon Sep 17 00:00:00 2001 From: Shefali Date: Wed, 12 Jul 2023 06:02:05 -0700 Subject: [PATCH 2/8] Add thumbnail metadata to image paramters --- src/providers/object-provider.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/providers/object-provider.js b/src/providers/object-provider.js index f4e26b3f..0fc872f1 100644 --- a/src/providers/object-provider.js +++ b/src/providers/object-provider.js @@ -346,6 +346,19 @@ export default class YamcsObjectProvider { }] } }; + + if (this.#isImage(obj)) { + obj.telemetry.values.push({ + name: 'Image Thumbnail', + key: 'thumbnail-url', + format: 'thumbnail', + hints: { + thumbnail: 1 + }, + source: 'url' + }); + } + const isAggregate = this.#isAggregate(parameter); let aggregateHasMembers = false; @@ -440,9 +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) { - console.log('adding hints for image', key, metadatum); - + } else if (this.#isImage(obj)) { metadatum.hints = { image: 1 }; metadatum.format = 'image'; } @@ -453,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'; } From c874a38361010429f536788fa53cc5a68f921933 Mon Sep 17 00:00:00 2001 From: Shefali Date: Wed, 12 Jul 2023 06:15:25 -0700 Subject: [PATCH 3/8] Add thumbnail formatter --- src/plugin.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugin.js b/src/plugin.js index 3d1e0bd6..923a466d 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -130,6 +130,17 @@ export default function installYamcsPlugin(configuration) { key: 'spacecraft' }); + const formatThumbnail = { + format: function (url) { + return `${url}?w=100&h=100`; + } + }; + + openmct.telemetry.addFormat({ + key: 'thumbnail', + ...formatThumbnail + }); + openmct.objects.addProvider('taxonomy', objectProvider); openmct.types.addType(OBJECT_TYPES.AGGREGATE_TELEMETRY_TYPE, { From 5b72f48d4b1f199f5693002fc18ecb6b888b56b7 Mon Sep 17 00:00:00 2001 From: Shefali Date: Thu, 13 Jul 2023 13:33:20 -0700 Subject: [PATCH 4/8] Fix source for thumbnails --- src/providers/object-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/object-provider.js b/src/providers/object-provider.js index 0fc872f1..2d08f1bb 100644 --- a/src/providers/object-provider.js +++ b/src/providers/object-provider.js @@ -355,7 +355,7 @@ export default class YamcsObjectProvider { hints: { thumbnail: 1 }, - source: 'url' + source: 'value' }); } From a002bc62b629963a82bbbcb5ba930c7b77dc39ed Mon Sep 17 00:00:00 2001 From: Shefali Date: Thu, 13 Jul 2023 15:19:17 -0700 Subject: [PATCH 5/8] Fix format function for thumbnails --- src/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index 923a466d..5b1b3c33 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -132,7 +132,7 @@ export default function installYamcsPlugin(configuration) { const formatThumbnail = { format: function (url) { - return `${url}?w=100&h=100`; + return url.replace(/\/images\//,'/rescaled-images/').replace(/.png$/, '_thumb.png'); } }; From b2d75cc8f46a42e4029ec56f503d95e19a6dd96e Mon Sep 17 00:00:00 2001 From: Shefali Date: Thu, 13 Jul 2023 16:09:31 -0700 Subject: [PATCH 6/8] Use unique thumbnail metadata key and format values --- src/plugin.js | 2 +- src/providers/object-provider.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugin.js b/src/plugin.js index 5b1b3c33..50ec1393 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -137,7 +137,7 @@ export default function installYamcsPlugin(configuration) { }; openmct.telemetry.addFormat({ - key: 'thumbnail', + key: 'yamcs-thumbnail', ...formatThumbnail }); diff --git a/src/providers/object-provider.js b/src/providers/object-provider.js index 2d08f1bb..1e9cf475 100644 --- a/src/providers/object-provider.js +++ b/src/providers/object-provider.js @@ -349,9 +349,9 @@ export default class YamcsObjectProvider { if (this.#isImage(obj)) { obj.telemetry.values.push({ - name: 'Image Thumbnail', - key: 'thumbnail-url', - format: 'thumbnail', + name: 'VIPER Image Thumbnail', + key: 'yamcs-thumbnail-url', + format: 'yamcs-thumbnail', hints: { thumbnail: 1 }, From 045ae3803d9d8e607454659ebc9e2e6c02d086c6 Mon Sep 17 00:00:00 2001 From: Shefali Date: Thu, 13 Jul 2023 17:51:57 -0700 Subject: [PATCH 7/8] Address review comments - remove reference to VIPER --- src/providers/object-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/object-provider.js b/src/providers/object-provider.js index 1e9cf475..1875e157 100644 --- a/src/providers/object-provider.js +++ b/src/providers/object-provider.js @@ -349,7 +349,7 @@ export default class YamcsObjectProvider { if (this.#isImage(obj)) { obj.telemetry.values.push({ - name: 'VIPER Image Thumbnail', + name: 'Image Thumbnail', key: 'yamcs-thumbnail-url', format: 'yamcs-thumbnail', hints: { From 7ca5d5bb47374b3db9914c33a223479280783474 Mon Sep 17 00:00:00 2001 From: Shefali Date: Fri, 14 Jul 2023 13:42:30 -0700 Subject: [PATCH 8/8] Change thumbnail extension to .jpeg --- src/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index 50ec1393..2e088b0f 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -132,7 +132,7 @@ export default function installYamcsPlugin(configuration) { const formatThumbnail = { format: function (url) { - return url.replace(/\/images\//,'/rescaled-images/').replace(/.png$/, '_thumb.png'); + return url.replace(/\/images\//,'/rescaled-images/').replace(/.png$/, '_thumb.jpeg'); } };