From 13e4dc25e1b0b584490957a213366be9f81b3822 Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Fri, 27 Jul 2018 13:51:38 +0200 Subject: [PATCH] Revert "merge plugin code to master" This reverts commit e896724f70a67b91eea37c8c845d8e3e1bf9400a. --- .../components/ohifViewer/ohifViewer.js | 85 ------------------- .../toolbarSection/toolbarSection.js | 17 +--- 2 files changed, 4 insertions(+), 98 deletions(-) diff --git a/OHIFViewer/client/components/ohifViewer/ohifViewer.js b/OHIFViewer/client/components/ohifViewer/ohifViewer.js index 27f7046f4..ab8ef732f 100644 --- a/OHIFViewer/client/components/ohifViewer/ohifViewer.js +++ b/OHIFViewer/client/components/ohifViewer/ohifViewer.js @@ -57,91 +57,6 @@ Template.ohifViewer.onCreated(() => { // Set the viewer open state on session Session.set('ViewerOpened', isViewer); }); - - // Add plugin reloader - class OHIFPlugin { - // TODO: this class is here for development purposes. - // Once it is fleshed out it would go in the OHIF - // base deployment and be available for plugins - // to inherit from. - - constructor () { - this.name = "Unnamed plugin"; - this.description = "No description available"; - } - - // load an individual script URL - static loadScript(scriptURL) { - const script = document.createElement("script"); - script.src = scriptURL; - script.type = "text/javascript"; - script.async = false; - const head = document.getElementsByTagName("head")[0]; - head.appendChild(script); - head.removeChild(script); - return (script) - } - - // reload all the dependency scripts and also - // the main plugin script url. - static reloadPlugin(plugin) { - plugin.scriptURLs = plugin.scriptURLs || {}; - plugin.scriptURLs.forEach(scriptURL => { - this.loadScript(scriptURL).onload = function() { - } - }); - let scriptURL = plugin.url; - if (!plugin.allowCaching) { - scriptURL += "?" + performance.now(); - } - this.loadScript(scriptURL).onload = function() { - if (OHIFPlugin.entryPoints[plugin.name]) { - OHIFPlugin.entryPoints[plugin.name](); - } - } - } - } - - // each plugin registers an entry point function to be called - // when the loading is complete (called above in reloadPlugin). - OHIFPlugin.entryPoints = {}; - - window.OHIFPlugin = OHIFPlugin; - - // TODO: this information should come from a plug registry - let volumeRenderingPlugin = { - name: "VolumeRenderingPlugin", - url:"https://rawgit.com/OHIF/VTKPlugin/master/vtkVolumeRendering/volumeRendering.js", - allowCaching: false, - scriptURLs: [ - "https://unpkg.com/vtk.js", - ] - }; - - // // TODO: this information should come from a plug registry - // let mprPlugin = { - // name: "MPRPlugin", - // url:"http://localhost/pluginsource/mprplugin.js", - // allowCaching: false, - // scriptURLs: [ - // "https://unpkg.com/vtk.js", - // ] - // }; - - OHIF.commands.contexts.viewer.reloadVolumeRendering = { - name: "reloadVolumeRendering", - action: function(event) { - OHIFPlugin.reloadPlugin(volumeRenderingPlugin); - } - } - - // OHIF.commands.contexts.viewer.reloadVolumeRendering = { - // name: "reloadMPR", - // action: function(event) { - // OHIFPlugin.reloadPlugin(mprPlugin); - // } - // } - }); Template.ohifViewer.events({ diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.js b/OHIFViewer/client/components/toolbarSection/toolbarSection.js index 4a8065bf5..9d0eb3601 100644 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.js +++ b/OHIFViewer/client/components/toolbarSection/toolbarSection.js @@ -84,13 +84,6 @@ Template.toolbarSection.helpers({ iconClasses: 'fa fa-crosshairs' }); - extraTools.push({ - id: 'stackScroll', - title: 'Stack Scroll', - classes: 'imageViewerTool', - iconClasses: 'fa fa-bars' - }); - extraTools.push({ id: 'magnify', title: 'Magnify', @@ -171,13 +164,11 @@ Template.toolbarSection.helpers({ const buttonData = []; - // TODO: this is just a temp hook for the volume rendering - // There needs to be a way for plugins to register new tools buttonData.push({ - id: 'reloadVolumeRendering', - title: 'Volume Renderin', - classes: 'imageViewerCommand', - iconClasses: 'fa fa-undo' + id: 'stackScroll', + title: 'Stack Scroll', + classes: 'imageViewerTool', + iconClasses: 'fa fa-bars' }); buttonData.push({