feat: OHIF-117 ohif extension default (#1712)
* initial structure for extension default * webpack config * split default modules into separated files * bump versions * update index * update index * fix * Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
parent
e633eb80eb
commit
97004de446
8
extensions/default/.webpack/webpack.dev.js
Normal file
8
extensions/default/.webpack/webpack.dev.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const webpackCommon = require('./../../../.webpack/webpack.commonjs.js');
|
||||||
|
const SRC_DIR = path.join(__dirname, '../src');
|
||||||
|
const DIST_DIR = path.join(__dirname, '../dist');
|
||||||
|
|
||||||
|
module.exports = (env, argv) => {
|
||||||
|
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR });
|
||||||
|
};
|
||||||
44
extensions/default/.webpack/webpack.prod.js
Normal file
44
extensions/default/.webpack/webpack.prod.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
const webpack = require('webpack');
|
||||||
|
const merge = require('webpack-merge');
|
||||||
|
const path = require('path');
|
||||||
|
const webpackCommon = require('./../../../.webpack/webpack.commonjs.js');
|
||||||
|
const pkg = require('./../package.json');
|
||||||
|
|
||||||
|
const ROOT_DIR = path.join(__dirname, './..');
|
||||||
|
const SRC_DIR = path.join(__dirname, '../src');
|
||||||
|
const DIST_DIR = path.join(__dirname, '../dist');
|
||||||
|
|
||||||
|
module.exports = (env, argv) => {
|
||||||
|
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR });
|
||||||
|
|
||||||
|
return merge(commonConfig, {
|
||||||
|
devtool: 'source-map',
|
||||||
|
stats: {
|
||||||
|
colors: true,
|
||||||
|
hash: true,
|
||||||
|
timings: true,
|
||||||
|
assets: true,
|
||||||
|
chunks: false,
|
||||||
|
chunkModules: false,
|
||||||
|
modules: false,
|
||||||
|
children: false,
|
||||||
|
warnings: true,
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
sideEffects: true,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: ROOT_DIR,
|
||||||
|
library: 'OHIFExtDefault',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
libraryExport: 'default',
|
||||||
|
filename: pkg.main,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.optimize.LimitChunkCountPlugin({
|
||||||
|
maxChunks: 1,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
};
|
||||||
39
extensions/default/package.json
Normal file
39
extensions/default/package.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "@ohif/extension-default",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"description": "Common/default features and functionality for basic image viewing",
|
||||||
|
"author": "OHIF Core Team",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "OHIF/Viewers",
|
||||||
|
"main": "dist/index.umd.js",
|
||||||
|
"module": "src/index.js",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10",
|
||||||
|
"npm": ">=6",
|
||||||
|
"yarn": ">=1.19.1"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"dev": "cross-env NODE_ENV=development webpack --config .webpack/webpack.dev.js --watch --debug --output-pathinfo",
|
||||||
|
"dev:dicom-pdf": "yarn run dev",
|
||||||
|
"build": "cross-env NODE_ENV=production webpack --config .webpack/webpack.prod.js",
|
||||||
|
"build:package": "yarn run build",
|
||||||
|
"start": "yarn run dev"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ohif/core": "^0.50.0",
|
||||||
|
"prop-types": "^15.6.2",
|
||||||
|
"react": "^16.13.1",
|
||||||
|
"react-dom": "^16.13.1",
|
||||||
|
"webpack": "^4.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "7.7.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
39
extensions/default/src/getDataSourcesModule.js
Normal file
39
extensions/default/src/getDataSourcesModule.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// TODO: Pull in IWebClientApi from @ohif/core
|
||||||
|
// TODO: Use constructor to create an instance of IWebClientApi
|
||||||
|
// TODO: Use existing DICOMWeb configuration (previously, appConfig, to configure instance)
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function getDataSourcesModule() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: 'dicomweb-client',
|
||||||
|
type: 'webApi',
|
||||||
|
/**
|
||||||
|
* TODO: Create JSDoc for this Data Source implementation.
|
||||||
|
*/
|
||||||
|
createDataSource: dataSourceConfiguration => {
|
||||||
|
// instantiate DicomWebClient
|
||||||
|
// const dicomWebClient = new DicomWebClient(dataSourceConfiguration);
|
||||||
|
|
||||||
|
return {
|
||||||
|
query: {
|
||||||
|
studies: {
|
||||||
|
mapParams: params => params,
|
||||||
|
searchStudies: params => {
|
||||||
|
/** dicomWebClient.searchStudies(params) **/
|
||||||
|
},
|
||||||
|
searchSeries: params => {
|
||||||
|
/** dicomWebClient.searchSeries(params) **/
|
||||||
|
},
|
||||||
|
processResults: results => results,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getDataSourcesModule;
|
||||||
9
extensions/default/src/index.js
Normal file
9
extensions/default/src/index.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import getDataSourcesModule from './getDataSourcesModule.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
/**
|
||||||
|
* Only required property. Should be a unique value across all extensions.
|
||||||
|
*/
|
||||||
|
id: 'org.ohif.default',
|
||||||
|
getDataSourcesModule,
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user