diff --git a/src/lib/viewers/iframe/IFrameLoader.js b/src/lib/viewers/iframe/IFrameLoader.js index 3a6864468..662b26b8d 100644 --- a/src/lib/viewers/iframe/IFrameLoader.js +++ b/src/lib/viewers/iframe/IFrameLoader.js @@ -1,16 +1,9 @@ -import getProp from 'lodash/get'; import AssetLoader from '../AssetLoader'; import IFrameViewer from './IFrameViewer'; import { ORIGINAL_REP_NAME } from '../../constants'; // Order of the viewers matters. Prefer original before others. Go from specific to general. const VIEWERS = [ - { - NAME: 'IFrame', - CONSTRUCTOR: IFrameViewer, - REP: ORIGINAL_REP_NAME, - EXT: ['boxdicom'], - }, { NAME: 'IFrame', CONSTRUCTOR: IFrameViewer, @@ -29,19 +22,6 @@ class IFrameLoader extends AssetLoader { super(); this.viewers = VIEWERS; } - - /** - * @inheritdoc - */ - determineViewer(file, disabledViewers = [], viewerOptions = {}) { - const disableDicom = getProp(viewerOptions, 'IFrame.disableDicom'); - // Removes boxdicom as a supported extension when the disableDicom viewer option is enabled - if (disableDicom) { - this.viewers = this.viewers.filter(viewer => !viewer.EXT.includes('boxdicom')); - } - - return super.determineViewer(file, disabledViewers); - } } export default new IFrameLoader(); diff --git a/src/lib/viewers/iframe/IFrameViewer.js b/src/lib/viewers/iframe/IFrameViewer.js index 9c6490095..534325d39 100644 --- a/src/lib/viewers/iframe/IFrameViewer.js +++ b/src/lib/viewers/iframe/IFrameViewer.js @@ -22,7 +22,7 @@ class IFrameViewer extends BaseViewer { } /** - * Loads a boxnote or boxdicom file + * Loads a boxnote * * @return {void} */ @@ -40,8 +40,6 @@ class IFrameViewer extends BaseViewer { const sharedName = sharedLink.substr(sharedNameIndex + 3); // shared name starts after /s/ src = `${src}&s=${sharedName}`; } - } else if (extension === 'boxdicom') { - src = `${appHost}/dicom_viewer/${file.id}`; } // Note that the load time for this will be negligible diff --git a/src/lib/viewers/iframe/README.md b/src/lib/viewers/iframe/README.md index b8041dc7e..fa11b59a4 100755 --- a/src/lib/viewers/iframe/README.md +++ b/src/lib/viewers/iframe/README.md @@ -4,23 +4,23 @@ The iframe viewer embeds an iframe to show content rendered from an external sou ## Behavior -The iframe viewer is used for previews of Box Notes and Box DICOM files, and these previews currently only work from within the Box Web Application. Platform customers should use the [Box DICOM Viewer] (https://boxdicom.com/#viewer) to preview DICOM studies over the API. +The iframe viewer is used for previews of Box Notes, and these previews currently only work from within the Box Web Application. -Both Box Notes and Box DICOM have full-featured viewers within the main Box Web Application, but these full viewers are not initialized when users navigate from previews of other files that may be in the same directory as the Notes and DICOM files. In this situation, the iframe viewer embeds an view-only render of the Box Note or Box DICOM file. +Box Notes has a full-featured viewer within the main Box Web Application, but this full viewer is not initialized when users navigate from previews of other files that may be in the same directory as the Notes files. In this situation, the iframe viewer embeds an view-only render of the Box Note file. ## Supported File Extensions -`boxnote, boxdicom` +`boxnote` ## Events The iframe viewer fires the following events -| Event Name | Explanation | Event Data | -| --- | --- | --- | -| destroy | The preview is intentionally destroyed || -| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | -| notification | A notification is displayed || -| navigate | The preview is shown for a given index | {object} file | -| reload | The preview reloads || -| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | +| Event Name | Explanation | Event Data | +| ------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| destroy | The preview is intentionally destroyed | | +| load | The preview loads | 1. {string} **error** (optional): error message 2. {object} **file**: current file 3. {object} **metrics**: information from the logger 4. {object} **viewer**: current viewer | +| notification | A notification is displayed | | +| navigate | The preview is shown for a given index | {object} file | +| reload | The preview reloads | | +| resize | The preview resizes | 1. {number} **height**: window height 2. {number} **width**: window width | diff --git a/src/lib/viewers/iframe/__tests__/IFrameLoader-test.js b/src/lib/viewers/iframe/__tests__/IFrameLoader-test.js index 1a199a6cd..d4762dbc2 100644 --- a/src/lib/viewers/iframe/__tests__/IFrameLoader-test.js +++ b/src/lib/viewers/iframe/__tests__/IFrameLoader-test.js @@ -2,29 +2,9 @@ import IFrameLoader from '../IFrameLoader'; import IFrameViewer from '../IFrameViewer'; describe('lib/viewers/iframe/IFrameLoader', () => { - const iframe = new IFrameViewer({ - file: { - id: '123', - extension: 'boxnote', - representations: { - entries: [ - { - representation: 'ORIGINAL', - }, - ], - }, - }, - }); - test('should have the correct viewers', () => { const iframeViewers = IFrameLoader.viewers; expect(iframeViewers).toEqual([ - { - NAME: 'IFrame', - CONSTRUCTOR: IFrameViewer, - REP: 'ORIGINAL', - EXT: ['boxdicom'], - }, { NAME: 'IFrame', CONSTRUCTOR: IFrameViewer, @@ -33,25 +13,4 @@ describe('lib/viewers/iframe/IFrameLoader', () => { }, ]); }); - - test.each` - disableDicom | fileType | viewerInstance - ${false} | ${'boxdicom'} | ${IFrameLoader.viewers.find(v => v.EXT.includes('boxdicom'))} - ${true} | ${'boxdicom'} | ${undefined} - ${true} | ${'boxnote'} | ${IFrameLoader.viewers.find(v => v.EXT.includes('boxnote'))} - `( - 'should return correct result depending on the disableDicom viewer option and file type', - ({ disableDicom, fileType, viewerInstance }) => { - iframe.options.file.extension = fileType; - - const viewerOptions = { - IFrame: { - disableDicom, - }, - }; - const viewer = IFrameLoader.determineViewer(iframe.options.file, [], viewerOptions); - expect(viewer).toEqual(viewerInstance); - expect(IFrameLoader.getViewers().some(v => v.EXT.includes('boxdicom'))).toEqual(!disableDicom); - }, - ); }); diff --git a/src/lib/viewers/iframe/__tests__/IFrameViewer-test.js b/src/lib/viewers/iframe/__tests__/IFrameViewer-test.js index 842ef02d3..e13888af5 100644 --- a/src/lib/viewers/iframe/__tests__/IFrameViewer-test.js +++ b/src/lib/viewers/iframe/__tests__/IFrameViewer-test.js @@ -71,17 +71,6 @@ describe('lib/viewers/iframe/IFrameViewer', () => { iframe.load(); }); - test('should load a boxdicom and fire load event', done => { - iframe.options.file.extension = 'boxdicom'; - - iframe.on('load', () => { - expect(iframe.iframeEl.src).toEqual('https://app.box.com/dicom_viewer/123'); - done(); - }); - - iframe.load(); - }); - test('should invoke startLoadTimer()', () => { const stub = jest.spyOn(iframe, 'startLoadTimer'); iframe.load();