From 03655ab575fe960104a59f9cfd583b343282abce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tib=C3=A9rio=20Baptista?= <38945670+tiberio-baptista@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:09:40 +0000 Subject: [PATCH] Fix Web UI Plugin Settings Files Not Handled Properly / Include PatientID in study view entries (#680) * Return settings in servlet response; Pass settings into registered plugin. * studyView.js - insert patientid into study entries * series uid->image view; study uid -> series view * Update dicoogle/src/main/resources/webapp/js/components/search/result/imageView.js --------- Co-authored-by: Eduardo Pinho --- .../dicoogle/server/web/servlets/webui/WebUIServlet.java | 6 +++++- .../webapp/js/components/search/result/imageView.js | 9 ++++++++- .../webapp/js/components/search/result/serieView.js | 7 ++++++- .../webapp/js/components/search/result/studyView.js | 6 +++++- webcore/src/dicoogle-webcore.js | 3 ++- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/webui/WebUIServlet.java b/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/webui/WebUIServlet.java index f33333c0c..1ccdd0a7d 100644 --- a/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/webui/WebUIServlet.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/webui/WebUIServlet.java @@ -89,7 +89,11 @@ private String getPluginsBySlot(HttpServletRequest req, String... slotIds) throw List pkgList = new ArrayList<>(plugins.size()); for (WebUIPlugin plugin : plugins) { - String pkg = PluginController.getInstance().getWebUIPackageJSON(plugin.getName()); + JSONObject pkgObject = + JSONObject.fromObject(PluginController.getInstance().getWebUIPackageJSON(plugin.getName())); + pkgObject.put("settings", plugin.getSettings()); + + String pkg = pkgObject.toString(); if (pkg == null) { logger.warn("Ignoring web plugin {}", plugin.getName()); continue; diff --git a/dicoogle/src/main/resources/webapp/js/components/search/result/imageView.js b/dicoogle/src/main/resources/webapp/js/components/search/result/imageView.js index 24ab14af5..ac871693a 100644 --- a/dicoogle/src/main/resources/webapp/js/components/search/result/imageView.js +++ b/dicoogle/src/main/resources/webapp/js/components/search/result/imageView.js @@ -142,7 +142,8 @@ const ImageView = createReactClass({ // deprecated data properties "data-result-type": "image", "data-result-uri": item.uri, - "data-result-uid": item.sopInstanceUID + "data-result-uid": item.sopInstanceUID, + "data-result-seriesuid": item.serieuid }} /> @@ -183,8 +184,14 @@ const ImageView = createReactClass({ render: function() { let self = this; + var resultArray = this.props.serie.images; + for (let i = 0; i < resultArray.length; i++){ + resultArray[i]['serieuid'] = this.props.serie.serieInstanceUID; + } + + var selectRowProp = { clickToSelect: true, mode: "none", diff --git a/dicoogle/src/main/resources/webapp/js/components/search/result/serieView.js b/dicoogle/src/main/resources/webapp/js/components/search/result/serieView.js index a811579f0..30db24f28 100644 --- a/dicoogle/src/main/resources/webapp/js/components/search/result/serieView.js +++ b/dicoogle/src/main/resources/webapp/js/components/search/result/serieView.js @@ -109,7 +109,8 @@ const SeriesView = createReactClass({ uid: item.serieInstanceUID, // deprecated data fields "data-result-type": "series", - "data-result-uid": item.serieInstanceUID + "data-result-uid": item.serieInstanceUID, + "data-result-studyuid": item.studyuid }} /> @@ -156,6 +157,10 @@ const SeriesView = createReactClass({ var resultArray = this.props.study.series; + for (let i = 0; i < resultArray.length; i++){ + resultArray[i]['studyuid'] = this.props.study.studyInstanceUID; + } + var selectRowProp = { clickToSelect: true, mode: "none", diff --git a/dicoogle/src/main/resources/webapp/js/components/search/result/studyView.js b/dicoogle/src/main/resources/webapp/js/components/search/result/studyView.js index 244454bfe..95b0cc4b9 100644 --- a/dicoogle/src/main/resources/webapp/js/components/search/result/studyView.js +++ b/dicoogle/src/main/resources/webapp/js/components/search/result/studyView.js @@ -102,7 +102,8 @@ const StudyView = createReactClass({ uid: item.studyInstanceUID, // deprecated data fields "data-result-type": "study", - "data-result-uid": item.studyInstanceUID + "data-result-uid": item.studyInstanceUID, + "data-result-patientid": item.patientid }} /> @@ -141,6 +142,9 @@ const StudyView = createReactClass({ var self = this; var resultArray = this.props.patient.studies; + for (let i = 0; i < resultArray.length; i++) + resultArray[i]['patientid'] = this.props.patient.id; + var selectRowProp = { clickToSelect: true, mode: "none", diff --git a/webcore/src/dicoogle-webcore.js b/webcore/src/dicoogle-webcore.js index 50c47e90f..5ad3a6a76 100644 --- a/webcore/src/dicoogle-webcore.js +++ b/webcore/src/dicoogle-webcore.js @@ -328,13 +328,14 @@ export const fetchModules = m.fetchModules; pluginInstance.Name = name; pluginInstance.SlotId = slotId; pluginInstance.Caption = thisPackage.dicoogle.caption || name; + pluginInstance.Settings = thisPackage.settings; plugins[name] = pluginInstance; if (slots[slotId]) { for (let slot of slots[slotId]) { slot.attachPlugin(pluginInstance); } } - const eventData = {name, slotId, caption: pluginInstance.Caption}; + const eventData = {name, slotId, caption: pluginInstance.Caption, settings: pluginInstance.Settings}; event_hub.emit('load', eventData); }; export const onRegister = m.onRegister;