Compare commits

...
Author SHA1 Message Date
ohif-bot 777cca7471 chore(release): publish [skip ci]
- @ohif/viewer@2.1.2
2019-10-26 11:06:53 +00:00
Danny Brown e4bbbfbbe4 Merge pull request #1103 from OHIF/dannyrb/fix/script-tag-template-changes
fix: update script-tag output to include config from default.js
2019-10-26 06:58:42 -04:00
dannyrb 10059adc57 make sure copy webpack plugin is available 2019-10-26 06:53:44 -04:00
dannyrb c522ff3dda fix: update script-tag output to include config from default.js
instead of hardcoded config
2019-10-26 06:48:06 -04:00
ohif-bot 980516fcfc chore(release): publish [skip ci]
- @ohif/viewer@2.1.1
2019-10-26 04:06:48 +00:00
Emanuel Fiuza de Oliveira 2677170d67 fix: 🐛 JSON launch not working properly (#1089) (#1093)
* fix: 🐛 JSON launch not working properly (#1089)

JSON launch not working properly after QIDO/WADO switch #1089

Closes: #1089

* fix: 🐛 addressing review feedback (#1089)

Closes: #1089
2019-10-26 00:00:34 -04:00
6 changed files with 70 additions and 53 deletions

No files matched your search

@@ -4,6 +4,7 @@ const path = require('path');
const merge = require('webpack-merge');
const webpackCommon = require('./../../../.webpack/webpack.commonjs.js');
// ~~ Plugins
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const fontsToJavaScriptRule = require('./rules/fontsToJavaScript.js');
const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -12,7 +13,9 @@ const SRC_DIR = path.join(__dirname, '../src');
const DIST_DIR = path.join(__dirname, '../dist');
const PUBLIC_DIR = path.join(__dirname, '../public');
// ~~ Env Vars
const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js';
const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'script-tag.html';
const PUBLIC_URL = process.env.PUBLIC_URL || '/';
module.exports = (env, argv) => {
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR });
@@ -33,12 +36,22 @@ module.exports = (env, argv) => {
plugins: [
// Clean output.path
new CleanWebpackPlugin(),
new CopyWebpackPlugin([
// Copy over and rename our target app config file
{
from: `${PUBLIC_DIR}/${APP_CONFIG}`,
to: `${DIST_DIR}/app-config.js`,
},
]),
// Generate "index.html" w/ correct includes/imports
// NOTE: We use this for E2E Tests
new HtmlWebpackPlugin({
inject: false,
template: `${PUBLIC_DIR}/html-templates/${HTML_TEMPLATE}`,
filename: 'index.html',
templateParameters: {
PUBLIC_URL: PUBLIC_URL,
},
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+22
View File
@@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.2](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.1.1...@ohif/viewer@2.1.2) (2019-10-26)
### Bug Fixes
* update script-tag output to include config from default.js ([c522ff3](https://github.com/OHIF/Viewers/commit/c522ff3ddab7ed8e3a128dd6edd2cd6902226e99))
## [2.1.1](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.1.0...@ohif/viewer@2.1.1) (2019-10-26)
### Bug Fixes
* 🐛 JSON launch not working properly ([#1089](https://github.com/OHIF/Viewers/issues/1089)) ([#1093](https://github.com/OHIF/Viewers/issues/1093)) ([2677170](https://github.com/OHIF/Viewers/commit/2677170d67659ee178cf77307414d54cfe9cb563))
# [2.1.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.0.0...@ohif/viewer@2.1.0) (2019-10-26)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/viewer",
"version": "2.1.0",
"version": "2.1.2",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
"license": "MIT",
@@ -24,6 +24,7 @@
<div id="root"></div>
<script type="text/javascript" src="<%= PUBLIC_URL %>app-config.js"></script>
<script src="/index.umd.js" crossorigin></script>
<script>
var containerId = 'root';
@@ -31,25 +32,7 @@
console.log('OHIF Viewer rendered/updated');
};
window.OHIFViewer.installViewer(
{
// routerBasename: '/',
servers: {
dicomWeb: [
{
name: 'DCM4CHEE',
wadoUriRoot:
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
qidoRoot:
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
wadoRoot:
'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
qidoSupportsIncludeField: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
},
],
},
},
window.config, // See `/config/default.js`
containerId,
componentRenderedOrUpdatedCallback
);
@@ -59,12 +59,7 @@ class ViewerMain extends Component {
// Get all the display sets for the viewer studies
if (this.props.studies) {
const displaySets = this.getDisplaySets(this.props.studies);
this.setState({
displaySets,
});
this.fillEmptyViewportPanes();
this.setState({ displaySets }, this.fillEmptyViewportPanes);
}
}
@@ -78,12 +73,7 @@ class ViewerMain extends Component {
(viewportAmount !== prevViewportAmount && !isVtk)
) {
const displaySets = this.getDisplaySets(this.props.studies);
this.setState({
displaySets,
});
this.fillEmptyViewportPanes();
this.setState({ displaySets }, this.fillEmptyViewportPanes);
}
}
+30 -21
View File
@@ -1,10 +1,10 @@
import React, { Component } from "react";
import { log, metadata, studies, utils } from "@ohif/core";
import React, { Component } from 'react';
import { log, metadata, studies, utils } from '@ohif/core';
import PropTypes from "prop-types";
import Viewer from "../connectedComponents/Viewer";
import { extensionManager } from "./../App.js";
import qs from "querystring";
import PropTypes from 'prop-types';
import ConnectedViewer from '../connectedComponents/ConnectedViewer';
import { extensionManager } from './../App.js';
import qs from 'querystring';
const { OHIFStudyMetadata } = metadata;
const { retrieveStudiesMetadata } = studies;
@@ -13,12 +13,14 @@ const { studyMetadataManager, updateMetaDataManager } = utils;
class StandaloneRouting extends Component {
state = {
studies: null,
error: null
error: null,
};
studyInstanceUids = [];
static propTypes = {
location: PropTypes.object,
store: PropTypes.object
store: PropTypes.object,
};
static parseQueryAndFetchStudies(query) {
@@ -26,7 +28,7 @@ class StandaloneRouting extends Component {
const url = query.url;
if (!url) {
return reject(new Error("No URL was specified. Use ?url=$yourURL"));
return reject(new Error('No URL was specified. Use ?url=$yourURL'));
}
// Define a request to the server to retrieve the study data
@@ -34,19 +36,19 @@ class StandaloneRouting extends Component {
const oReq = new XMLHttpRequest();
// Add event listeners for request failure
oReq.addEventListener("error", error => {
log.warn("An error occurred while retrieving the JSON data");
oReq.addEventListener('error', error => {
log.warn('An error occurred while retrieving the JSON data');
reject(error);
});
// When the JSON has been returned, parse it into a JavaScript Object
// and render the OHIF Viewer with this data
oReq.addEventListener("load", () => {
oReq.addEventListener('load', () => {
// Parse the response content
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText
if (!oReq.responseText) {
log.warn("Response was undefined");
reject(new Error("Response was undefined"));
log.warn('Response was undefined');
reject(new Error('Response was undefined'));
}
log.info(JSON.stringify(oReq.responseText, null, 2));
@@ -54,9 +56,9 @@ class StandaloneRouting extends Component {
const data = JSON.parse(oReq.responseText);
if (data.servers && query.studyInstanceUids) {
const server = data.servers.dicomWeb[0];
server.type = "dicomWeb";
server.type = 'dicomWeb';
const studyInstanceUids = query.studyInstanceUids.split(";");
const studyInstanceUids = query.studyInstanceUids.split(';');
const seriesInstanceUids = [];
retrieveStudiesMetadata(
@@ -80,8 +82,8 @@ class StandaloneRouting extends Component {
// In this case we have a server-side route called /api/
// which responds to GET requests with the study data
log.info(`Sending Request to: ${url}`);
oReq.open("GET", url);
oReq.setRequestHeader("Accept", "application/json");
oReq.open('GET', url);
oReq.setRequestHeader('Accept', 'application/json');
// Fire the request to the server
oReq.send();
@@ -101,13 +103,14 @@ class StandaloneRouting extends Component {
studyMetadataManager.purge();
// Map studies to new format, update metadata manager?
const uniqueStudyUids = new Set();
const updatedStudies = studies.map(study => {
const studyMetadata = new OHIFStudyMetadata(
study,
study.studyInstanceUid
);
const sopClassHandlerModules =
extensionManager.modules["sopClassHandlerModule"];
extensionManager.modules['sopClassHandlerModule'];
study.displaySets =
study.displaySets ||
@@ -118,10 +121,12 @@ class StandaloneRouting extends Component {
updateMetaDataManager(study);
studyMetadataManager.add(studyMetadata);
uniqueStudyUids.add(study.studyInstanceUid);
return study;
});
this.studyInstanceUids = Array.from(uniqueStudyUids);
this.setState({ studies: updatedStudies });
} catch (error) {
this.setState({ error });
@@ -134,8 +139,12 @@ class StandaloneRouting extends Component {
} else if (!this.state.studies) {
return <div>Loading...</div>;
}
return <Viewer studies={this.state.studies} />;
return (
<ConnectedViewer
studies={this.state.studies}
studyInstanceUids={this.studyInstanceUids}
/>
);
}
}