chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"files": [
|
||||
"README.md"
|
||||
],
|
||||
"files": ["README.md"],
|
||||
"imageSize": 100,
|
||||
"commit": false,
|
||||
"contributors": [
|
||||
@@ -10,92 +8,70 @@
|
||||
"name": "Erik Ziegler",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/607793?v=4",
|
||||
"profile": "https://github.com/swederik",
|
||||
"contributions": [
|
||||
"code",
|
||||
"infra"
|
||||
]
|
||||
"contributions": ["code", "infra"]
|
||||
},
|
||||
{
|
||||
"login": "evren217",
|
||||
"name": "Evren Ozkan",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/4920551?v=4",
|
||||
"profile": "https://github.com/evren217",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "galelis",
|
||||
"name": "Gustavo André Lelis",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2378326?v=4",
|
||||
"profile": "https://github.com/galelis",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "dannyrb",
|
||||
"name": "Danny Brown",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/5797588?v=4",
|
||||
"profile": "http://dannyrb.com/",
|
||||
"contributions": [
|
||||
"code",
|
||||
"infra"
|
||||
]
|
||||
"contributions": ["code", "infra"]
|
||||
},
|
||||
{
|
||||
"login": "allcontributors",
|
||||
"name": "allcontributors[bot]",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/46843839?v=4",
|
||||
"profile": "https://github.com/all-contributors/all-contributors-bot",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "EsrefDurna",
|
||||
"name": "Esref Durna",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/1230575?v=4",
|
||||
"profile": "https://www.linkedin.com/in/siliconvalleynextgeneration/",
|
||||
"contributions": [
|
||||
"question"
|
||||
]
|
||||
"contributions": ["question"]
|
||||
},
|
||||
{
|
||||
"login": "diego0020",
|
||||
"name": "diego0020",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7297450?v=4",
|
||||
"profile": "https://github.com/diego0020",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "dlwire",
|
||||
"name": "David Wire",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/1167291?v=4",
|
||||
"profile": "https://github.com/dlwire",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "jfmedeiros1820",
|
||||
"name": "João Felipe de Medeiros Moreira",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/2211708?v=4",
|
||||
"profile": "https://github.com/jfmedeiros1820",
|
||||
"contributions": [
|
||||
"test"
|
||||
]
|
||||
"contributions": ["test"]
|
||||
},
|
||||
{
|
||||
"login": "pavertomato",
|
||||
"name": "Egor Lezhnin",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/878990?v=4",
|
||||
"profile": "http://egor.lezhn.in",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -368,19 +368,8 @@
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": false,
|
||||
"nodeReRegistrationTimeout": 0,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"id": "84e7b84d-ab74-452e-8a24-a0e657f100ea",
|
||||
@@ -406,19 +395,8 @@
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": false,
|
||||
"nodeReRegistrationTimeout": 0,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"id": "f7dd8587-4035-4590-a1c0-ebf576c4dfe3",
|
||||
@@ -462,19 +440,8 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"id": "f7f76add-411b-420d-9be1-bd120ed99918",
|
||||
@@ -500,19 +467,8 @@
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": false,
|
||||
"nodeReRegistrationTimeout": 0,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"id": "3785434d-2af8-478c-b135-f0b11d1d3205",
|
||||
@@ -598,19 +554,8 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"],
|
||||
"authorizationSettings": {
|
||||
"allowRemoteResourceManagement": true,
|
||||
"policyEnforcementMode": "ENFORCING",
|
||||
@@ -678,19 +623,8 @@
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": false,
|
||||
"nodeReRegistrationTimeout": 0,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
},
|
||||
{
|
||||
"id": "53d51818-e1bf-4fc2-aa20-5541f2646f12",
|
||||
@@ -733,19 +667,8 @@
|
||||
"authenticationFlowBindingOverrides": {},
|
||||
"fullScopeAllowed": true,
|
||||
"nodeReRegistrationTimeout": -1,
|
||||
"defaultClientScopes": [
|
||||
"web-origins",
|
||||
"role_list",
|
||||
"profile",
|
||||
"roles",
|
||||
"email"
|
||||
],
|
||||
"optionalClientScopes": [
|
||||
"address",
|
||||
"phone",
|
||||
"offline_access",
|
||||
"microprofile-jwt"
|
||||
]
|
||||
"defaultClientScopes": ["web-origins", "role_list", "profile", "roles", "email"],
|
||||
"optionalClientScopes": ["address", "phone", "offline_access", "microprofile-jwt"]
|
||||
}
|
||||
],
|
||||
"clientScopes": [
|
||||
@@ -1233,19 +1156,8 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"defaultDefaultClientScopes": [
|
||||
"role_list",
|
||||
"profile",
|
||||
"email",
|
||||
"roles",
|
||||
"web-origins"
|
||||
],
|
||||
"defaultOptionalClientScopes": [
|
||||
"offline_access",
|
||||
"address",
|
||||
"phone",
|
||||
"microprofile-jwt"
|
||||
],
|
||||
"defaultDefaultClientScopes": ["role_list", "profile", "email", "roles", "web-origins"],
|
||||
"defaultOptionalClientScopes": ["offline_access", "address", "phone", "microprofile-jwt"],
|
||||
"browserSecurityHeaders": {
|
||||
"contentSecurityPolicyReportOnly": "",
|
||||
"xContentTypeOptions": "nosniff",
|
||||
|
||||
+4
-20
@@ -71,26 +71,10 @@ input[type='password']:hover {
|
||||
input[type='submit'] {
|
||||
border: none;
|
||||
|
||||
background: -webkit-linear-gradient(
|
||||
top,
|
||||
rgba(255, 255, 255, 0.8),
|
||||
rgba(255, 255, 255, 0.1)
|
||||
);
|
||||
background: -moz-linear-gradient(
|
||||
top,
|
||||
rgba(255, 255, 255, 0.8),
|
||||
rgba(255, 255, 255, 0.1)
|
||||
);
|
||||
background: -ms-linear-gradient(
|
||||
top,
|
||||
rgba(255, 255, 255, 0.8),
|
||||
rgba(255, 255, 255, 0.1)
|
||||
);
|
||||
background: -o-linear-gradient(
|
||||
top,
|
||||
rgba(255, 255, 255, 0.8),
|
||||
rgba(255, 255, 255, 0.1)
|
||||
);
|
||||
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
|
||||
background: -moz-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
|
||||
background: -ms-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
|
||||
background: -o-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
|
||||
|
||||
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.5);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ function extractStyleChunks(isProdBuild) {
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
'postcss-loader',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = (env, argv) => {
|
||||
path: DIST_DIR,
|
||||
filename: isProdBuild ? '[name].bundle.[chunkhash].js' : '[name].js',
|
||||
publicPath: PUBLIC_URL, // Used by HtmlWebPackPlugin for asset prefix
|
||||
devtoolModuleFilenameTemplate: function(info) {
|
||||
devtoolModuleFilenameTemplate: function (info) {
|
||||
if (isProdBuild) {
|
||||
return `webpack:///${info.resourcePath}`;
|
||||
} else {
|
||||
@@ -102,8 +102,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
// Copy Dicom Microscopy Viewer build files
|
||||
{
|
||||
from:
|
||||
'../../../node_modules/dicom-microscopy-viewer/dist/dynamic-import',
|
||||
from: '../../../node_modules/dicom-microscopy-viewer/dist/dynamic-import',
|
||||
to: DIST_DIR,
|
||||
globOptions: {
|
||||
ignore: ['**/*.min.js.map'],
|
||||
@@ -111,8 +110,7 @@ module.exports = (env, argv) => {
|
||||
},
|
||||
// Copy dicom-image-loader build files
|
||||
{
|
||||
from:
|
||||
'../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import',
|
||||
from: '../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import',
|
||||
to: DIST_DIR,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -7,7 +7,7 @@ const autogenerationDisclaimer = `
|
||||
// THIS FILE IS AUTOGENERATED AS PART OF THE EXTENSION AND MODE PLUGIN PROCESS.
|
||||
// IT SHOULD NOT BE MODIFIED MANUALLY \n`;
|
||||
|
||||
const extractName = (val) => (typeof val === 'string') ? val : val.packageName;
|
||||
const extractName = val => (typeof val === 'string' ? val : val.packageName);
|
||||
|
||||
function constructLines(input, categoryName) {
|
||||
let pluginCount = 0;
|
||||
@@ -24,9 +24,7 @@ function constructLines(input, categoryName) {
|
||||
|
||||
const packageName = extractName(entry);
|
||||
|
||||
lines.addToWindowLines.push(
|
||||
`${categoryName}.push("${packageName}");\n`
|
||||
);
|
||||
lines.addToWindowLines.push(`${categoryName}.push("${packageName}");\n`);
|
||||
|
||||
pluginCount++;
|
||||
});
|
||||
@@ -64,7 +62,8 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
dynamicLoad.push(
|
||||
'\n\n// Add a dynamic runtime loader',
|
||||
'async function loadModule(module) {',
|
||||
' if (typeof module !== \'string\') return module;');
|
||||
" if (typeof module !== 'string') return module;"
|
||||
);
|
||||
modules.forEach(module => {
|
||||
const packageName = extractName(module);
|
||||
dynamicLoad.push(
|
||||
@@ -73,7 +72,7 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
' return imported.default;',
|
||||
' }'
|
||||
);
|
||||
})
|
||||
});
|
||||
dynamicLoad.push(
|
||||
' return (await import(module)).default;',
|
||||
'}\n',
|
||||
@@ -82,7 +81,8 @@ function getRuntimeLoadModesExtensions(modules) {
|
||||
'export default function importItems(modules) {',
|
||||
' return Promise.all(modules.map(loadModule));',
|
||||
'}\n',
|
||||
'export { loadModule, modes, extensions, importItems };\n\n');
|
||||
'export { loadModule, modes, extensions, importItems };\n\n'
|
||||
);
|
||||
return dynamicLoad.join('\n');
|
||||
}
|
||||
|
||||
@@ -91,14 +91,9 @@ const fromDirectory = (srcDir, path) => {
|
||||
if (path[0] === '.') return srcDir + '/../../..' + path.substring(1);
|
||||
if (path[0] === '~') return os.homedir() + path.substring(1);
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
||||
const createCopyPluginToDistForLink = (
|
||||
srcDir,
|
||||
distDir,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
const createCopyPluginToDistForLink = (srcDir, distDir, plugins, folderName) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const fromDir = fromDirectory(srcDir, plugin.directory);
|
||||
@@ -107,7 +102,7 @@ const createCopyPluginToDistForLink = (
|
||||
return exists
|
||||
? {
|
||||
from,
|
||||
to: distDir,
|
||||
to: distDir,
|
||||
toType: 'dir',
|
||||
}
|
||||
: undefined;
|
||||
@@ -115,12 +110,7 @@ const createCopyPluginToDistForLink = (
|
||||
.filter(x => !!x);
|
||||
};
|
||||
|
||||
const createCopyPluginToDistForBuild = (
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
plugins,
|
||||
folderName
|
||||
) => {
|
||||
const createCopyPluginToDistForBuild = (SRC_DIR, DIST_DIR, plugins, folderName) => {
|
||||
return plugins
|
||||
.map(plugin => {
|
||||
const from = `${SRC_DIR}/../../../node_modules/${plugin.packageName}/${folderName}/`;
|
||||
@@ -156,17 +146,12 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
...pluginConfig.modes,
|
||||
]);
|
||||
|
||||
fs.writeFileSync(
|
||||
`${SRC_DIR}/pluginImports.js`,
|
||||
pluginImportsJsContent,
|
||||
{ flag: 'w+' },
|
||||
err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
fs.writeFileSync(`${SRC_DIR}/pluginImports.js`, pluginImportsJsContent, { flag: 'w+' }, err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Build packages using cli add-mode and add-extension
|
||||
// will get added to the root node_modules, but the linked packages
|
||||
@@ -175,21 +160,14 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
const copyPluginPublicToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'public'
|
||||
);
|
||||
|
||||
const copyPluginPublicToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
...pluginConfig.public,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions, ...pluginConfig.public],
|
||||
'public'
|
||||
);
|
||||
|
||||
@@ -198,20 +176,14 @@ function writePluginImportsFile(SRC_DIR, DIST_DIR) {
|
||||
const copyPluginDistToDistBuild = createCopyPluginToDistForBuild(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'dist'
|
||||
);
|
||||
|
||||
const copyPluginDistToDistLink = createCopyPluginToDistForLink(
|
||||
SRC_DIR,
|
||||
DIST_DIR,
|
||||
[
|
||||
...pluginConfig.modes,
|
||||
...pluginConfig.extensions,
|
||||
],
|
||||
[...pluginConfig.modes, ...pluginConfig.extensions],
|
||||
'dist'
|
||||
);
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
module.exports = require("../../babel.config.js");
|
||||
module.exports = require('../../babel.config.js');
|
||||
@@ -2,4 +2,4 @@
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,11 @@ describe('OHIF Multi Study', () => {
|
||||
it('Should display 2 comparison up', () => {
|
||||
beforeSetup();
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 4);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 4);
|
||||
cy.get('[data-cy="studyDate"]').should(studyDate => {
|
||||
expect(studyDate.length).to.be.eq(4);
|
||||
expect(studyDate.text())
|
||||
.to.contain('2014')
|
||||
.contain('2001');
|
||||
expect(studyDate.text().indexOf('2014')).to.be.lessThan(
|
||||
studyDate.text().indexOf('2001')
|
||||
);
|
||||
expect(studyDate.text()).to.contain('2014').contain('2001');
|
||||
expect(studyDate.text().indexOf('2014')).to.be.lessThan(studyDate.text().indexOf('2001'));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,11 @@
|
||||
describe('OHIF PDF Display', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF PDF Display', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyInViewer('2.25.317377619501274872606137091638706705333');
|
||||
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]')
|
||||
.its('length')
|
||||
.should('be.gt', 0);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]').its('length').should('be.gt', 0);
|
||||
});
|
||||
});
|
||||
@@ -1,19 +1,15 @@
|
||||
describe('OHIF Video Display', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF Video Display', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyInViewer('2.25.96975534054447904995905761963464388233');
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]')
|
||||
.its('length')
|
||||
.should('be.gt', 1);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]').its('length').should('be.gt', 1);
|
||||
});
|
||||
|
||||
it('performs double-click to load thumbnail in active viewport', () => {
|
||||
cy.get(
|
||||
'[data-cy="study-browser-thumbnail-no-image"]:nth-child(2)'
|
||||
).dblclick();
|
||||
cy.get('[data-cy="study-browser-thumbnail-no-image"]:nth-child(2)').dblclick();
|
||||
|
||||
//const expectedText = 'Ser: 3';
|
||||
//cy.get('@viewportInfoBottomLeft').should('contains.text', expectedText);
|
||||
|
||||
@@ -12,9 +12,7 @@ describe('OHIF HP', () => {
|
||||
it('Should display 3 up', () => {
|
||||
beforeSetup();
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 3);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 3);
|
||||
});
|
||||
|
||||
it('Should navigate next/previous stage', () => {
|
||||
@@ -22,15 +20,11 @@ describe('OHIF HP', () => {
|
||||
|
||||
cy.get('body').type(',');
|
||||
cy.wait(250);
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 4);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 4);
|
||||
|
||||
cy.get('body').type('..');
|
||||
cy.wait(250);
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 2);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 2);
|
||||
});
|
||||
|
||||
it('Should navigate to display set specified', () => {
|
||||
|
||||
@@ -11,9 +11,7 @@ describe('OHIF Double Click', () => {
|
||||
|
||||
it('Should double click each viewport to one up and back', () => {
|
||||
const numExpectedViewports = 3;
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', numExpectedViewports);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', numExpectedViewports);
|
||||
|
||||
for (let i = 0; i < numExpectedViewports; i += 1) {
|
||||
cy.wait(2000);
|
||||
@@ -38,13 +36,9 @@ describe('OHIF Double Click', () => {
|
||||
.not('.pointer-events-none');
|
||||
|
||||
// The actual double click.
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.eq(i)
|
||||
.trigger('dblclick', 'center');
|
||||
cy.get('[data-cy="viewport-pane"]').eq(i).trigger('dblclick', 'center');
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.its('length')
|
||||
.should('be.eq', 1);
|
||||
cy.get('[data-cy="viewport-pane"]').its('length').should('be.eq', 1);
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.trigger('mousedown', 'center', {
|
||||
@@ -54,9 +48,7 @@ describe('OHIF Double Click', () => {
|
||||
force: true,
|
||||
});
|
||||
|
||||
cy.get('[data-cy="viewport-pane"]')
|
||||
.eq(0)
|
||||
.trigger('dblclick', 'center');
|
||||
cy.get('[data-cy="viewport-pane"]').eq(0).trigger('dblclick', 'center');
|
||||
}
|
||||
});
|
||||
});
|
||||
+6
-12
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Context Menu', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Context Menu', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -10,7 +8,7 @@ describe('OHIF Context Menu', function() {
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks context menu customization', function() {
|
||||
it('checks context menu customization', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
@@ -29,14 +27,10 @@ describe('OHIF Context Menu', function() {
|
||||
cy.get('[data-cy="context-menu"]').should('be.visible');
|
||||
|
||||
// Click "Finding" subMenu
|
||||
cy.get('[data-cy="context-menu-item"]')
|
||||
.contains('Finding')
|
||||
.click();
|
||||
cy.get('[data-cy="context-menu-item"]').contains('Finding').click();
|
||||
|
||||
// Click "Finding" subMenu
|
||||
cy.get('[data-cy="context-menu-item"]')
|
||||
.contains('Aortic insufficiency')
|
||||
.click();
|
||||
cy.get('[data-cy="context-menu-item"]').contains('Aortic insufficiency').click();
|
||||
cy.get('[data-cy="measurement-item"]').contains('Aortic insufficiency');
|
||||
});
|
||||
});
|
||||
+2
-6
@@ -1,17 +1,13 @@
|
||||
describe('OHIF Cornerstone Hotkeys', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.then(cornerstone => {
|
||||
// For debugging issues where tests pass locally but fail on CI
|
||||
// - Sometimes Cypress orb seems to use CPU rendering pathway
|
||||
cy.log(
|
||||
`Cornerstone using CPU Rendering?: ${cornerstone.getShouldUseCPURendering()}`
|
||||
);
|
||||
cy.log(`Cornerstone using CPU Rendering?: ${cornerstone.getShouldUseCPURendering()}`);
|
||||
});
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
|
||||
+4
-12
@@ -1,15 +1,11 @@
|
||||
describe('OHIF Cornerstone Toolbar', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCornerstoneToolsAliases();
|
||||
cy.initCommonElementsAliases();
|
||||
|
||||
cy.get('[data-cy="study-browser-thumbnail"]')
|
||||
.eq(1)
|
||||
.click();
|
||||
cy.get('[data-cy="study-browser-thumbnail"]').eq(1).click();
|
||||
|
||||
//const expectedText = 'Ser: 1';
|
||||
//cy.get('@viewportInfoBottomLeft').should('contains.text', expectedText);
|
||||
@@ -89,9 +85,7 @@ describe('OHIF Cornerstone Toolbar', () => {
|
||||
// The exact text is slightly dependent on the viewport resolution, so leave a range
|
||||
cy.get('@viewportInfoTopLeft').should($txt => {
|
||||
const text = $txt.text();
|
||||
expect(text)
|
||||
.to.include('W:193')
|
||||
.include('L:479');
|
||||
expect(text).to.include('W:193').include('L:479');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -119,9 +113,7 @@ describe('OHIF Cornerstone Toolbar', () => {
|
||||
//Verify the measurement exists in the table
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.its('length')
|
||||
.should('be.at.least', 1);
|
||||
cy.get('[data-cy="measurement-item"]').its('length').should('be.at.least', 1);
|
||||
});
|
||||
|
||||
/*it('checks if angle annotation can be added on viewport without causing any errors', () => {
|
||||
|
||||
+4
-10
@@ -1,13 +1,11 @@
|
||||
describe('OHIF Download Snapshot File', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.openDownloadImageModal();
|
||||
});
|
||||
|
||||
it('checks displayed information for Desktop experience', function() {
|
||||
it('checks displayed information for Desktop experience', function () {
|
||||
// Set Desktop resolution
|
||||
// cy.viewport(1750, 720);
|
||||
// Visual comparison
|
||||
@@ -36,12 +34,8 @@ describe('OHIF Download Snapshot File', () => {
|
||||
// .and('include', 'data:image');
|
||||
|
||||
// Check buttons
|
||||
cy.get('[data-cy="cancel-btn"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get('[data-cy="download-btn"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
cy.get('[data-cy="cancel-btn"]').scrollIntoView().should('be.visible');
|
||||
cy.get('[data-cy="download-btn"]').scrollIntoView().should('be.visible');
|
||||
});
|
||||
|
||||
/*it('cancel changes on download modal', function() {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
describe('OHIF Study Viewer Page', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Study Viewer Page', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
cy.initCornerstoneToolsAliases();
|
||||
});
|
||||
|
||||
it('scrolls series stack using scrollbar', function() {
|
||||
it('scrolls series stack using scrollbar', function () {
|
||||
cy.scrollToIndex(13);
|
||||
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '14');
|
||||
});
|
||||
|
||||
it('performs right click to zoom', function() {
|
||||
it('performs right click to zoom', function () {
|
||||
// This is not used to activate the tool, it is used to ensure the
|
||||
// top left viewport info shows the zoom values (it only shows up
|
||||
// when the zoom tool is active)
|
||||
@@ -25,11 +23,9 @@ describe('OHIF Study Viewer Page', function() {
|
||||
cy.wrap($zoomBtn).should('have.class', 'active');
|
||||
});
|
||||
|
||||
const zoomLevelInitial = cy
|
||||
.get('@viewportInfoTopLeft')
|
||||
.then($viewportInfo => {
|
||||
return $viewportInfo.text().substring(6, 9);
|
||||
});
|
||||
const zoomLevelInitial = cy.get('@viewportInfoTopLeft').then($viewportInfo => {
|
||||
return $viewportInfo.text().substring(6, 9);
|
||||
});
|
||||
|
||||
//Right click on viewport
|
||||
cy.get('@viewport')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Measurement Panel', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Measurement Panel', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -11,7 +9,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.waitDicomImage();
|
||||
});
|
||||
|
||||
it('checks if Measurements right panel can be hidden/displayed', function() {
|
||||
it('checks if Measurements right panel can be hidden/displayed', function () {
|
||||
cy.get('@measurementsPanel').should('exist');
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
|
||||
@@ -23,7 +21,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('@measurementsPanel').should('be.visible');
|
||||
});
|
||||
|
||||
it('checks if measurement item can be Relabeled under Measurements panel', function() {
|
||||
it('checks if measurement item can be Relabeled under Measurements panel', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="viewport-notification"]').should('exist');
|
||||
@@ -31,9 +29,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
cy.get('[data-cy="measurement-item"]').click();
|
||||
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.find('svg')
|
||||
.click();
|
||||
cy.get('[data-cy="measurement-item"]').find('svg').click();
|
||||
|
||||
// enter Bone label
|
||||
cy.get('[data-cy="input-annotation"]').should('exist');
|
||||
@@ -44,7 +40,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('[data-cy="measurement-item"]').should('contain.text', 'Bone');
|
||||
});
|
||||
|
||||
it('checks if image would jump when clicked on a measurement item', function() {
|
||||
it('checks if image would jump when clicked on a measurement item', function () {
|
||||
// Add length measurement
|
||||
cy.addLengthMeasurement();
|
||||
cy.get('[data-cy="prompt-begin-tracking-yes-btn"]').click();
|
||||
@@ -56,9 +52,7 @@ describe('OHIF Measurement Panel', function() {
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '(14/');
|
||||
|
||||
// Click on first measurement item
|
||||
cy.get('[data-cy="measurement-item"]')
|
||||
.eq(0)
|
||||
.click();
|
||||
cy.get('[data-cy="measurement-item"]').eq(0).click();
|
||||
|
||||
cy.get('@viewportInfoTopRight').should('contains.text', '(1/');
|
||||
cy.get('@viewportInfoTopRight').should('not.contains.text', '(14/');
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF Study Viewer Page', function() {
|
||||
beforeEach(function() {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.2.840.113619.2.5.1762583153.215519.978957063.78'
|
||||
);
|
||||
describe('OHIF Study Viewer Page', function () {
|
||||
beforeEach(function () {
|
||||
cy.checkStudyRouteInViewer('1.2.840.113619.2.5.1762583153.215519.978957063.78');
|
||||
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -10,13 +8,11 @@ describe('OHIF Study Viewer Page', function() {
|
||||
cy.resetViewport().wait(50);
|
||||
});
|
||||
|
||||
it('checks if series thumbnails are being displayed', function() {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]')
|
||||
.its('length')
|
||||
.should('be.gt', 1);
|
||||
it('checks if series thumbnails are being displayed', function () {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]').its('length').should('be.gt', 1);
|
||||
});
|
||||
|
||||
it('drags and drop a series thumbnail into viewport', function() {
|
||||
it('drags and drop a series thumbnail into viewport', function () {
|
||||
// Can't use the native drag version as the element should be rerendered
|
||||
// cy.get('[data-cy="study-browser-thumbnail"]:nth-child(2)') //element to be dragged
|
||||
// .drag('.cornerstone-canvas'); //dropzone element
|
||||
@@ -38,7 +34,7 @@ describe('OHIF Study Viewer Page', function() {
|
||||
//cy.get('@viewportInfoBottomLeft').should('contain.text', expectedText);
|
||||
});
|
||||
|
||||
it('checks if Series left panel can be hidden/displayed', function() {
|
||||
it('checks if Series left panel can be hidden/displayed', function () {
|
||||
cy.get('@seriesPanel').should('exist');
|
||||
cy.get('@seriesPanel').should('be.visible');
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//We are keeping the hardcoded results values for the study list tests
|
||||
//this is intended to be running in a controled docker environment with test data.
|
||||
describe('OHIF Study List', function() {
|
||||
context('Desktop resolution', function() {
|
||||
beforeEach(function() {
|
||||
describe('OHIF Study List', function () {
|
||||
context('Desktop resolution', function () {
|
||||
beforeEach(function () {
|
||||
cy.openStudyList();
|
||||
|
||||
cy.viewport(1750, 720);
|
||||
@@ -14,7 +14,7 @@ describe('OHIF Study List', function() {
|
||||
cy.get('@StudyDescription').clear();
|
||||
});
|
||||
|
||||
it('Displays several studies initially', function() {
|
||||
it('Displays several studies initially', function () {
|
||||
cy.waitStudyList();
|
||||
cy.get('@searchResult2').should($list => {
|
||||
expect($list.length).to.be.greaterThan(1);
|
||||
@@ -23,7 +23,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Patient Name with exact string', function() {
|
||||
it('searches Patient Name with exact string', function () {
|
||||
cy.get('@PatientName').type('Juno');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -33,7 +33,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches MRN with exact string', function() {
|
||||
it('searches MRN with exact string', function () {
|
||||
cy.get('@MRN').type('0000003');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -43,7 +43,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Accession with exact string', function() {
|
||||
it('searches Accession with exact string', function () {
|
||||
cy.get('@AccessionNumber').type('321');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
@@ -53,7 +53,7 @@ describe('OHIF Study List', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('searches Description with exact string', function() {
|
||||
it('searches Description with exact string', function () {
|
||||
cy.get('@StudyDescription').type('PETCT');
|
||||
//Wait result list to be displayed
|
||||
cy.waitStudyList();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
describe('OHIF MPR', () => {
|
||||
beforeEach(() => {
|
||||
cy.checkStudyRouteInViewer(
|
||||
'1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1'
|
||||
);
|
||||
cy.checkStudyRouteInViewer('1.3.6.1.4.1.25403.345050719074.3824.20170125113417.1');
|
||||
cy.expectMinimumThumbnails(3);
|
||||
cy.initCornerstoneToolsAliases();
|
||||
cy.initCommonElementsAliases();
|
||||
@@ -76,10 +74,7 @@ describe('OHIF MPR', () => {
|
||||
cy.wrap(imageData2).should('not.be', undefined);
|
||||
cy.wrap(imageData3).should('not.be', undefined);
|
||||
|
||||
cy.wrap(imageData1.dimensions).should(
|
||||
'deep.equal',
|
||||
imageData2.dimensions
|
||||
);
|
||||
cy.wrap(imageData1.dimensions).should('deep.equal', imageData2.dimensions);
|
||||
|
||||
cy.wrap(imageData1.origin).should('deep.equal', imageData2.origin);
|
||||
});
|
||||
@@ -89,10 +84,7 @@ describe('OHIF MPR', () => {
|
||||
cy.get('.cornerstone-canvas').should('have.length', 1);
|
||||
|
||||
// should not have any div under it
|
||||
cy.get('[data-cy="thumbnail-viewport-labels"]')
|
||||
.eq(2)
|
||||
.find('div')
|
||||
.should('have.length', 0);
|
||||
cy.get('[data-cy="thumbnail-viewport-labels"]').eq(2).find('div').should('have.length', 0);
|
||||
});
|
||||
|
||||
it('should correctly render Crosshairs for MPR', () => {
|
||||
|
||||
@@ -18,4 +18,4 @@
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
};
|
||||
@@ -6,18 +6,12 @@ export const DragSimulator = {
|
||||
counter: 0,
|
||||
rectsEqual(r1, r2) {
|
||||
return (
|
||||
r1.top === r2.top &&
|
||||
r1.right === r2.right &&
|
||||
r1.bottom === r2.bottom &&
|
||||
r1.left === r2.left
|
||||
r1.top === r2.top && r1.right === r2.right && r1.bottom === r2.bottom && r1.left === r2.left
|
||||
);
|
||||
},
|
||||
get dropped() {
|
||||
const currentSourcePosition = this.source.getBoundingClientRect();
|
||||
return !this.rectsEqual(
|
||||
this.initialSourcePosition,
|
||||
currentSourcePosition
|
||||
);
|
||||
return !this.rectsEqual(this.initialSourcePosition, currentSourcePosition);
|
||||
},
|
||||
get hasTriesLeft() {
|
||||
return this.counter < this.MAX_TRIES;
|
||||
@@ -71,8 +65,6 @@ export const DragSimulator = {
|
||||
simulate(sourceWrapper, targetSelector, position = 'center') {
|
||||
return cy
|
||||
.get(targetSelector)
|
||||
.then(targetWrapper =>
|
||||
this.init(sourceWrapper.get(0), targetWrapper.get(0), position)
|
||||
);
|
||||
.then(targetWrapper => this.init(sourceWrapper.get(0), targetWrapper.get(0), position));
|
||||
},
|
||||
};
|
||||
@@ -3,16 +3,10 @@ export function initCornerstoneToolsAliases() {
|
||||
cy.get('[data-cy="StackScroll"]').as('stackScrollBtn');
|
||||
cy.get('[data-cy="Zoom"]').as('zoomBtn');
|
||||
cy.get('[data-cy="WindowLevel-split-button-primary"]').as('wwwcBtnPrimary');
|
||||
cy.get('[data-cy="WindowLevel-split-button-secondary"]').as(
|
||||
'wwwcBtnSecondary'
|
||||
);
|
||||
cy.get('[data-cy="WindowLevel-split-button-secondary"]').as('wwwcBtnSecondary');
|
||||
cy.get('[data-cy="Pan"]').as('panBtn');
|
||||
cy.get('[data-cy="MeasurementTools-split-button-primary"]').as(
|
||||
'measurementToolsBtnPrimary'
|
||||
);
|
||||
cy.get('[data-cy="MeasurementTools-split-button-secondary"]').as(
|
||||
'measurementToolsBtnSecondary'
|
||||
);
|
||||
cy.get('[data-cy="MeasurementTools-split-button-primary"]').as('measurementToolsBtnPrimary');
|
||||
cy.get('[data-cy="MeasurementTools-split-button-secondary"]').as('measurementToolsBtnSecondary');
|
||||
// cy.get('[data-cy="Angle"]').as('angleBtn');
|
||||
cy.get('[data-cy="MoreTools-split-button-primary"]').as('moreBtnPrimary');
|
||||
cy.get('[data-cy="MoreTools-split-button-secondary"]').as('moreBtnSecondary');
|
||||
@@ -37,12 +31,8 @@ export function initCommonElementsAliases() {
|
||||
cy.get('[data-cy="studyBrowser-panel"]').as('seriesPanel');
|
||||
cy.get('[data-cy="viewport-overlay-top-right"]').as('viewportInfoTopRight');
|
||||
cy.get('[data-cy="viewport-overlay-top-left"]').as('viewportInfoTopLeft');
|
||||
cy.get('[data-cy="viewport-overlay-bottom-right"]').as(
|
||||
'viewportInfoBottomRight'
|
||||
);
|
||||
cy.get('[data-cy="viewport-overlay-bottom-left"]').as(
|
||||
'viewportInfoBottomLeft'
|
||||
);
|
||||
cy.get('[data-cy="viewport-overlay-bottom-right"]').as('viewportInfoBottomRight');
|
||||
cy.get('[data-cy="viewport-overlay-bottom-left"]').as('viewportInfoBottomLeft');
|
||||
|
||||
cy.get('.left-mid.orientation-marker').as('viewportInfoMidLeft');
|
||||
cy.get('.top-mid.orientation-marker').as('viewportInfoMidTop');
|
||||
@@ -50,9 +40,7 @@ export function initCommonElementsAliases() {
|
||||
|
||||
//Creating aliases for Routes
|
||||
export function initRouteAliases() {
|
||||
cy.intercept('GET', '**/series**', { statusCode: 200, body: [] }).as(
|
||||
'getStudySeries'
|
||||
);
|
||||
cy.intercept('GET', '**/series**', { statusCode: 200, body: [] }).as('getStudySeries');
|
||||
|
||||
// Todo: for some reason cypress does not redirect to the correct url
|
||||
// so we intercept the request and redirect it to the correct url
|
||||
|
||||
@@ -59,10 +59,7 @@ Cypress.Commands.add(
|
||||
(StudyInstanceUID, otherParams = '', mode = '/basic-test') => {
|
||||
cy.location('pathname').then($url => {
|
||||
cy.log($url);
|
||||
if (
|
||||
$url === 'blank' ||
|
||||
!$url.includes(`${mode}/${StudyInstanceUID}${otherParams}`)
|
||||
) {
|
||||
if ($url === 'blank' || !$url.includes(`${mode}/${StudyInstanceUID}${otherParams}`)) {
|
||||
cy.openStudyInViewer(StudyInstanceUID, otherParams, mode);
|
||||
cy.waitDicomImage();
|
||||
// Very short wait to ensure pending updates are handled
|
||||
@@ -91,14 +88,9 @@ Cypress.Commands.add('openStudyModality', Modality => {
|
||||
cy.initRouteAliases();
|
||||
cy.visit('/');
|
||||
|
||||
cy.get('#filter-accessionOrModalityOrDescription')
|
||||
.type(Modality)
|
||||
.waitQueryList();
|
||||
cy.get('#filter-accessionOrModalityOrDescription').type(Modality).waitQueryList();
|
||||
|
||||
cy.get('[data-cy="study-list-results"]')
|
||||
.contains(Modality)
|
||||
.first()
|
||||
.click();
|
||||
cy.get('[data-cy="study-list-results"]').contains(Modality).first().click();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -175,60 +167,47 @@ Cypress.Commands.add('addLine', (viewport, firstClick, secondClick) => {
|
||||
* @param {number[]} secondClick - Click position [x, y]
|
||||
* @param {number[]} thirdClick - Click position [x, y]
|
||||
*/
|
||||
Cypress.Commands.add(
|
||||
'addAngle',
|
||||
(viewport, firstClick, secondClick, thirdClick) => {
|
||||
cy.get(viewport).then($viewport => {
|
||||
const [x1, y1] = firstClick;
|
||||
const [x2, y2] = secondClick;
|
||||
const [x3, y3] = thirdClick;
|
||||
Cypress.Commands.add('addAngle', (viewport, firstClick, secondClick, thirdClick) => {
|
||||
cy.get(viewport).then($viewport => {
|
||||
const [x1, y1] = firstClick;
|
||||
const [x2, y2] = secondClick;
|
||||
const [x3, y3] = thirdClick;
|
||||
|
||||
cy.wrap($viewport)
|
||||
.click(x1, y1, { force: true })
|
||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||
.click(x2, y2, { force: true })
|
||||
.trigger('mousemove', { clientX: x3, clientY: y3 })
|
||||
.click(x3, y3, { force: true });
|
||||
});
|
||||
}
|
||||
);
|
||||
cy.wrap($viewport)
|
||||
.click(x1, y1, { force: true })
|
||||
.trigger('mousemove', { clientX: x2, clientY: y2 })
|
||||
.click(x2, y2, { force: true })
|
||||
.trigger('mousemove', { clientX: x3, clientY: y3 })
|
||||
.click(x3, y3, { force: true });
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('expectMinimumThumbnails', (seriesToWait = 1) => {
|
||||
cy.get('[data-cy="study-browser-thumbnail"]', { timeout: 50000 }).should(
|
||||
$itemList => {
|
||||
expect($itemList.length >= seriesToWait).to.be.true;
|
||||
}
|
||||
);
|
||||
cy.get('[data-cy="study-browser-thumbnail"]', { timeout: 50000 }).should($itemList => {
|
||||
expect($itemList.length >= seriesToWait).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
//Command to wait DICOM image to load into the viewport
|
||||
Cypress.Commands.add(
|
||||
'waitDicomImage',
|
||||
(mode = '/basic-test', timeout = 50000) => {
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.should($cornerstone => {
|
||||
const enabled = $cornerstone.getEnabledElements();
|
||||
if (enabled?.length) {
|
||||
enabled.forEach((item, i) => {
|
||||
if (
|
||||
item.viewport.viewportStatus !==
|
||||
$cornerstone.Enums.ViewportStatus.RENDERED
|
||||
) {
|
||||
throw new Error(
|
||||
`Viewport ${i} in state ${item.viewport.viewportStatus}`
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('No enabled elements');
|
||||
}
|
||||
});
|
||||
// This shouldn't be necessary, but seems to be.
|
||||
cy.wait(250);
|
||||
cy.log('DICOM image loaded');
|
||||
}
|
||||
);
|
||||
Cypress.Commands.add('waitDicomImage', (mode = '/basic-test', timeout = 50000) => {
|
||||
cy.window()
|
||||
.its('cornerstone')
|
||||
.should($cornerstone => {
|
||||
const enabled = $cornerstone.getEnabledElements();
|
||||
if (enabled?.length) {
|
||||
enabled.forEach((item, i) => {
|
||||
if (item.viewport.viewportStatus !== $cornerstone.Enums.ViewportStatus.RENDERED) {
|
||||
throw new Error(`Viewport ${i} in state ${item.viewport.viewportStatus}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new Error('No enabled elements');
|
||||
}
|
||||
});
|
||||
// This shouldn't be necessary, but seems to be.
|
||||
cy.wait(250);
|
||||
cy.log('DICOM image loaded');
|
||||
});
|
||||
|
||||
//Command to reset and clear all the changes made to the viewport
|
||||
Cypress.Commands.add('resetViewport', () => {
|
||||
@@ -392,18 +371,14 @@ Cypress.Commands.add('setLayout', (columns = 1, rows = 1) => {
|
||||
});
|
||||
|
||||
function convertCanvas(documentClone) {
|
||||
documentClone
|
||||
.querySelectorAll('canvas')
|
||||
.forEach(selector => canvasToImage(selector));
|
||||
documentClone.querySelectorAll('canvas').forEach(selector => canvasToImage(selector));
|
||||
|
||||
return documentClone;
|
||||
}
|
||||
|
||||
function unconvertCanvas(documentClone) {
|
||||
// Remove previously generated images
|
||||
documentClone
|
||||
.querySelectorAll('[data-percy-image]')
|
||||
.forEach(selector => selector.remove());
|
||||
documentClone.querySelectorAll('[data-percy-image]').forEach(selector => selector.remove());
|
||||
// Restore canvas visibility
|
||||
documentClone.querySelectorAll('[data-percy-canvas]').forEach(selector => {
|
||||
selector.removeAttribute('data-percy-canvas');
|
||||
@@ -413,9 +388,7 @@ function unconvertCanvas(documentClone) {
|
||||
|
||||
function canvasToImage(selectorOrEl) {
|
||||
let canvas =
|
||||
typeof selectorOrEl === 'object'
|
||||
? selectorOrEl
|
||||
: document.querySelector(selectorOrEl);
|
||||
typeof selectorOrEl === 'object' ? selectorOrEl : document.querySelector(selectorOrEl);
|
||||
let image = document.createElement('img');
|
||||
let canvasImageBase64 = canvas.toDataURL('image/png');
|
||||
|
||||
@@ -443,10 +416,7 @@ Cypress.Commands.add('openPreferences', () => {
|
||||
.scrollIntoView()
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('[data-cy="options-dropdown"]')
|
||||
.last()
|
||||
.click()
|
||||
.wait(200);
|
||||
cy.get('[data-cy="options-dropdown"]').last().click().wait(200);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -481,9 +451,7 @@ Cypress.Commands.add('closePreferences', () => {
|
||||
cy.get('body').then(body => {
|
||||
// Close notification if displayed
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
|
||||
// Close User Preferences Modal (if displayed)
|
||||
@@ -495,9 +463,7 @@ Cypress.Commands.add('closePreferences', () => {
|
||||
|
||||
Cypress.Commands.add('selectPreferencesTab', tabAlias => {
|
||||
cy.initPreferencesModalAliases();
|
||||
cy.get(tabAlias)
|
||||
.click()
|
||||
.should('have.class', 'active');
|
||||
cy.get(tabAlias).click().should('have.class', 'active');
|
||||
initPreferencesModalFooterBtnAliases();
|
||||
});
|
||||
|
||||
@@ -513,9 +479,7 @@ Cypress.Commands.add('resetUserHotkeyPreferences', () => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
// Click on Save Button
|
||||
cy.get('@saveBtn').click();
|
||||
@@ -534,28 +498,23 @@ Cypress.Commands.add('resetUserGeneralPreferences', () => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
// Click on Save Button
|
||||
cy.get('@saveBtn').click();
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
'setNewHotkeyShortcutOnUserPreferencesModal',
|
||||
(function_label, shortcut) => {
|
||||
// Within scopes all `.get` and `.contains` to within the matched elements
|
||||
// dom instead of checking from document
|
||||
cy.get('.HotkeysPreferences').within(() => {
|
||||
cy.contains(function_label) // label we're looking for
|
||||
.parent()
|
||||
.find('input') // closest input to that label
|
||||
.type(shortcut, { force: true }); // Set new shortcut for that function
|
||||
});
|
||||
}
|
||||
);
|
||||
Cypress.Commands.add('setNewHotkeyShortcutOnUserPreferencesModal', (function_label, shortcut) => {
|
||||
// Within scopes all `.get` and `.contains` to within the matched elements
|
||||
// dom instead of checking from document
|
||||
cy.get('.HotkeysPreferences').within(() => {
|
||||
cy.contains(function_label) // label we're looking for
|
||||
.parent()
|
||||
.find('input') // closest input to that label
|
||||
.type(shortcut, { force: true }); // Set new shortcut for that function
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
'setWindowLevelPreset',
|
||||
@@ -590,9 +549,7 @@ Cypress.Commands.add(
|
||||
|
||||
Cypress.Commands.add('openDownloadImageModal', () => {
|
||||
// Click on More button
|
||||
cy.get('[data-cy="Capture"]')
|
||||
.as('captureBtn')
|
||||
.click();
|
||||
cy.get('[data-cy="Capture"]').as('captureBtn').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
@@ -609,16 +566,12 @@ Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
// Close Success Message overlay (if displayed)
|
||||
cy.get('body').then(body => {
|
||||
if (body.find('.sb-closeIcon').length > 0) {
|
||||
cy.get('.sb-closeIcon')
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get('.sb-closeIcon').first().click({ force: true });
|
||||
}
|
||||
|
||||
//Click on Save/Cancel button
|
||||
const toClick = save ? '@saveBtn' : '@cancelBtn';
|
||||
cy.get(toClick)
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
cy.get(toClick).scrollIntoView().click();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -626,7 +579,7 @@ Cypress.Commands.add('setLanguage', (language, save = true) => {
|
||||
// https://github.com/cypress-io/cypress/issues/7362
|
||||
// uncomment this if you really need the network logs
|
||||
const origLog = Cypress.log;
|
||||
Cypress.log = function(opts, ...other) {
|
||||
Cypress.log = function (opts, ...other) {
|
||||
if (opts.displayName === 'script' || opts.name === 'request') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const babelJest = require("babel-jest");
|
||||
const babelJest = require('babel-jest');
|
||||
|
||||
module.exports = babelJest.createTransformer({
|
||||
rootMode: "upward"
|
||||
rootMode: 'upward',
|
||||
});
|
||||
@@ -1 +1 @@
|
||||
module.exports = require("../../postcss.config.js");
|
||||
module.exports = require('../../postcss.config.js');
|
||||
@@ -6,4 +6,4 @@
|
||||
"color": "#fff",
|
||||
"show_title": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,7 @@ window.config = {
|
||||
// ~ REQUIRED
|
||||
// Authorization Server URL
|
||||
authority: 'https://accounts.google.com',
|
||||
client_id:
|
||||
'723928408739-k9k9r3i44j32rhu69vlnibipmmk9i57p.apps.googleusercontent.com',
|
||||
client_id: '723928408739-k9k9r3i44j32rhu69vlnibipmmk9i57p.apps.googleusercontent.com',
|
||||
redirect_uri: '/callback',
|
||||
response_type: 'id_token token',
|
||||
scope:
|
||||
|
||||
@@ -16,8 +16,7 @@ window.config = {
|
||||
// ~ REQUIRED
|
||||
// Authorization Server URL
|
||||
authority: 'https://accounts.google.com',
|
||||
client_id:
|
||||
'723928408739-k9k9r3i44j32rhu69vlnibipmmk9i57p.apps.googleusercontent.com',
|
||||
client_id: '723928408739-k9k9r3i44j32rhu69vlnibipmmk9i57p.apps.googleusercontent.com',
|
||||
redirect_uri: '/callback', // `OHIFStandaloneViewer.js`
|
||||
response_type: 'id_token token',
|
||||
scope:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
window.config = {
|
||||
routerBasename: '/',
|
||||
customizationService: [
|
||||
'@ohif/extension-default.customizationModule.helloPage',
|
||||
],
|
||||
customizationService: ['@ohif/extension-default.customizationModule.helloPage'],
|
||||
extensions: [],
|
||||
modes: [],
|
||||
showStudyList: true,
|
||||
|
||||
Vendored
+3569
-2
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -6,16 +6,34 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="OHIF Viewer" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="#000000"
|
||||
/>
|
||||
<meta
|
||||
name="mobile-web-app-capable"
|
||||
content="yes"
|
||||
/>
|
||||
<meta
|
||||
name="application-name"
|
||||
content="OHIF Viewer"
|
||||
/>
|
||||
<meta
|
||||
name="apple-mobile-web-app-capable"
|
||||
content="yes"
|
||||
/>
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-title" content="@ohif/app" />
|
||||
<meta name="msapplication-TileColor" content="#fff" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-title"
|
||||
content="@ohif/app"
|
||||
/>
|
||||
<meta
|
||||
name="msapplication-TileColor"
|
||||
content="#fff"
|
||||
/>
|
||||
<meta
|
||||
name="msapplication-TileImage"
|
||||
content="<%= PUBLIC_URL %>assets/mstile-144x144.png"
|
||||
@@ -24,9 +42,15 @@
|
||||
name="msapplication-config"
|
||||
content="<%= PUBLIC_URL %>assets/browserconfig.xml"
|
||||
/>
|
||||
<link rel="manifest" href="<%= PUBLIC_URL %>manifest.json" />
|
||||
<link
|
||||
rel="manifest"
|
||||
href="<%= PUBLIC_URL %>manifest.json"
|
||||
/>
|
||||
|
||||
<link rel="shortcut icon" href="<%= PUBLIC_URL %>assets/favicon.ico" />
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="<%= PUBLIC_URL %>assets/favicon.ico"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
@@ -178,7 +202,11 @@
|
||||
<title>OHIF Viewer</title>
|
||||
|
||||
<!-- WEB FONTS -->
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
rel="preconnect"
|
||||
href="https://fonts.gstatic.com"
|
||||
crossorigin
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Inter:100,300,400,500,700&display=swap"
|
||||
rel="stylesheet"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
@@ -6,16 +6,34 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="application-name" content="OHIF Viewer" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="#000000"
|
||||
/>
|
||||
<meta
|
||||
name="mobile-web-app-capable"
|
||||
content="yes"
|
||||
/>
|
||||
<meta
|
||||
name="application-name"
|
||||
content="OHIF Viewer"
|
||||
/>
|
||||
<meta
|
||||
name="apple-mobile-web-app-capable"
|
||||
content="yes"
|
||||
/>
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-title" content="@ohif/app" />
|
||||
<meta name="msapplication-TileColor" content="#fff" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-title"
|
||||
content="@ohif/app"
|
||||
/>
|
||||
<meta
|
||||
name="msapplication-TileColor"
|
||||
content="#fff"
|
||||
/>
|
||||
<meta
|
||||
name="msapplication-TileImage"
|
||||
content="<%= PUBLIC_URL %>assets/mstile-144x144.png"
|
||||
@@ -24,9 +42,15 @@
|
||||
name="msapplication-config"
|
||||
content="<%= PUBLIC_URL %>assets/browserconfig.xml"
|
||||
/>
|
||||
<link rel="manifest" href="<%= PUBLIC_URL %>manifest.json" />
|
||||
<link
|
||||
rel="manifest"
|
||||
href="<%= PUBLIC_URL %>manifest.json"
|
||||
/>
|
||||
|
||||
<link rel="shortcut icon" href="<%= PUBLIC_URL %>assets/favicon.ico" />
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="<%= PUBLIC_URL %>assets/favicon.ico"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
@@ -211,7 +235,7 @@
|
||||
},
|
||||
};
|
||||
// Rollbar Snippet
|
||||
!(function(r) {
|
||||
!(function (r) {
|
||||
var e = {};
|
||||
function o(n) {
|
||||
if (e[n]) return e[n].exports;
|
||||
@@ -220,17 +244,16 @@
|
||||
}
|
||||
(o.m = r),
|
||||
(o.c = e),
|
||||
(o.d = function(r, e, n) {
|
||||
o.o(r, e) ||
|
||||
Object.defineProperty(r, e, { enumerable: !0, get: n });
|
||||
(o.d = function (r, e, n) {
|
||||
o.o(r, e) || Object.defineProperty(r, e, { enumerable: !0, get: n });
|
||||
}),
|
||||
(o.r = function(r) {
|
||||
(o.r = function (r) {
|
||||
'undefined' != typeof Symbol &&
|
||||
Symbol.toStringTag &&
|
||||
Object.defineProperty(r, Symbol.toStringTag, { value: 'Module' }),
|
||||
Object.defineProperty(r, '__esModule', { value: !0 });
|
||||
}),
|
||||
(o.t = function(r, e) {
|
||||
(o.t = function (r, e) {
|
||||
if ((1 & e && (r = o(r)), 8 & e)) return r;
|
||||
if (4 & e && 'object' == typeof r && r && r.__esModule) return r;
|
||||
var n = Object.create(null);
|
||||
@@ -243,53 +266,46 @@
|
||||
o.d(
|
||||
n,
|
||||
t,
|
||||
function(e) {
|
||||
function (e) {
|
||||
return r[e];
|
||||
}.bind(null, t)
|
||||
);
|
||||
return n;
|
||||
}),
|
||||
(o.n = function(r) {
|
||||
(o.n = function (r) {
|
||||
var e =
|
||||
r && r.__esModule
|
||||
? function() {
|
||||
? function () {
|
||||
return r.default;
|
||||
}
|
||||
: function() {
|
||||
: function () {
|
||||
return r;
|
||||
};
|
||||
return o.d(e, 'a', e), e;
|
||||
}),
|
||||
(o.o = function(r, e) {
|
||||
(o.o = function (r, e) {
|
||||
return Object.prototype.hasOwnProperty.call(r, e);
|
||||
}),
|
||||
(o.p = ''),
|
||||
o((o.s = 0));
|
||||
})([
|
||||
function(r, e, o) {
|
||||
function (r, e, o) {
|
||||
var n = o(1),
|
||||
t = o(4);
|
||||
(_rollbarConfig = _rollbarConfig || {}),
|
||||
(_rollbarConfig.rollbarJsUrl =
|
||||
_rollbarConfig.rollbarJsUrl ||
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.7.1/rollbar.min.js'),
|
||||
(_rollbarConfig.async =
|
||||
void 0 === _rollbarConfig.async || _rollbarConfig.async);
|
||||
(_rollbarConfig.async = void 0 === _rollbarConfig.async || _rollbarConfig.async);
|
||||
var a = n.setupShim(window, _rollbarConfig),
|
||||
l = t(_rollbarConfig);
|
||||
(window.rollbar = n.Rollbar),
|
||||
a.loadFull(
|
||||
window,
|
||||
document,
|
||||
!_rollbarConfig.async,
|
||||
_rollbarConfig,
|
||||
l
|
||||
);
|
||||
a.loadFull(window, document, !_rollbarConfig.async, _rollbarConfig, l);
|
||||
},
|
||||
function(r, e, o) {
|
||||
function (r, e, o) {
|
||||
var n = o(2);
|
||||
function t(r) {
|
||||
return function() {
|
||||
return function () {
|
||||
try {
|
||||
return r.apply(this, arguments);
|
||||
} catch (r) {
|
||||
@@ -303,7 +319,7 @@
|
||||
function l(r, e) {
|
||||
(this.options = r), (this._rollbarOldOnError = null);
|
||||
var o = a++;
|
||||
(this.shimId = function() {
|
||||
(this.shimId = function () {
|
||||
return o;
|
||||
}),
|
||||
'undefined' != typeof window &&
|
||||
@@ -311,20 +327,20 @@
|
||||
(window._rollbarShims[o] = { handler: e, messages: [] });
|
||||
}
|
||||
var i = o(3),
|
||||
d = function(r, e) {
|
||||
d = function (r, e) {
|
||||
return new l(r, e);
|
||||
},
|
||||
c = function(r) {
|
||||
c = function (r) {
|
||||
return new i(d, r);
|
||||
};
|
||||
function s(r) {
|
||||
return t(function() {
|
||||
return t(function () {
|
||||
var e = Array.prototype.slice.call(arguments, 0),
|
||||
o = { shim: this, method: r, args: e, ts: new Date() };
|
||||
window._rollbarShims[this.shimId()].messages.push(o);
|
||||
});
|
||||
}
|
||||
(l.prototype.loadFull = function(r, e, o, n, a) {
|
||||
(l.prototype.loadFull = function (r, e, o, n, a) {
|
||||
var l = !1,
|
||||
i = e.createElement('script'),
|
||||
d = e.getElementsByTagName('script')[0],
|
||||
@@ -332,50 +348,47 @@
|
||||
(i.crossOrigin = ''),
|
||||
(i.src = n.rollbarJsUrl),
|
||||
o || (i.async = !0),
|
||||
(i.onload = i.onreadystatechange = t(function() {
|
||||
if (
|
||||
!(
|
||||
l ||
|
||||
(this.readyState &&
|
||||
'loaded' !== this.readyState &&
|
||||
'complete' !== this.readyState)
|
||||
)
|
||||
) {
|
||||
i.onload = i.onreadystatechange = null;
|
||||
try {
|
||||
c.removeChild(i);
|
||||
} catch (r) {}
|
||||
(l = !0),
|
||||
(function() {
|
||||
var e;
|
||||
if (void 0 === r._rollbarDidLoad) {
|
||||
e = new Error('rollbar.js did not load');
|
||||
for (
|
||||
var o, n, t, l, i = 0;
|
||||
(o = r._rollbarShims[i++]);
|
||||
|
||||
)
|
||||
for (o = o.messages || []; (n = o.shift()); )
|
||||
for (t = n.args || [], i = 0; i < t.length; ++i)
|
||||
if ('function' == typeof (l = t[i])) {
|
||||
l(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
'function' == typeof a && a(e);
|
||||
})();
|
||||
}
|
||||
})),
|
||||
(i.onload = i.onreadystatechange =
|
||||
t(function () {
|
||||
if (
|
||||
!(
|
||||
l ||
|
||||
(this.readyState &&
|
||||
'loaded' !== this.readyState &&
|
||||
'complete' !== this.readyState)
|
||||
)
|
||||
) {
|
||||
i.onload = i.onreadystatechange = null;
|
||||
try {
|
||||
c.removeChild(i);
|
||||
} catch (r) {}
|
||||
(l = !0),
|
||||
(function () {
|
||||
var e;
|
||||
if (void 0 === r._rollbarDidLoad) {
|
||||
e = new Error('rollbar.js did not load');
|
||||
for (var o, n, t, l, i = 0; (o = r._rollbarShims[i++]); )
|
||||
for (o = o.messages || []; (n = o.shift()); )
|
||||
for (t = n.args || [], i = 0; i < t.length; ++i)
|
||||
if ('function' == typeof (l = t[i])) {
|
||||
l(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
'function' == typeof a && a(e);
|
||||
})();
|
||||
}
|
||||
})),
|
||||
c.insertBefore(i, d);
|
||||
}),
|
||||
(l.prototype.wrap = function(r, e, o) {
|
||||
(l.prototype.wrap = function (r, e, o) {
|
||||
try {
|
||||
var n;
|
||||
if (
|
||||
((n =
|
||||
'function' == typeof e
|
||||
? e
|
||||
: function() {
|
||||
: function () {
|
||||
return e || {};
|
||||
}),
|
||||
'function' != typeof r)
|
||||
@@ -384,65 +397,61 @@
|
||||
if (r._isWrap) return r;
|
||||
if (
|
||||
!r._rollbar_wrapped &&
|
||||
((r._rollbar_wrapped = function() {
|
||||
((r._rollbar_wrapped = function () {
|
||||
o && 'function' == typeof o && o.apply(this, arguments);
|
||||
try {
|
||||
return r.apply(this, arguments);
|
||||
} catch (o) {
|
||||
var e = o;
|
||||
throw (e &&
|
||||
('string' == typeof e && (e = new String(e)),
|
||||
(e._rollbarContext = n() || {}),
|
||||
(e._rollbarContext._wrappedSource = r.toString()),
|
||||
(window._rollbarWrappedError = e)),
|
||||
e);
|
||||
throw (
|
||||
(e &&
|
||||
('string' == typeof e && (e = new String(e)),
|
||||
(e._rollbarContext = n() || {}),
|
||||
(e._rollbarContext._wrappedSource = r.toString()),
|
||||
(window._rollbarWrappedError = e)),
|
||||
e)
|
||||
);
|
||||
}
|
||||
}),
|
||||
(r._rollbar_wrapped._isWrap = !0),
|
||||
r.hasOwnProperty)
|
||||
)
|
||||
for (var t in r)
|
||||
r.hasOwnProperty(t) && (r._rollbar_wrapped[t] = r[t]);
|
||||
for (var t in r) r.hasOwnProperty(t) && (r._rollbar_wrapped[t] = r[t]);
|
||||
return r._rollbar_wrapped;
|
||||
} catch (e) {
|
||||
return r;
|
||||
}
|
||||
});
|
||||
for (
|
||||
var p = 'log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad'.split(
|
||||
','
|
||||
),
|
||||
var p =
|
||||
'log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad'.split(
|
||||
','
|
||||
),
|
||||
u = 0;
|
||||
u < p.length;
|
||||
++u
|
||||
)
|
||||
l.prototype[p[u]] = s(p[u]);
|
||||
r.exports = {
|
||||
setupShim: function(r, e) {
|
||||
setupShim: function (r, e) {
|
||||
if (r) {
|
||||
var o = e.globalAlias || 'Rollbar';
|
||||
if ('object' == typeof r[o]) return r[o];
|
||||
(r._rollbarShims = {}), (r._rollbarWrappedError = null);
|
||||
var a = new c(e);
|
||||
return t(function() {
|
||||
return t(function () {
|
||||
e.captureUncaught &&
|
||||
((a._rollbarOldOnError = r.onerror),
|
||||
n.captureUncaughtExceptions(r, a, !0),
|
||||
n.wrapGlobals(r, a, !0)),
|
||||
e.captureUnhandledRejections &&
|
||||
n.captureUnhandledRejections(r, a, !0);
|
||||
e.captureUnhandledRejections && n.captureUnhandledRejections(r, a, !0);
|
||||
var t = e.autoInstrument;
|
||||
return (
|
||||
!1 !== e.enabled &&
|
||||
(void 0 === t ||
|
||||
!0 === t ||
|
||||
('object' == typeof t && t.network)) &&
|
||||
(void 0 === t || !0 === t || ('object' == typeof t && t.network)) &&
|
||||
r.addEventListener &&
|
||||
(r.addEventListener('load', a.captureLoad.bind(a)),
|
||||
r.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
a.captureDomContentLoaded.bind(a)
|
||||
)),
|
||||
r.addEventListener('DOMContentLoaded', a.captureDomContentLoaded.bind(a))),
|
||||
(r[o] = a),
|
||||
a
|
||||
);
|
||||
@@ -452,49 +461,35 @@
|
||||
Rollbar: c,
|
||||
};
|
||||
},
|
||||
function(r, e) {
|
||||
function (r, e) {
|
||||
function o(r, e, o) {
|
||||
if (e.hasOwnProperty && e.hasOwnProperty('addEventListener')) {
|
||||
for (
|
||||
var n = e.addEventListener;
|
||||
n._rollbarOldAdd && n.belongsToShim;
|
||||
|
||||
)
|
||||
for (var n = e.addEventListener; n._rollbarOldAdd && n.belongsToShim; )
|
||||
n = n._rollbarOldAdd;
|
||||
var t = function(e, o, t) {
|
||||
var t = function (e, o, t) {
|
||||
n.call(this, e, r.wrap(o), t);
|
||||
};
|
||||
(t._rollbarOldAdd = n),
|
||||
(t.belongsToShim = o),
|
||||
(e.addEventListener = t);
|
||||
for (
|
||||
var a = e.removeEventListener;
|
||||
a._rollbarOldRemove && a.belongsToShim;
|
||||
|
||||
)
|
||||
(t._rollbarOldAdd = n), (t.belongsToShim = o), (e.addEventListener = t);
|
||||
for (var a = e.removeEventListener; a._rollbarOldRemove && a.belongsToShim; )
|
||||
a = a._rollbarOldRemove;
|
||||
var l = function(r, e, o) {
|
||||
var l = function (r, e, o) {
|
||||
a.call(this, r, (e && e._rollbar_wrapped) || e, o);
|
||||
};
|
||||
(l._rollbarOldRemove = a),
|
||||
(l.belongsToShim = o),
|
||||
(e.removeEventListener = l);
|
||||
(l._rollbarOldRemove = a), (l.belongsToShim = o), (e.removeEventListener = l);
|
||||
}
|
||||
}
|
||||
r.exports = {
|
||||
captureUncaughtExceptions: function(r, e, o) {
|
||||
captureUncaughtExceptions: function (r, e, o) {
|
||||
if (r) {
|
||||
var n;
|
||||
if ('function' == typeof e._rollbarOldOnError)
|
||||
n = e._rollbarOldOnError;
|
||||
if ('function' == typeof e._rollbarOldOnError) n = e._rollbarOldOnError;
|
||||
else if (r.onerror) {
|
||||
for (n = r.onerror; n._rollbarOldOnError; )
|
||||
n = n._rollbarOldOnError;
|
||||
for (n = r.onerror; n._rollbarOldOnError; ) n = n._rollbarOldOnError;
|
||||
e._rollbarOldOnError = n;
|
||||
}
|
||||
var t = function() {
|
||||
var t = function () {
|
||||
var o = Array.prototype.slice.call(arguments, 0);
|
||||
!(function(r, e, o, n) {
|
||||
!(function (r, e, o, n) {
|
||||
r._rollbarWrappedError &&
|
||||
(n[4] || (n[4] = r._rollbarWrappedError),
|
||||
n[5] || (n[5] = r._rollbarWrappedError._rollbarContext),
|
||||
@@ -506,12 +501,12 @@
|
||||
o && (t._rollbarOldOnError = n), (r.onerror = t);
|
||||
}
|
||||
},
|
||||
captureUnhandledRejections: function(r, e, o) {
|
||||
captureUnhandledRejections: function (r, e, o) {
|
||||
if (r) {
|
||||
'function' == typeof r._rollbarURH &&
|
||||
r._rollbarURH.belongsToShim &&
|
||||
r.removeEventListener('unhandledrejection', r._rollbarURH);
|
||||
var n = function(r) {
|
||||
var n = function (r) {
|
||||
var o, n, t;
|
||||
try {
|
||||
o = r.reason;
|
||||
@@ -521,54 +516,49 @@
|
||||
try {
|
||||
n = r.promise;
|
||||
} catch (r) {
|
||||
n =
|
||||
'[unhandledrejection] error getting `promise` from event';
|
||||
n = '[unhandledrejection] error getting `promise` from event';
|
||||
}
|
||||
try {
|
||||
(t = r.detail),
|
||||
!o && t && ((o = t.reason), (n = t.promise));
|
||||
(t = r.detail), !o && t && ((o = t.reason), (n = t.promise));
|
||||
} catch (r) {}
|
||||
o ||
|
||||
(o =
|
||||
'[unhandledrejection] error getting `reason` from event'),
|
||||
e &&
|
||||
e.handleUnhandledRejection &&
|
||||
e.handleUnhandledRejection(o, n);
|
||||
o || (o = '[unhandledrejection] error getting `reason` from event'),
|
||||
e && e.handleUnhandledRejection && e.handleUnhandledRejection(o, n);
|
||||
};
|
||||
(n.belongsToShim = o),
|
||||
(r._rollbarURH = n),
|
||||
r.addEventListener('unhandledrejection', n);
|
||||
}
|
||||
},
|
||||
wrapGlobals: function(r, e, n) {
|
||||
wrapGlobals: function (r, e, n) {
|
||||
if (r) {
|
||||
var t,
|
||||
a,
|
||||
l = 'EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload'.split(
|
||||
','
|
||||
);
|
||||
l =
|
||||
'EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload'.split(
|
||||
','
|
||||
);
|
||||
for (t = 0; t < l.length; ++t)
|
||||
r[(a = l[t])] && r[a].prototype && o(e, r[a].prototype, n);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
function(r, e) {
|
||||
function (r, e) {
|
||||
function o(r, e) {
|
||||
(this.impl = r(e, this)),
|
||||
(this.options = e),
|
||||
(function(r) {
|
||||
(function (r) {
|
||||
for (
|
||||
var e = function(r) {
|
||||
return function() {
|
||||
var e = function (r) {
|
||||
return function () {
|
||||
var e = Array.prototype.slice.call(arguments, 0);
|
||||
if (this.impl[r])
|
||||
return this.impl[r].apply(this.impl, e);
|
||||
if (this.impl[r]) return this.impl[r].apply(this.impl, e);
|
||||
};
|
||||
},
|
||||
o = 'log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad'.split(
|
||||
','
|
||||
),
|
||||
o =
|
||||
'log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad'.split(
|
||||
','
|
||||
),
|
||||
n = 0;
|
||||
n < o.length;
|
||||
n++
|
||||
@@ -576,7 +566,7 @@
|
||||
r[o[n]] = e(o[n]);
|
||||
})(o.prototype);
|
||||
}
|
||||
(o.prototype._swapAndProcessMessages = function(r, e) {
|
||||
(o.prototype._swapAndProcessMessages = function (r, e) {
|
||||
var o, n, t;
|
||||
for (this.impl = r(this.options); (o = e.shift()); )
|
||||
(n = o.method),
|
||||
@@ -590,24 +580,23 @@
|
||||
}),
|
||||
(r.exports = o);
|
||||
},
|
||||
function(r, e) {
|
||||
r.exports = function(r) {
|
||||
return function(e) {
|
||||
function (r, e) {
|
||||
r.exports = function (r) {
|
||||
return function (e) {
|
||||
if (!e && !window._rollbarInitialized) {
|
||||
for (
|
||||
var o,
|
||||
n,
|
||||
t = (r = r || {}).globalAlias || 'Rollbar',
|
||||
a = window.rollbar,
|
||||
l = function(r) {
|
||||
l = function (r) {
|
||||
return new a(r);
|
||||
},
|
||||
i = 0;
|
||||
(o = window._rollbarShims[i++]);
|
||||
|
||||
)
|
||||
n || (n = o.handler),
|
||||
o.handler._swapAndProcessMessages(l, o.messages);
|
||||
n || (n = o.handler), o.handler._swapAndProcessMessages(l, o.messages);
|
||||
(window[t] = n), (window._rollbarInitialized = !0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||
for (let registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
@@ -17,8 +17,7 @@ if ('function' === typeof importScripts) {
|
||||
);
|
||||
|
||||
var supportsServiceWorker = 'serviceWorker' in navigator;
|
||||
var isNotLocalDevelopment =
|
||||
['localhost', '127'].indexOf(location.hostname) === -1;
|
||||
var isNotLocalDevelopment = ['localhost', '127'].indexOf(location.hostname) === -1;
|
||||
|
||||
if (supportsServiceWorker && isNotLocalDevelopment) {
|
||||
const swFileLocation = (window.PUBLIC_URL || '/') + 'sw.js';
|
||||
@@ -28,8 +27,7 @@ if ('function' === typeof importScripts) {
|
||||
// service worker has installed but is waiting to activate.
|
||||
wb.addEventListener('waiting', event => {
|
||||
// customize the UI prompt accordingly.
|
||||
const isFirstTimeUpdatedServiceWorkerIsWaiting =
|
||||
event.wasWaitingBeforeRegister === false;
|
||||
const isFirstTimeUpdatedServiceWorkerIsWaiting = event.wasWaitingBeforeRegister === false;
|
||||
console.log(
|
||||
'isFirstTimeUpdatedServiceWorkerIsWaiting',
|
||||
isFirstTimeUpdatedServiceWorkerIsWaiting
|
||||
|
||||
+10857
-39
File diff suppressed because it is too large.
Load diff
Vendored
+184
-1
@@ -1 +1,184 @@
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(){}function t(e){if(!(this instanceof t))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],u(e,this)}function o(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,t._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(f){return void i(n.promise,f)}r(n.promise,o)}else(1===e._state?r:i)(n.promise,e._value)})):e._deferreds.push(n)}function r(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var o=n.then;if(n instanceof t)return e._state=3,e._value=n,void f(e);if("function"==typeof o)return void u(function(e,n){return function(){e.apply(n,arguments)}}(o,n),e)}e._state=1,e._value=n,f(e)}catch(r){i(e,r)}}function i(e,n){e._state=2,e._value=n,f(e)}function f(e){2===e._state&&0===e._deferreds.length&&t._immediateFn(function(){e._handled||t._unhandledRejectionFn(e._value)});for(var n=0,r=e._deferreds.length;r>n;n++)o(e,e._deferreds[n]);e._deferreds=null}function u(e,n){var t=!1;try{e(function(e){t||(t=!0,r(n,e))},function(e){t||(t=!0,i(n,e))})}catch(o){if(t)return;t=!0,i(n,o)}}var c=setTimeout;t.prototype["catch"]=function(e){return this.then(null,e)},t.prototype.then=function(e,t){var r=new this.constructor(n);return o(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,t,r)),r},t.prototype["finally"]=e,t.all=function(e){return new t(function(n,t){function o(e,f){try{if(f&&("object"==typeof f||"function"==typeof f)){var u=f.then;if("function"==typeof u)return void u.call(f,function(n){o(e,n)},t)}r[e]=f,0==--i&&n(r)}catch(c){t(c)}}if(!e||"undefined"==typeof e.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(e);if(0===r.length)return n([]);for(var i=r.length,f=0;r.length>f;f++)o(f,r[f])})},t.resolve=function(e){return e&&"object"==typeof e&&e.constructor===t?e:new t(function(n){n(e)})},t.reject=function(e){return new t(function(n,t){t(e)})},t.race=function(e){return new t(function(n,t){for(var o=0,r=e.length;r>o;o++)e[o].then(n,t)})},t._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){c(e,0)},t._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=t});
|
||||
!(function (e, n) {
|
||||
'object' == typeof exports && 'undefined' != typeof module
|
||||
? n()
|
||||
: 'function' == typeof define && define.amd
|
||||
? define(n)
|
||||
: n();
|
||||
})(0, function () {
|
||||
'use strict';
|
||||
function e(e) {
|
||||
var n = this.constructor;
|
||||
return this.then(
|
||||
function (t) {
|
||||
return n.resolve(e()).then(function () {
|
||||
return t;
|
||||
});
|
||||
},
|
||||
function (t) {
|
||||
return n.resolve(e()).then(function () {
|
||||
return n.reject(t);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
function n() {}
|
||||
function t(e) {
|
||||
if (!(this instanceof t)) throw new TypeError('Promises must be constructed via new');
|
||||
if ('function' != typeof e) throw new TypeError('not a function');
|
||||
(this._state = 0),
|
||||
(this._handled = !1),
|
||||
(this._value = undefined),
|
||||
(this._deferreds = []),
|
||||
u(e, this);
|
||||
}
|
||||
function o(e, n) {
|
||||
for (; 3 === e._state; ) e = e._value;
|
||||
0 !== e._state
|
||||
? ((e._handled = !0),
|
||||
t._immediateFn(function () {
|
||||
var t = 1 === e._state ? n.onFulfilled : n.onRejected;
|
||||
if (null !== t) {
|
||||
var o;
|
||||
try {
|
||||
o = t(e._value);
|
||||
} catch (f) {
|
||||
return void i(n.promise, f);
|
||||
}
|
||||
r(n.promise, o);
|
||||
} else (1 === e._state ? r : i)(n.promise, e._value);
|
||||
}))
|
||||
: e._deferreds.push(n);
|
||||
}
|
||||
function r(e, n) {
|
||||
try {
|
||||
if (n === e) throw new TypeError('A promise cannot be resolved with itself.');
|
||||
if (n && ('object' == typeof n || 'function' == typeof n)) {
|
||||
var o = n.then;
|
||||
if (n instanceof t) return (e._state = 3), (e._value = n), void f(e);
|
||||
if ('function' == typeof o)
|
||||
return void u(
|
||||
(function (e, n) {
|
||||
return function () {
|
||||
e.apply(n, arguments);
|
||||
};
|
||||
})(o, n),
|
||||
e
|
||||
);
|
||||
}
|
||||
(e._state = 1), (e._value = n), f(e);
|
||||
} catch (r) {
|
||||
i(e, r);
|
||||
}
|
||||
}
|
||||
function i(e, n) {
|
||||
(e._state = 2), (e._value = n), f(e);
|
||||
}
|
||||
function f(e) {
|
||||
2 === e._state &&
|
||||
0 === e._deferreds.length &&
|
||||
t._immediateFn(function () {
|
||||
e._handled || t._unhandledRejectionFn(e._value);
|
||||
});
|
||||
for (var n = 0, r = e._deferreds.length; r > n; n++) o(e, e._deferreds[n]);
|
||||
e._deferreds = null;
|
||||
}
|
||||
function u(e, n) {
|
||||
var t = !1;
|
||||
try {
|
||||
e(
|
||||
function (e) {
|
||||
t || ((t = !0), r(n, e));
|
||||
},
|
||||
function (e) {
|
||||
t || ((t = !0), i(n, e));
|
||||
}
|
||||
);
|
||||
} catch (o) {
|
||||
if (t) return;
|
||||
(t = !0), i(n, o);
|
||||
}
|
||||
}
|
||||
var c = setTimeout;
|
||||
(t.prototype['catch'] = function (e) {
|
||||
return this.then(null, e);
|
||||
}),
|
||||
(t.prototype.then = function (e, t) {
|
||||
var r = new this.constructor(n);
|
||||
return (
|
||||
o(
|
||||
this,
|
||||
new (function (e, n, t) {
|
||||
(this.onFulfilled = 'function' == typeof e ? e : null),
|
||||
(this.onRejected = 'function' == typeof n ? n : null),
|
||||
(this.promise = t);
|
||||
})(e, t, r)
|
||||
),
|
||||
r
|
||||
);
|
||||
}),
|
||||
(t.prototype['finally'] = e),
|
||||
(t.all = function (e) {
|
||||
return new t(function (n, t) {
|
||||
function o(e, f) {
|
||||
try {
|
||||
if (f && ('object' == typeof f || 'function' == typeof f)) {
|
||||
var u = f.then;
|
||||
if ('function' == typeof u)
|
||||
return void u.call(
|
||||
f,
|
||||
function (n) {
|
||||
o(e, n);
|
||||
},
|
||||
t
|
||||
);
|
||||
}
|
||||
(r[e] = f), 0 == --i && n(r);
|
||||
} catch (c) {
|
||||
t(c);
|
||||
}
|
||||
}
|
||||
if (!e || 'undefined' == typeof e.length)
|
||||
throw new TypeError('Promise.all accepts an array');
|
||||
var r = Array.prototype.slice.call(e);
|
||||
if (0 === r.length) return n([]);
|
||||
for (var i = r.length, f = 0; r.length > f; f++) o(f, r[f]);
|
||||
});
|
||||
}),
|
||||
(t.resolve = function (e) {
|
||||
return e && 'object' == typeof e && e.constructor === t
|
||||
? e
|
||||
: new t(function (n) {
|
||||
n(e);
|
||||
});
|
||||
}),
|
||||
(t.reject = function (e) {
|
||||
return new t(function (n, t) {
|
||||
t(e);
|
||||
});
|
||||
}),
|
||||
(t.race = function (e) {
|
||||
return new t(function (n, t) {
|
||||
for (var o = 0, r = e.length; r > o; o++) e[o].then(n, t);
|
||||
});
|
||||
}),
|
||||
(t._immediateFn =
|
||||
('function' == typeof setImmediate &&
|
||||
function (e) {
|
||||
setImmediate(e);
|
||||
}) ||
|
||||
function (e) {
|
||||
c(e, 0);
|
||||
}),
|
||||
(t._unhandledRejectionFn = function (e) {
|
||||
void 0 !== console && console && console.warn('Possible Unhandled Promise Rejection:', e);
|
||||
});
|
||||
var l = (function () {
|
||||
if ('undefined' != typeof self) return self;
|
||||
if ('undefined' != typeof window) return window;
|
||||
if ('undefined' != typeof global) return global;
|
||||
throw Error('unable to locate global object');
|
||||
})();
|
||||
'Promise' in l
|
||||
? l.Promise.prototype['finally'] || (l.Promise.prototype['finally'] = e)
|
||||
: (l.Promise = t);
|
||||
});
|
||||
@@ -1,16 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Silent OpenID Connect Token Refresh Page</title>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.7/es5-shim.min.js"></script>
|
||||
<script type="text/javascript" src='es6-shim.min.js'></script>
|
||||
<script type="text/javascript" src="oidc-client.min.js"></script>
|
||||
<script type="text/javascript" src='polyfill.min.js'></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="es6-shim.min.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="oidc-client.min.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="polyfill.min.js"
|
||||
></script>
|
||||
<script type="text/javascript">
|
||||
new UserManager().signinSilentCallback().catch(console.error);
|
||||
</script>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,12 +5,7 @@ import i18n from '@ohif/i18n';
|
||||
import { I18nextProvider } from 'react-i18next';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import Compose from './routes/Mode/Compose';
|
||||
import {
|
||||
ServicesManager,
|
||||
ExtensionManager,
|
||||
CommandsManager,
|
||||
HotkeysManager,
|
||||
} from '@ohif/core';
|
||||
import { ServicesManager, ExtensionManager, CommandsManager, HotkeysManager } from '@ohif/core';
|
||||
import {
|
||||
DialogProvider,
|
||||
Modal,
|
||||
@@ -38,9 +33,7 @@ function App({ config, defaultExtensions, defaultModes }) {
|
||||
const [init, setInit] = useState(null);
|
||||
useEffect(() => {
|
||||
const run = async () => {
|
||||
appInit(config, defaultExtensions, defaultModes)
|
||||
.then(setInit)
|
||||
.catch(console.error);
|
||||
appInit(config, defaultExtensions, defaultModes).then(setInit).catch(console.error);
|
||||
};
|
||||
|
||||
run();
|
||||
@@ -58,13 +51,7 @@ function App({ config, defaultExtensions, defaultModes }) {
|
||||
|
||||
// Set appConfig
|
||||
const appConfigState = init.appConfig;
|
||||
const {
|
||||
routerBasename,
|
||||
modes,
|
||||
dataSources,
|
||||
oidc,
|
||||
showStudyList,
|
||||
} = appConfigState;
|
||||
const { routerBasename, modes, dataSources, oidc, showStudyList } = appConfigState;
|
||||
|
||||
const {
|
||||
uiDialogService,
|
||||
@@ -89,8 +76,7 @@ function App({ config, defaultExtensions, defaultModes }) {
|
||||
[DialogProvider, { service: uiDialogService }],
|
||||
[ModalProvider, { service: uiModalService, modal: Modal }],
|
||||
];
|
||||
const CombinedProviders = ({ children }) =>
|
||||
Compose({ components: providers, children });
|
||||
const CombinedProviders = ({ children }) => Compose({ components: providers, children });
|
||||
|
||||
let authRoutes = null;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const originalConsoleError = console.error;
|
||||
|
||||
// JSDom's CSS Parser has limited support for certain features
|
||||
// This supresses error warnings caused by it
|
||||
console.error = function(msg) {
|
||||
console.error = function (msg) {
|
||||
if (_.startsWith(msg, 'Error: Could not parse CSS stylesheet')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,14 +76,8 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
|
||||
* Example: [ext1, ext2, ext3]
|
||||
* Example2: [[ext1, config], ext2, [ext3, config]]
|
||||
*/
|
||||
const loadedExtensions = await loadModules([
|
||||
...defaultExtensions,
|
||||
...appConfig.extensions,
|
||||
]);
|
||||
await extensionManager.registerExtensions(
|
||||
loadedExtensions,
|
||||
appConfig.dataSources
|
||||
);
|
||||
const loadedExtensions = await loadModules([...defaultExtensions, ...appConfig.extensions]);
|
||||
await extensionManager.registerExtensions(loadedExtensions, appConfig.dataSources);
|
||||
|
||||
// TODO: We no longer use `utils.addServer`
|
||||
// TODO: We no longer init webWorkers at app level
|
||||
@@ -93,10 +87,7 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
|
||||
throw new Error('No modes are defined! Check your app-config.js');
|
||||
}
|
||||
|
||||
const loadedModes = await loadModules([
|
||||
...(appConfig.modes || []),
|
||||
...defaultModes,
|
||||
]);
|
||||
const loadedModes = await loadModules([...(appConfig.modes || []), ...defaultModes]);
|
||||
|
||||
// This is the name for the loaded istance object
|
||||
appConfig.loadedModes = [];
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ViewportGrid, ViewportPane, useViewportGrid } from '@ohif/ui';
|
||||
import EmptyViewport from './EmptyViewport';
|
||||
import classNames from 'classnames';
|
||||
|
||||
|
||||
function ViewerViewportGrid(props) {
|
||||
const { servicesManager, viewportComponents, dataSource } = props;
|
||||
const [viewportGrid, viewportGridService] = useViewportGrid();
|
||||
@@ -14,12 +13,9 @@ function ViewerViewportGrid(props) {
|
||||
const { numCols, numRows } = layout;
|
||||
|
||||
// TODO -> Need some way of selecting which displaySets hit the viewports.
|
||||
const {
|
||||
displaySetService,
|
||||
measurementService,
|
||||
hangingProtocolService,
|
||||
uiNotificationService,
|
||||
} = (servicesManager as ServicesManager).services;
|
||||
const { displaySetService, measurementService, hangingProtocolService, uiNotificationService } = (
|
||||
servicesManager as ServicesManager
|
||||
).services;
|
||||
|
||||
/**
|
||||
* This callback runs after the viewports structure has changed in any way.
|
||||
@@ -63,15 +59,13 @@ function ViewerViewportGrid(props) {
|
||||
const displaySetUIDsToHang = [];
|
||||
const displaySetUIDsToHangOptions = [];
|
||||
|
||||
displaySetsInfo.forEach(
|
||||
({ displaySetInstanceUID, displaySetOptions }) => {
|
||||
if (displaySetInstanceUID) {
|
||||
displaySetUIDsToHang.push(displaySetInstanceUID);
|
||||
}
|
||||
|
||||
displaySetUIDsToHangOptions.push(displaySetOptions);
|
||||
displaySetsInfo.forEach(({ displaySetInstanceUID, displaySetOptions }) => {
|
||||
if (displaySetInstanceUID) {
|
||||
displaySetUIDsToHang.push(displaySetInstanceUID);
|
||||
}
|
||||
);
|
||||
|
||||
displaySetUIDsToHangOptions.push(displaySetOptions);
|
||||
});
|
||||
|
||||
const computedViewportOptions = hangingProtocolService.getComputedOptions(
|
||||
viewportOptions,
|
||||
@@ -128,12 +122,7 @@ function ViewerViewportGrid(props) {
|
||||
const { unsubscribe } = hangingProtocolService.subscribe(
|
||||
hangingProtocolService.EVENTS.PROTOCOL_CHANGED,
|
||||
({ protocol, stage, activeStudyUID, viewportMatchDetails }) => {
|
||||
updateDisplaySetsFromProtocol(
|
||||
protocol,
|
||||
stage,
|
||||
activeStudyUID,
|
||||
viewportMatchDetails
|
||||
);
|
||||
updateDisplaySetsFromProtocol(protocol, stage, activeStudyUID, viewportMatchDetails);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -152,13 +141,9 @@ function ViewerViewportGrid(props) {
|
||||
// This occurs when no viewport has elected to consume the event
|
||||
// so we need to change layouts into a layout which can consume
|
||||
// the event.
|
||||
const { displaySetInstanceUID: referencedDisplaySetInstanceUID } =
|
||||
measurement;
|
||||
const { displaySetInstanceUID: referencedDisplaySetInstanceUID } = measurement;
|
||||
|
||||
const updatedViewports = _getUpdatedViewports(
|
||||
viewportId,
|
||||
referencedDisplaySetInstanceUID
|
||||
);
|
||||
const updatedViewports = _getUpdatedViewports(viewportId, referencedDisplaySetInstanceUID);
|
||||
// Arbitrarily assign the viewport to element 0
|
||||
const viewport = updatedViewports?.[0];
|
||||
|
||||
@@ -173,9 +158,7 @@ function ViewerViewportGrid(props) {
|
||||
viewport.viewportOptions ||= {};
|
||||
viewport.viewportOptions.orientation = 'acquisition';
|
||||
|
||||
const displaySet = displaySetService.getDisplaySetByUID(
|
||||
referencedDisplaySetInstanceUID
|
||||
);
|
||||
const displaySet = displaySetService.getDisplaySetByUID(referencedDisplaySetInstanceUID);
|
||||
// jump straight to the initial image index if we can
|
||||
if (displaySet.images && measurement.SOPInstanceUID) {
|
||||
for (let index = 0; index < displaySet.images.length; index++) {
|
||||
@@ -242,10 +225,7 @@ function ViewerViewportGrid(props) {
|
||||
*/
|
||||
|
||||
const onDropHandler = (viewportId, { displaySetInstanceUID }) => {
|
||||
const updatedViewports = _getUpdatedViewports(
|
||||
viewportId,
|
||||
displaySetInstanceUID
|
||||
);
|
||||
const updatedViewports = _getUpdatedViewports(viewportId, displaySetInstanceUID);
|
||||
viewportGridService.setDisplaySetsForViewports(updatedViewports);
|
||||
};
|
||||
|
||||
@@ -266,24 +246,19 @@ function ViewerViewportGrid(props) {
|
||||
viewportLabel,
|
||||
} = paneMetadata;
|
||||
|
||||
const viewportId = viewportOptions.viewportId
|
||||
const viewportId = viewportOptions.viewportId;
|
||||
const isActive = activeViewportId === viewportId;
|
||||
|
||||
|
||||
const displaySetInstanceUIDsToUse = displaySetInstanceUIDs || [];
|
||||
|
||||
// This is causing the viewport components re-render when the activeViewportId changes
|
||||
const displaySets = displaySetInstanceUIDsToUse.map(
|
||||
displaySetInstanceUID => {
|
||||
return (
|
||||
displaySetService.getDisplaySetByUID(displaySetInstanceUID) || {}
|
||||
);
|
||||
}
|
||||
).filter(
|
||||
(displaySet) => {
|
||||
const displaySets = displaySetInstanceUIDsToUse
|
||||
.map(displaySetInstanceUID => {
|
||||
return displaySetService.getDisplaySetByUID(displaySetInstanceUID) || {};
|
||||
})
|
||||
.filter(displaySet => {
|
||||
return !displaySet?.unsupported;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
const ViewportComponent = _getViewportComponent(
|
||||
displaySets,
|
||||
@@ -335,7 +310,7 @@ function ViewerViewportGrid(props) {
|
||||
>
|
||||
<div
|
||||
data-cy="viewport-pane"
|
||||
className={classNames('h-full w-full flex flex-col', {
|
||||
className={classNames('flex h-full w-full flex-col', {
|
||||
'pointer-events-none': !isActive,
|
||||
})}
|
||||
>
|
||||
@@ -364,7 +339,10 @@ function ViewerViewportGrid(props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<ViewportGrid numRows={numRows} numCols={numCols}>
|
||||
<ViewportGrid
|
||||
numRows={numRows}
|
||||
numCols={numCols}
|
||||
>
|
||||
{/* {ViewportPanes} */}
|
||||
{getViewportPanes()}
|
||||
</ViewportGrid>
|
||||
@@ -380,11 +358,7 @@ ViewerViewportGrid.defaultProps = {
|
||||
viewportComponents: [],
|
||||
};
|
||||
|
||||
function _getViewportComponent(
|
||||
displaySets,
|
||||
viewportComponents,
|
||||
uiNotificationService
|
||||
) {
|
||||
function _getViewportComponent(displaySets, viewportComponents, uiNotificationService) {
|
||||
if (!displaySets || !displaySets.length) {
|
||||
return EmptyViewport;
|
||||
}
|
||||
@@ -399,9 +373,7 @@ function _getViewportComponent(
|
||||
if (!viewportComponents[i].displaySetsToDisplay) {
|
||||
throw new Error('displaySetsToDisplay is null');
|
||||
}
|
||||
if (
|
||||
viewportComponents[i].displaySetsToDisplay.includes(SOPClassHandlerId)
|
||||
) {
|
||||
if (viewportComponents[i].displaySetsToDisplay.includes(SOPClassHandlerId)) {
|
||||
const { component } = viewportComponents[i];
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ import { history } from './utils/history';
|
||||
* pluginImports.js imports all of the modes and extensions and adds them
|
||||
* to the window for processing.
|
||||
*/
|
||||
import {
|
||||
modes as defaultModes,
|
||||
extensions as defaultExtensions,
|
||||
} from './pluginImports';
|
||||
import { modes as defaultModes, extensions as defaultExtensions } from './pluginImports';
|
||||
import loadDynamicConfig from './loadDynamicConfig';
|
||||
|
||||
loadDynamicConfig(window.config).then(config_json => {
|
||||
|
||||
@@ -60,8 +60,7 @@ function DataSourceWrapper(props) {
|
||||
if (!dataSourceName) {
|
||||
// Gets the first defined datasource with the right name
|
||||
// Mostly for historical reasons - new configs should use the defaultDataSourceName
|
||||
const dataSourceModules =
|
||||
extensionManager.modules[MODULE_TYPES.DATA_SOURCE];
|
||||
const dataSourceModules = extensionManager.modules[MODULE_TYPES.DATA_SOURCE];
|
||||
// TODO: Good usecase for flatmap?
|
||||
const webApiDataSources = dataSourceModules.reduce((acc, curr) => {
|
||||
const mods = [];
|
||||
@@ -145,10 +144,7 @@ function DataSourceWrapper(props) {
|
||||
return;
|
||||
}
|
||||
|
||||
const queryFilterValues = _getQueryFilterValues(
|
||||
location.search,
|
||||
STUDIES_LIMIT
|
||||
);
|
||||
const queryFilterValues = _getQueryFilterValues(location.search, STUDIES_LIMIT);
|
||||
|
||||
// 204: no content
|
||||
async function getData() {
|
||||
@@ -173,23 +169,19 @@ function DataSourceWrapper(props) {
|
||||
// - And we didn't cross a result offset range
|
||||
const isSamePage = data.pageNumber === queryFilterValues.pageNumber;
|
||||
const previousOffset =
|
||||
Math.floor((data.pageNumber * data.resultsPerPage) / STUDIES_LIMIT) *
|
||||
(STUDIES_LIMIT - 1);
|
||||
Math.floor((data.pageNumber * data.resultsPerPage) / STUDIES_LIMIT) * (STUDIES_LIMIT - 1);
|
||||
const newOffset =
|
||||
Math.floor(
|
||||
(queryFilterValues.pageNumber * queryFilterValues.resultsPerPage) /
|
||||
STUDIES_LIMIT
|
||||
(queryFilterValues.pageNumber * queryFilterValues.resultsPerPage) / STUDIES_LIMIT
|
||||
) *
|
||||
(STUDIES_LIMIT - 1);
|
||||
// Simply checking data.location !== location is not sufficient because even though the location href (i.e. entire URL)
|
||||
// has not changed, the React Router still provides a new location reference and would result in two study queries
|
||||
// on initial load. Alternatively, window.location.href could be used.
|
||||
const isLocationUpdated =
|
||||
typeof data.location === 'string' ||
|
||||
!areLocationsTheSame(data.location, location);
|
||||
typeof data.location === 'string' || !areLocationsTheSame(data.location, location);
|
||||
const isDataInvalid =
|
||||
!isSamePage ||
|
||||
(!isLoading && (newOffset !== previousOffset || isLocationUpdated));
|
||||
!isSamePage || (!isLoading && (newOffset !== previousOffset || isLocationUpdated));
|
||||
|
||||
if (isDataInvalid) {
|
||||
getData().catch(() => {
|
||||
@@ -207,15 +199,7 @@ function DataSourceWrapper(props) {
|
||||
console.warn(ex);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
data,
|
||||
location,
|
||||
params,
|
||||
isLoading,
|
||||
setIsLoading,
|
||||
dataSource,
|
||||
isDataSourceInitialized,
|
||||
]);
|
||||
}, [data, location, params, isLoading, setIsLoading, dataSource, isDataSourceInitialized]);
|
||||
// queryFilterValues
|
||||
|
||||
// TODO: Better way to pass DataSource?
|
||||
@@ -256,8 +240,7 @@ function _getQueryFilterValues(query, queryLimit) {
|
||||
patientId: query.get('mrn'),
|
||||
patientName: query.get('patientName'),
|
||||
studyDescription: query.get('description'),
|
||||
modalitiesInStudy:
|
||||
query.get('modalities') && query.get('modalities').split(','),
|
||||
modalitiesInStudy: query.get('modalities') && query.get('modalities').split(','),
|
||||
accessionNumber: query.get('accession'),
|
||||
//
|
||||
startDate: query.get('startDate'),
|
||||
@@ -269,8 +252,7 @@ function _getQueryFilterValues(query, queryLimit) {
|
||||
sortBy: query.get('sortBy'),
|
||||
sortDirection: query.get('sortDirection'),
|
||||
// Offset...
|
||||
offset:
|
||||
Math.floor((pageNumber * resultsPerPage) / queryLimit) * (queryLimit - 1),
|
||||
offset: Math.floor((pageNumber * resultsPerPage) / queryLimit) * (queryLimit - 1),
|
||||
config: query.get('configUrl'),
|
||||
};
|
||||
|
||||
|
||||
@@ -6,36 +6,29 @@ import { Icon } from '@ohif/ui';
|
||||
function Debug() {
|
||||
return (
|
||||
<div style={{ width: '100%', height: '100%' }}>
|
||||
<div className="h-screen w-screen flex justify-center items-center ">
|
||||
<div className="py-8 px-8 mx-auto bg-secondary-dark drop-shadow-md space-y-2 rounded-lg">
|
||||
<div className="flex h-screen w-screen items-center justify-center ">
|
||||
<div className="bg-secondary-dark mx-auto space-y-2 rounded-lg py-8 px-8 drop-shadow-md">
|
||||
<img
|
||||
className="block mx-auto h-14"
|
||||
className="mx-auto block h-14"
|
||||
src="./ohif-logo.svg"
|
||||
alt="OHIF"
|
||||
/>
|
||||
<div className="text-center space-y-2 pt-4">
|
||||
<div className="flex flex-col justify-center items-center">
|
||||
<p className="text-xl text-primary-active font-semibold mt-4">
|
||||
Debug Information
|
||||
</p>
|
||||
<div className="flex space-x-2 mt-4 items-center">
|
||||
<p className="text-md text-white">
|
||||
Cross Origin Isolated (COOP/COEP)
|
||||
</p>
|
||||
<div className="space-y-2 pt-4 text-center">
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<p className="text-primary-active mt-4 text-xl font-semibold">Debug Information</p>
|
||||
<div className="mt-4 flex items-center space-x-2">
|
||||
<p className="text-md text-white">Cross Origin Isolated (COOP/COEP)</p>
|
||||
<Icon
|
||||
name={
|
||||
window.crossOriginIsolated
|
||||
? 'notifications-success'
|
||||
: 'notifications-error'
|
||||
window.crossOriginIsolated ? 'notifications-success' : 'notifications-error'
|
||||
}
|
||||
className="w-5 h-5"
|
||||
className="h-5 w-5"
|
||||
/>
|
||||
{!window.crossOriginIsolated && (
|
||||
<div className="text-md text-white flex-1">
|
||||
We use SharedArrayBuffer to render volume data (e.g., MPR).
|
||||
If you are seeing this message, it means that your browser
|
||||
has not enabled COOP/COEP. Please see the following link for
|
||||
more information:{' '}
|
||||
<div className="text-md flex-1 text-white">
|
||||
We use SharedArrayBuffer to render volume data (e.g., MPR). If you are seeing
|
||||
this message, it means that your browser has not enabled COOP/COEP. Please see
|
||||
the following link for more information:{' '}
|
||||
<a
|
||||
href="https://web.dev/coop-coep/"
|
||||
target="_blank"
|
||||
|
||||
@@ -12,7 +12,10 @@ import { Icon, Button, LoadingIndicatorProgress } from '@ohif/ui';
|
||||
|
||||
const getLoadButton = (onDrop, text, isDir) => {
|
||||
return (
|
||||
<Dropzone onDrop={onDrop} noDrag>
|
||||
<Dropzone
|
||||
onDrop={onDrop}
|
||||
noDrag
|
||||
>
|
||||
{({ getRootProps, getInputProps }) => (
|
||||
<div {...getRootProps()}>
|
||||
<Button
|
||||
@@ -80,9 +83,7 @@ function Local({ modePath }: LocalProps) {
|
||||
const smStudies = studies.filter(id => {
|
||||
const study = DicomMetadataStore.getStudy(id);
|
||||
return (
|
||||
study.series.findIndex(
|
||||
s => s.Modality === 'SM' || s.instances[0].Modality === 'SM'
|
||||
) >= 0
|
||||
study.series.findIndex(s => s.Modality === 'SM' || s.instances[0].Modality === 'SM') >= 0
|
||||
);
|
||||
});
|
||||
|
||||
@@ -118,31 +119,32 @@ function Local({ modePath }: LocalProps) {
|
||||
noClick
|
||||
>
|
||||
{({ getRootProps }) => (
|
||||
<div {...getRootProps()} style={{ width: '100%', height: '100%' }}>
|
||||
<div className="h-screen w-screen flex justify-center items-center ">
|
||||
<div className="py-8 px-8 mx-auto bg-secondary-dark drop-shadow-md space-y-2 rounded-lg">
|
||||
<div
|
||||
{...getRootProps()}
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
>
|
||||
<div className="flex h-screen w-screen items-center justify-center ">
|
||||
<div className="bg-secondary-dark mx-auto space-y-2 rounded-lg py-8 px-8 drop-shadow-md">
|
||||
<img
|
||||
className="block mx-auto h-14"
|
||||
className="mx-auto block h-14"
|
||||
src="./ohif-logo.svg"
|
||||
alt="OHIF"
|
||||
/>
|
||||
<div className="text-center space-y-2 pt-4">
|
||||
<div className="space-y-2 pt-4 text-center">
|
||||
{dropInitiated ? (
|
||||
<div className="flex flex-col items-center justify-center pt-48">
|
||||
<LoadingIndicatorProgress
|
||||
className={'w-full h-full bg-black'}
|
||||
/>
|
||||
<LoadingIndicatorProgress className={'h-full w-full bg-black'} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
<p className="text-blue-300 text-base">
|
||||
Note: You data is not uploaded to any server, it will stay
|
||||
in your local browser application
|
||||
<p className="text-base text-blue-300">
|
||||
Note: You data is not uploaded to any server, it will stay in your local
|
||||
browser application
|
||||
</p>
|
||||
<p className="text-xg text-primary-active font-semibold pt-6">
|
||||
<p className="text-xg text-primary-active pt-6 font-semibold">
|
||||
Drag and Drop DICOM files here to load them in the Viewer
|
||||
</p>
|
||||
<p className="text-blue-300 text-lg">Or click to </p>
|
||||
<p className="text-lg text-blue-300">Or click to </p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -11,19 +11,14 @@ const DICOMFileLoader = new (class extends FileLoader {
|
||||
getDataset(image, imageId) {
|
||||
const dicomData = dcmjs.data.DicomMessage.readFile(image);
|
||||
|
||||
const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(
|
||||
dicomData.dict
|
||||
);
|
||||
const dataset = dcmjs.data.DicomMetaDictionary.naturalizeDataset(dicomData.dict);
|
||||
|
||||
dataset.url = imageId;
|
||||
|
||||
dataset._meta = dcmjs.data.DicomMetaDictionary.namifyDataset(
|
||||
dicomData.meta
|
||||
);
|
||||
dataset._meta = dcmjs.data.DicomMetaDictionary.namifyDataset(dicomData.meta);
|
||||
|
||||
dataset.AvailableTransferSyntaxUID =
|
||||
dataset.AvailableTransferSyntaxUID ||
|
||||
dataset._meta.TransferSyntaxUID?.Value?.[0];
|
||||
dataset.AvailableTransferSyntaxUID || dataset._meta.TransferSyntaxUID?.Value?.[0];
|
||||
|
||||
return dataset;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,7 @@ const processFile = async file => {
|
||||
|
||||
DicomMetadataStore.addInstance(dicomJSONDataset);
|
||||
} catch (error) {
|
||||
console.log(
|
||||
error.name,
|
||||
':Error when trying to load and process local files:',
|
||||
error.message
|
||||
);
|
||||
console.log(error.name, ':Error when trying to load and process local files:', error.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ export default function Compose(props) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
{components.reduceRight((acc, curr) => {
|
||||
const [Comp, props] = Array.isArray(curr)
|
||||
? [curr[0], curr[1]]
|
||||
: [curr, {}];
|
||||
const [Comp, props] = Array.isArray(curr) ? [curr[0], curr[1]] : [curr, {}];
|
||||
return <Comp {...props}>{acc}</Comp>;
|
||||
}, children)}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -28,23 +28,15 @@ function defaultRouteInit(
|
||||
{ servicesManager, studyInstanceUIDs, dataSource, filters },
|
||||
hangingProtocolId
|
||||
) {
|
||||
const {
|
||||
displaySetService,
|
||||
hangingProtocolService,
|
||||
uiNotificationService,
|
||||
} = servicesManager.services;
|
||||
const { displaySetService, hangingProtocolService, uiNotificationService } =
|
||||
servicesManager.services;
|
||||
|
||||
const unsubscriptions = [];
|
||||
const issuedWarningSeries = [];
|
||||
const {
|
||||
unsubscribe: instanceAddedUnsubscribe,
|
||||
} = DicomMetadataStore.subscribe(
|
||||
const { unsubscribe: instanceAddedUnsubscribe } = DicomMetadataStore.subscribe(
|
||||
DicomMetadataStore.EVENTS.INSTANCES_ADDED,
|
||||
function({ StudyInstanceUID, SeriesInstanceUID, madeInClient = false }) {
|
||||
const seriesMetadata = DicomMetadataStore.getSeries(
|
||||
StudyInstanceUID,
|
||||
SeriesInstanceUID
|
||||
);
|
||||
function ({ StudyInstanceUID, SeriesInstanceUID, madeInClient = false }) {
|
||||
const seriesMetadata = DicomMetadataStore.getSeries(StudyInstanceUID, SeriesInstanceUID);
|
||||
|
||||
// checks if the series filter was used, if it exists
|
||||
const seriesInstanceUIDs = filters?.seriesInstanceUID;
|
||||
@@ -96,10 +88,7 @@ function defaultRouteInit(
|
||||
|
||||
// run the hanging protocol matching on the displaySets with the predefined
|
||||
// hanging protocol in the mode configuration
|
||||
hangingProtocolService.run(
|
||||
{ studies, activeStudy, displaySets },
|
||||
hangingProtocolId
|
||||
);
|
||||
hangingProtocolService.run({ studies, activeStudy, displaySets }, hangingProtocolId);
|
||||
});
|
||||
|
||||
return unsubscriptions;
|
||||
@@ -128,10 +117,7 @@ export default function ModeRoute({
|
||||
const [studyInstanceUIDs, setStudyInstanceUIDs] = useState();
|
||||
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const [
|
||||
ExtensionDependenciesLoaded,
|
||||
setExtensionDependenciesLoaded,
|
||||
] = useState(false);
|
||||
const [ExtensionDependenciesLoaded, setExtensionDependenciesLoaded] = useState(false);
|
||||
|
||||
const layoutTemplateData = useRef(false);
|
||||
const locationRef = useRef(null);
|
||||
@@ -145,22 +131,13 @@ export default function ModeRoute({
|
||||
locationRef.current = location;
|
||||
}
|
||||
|
||||
const {
|
||||
displaySetService,
|
||||
hangingProtocolService,
|
||||
userAuthenticationService,
|
||||
} = (servicesManager as ServicesManager).services;
|
||||
const { displaySetService, hangingProtocolService, userAuthenticationService } = (
|
||||
servicesManager as ServicesManager
|
||||
).services;
|
||||
|
||||
const {
|
||||
extensions,
|
||||
sopClassHandlers,
|
||||
hotkeys: hotkeyObj,
|
||||
hangingProtocol,
|
||||
} = mode;
|
||||
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
|
||||
|
||||
const runTimeHangingProtocolId = lowerCaseSearchParams.get(
|
||||
'hangingprotocolid'
|
||||
);
|
||||
const runTimeHangingProtocolId = lowerCaseSearchParams.get('hangingprotocolid');
|
||||
const token = lowerCaseSearchParams.get('token');
|
||||
|
||||
if (token) {
|
||||
@@ -173,9 +150,7 @@ export default function ModeRoute({
|
||||
});
|
||||
|
||||
// Create a URL object with the current location
|
||||
const urlObj = new URL(
|
||||
window.location.origin + location.pathname + location.search
|
||||
);
|
||||
const urlObj = new URL(window.location.origin + location.pathname + location.search);
|
||||
|
||||
// Remove the token from the URL object
|
||||
urlObj.searchParams.delete('token');
|
||||
@@ -232,9 +207,7 @@ export default function ModeRoute({
|
||||
const loadedExtensions = await loadModules(Object.keys(extensions));
|
||||
for (const extension of loadedExtensions) {
|
||||
const { id: extensionId } = extension;
|
||||
if (
|
||||
extensionManager.registeredExtensionIds.indexOf(extensionId) === -1
|
||||
) {
|
||||
if (extensionManager.registeredExtensionIds.indexOf(extensionId) === -1) {
|
||||
await extensionManager.registerExtension(extension);
|
||||
}
|
||||
}
|
||||
@@ -369,24 +342,21 @@ export default function ModeRoute({
|
||||
* }
|
||||
*/
|
||||
const filters =
|
||||
Array.from(query.keys()).reduce(
|
||||
(acc: Record<string, string>, val: string) => {
|
||||
const lowerVal = val.toLowerCase();
|
||||
if (lowerVal !== 'studyinstanceuids') {
|
||||
// Not sure why the case matters here - it doesn't in the URL
|
||||
if (lowerVal === 'seriesinstanceuid') {
|
||||
const seriesUIDs = getSplitParam(lowerVal, query);
|
||||
return {
|
||||
...acc,
|
||||
seriesInstanceUID: seriesUIDs,
|
||||
};
|
||||
}
|
||||
|
||||
return { ...acc, [val]: getSplitParam(lowerVal, query) };
|
||||
Array.from(query.keys()).reduce((acc: Record<string, string>, val: string) => {
|
||||
const lowerVal = val.toLowerCase();
|
||||
if (lowerVal !== 'studyinstanceuids') {
|
||||
// Not sure why the case matters here - it doesn't in the URL
|
||||
if (lowerVal === 'seriesinstanceuid') {
|
||||
const seriesUIDs = getSplitParam(lowerVal, query);
|
||||
return {
|
||||
...acc,
|
||||
seriesInstanceUID: seriesUIDs,
|
||||
};
|
||||
}
|
||||
},
|
||||
{}
|
||||
) ?? {};
|
||||
|
||||
return { ...acc, [val]: getSplitParam(lowerVal, query) };
|
||||
}
|
||||
}, {}) ?? {};
|
||||
|
||||
if (route.init) {
|
||||
return await route.init(
|
||||
|
||||
@@ -39,11 +39,7 @@ const getStudiesfromDisplaySets = (displaysets): StudyMetadata[] => {
|
||||
}, []);
|
||||
// Return the sorted studies, first on study date and second on study instance UID
|
||||
ret.sort((a, b) => {
|
||||
return compare(
|
||||
a.StudyDate,
|
||||
b.StudyDate,
|
||||
compare(a.StudyInstanceUID, b.StudyInstanceUID)
|
||||
);
|
||||
return compare(a.StudyDate, b.StudyDate, compare(a.StudyInstanceUID, b.StudyInstanceUID));
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
@@ -61,9 +57,7 @@ const getStudiesFromUIDs = (studyUids: string[]): StudyMetadata[] => {
|
||||
|
||||
/** Gets the array of studies */
|
||||
const getStudies = (studyUids?: string[], displaySets): StudyMetadata[] => {
|
||||
return (
|
||||
getStudiesFromUIDs(studyUids) || getStudiesfromDisplaySets(displaySets)
|
||||
);
|
||||
return getStudiesFromUIDs(studyUids) || getStudiesfromDisplaySets(displaySets);
|
||||
};
|
||||
|
||||
export default getStudies;
|
||||
|
||||
@@ -4,15 +4,12 @@ import { Link } from 'react-router-dom';
|
||||
|
||||
import { useAppConfig } from '@state';
|
||||
|
||||
const NotFound = ({
|
||||
message = 'Sorry, this page does not exist.',
|
||||
showGoBackButton = true,
|
||||
}) => {
|
||||
const NotFound = ({ message = 'Sorry, this page does not exist.', showGoBackButton = true }) => {
|
||||
const [appConfig] = useAppConfig();
|
||||
const { showStudyList } = appConfig;
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex justify-center items-center text-white">
|
||||
<div className="flex h-full w-full items-center justify-center text-white">
|
||||
<div>
|
||||
<h4>{message}</h4>
|
||||
{showGoBackButton && showStudyList && (
|
||||
|
||||
@@ -6,9 +6,7 @@ function SignoutCallbackComponent({ userManager }) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onRedirectSuccess = (/* user */) => {
|
||||
const { pathname, search = '' } = JSON.parse(
|
||||
sessionStorage.getItem('ohif-redirect-to')
|
||||
);
|
||||
const { pathname, search = '' } = JSON.parse(sessionStorage.getItem('ohif-redirect-to'));
|
||||
|
||||
navigate(`${pathname}?${search}`);
|
||||
};
|
||||
|
||||
@@ -77,9 +77,7 @@ function WorkList({
|
||||
const shouldUseDefaultSort = sortBy === '' || !sortBy;
|
||||
const sortModifier = sortDirection === 'descending' ? 1 : -1;
|
||||
const defaultSortValues =
|
||||
shouldUseDefaultSort && canSort
|
||||
? { sortBy: 'studyDate', sortDirection: 'ascending' }
|
||||
: {};
|
||||
shouldUseDefaultSort && canSort ? { sortBy: 'studyDate', sortDirection: 'ascending' } : {};
|
||||
const sortedStudies = studies;
|
||||
|
||||
if (canSort) {
|
||||
@@ -129,8 +127,7 @@ function WorkList({
|
||||
const rollingPageNumberMod = Math.floor(101 / filterValues.resultsPerPage);
|
||||
const rollingPageNumber = oldPageNumber % rollingPageNumberMod;
|
||||
const isNextPage = newPageNumber > oldPageNumber;
|
||||
const hasNextPage =
|
||||
Math.max(rollingPageNumber, 1) * resultsPerPage < numOfStudies;
|
||||
const hasNextPage = Math.max(rollingPageNumber, 1) * resultsPerPage < numOfStudies;
|
||||
|
||||
if (isNextPage && !hasNextPage) {
|
||||
return;
|
||||
@@ -168,10 +165,7 @@ function WorkList({
|
||||
|
||||
// TODO: nesting/recursion?
|
||||
if (key === 'studyDate') {
|
||||
if (
|
||||
currValue.startDate &&
|
||||
defaultValue.startDate !== currValue.startDate
|
||||
) {
|
||||
if (currValue.startDate && defaultValue.startDate !== currValue.startDate) {
|
||||
queryString.startDate = currValue.startDate;
|
||||
}
|
||||
if (currValue.endDate && defaultValue.endDate !== currValue.endDate) {
|
||||
@@ -305,7 +299,7 @@ function WorkList({
|
||||
<>
|
||||
<Icon
|
||||
name="group-layers"
|
||||
className={classnames('inline-flex mr-2 w-4', {
|
||||
className={classnames('mr-2 inline-flex w-4', {
|
||||
'text-primary-active': isExpanded,
|
||||
'text-secondary-light': !isExpanded,
|
||||
})}
|
||||
@@ -366,9 +360,9 @@ function WorkList({
|
||||
<Link
|
||||
className={isValidMode ? '' : 'cursor-not-allowed'}
|
||||
key={i}
|
||||
to={`${dataPath ? '../../' : ''}${
|
||||
mode.routeName
|
||||
}${dataPath || ''}?${query.toString()}`}
|
||||
to={`${dataPath ? '../../' : ''}${mode.routeName}${
|
||||
dataPath || ''
|
||||
}?${query.toString()}`}
|
||||
onClick={event => {
|
||||
// In case any event bubbles up for an invalid mode, prevent the navigation.
|
||||
// For example, the event bubbles up when the icon embedded in the disabled button is clicked.
|
||||
@@ -396,9 +390,7 @@ function WorkList({
|
||||
</StudyListExpandedRow>
|
||||
),
|
||||
onClickRow: () =>
|
||||
setExpandedRows(s =>
|
||||
isExpanded ? s.filter(n => rowKey !== n) : [...s, rowKey]
|
||||
),
|
||||
setExpandedRows(s => (isExpanded ? s.filter(n => rowKey !== n) : [...s, rowKey])),
|
||||
isExpanded,
|
||||
};
|
||||
});
|
||||
@@ -426,9 +418,7 @@ function WorkList({
|
||||
title: t('UserPreferencesModal:User Preferences'),
|
||||
content: UserPreferences,
|
||||
contentProps: {
|
||||
hotkeyDefaults: hotkeysManager.getValidHotkeyDefinitions(
|
||||
hotkeyDefaults
|
||||
),
|
||||
hotkeyDefaults: hotkeysManager.getValidHotkeyDefinitions(hotkeyDefaults),
|
||||
hotkeyDefinitions,
|
||||
onCancel: hide,
|
||||
currentLanguage: currentLanguage(),
|
||||
@@ -451,9 +441,7 @@ function WorkList({
|
||||
icon: 'power-off',
|
||||
title: t('Header:Logout'),
|
||||
onClick: () => {
|
||||
navigate(
|
||||
`/logout?redirect_uri=${encodeURIComponent(window.location.href)}`
|
||||
);
|
||||
navigate(`/logout?redirect_uri=${encodeURIComponent(window.location.href)}`);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -489,14 +477,14 @@ function WorkList({
|
||||
customizationService.get('ohif.dataSourceConfigurationComponent') ?? {};
|
||||
|
||||
return (
|
||||
<div className="bg-black h-screen flex flex-col ">
|
||||
<div className="flex h-screen flex-col bg-black ">
|
||||
<Header
|
||||
isSticky
|
||||
menuOptions={menuOptions}
|
||||
isReturnEnabled={false}
|
||||
WhiteLabeling={appConfig.whiteLabeling}
|
||||
/>
|
||||
<div className="overflow-y-auto ohif-scrollbar flex flex-col grow">
|
||||
<div className="ohif-scrollbar flex grow flex-col overflow-y-auto">
|
||||
<StudyListFilter
|
||||
numOfStudies={pageNumber * resultsPerPage > 100 ? 101 : numOfStudies}
|
||||
filtersMeta={filtersMeta}
|
||||
@@ -506,13 +494,11 @@ function WorkList({
|
||||
isFiltering={isFiltering(filterValues, defaultFilterValues)}
|
||||
onUploadClick={uploadProps ? () => show(uploadProps) : undefined}
|
||||
getDataSourceConfigurationComponent={
|
||||
dataSourceConfigurationComponent
|
||||
? () => dataSourceConfigurationComponent()
|
||||
: undefined
|
||||
dataSourceConfigurationComponent ? () => dataSourceConfigurationComponent() : undefined
|
||||
}
|
||||
/>
|
||||
{hasStudies ? (
|
||||
<div className="grow flex flex-col">
|
||||
<div className="flex grow flex-col">
|
||||
<StudyListTable
|
||||
tableDataSource={tableDataSource.slice(offset, offsetAndTake)}
|
||||
numOfStudies={numOfStudies}
|
||||
@@ -531,7 +517,7 @@ function WorkList({
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center pt-48">
|
||||
{appConfig.showLoadingIndicator && isLoadingData ? (
|
||||
<LoadingIndicatorProgress className={'w-full h-full bg-black'} />
|
||||
<LoadingIndicatorProgress className={'h-full w-full bg-black'} />
|
||||
) : (
|
||||
<EmptyStudies />
|
||||
)}
|
||||
@@ -589,9 +575,7 @@ function _getQueryFilterValues(params) {
|
||||
endDate: params.get('enddate') || null,
|
||||
},
|
||||
description: params.get('description'),
|
||||
modalities: params.get('modalities')
|
||||
? params.get('modalities').split(',')
|
||||
: [],
|
||||
modalities: params.get('modalities') ? params.get('modalities').split(',') : [],
|
||||
accession: params.get('accession'),
|
||||
sortBy: params.get('sortby'),
|
||||
sortDirection: params.get('sortdirection'),
|
||||
@@ -615,9 +599,7 @@ function _sortStringDates(s1, s2, sortModifier) {
|
||||
const s2Date = moment(s2.date, ['YYYYMMDD', 'YYYY.MM.DD'], true);
|
||||
|
||||
if (s1Date.isValid() && s2Date.isValid()) {
|
||||
return (
|
||||
(s1Date.toISOString() > s2Date.toISOString() ? 1 : -1) * sortModifier
|
||||
);
|
||||
return (s1Date.toISOString() > s2Date.toISOString() ? 1 : -1) * sortModifier;
|
||||
} else if (s1Date.isValid()) {
|
||||
return sortModifier;
|
||||
} else if (s2Date.isValid()) {
|
||||
|
||||
@@ -17,7 +17,7 @@ const NotFoundServer = ({
|
||||
message = 'Unable to query for studies at this time. Check your data source configuration or network connection',
|
||||
}) => {
|
||||
return (
|
||||
<div className="absolute w-full h-full flex justify-center items-center text-white">
|
||||
<div className="absolute flex h-full w-full items-center justify-center text-white">
|
||||
<div>
|
||||
<h4>{message}</h4>
|
||||
</div>
|
||||
@@ -31,12 +31,14 @@ NotFoundServer.propTypes = {
|
||||
|
||||
const NotFoundStudy = () => {
|
||||
return (
|
||||
<div className="absolute w-full h-full flex justify-center items-center text-white">
|
||||
<div className="absolute flex h-full w-full items-center justify-center text-white">
|
||||
<div>
|
||||
<h4>
|
||||
One or more of the requested studies are not available at this time.
|
||||
Return to the{' '}
|
||||
<Link className="text-primary-light" to={'/'}>
|
||||
One or more of the requested studies are not available at this time. Return to the{' '}
|
||||
<Link
|
||||
className="text-primary-light"
|
||||
to={'/'}
|
||||
>
|
||||
study list
|
||||
</Link>{' '}
|
||||
to select a different study to view.
|
||||
@@ -106,9 +108,7 @@ const createRoutes = ({
|
||||
props: { children: WorkList, servicesManager, extensionManager },
|
||||
};
|
||||
|
||||
const customRoutes = customizationService.getGlobalCustomization(
|
||||
'customRoutes'
|
||||
);
|
||||
const customRoutes = customizationService.getGlobalCustomization('customRoutes');
|
||||
const allRoutes = [
|
||||
...routes,
|
||||
...(showStudyList ? [WorkListRoute] : []),
|
||||
@@ -120,7 +120,10 @@ const createRoutes = ({
|
||||
function RouteWithErrorBoundary({ route, ...rest }) {
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
return (
|
||||
<ErrorBoundary context={`Route ${route.path}`} fallbackRoute="/">
|
||||
<ErrorBoundary
|
||||
context={`Route ${route.path}`}
|
||||
fallbackRoute="/"
|
||||
>
|
||||
<route.children
|
||||
{...rest}
|
||||
{...route.props}
|
||||
@@ -146,11 +149,7 @@ const createRoutes = ({
|
||||
exact
|
||||
path={route.path}
|
||||
element={
|
||||
<PrivateRoute
|
||||
handleUnauthenticated={
|
||||
userAuthenticationService.handleUnauthenticated
|
||||
}
|
||||
>
|
||||
<PrivateRoute handleUnauthenticated={userAuthenticationService.handleUnauthenticated}>
|
||||
<RouteWithErrorBoundary route={route} />
|
||||
</PrivateRoute>
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||
for (let registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
|
||||
// https://developers.google.com/web/tools/workbox/guides/troubleshoot-and-debug
|
||||
importScripts(
|
||||
'https://storage.googleapis.com/workbox-cdn/releases/5.0.0-beta.1/workbox-sw.js'
|
||||
);
|
||||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.0.0-beta.1/workbox-sw.js');
|
||||
|
||||
// Install newest
|
||||
// https://developers.google.com/web/tools/workbox/modules/workbox-core
|
||||
|
||||
@@ -34,18 +34,13 @@ const initUserManager = (oidc, routerBasename) => {
|
||||
const baseUri = `${protocol}//${host}${routerBasename}`;
|
||||
|
||||
const redirect_uri = firstOpenIdClient.redirect_uri || '/callback';
|
||||
const silent_redirect_uri =
|
||||
firstOpenIdClient.silent_redirect_uri || '/silent-refresh.html';
|
||||
const post_logout_redirect_uri =
|
||||
firstOpenIdClient.post_logout_redirect_uri || '/';
|
||||
const silent_redirect_uri = firstOpenIdClient.silent_redirect_uri || '/silent-refresh.html';
|
||||
const post_logout_redirect_uri = firstOpenIdClient.post_logout_redirect_uri || '/';
|
||||
|
||||
const openIdConnectConfiguration = Object.assign({}, firstOpenIdClient, {
|
||||
redirect_uri: _makeAbsoluteIfNecessary(redirect_uri, baseUri),
|
||||
silent_redirect_uri: _makeAbsoluteIfNecessary(silent_redirect_uri, baseUri),
|
||||
post_logout_redirect_uri: _makeAbsoluteIfNecessary(
|
||||
post_logout_redirect_uri,
|
||||
baseUri
|
||||
),
|
||||
post_logout_redirect_uri: _makeAbsoluteIfNecessary(post_logout_redirect_uri, baseUri),
|
||||
});
|
||||
|
||||
return getUserManagerForOpenIdConnectClient(openIdConnectConfiguration);
|
||||
@@ -77,18 +72,12 @@ function LoginComponent(userManager) {
|
||||
const ohifRedirectTo = {
|
||||
pathname: new URL(targetLinkUri).pathname,
|
||||
};
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
JSON.stringify(ohifRedirectTo)
|
||||
);
|
||||
sessionStorage.setItem('ohif-redirect-to', JSON.stringify(ohifRedirectTo));
|
||||
} else {
|
||||
const ohifRedirectTo = {
|
||||
pathname: '/',
|
||||
};
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
JSON.stringify(ohifRedirectTo)
|
||||
);
|
||||
sessionStorage.setItem('ohif-redirect-to', JSON.stringify(ohifRedirectTo));
|
||||
}
|
||||
|
||||
if (loginHint !== null) {
|
||||
@@ -101,11 +90,7 @@ function LoginComponent(userManager) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function OpenIdConnectRoutes({
|
||||
oidc,
|
||||
routerBasename,
|
||||
userAuthenticationService,
|
||||
}) {
|
||||
function OpenIdConnectRoutes({ oidc, routerBasename, userAuthenticationService }) {
|
||||
const userManager = initUserManager(oidc, routerBasename);
|
||||
|
||||
const getAuthorizationHeader = () => {
|
||||
@@ -137,9 +122,7 @@ function OpenIdConnectRoutes({
|
||||
const storageEventListener = event => {
|
||||
const signOutEvent = localStorage.getItem('signoutEvent');
|
||||
if (signOutEvent) {
|
||||
navigate(
|
||||
`/logout?redirect_uri=${encodeURIComponent(window.location.href)}`
|
||||
);
|
||||
navigate(`/logout?redirect_uri=${encodeURIComponent(window.location.href)}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -165,24 +148,21 @@ function OpenIdConnectRoutes({
|
||||
const { pathname, search } = location;
|
||||
|
||||
const redirect_uri = new URL(userManager.settings._redirect_uri).pathname; //.replace(routerBasename,'')
|
||||
const silent_refresh_uri = new URL(userManager.settings._silent_redirect_uri)
|
||||
.pathname; //.replace(routerBasename,'')
|
||||
const post_logout_redirect_uri = new URL(
|
||||
userManager.settings._post_logout_redirect_uri
|
||||
).pathname; //.replace(routerBasename,'');
|
||||
const silent_refresh_uri = new URL(userManager.settings._silent_redirect_uri).pathname; //.replace(routerBasename,'')
|
||||
const post_logout_redirect_uri = new URL(userManager.settings._post_logout_redirect_uri).pathname; //.replace(routerBasename,'');
|
||||
|
||||
// const pathnameRelative = pathname.replace(routerBasename,'');
|
||||
|
||||
if (pathname !== redirect_uri) {
|
||||
sessionStorage.setItem(
|
||||
'ohif-redirect-to',
|
||||
JSON.stringify({ pathname, search })
|
||||
);
|
||||
sessionStorage.setItem('ohif-redirect-to', JSON.stringify({ pathname, search }));
|
||||
}
|
||||
|
||||
return (
|
||||
<Routes basename={routerBasename}>
|
||||
<Route path={silent_refresh_uri} onEnter={window.location.reload} />
|
||||
<Route
|
||||
path={silent_refresh_uri}
|
||||
onEnter={window.location.reload}
|
||||
/>
|
||||
<Route
|
||||
path={post_logout_redirect_uri}
|
||||
element={
|
||||
|
||||
+149
-174
@@ -225,14 +225,10 @@ module.exports = {
|
||||
boxShadow: {
|
||||
xs: '0 0 0 1px rgba(0, 0, 0, 0.05)',
|
||||
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
||||
DEFAULT:
|
||||
'0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
|
||||
md:
|
||||
'0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
||||
lg:
|
||||
'0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
||||
xl:
|
||||
'0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
||||
DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
|
||||
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
|
||||
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
||||
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
||||
'2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
||||
inner: 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)',
|
||||
outline: '0 0 0 3px rgba(66, 153, 225, 0.5)',
|
||||
@@ -252,20 +248,20 @@ module.exports = {
|
||||
current: 'currentColor',
|
||||
},
|
||||
flex: {
|
||||
'1': '1 1 0%',
|
||||
'0.3': '0.3 0.3 0%',
|
||||
'0.5': '0.5 0.5 0%',
|
||||
1: '1 1 0%',
|
||||
0.3: '0.3 0.3 0%',
|
||||
0.5: '0.5 0.5 0%',
|
||||
auto: '1 1 auto',
|
||||
initial: '0 1 auto',
|
||||
none: 'none',
|
||||
static: '0 0 auto',
|
||||
},
|
||||
flexGrow: {
|
||||
'0': '0',
|
||||
0: '0',
|
||||
DEFAULT: '1',
|
||||
},
|
||||
flexShrink: {
|
||||
'0': '0',
|
||||
0: '0',
|
||||
DEFAULT: '1',
|
||||
},
|
||||
fontFamily: {
|
||||
@@ -286,14 +282,7 @@ module.exports = {
|
||||
'"Noto Color Emoji"',
|
||||
],
|
||||
serif: ['Georgia', 'Cambria', '"Times New Roman"', 'Times', 'serif'],
|
||||
mono: [
|
||||
'Menlo',
|
||||
'Monaco',
|
||||
'Consolas',
|
||||
'"Liberation Mono"',
|
||||
'"Courier New"',
|
||||
'monospace',
|
||||
],
|
||||
mono: ['Menlo', 'Monaco', 'Consolas', '"Liberation Mono"', '"Courier New"', 'monospace'],
|
||||
},
|
||||
fontSize: {
|
||||
xs: '0.65rem',
|
||||
@@ -327,7 +316,7 @@ module.exports = {
|
||||
}),
|
||||
inset: theme => ({
|
||||
...theme('spacing'),
|
||||
'0': '0',
|
||||
0: '0',
|
||||
auto: 'auto',
|
||||
full: '100%',
|
||||
viewport: '0.5rem',
|
||||
@@ -336,7 +325,7 @@ module.exports = {
|
||||
}),
|
||||
minHeight: theme => ({
|
||||
...theme('spacing'),
|
||||
'0': '0',
|
||||
0: '0',
|
||||
full: '100%',
|
||||
screen: '100vh',
|
||||
}),
|
||||
@@ -355,14 +344,14 @@ module.exports = {
|
||||
normal: '1.5',
|
||||
relaxed: '1.625',
|
||||
loose: '2',
|
||||
'3': '.75rem',
|
||||
'4': '1rem',
|
||||
'5': '1.25rem',
|
||||
'6': '1.5rem',
|
||||
'7': '1.75rem',
|
||||
'8': '2rem',
|
||||
'9': '2.25rem',
|
||||
'10': '2.5rem',
|
||||
3: '.75rem',
|
||||
4: '1rem',
|
||||
5: '1.25rem',
|
||||
6: '1.5rem',
|
||||
7: '1.75rem',
|
||||
8: '2rem',
|
||||
9: '2.25rem',
|
||||
10: '2.5rem',
|
||||
},
|
||||
listStyleType: {
|
||||
none: 'none',
|
||||
@@ -397,7 +386,7 @@ module.exports = {
|
||||
}),
|
||||
minWidth: theme => ({
|
||||
...theme('spacing'),
|
||||
'0': '0',
|
||||
0: '0',
|
||||
xs: '2rem',
|
||||
sm: '4rem',
|
||||
md: '6rem',
|
||||
@@ -417,44 +406,44 @@ module.exports = {
|
||||
top: 'top',
|
||||
},
|
||||
opacity: {
|
||||
'0': '0',
|
||||
'5': '.5',
|
||||
'10': '.10',
|
||||
'15': '.15',
|
||||
'20': '.20',
|
||||
'25': '.25',
|
||||
'30': '.30',
|
||||
'35': '.35',
|
||||
'40': '.40',
|
||||
'45': '.45',
|
||||
'50': '.50',
|
||||
'55': '.55',
|
||||
'60': '.60',
|
||||
'65': '.65',
|
||||
'70': '.70',
|
||||
'75': '.75',
|
||||
'80': '.80',
|
||||
'85': '.85',
|
||||
'90': '.90',
|
||||
'95': '.95',
|
||||
'100': '1',
|
||||
0: '0',
|
||||
5: '.5',
|
||||
10: '.10',
|
||||
15: '.15',
|
||||
20: '.20',
|
||||
25: '.25',
|
||||
30: '.30',
|
||||
35: '.35',
|
||||
40: '.40',
|
||||
45: '.45',
|
||||
50: '.50',
|
||||
55: '.55',
|
||||
60: '.60',
|
||||
65: '.65',
|
||||
70: '.70',
|
||||
75: '.75',
|
||||
80: '.80',
|
||||
85: '.85',
|
||||
90: '.90',
|
||||
95: '.95',
|
||||
100: '1',
|
||||
},
|
||||
order: {
|
||||
first: '-9999',
|
||||
last: '9999',
|
||||
none: '0',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
'3': '3',
|
||||
'4': '4',
|
||||
'5': '5',
|
||||
'6': '6',
|
||||
'7': '7',
|
||||
'8': '8',
|
||||
'9': '9',
|
||||
'10': '10',
|
||||
'11': '11',
|
||||
'12': '12',
|
||||
1: '1',
|
||||
2: '2',
|
||||
3: '3',
|
||||
4: '4',
|
||||
5: '5',
|
||||
6: '6',
|
||||
7: '7',
|
||||
8: '8',
|
||||
9: '9',
|
||||
10: '10',
|
||||
11: '11',
|
||||
12: '12',
|
||||
},
|
||||
padding: theme => theme('spacing'),
|
||||
placeholderColor: theme => theme('colors'),
|
||||
@@ -463,9 +452,9 @@ module.exports = {
|
||||
current: 'currentColor',
|
||||
}),
|
||||
strokeWidth: {
|
||||
'0': '0',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
0: '0',
|
||||
1: '1',
|
||||
2: '2',
|
||||
},
|
||||
textColor: theme => theme('colors'),
|
||||
width: theme => ({
|
||||
@@ -526,28 +515,28 @@ module.exports = {
|
||||
}),
|
||||
zIndex: {
|
||||
auto: 'auto',
|
||||
'0': '0',
|
||||
'10': '10',
|
||||
'20': '20',
|
||||
'30': '30',
|
||||
'40': '40',
|
||||
'50': '50',
|
||||
0: '0',
|
||||
10: '10',
|
||||
20: '20',
|
||||
30: '30',
|
||||
40: '40',
|
||||
50: '50',
|
||||
},
|
||||
gap: theme => theme('spacing'),
|
||||
gridTemplateColumns: {
|
||||
none: 'none',
|
||||
'1': 'repeat(1, minmax(0, 1fr))',
|
||||
'2': 'repeat(2, minmax(0, 1fr))',
|
||||
'3': 'repeat(3, minmax(0, 1fr))',
|
||||
'4': 'repeat(4, minmax(0, 1fr))',
|
||||
'5': 'repeat(5, minmax(0, 1fr))',
|
||||
'6': 'repeat(6, minmax(0, 1fr))',
|
||||
'7': 'repeat(7, minmax(0, 1fr))',
|
||||
'8': 'repeat(8, minmax(0, 1fr))',
|
||||
'9': 'repeat(9, minmax(0, 1fr))',
|
||||
'10': 'repeat(10, minmax(0, 1fr))',
|
||||
'11': 'repeat(11, minmax(0, 1fr))',
|
||||
'12': 'repeat(12, minmax(0, 1fr))',
|
||||
1: 'repeat(1, minmax(0, 1fr))',
|
||||
2: 'repeat(2, minmax(0, 1fr))',
|
||||
3: 'repeat(3, minmax(0, 1fr))',
|
||||
4: 'repeat(4, minmax(0, 1fr))',
|
||||
5: 'repeat(5, minmax(0, 1fr))',
|
||||
6: 'repeat(6, minmax(0, 1fr))',
|
||||
7: 'repeat(7, minmax(0, 1fr))',
|
||||
8: 'repeat(8, minmax(0, 1fr))',
|
||||
9: 'repeat(9, minmax(0, 1fr))',
|
||||
10: 'repeat(10, minmax(0, 1fr))',
|
||||
11: 'repeat(11, minmax(0, 1fr))',
|
||||
12: 'repeat(12, minmax(0, 1fr))',
|
||||
},
|
||||
gridColumn: {
|
||||
auto: 'auto',
|
||||
@@ -566,44 +555,44 @@ module.exports = {
|
||||
},
|
||||
gridColumnStart: {
|
||||
auto: 'auto',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
'3': '3',
|
||||
'4': '4',
|
||||
'5': '5',
|
||||
'6': '6',
|
||||
'7': '7',
|
||||
'8': '8',
|
||||
'9': '9',
|
||||
'10': '10',
|
||||
'11': '11',
|
||||
'12': '12',
|
||||
'13': '13',
|
||||
1: '1',
|
||||
2: '2',
|
||||
3: '3',
|
||||
4: '4',
|
||||
5: '5',
|
||||
6: '6',
|
||||
7: '7',
|
||||
8: '8',
|
||||
9: '9',
|
||||
10: '10',
|
||||
11: '11',
|
||||
12: '12',
|
||||
13: '13',
|
||||
},
|
||||
gridColumnEnd: {
|
||||
auto: 'auto',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
'3': '3',
|
||||
'4': '4',
|
||||
'5': '5',
|
||||
'6': '6',
|
||||
'7': '7',
|
||||
'8': '8',
|
||||
'9': '9',
|
||||
'10': '10',
|
||||
'11': '11',
|
||||
'12': '12',
|
||||
'13': '13',
|
||||
1: '1',
|
||||
2: '2',
|
||||
3: '3',
|
||||
4: '4',
|
||||
5: '5',
|
||||
6: '6',
|
||||
7: '7',
|
||||
8: '8',
|
||||
9: '9',
|
||||
10: '10',
|
||||
11: '11',
|
||||
12: '12',
|
||||
13: '13',
|
||||
},
|
||||
gridTemplateRows: {
|
||||
none: 'none',
|
||||
'1': 'repeat(1, minmax(0, 1fr))',
|
||||
'2': 'repeat(2, minmax(0, 1fr))',
|
||||
'3': 'repeat(3, minmax(0, 1fr))',
|
||||
'4': 'repeat(4, minmax(0, 1fr))',
|
||||
'5': 'repeat(5, minmax(0, 1fr))',
|
||||
'6': 'repeat(6, minmax(0, 1fr))',
|
||||
1: 'repeat(1, minmax(0, 1fr))',
|
||||
2: 'repeat(2, minmax(0, 1fr))',
|
||||
3: 'repeat(3, minmax(0, 1fr))',
|
||||
4: 'repeat(4, minmax(0, 1fr))',
|
||||
5: 'repeat(5, minmax(0, 1fr))',
|
||||
6: 'repeat(6, minmax(0, 1fr))',
|
||||
},
|
||||
gridRow: {
|
||||
auto: 'auto',
|
||||
@@ -616,23 +605,23 @@ module.exports = {
|
||||
},
|
||||
gridRowStart: {
|
||||
auto: 'auto',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
'3': '3',
|
||||
'4': '4',
|
||||
'5': '5',
|
||||
'6': '6',
|
||||
'7': '7',
|
||||
1: '1',
|
||||
2: '2',
|
||||
3: '3',
|
||||
4: '4',
|
||||
5: '5',
|
||||
6: '6',
|
||||
7: '7',
|
||||
},
|
||||
gridRowEnd: {
|
||||
auto: 'auto',
|
||||
'1': '1',
|
||||
'2': '2',
|
||||
'3': '3',
|
||||
'4': '4',
|
||||
'5': '5',
|
||||
'6': '6',
|
||||
'7': '7',
|
||||
1: '1',
|
||||
2: '2',
|
||||
3: '3',
|
||||
4: '4',
|
||||
5: '5',
|
||||
6: '6',
|
||||
7: '7',
|
||||
},
|
||||
transformOrigin: {
|
||||
center: 'center',
|
||||
@@ -646,25 +635,25 @@ module.exports = {
|
||||
'top-left': 'top left',
|
||||
},
|
||||
scale: {
|
||||
'0': '0',
|
||||
'50': '.5',
|
||||
'75': '.75',
|
||||
'90': '.9',
|
||||
'95': '.95',
|
||||
'100': '1',
|
||||
'105': '1.05',
|
||||
'110': '1.1',
|
||||
'125': '1.25',
|
||||
'150': '1.5',
|
||||
0: '0',
|
||||
50: '.5',
|
||||
75: '.75',
|
||||
90: '.9',
|
||||
95: '.95',
|
||||
100: '1',
|
||||
105: '1.05',
|
||||
110: '1.1',
|
||||
125: '1.25',
|
||||
150: '1.5',
|
||||
},
|
||||
rotate: {
|
||||
'-180': '-180deg',
|
||||
'-90': '-90deg',
|
||||
'-45': '-45deg',
|
||||
'0': '0',
|
||||
'45': '45deg',
|
||||
'90': '90deg',
|
||||
'180': '180deg',
|
||||
0: '0',
|
||||
45: '45deg',
|
||||
90: '90deg',
|
||||
180: '180deg',
|
||||
},
|
||||
translate: (theme, { negative }) => ({
|
||||
...theme('spacing'),
|
||||
@@ -678,10 +667,10 @@ module.exports = {
|
||||
'-12': '-12deg',
|
||||
'-6': '-6deg',
|
||||
'-3': '-3deg',
|
||||
'0': '0',
|
||||
'3': '3deg',
|
||||
'6': '6deg',
|
||||
'12': '12deg',
|
||||
0: '0',
|
||||
3: '3deg',
|
||||
6: '6deg',
|
||||
12: '12deg',
|
||||
},
|
||||
transitionProperty: {
|
||||
none: 'none',
|
||||
@@ -701,14 +690,14 @@ module.exports = {
|
||||
'in-out': 'cubic-bezier(0.4, 0, 0.2, 1)',
|
||||
},
|
||||
transitionDuration: {
|
||||
'75': '75ms',
|
||||
'100': '100ms',
|
||||
'150': '150ms',
|
||||
'200': '200ms',
|
||||
'300': '300ms',
|
||||
'500': '500ms',
|
||||
'700': '700ms',
|
||||
'1000': '1000ms',
|
||||
75: '75ms',
|
||||
100: '100ms',
|
||||
150: '150ms',
|
||||
200: '200ms',
|
||||
300: '300ms',
|
||||
500: '500ms',
|
||||
700: '700ms',
|
||||
1000: '1000ms',
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
@@ -718,26 +707,12 @@ module.exports = {
|
||||
alignSelf: ['responsive'],
|
||||
appearance: ['responsive'],
|
||||
backgroundAttachment: ['responsive'],
|
||||
backgroundColor: [
|
||||
'responsive',
|
||||
'hover',
|
||||
'focus',
|
||||
'active',
|
||||
'group-focus',
|
||||
'group-hover',
|
||||
],
|
||||
backgroundColor: ['responsive', 'hover', 'focus', 'active', 'group-focus', 'group-hover'],
|
||||
backgroundPosition: ['responsive'],
|
||||
backgroundRepeat: ['responsive'],
|
||||
backgroundSize: ['responsive'],
|
||||
borderCollapse: ['responsive'],
|
||||
borderColor: [
|
||||
'responsive',
|
||||
'hover',
|
||||
'focus',
|
||||
'active',
|
||||
'group-focus',
|
||||
'group-hover',
|
||||
],
|
||||
borderColor: ['responsive', 'hover', 'focus', 'active', 'group-focus', 'group-hover'],
|
||||
borderRadius: ['responsive', 'focus', 'first', 'last'],
|
||||
borderStyle: ['responsive', 'focus'],
|
||||
borderWidth: ['responsive', 'focus', 'first', 'last'],
|
||||
|
||||
@@ -44,9 +44,7 @@ export default async function addExtension(packageName, version) {
|
||||
.run()
|
||||
.then(ctx => {
|
||||
console.log(
|
||||
`${chalk.green.bold(
|
||||
`Added ohif-extension ${packageName}@${ctx.yarnInfo.version}`
|
||||
)} `
|
||||
`${chalk.green.bold(`Added ohif-extension ${packageName}@${ctx.yarnInfo.version}`)} `
|
||||
);
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
@@ -28,9 +28,7 @@ export default async function addExtensions(ohifExtensions) {
|
||||
extensonsString += ` ${packageName}@${version}`;
|
||||
});
|
||||
|
||||
console.log(
|
||||
`${chalk.green.bold(`Extensions added:${extensonsString}`)} `
|
||||
);
|
||||
console.log(`${chalk.green.bold(`Extensions added:${extensonsString}`)} `);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message);
|
||||
|
||||
@@ -39,9 +39,7 @@ export default async function addMode(packageName, version) {
|
||||
{
|
||||
title: 'Detecting required ohif-extensions...',
|
||||
task: async ctx => {
|
||||
ctx.ohifExtensions = await findRequiredOhifExtensionsForMode(
|
||||
ctx.yarnInfo
|
||||
);
|
||||
ctx.ohifExtensions = await findRequiredOhifExtensionsForMode(ctx.yarnInfo);
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -53,11 +51,7 @@ export default async function addMode(packageName, version) {
|
||||
await tasks
|
||||
.run()
|
||||
.then(async ctx => {
|
||||
console.log(
|
||||
`${chalk.green.bold(
|
||||
`Added ohif-mode ${packageName}@${ctx.yarnInfo.version}`
|
||||
)} `
|
||||
);
|
||||
console.log(`${chalk.green.bold(`Added ohif-mode ${packageName}@${ctx.yarnInfo.version}`)} `);
|
||||
|
||||
const ohifExtensions = ctx.ohifExtensions;
|
||||
|
||||
|
||||
@@ -28,11 +28,7 @@ const createPackage = async options => {
|
||||
{
|
||||
title: 'Copying template files',
|
||||
task: () =>
|
||||
createDirectoryContents(
|
||||
options.templateDir,
|
||||
options.targetDir,
|
||||
options.prettier
|
||||
),
|
||||
createDirectoryContents(options.templateDir, options.targetDir, options.prettier),
|
||||
},
|
||||
{
|
||||
title: 'Editing Package.json with provided information',
|
||||
@@ -59,36 +55,20 @@ const createPackage = async options => {
|
||||
|
||||
await tasks.run();
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.green(`Done: ${packageType} is ready at`, options.targetDir)
|
||||
);
|
||||
console.log(chalk.green(`Done: ${packageType} is ready at`, options.targetDir));
|
||||
console.log();
|
||||
|
||||
console.log(
|
||||
chalk.green(`NOTE: In order to use this ${packageType} for development,`)
|
||||
);
|
||||
console.log(
|
||||
chalk.green(
|
||||
`run the following command inside the root of the OHIF monorepo`
|
||||
)
|
||||
);
|
||||
console.log(chalk.green(`NOTE: In order to use this ${packageType} for development,`));
|
||||
console.log(chalk.green(`run the following command inside the root of the OHIF monorepo`));
|
||||
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.green.bold(
|
||||
` yarn run cli link-${packageType} ${options.targetDir}`
|
||||
)
|
||||
);
|
||||
console.log(chalk.green.bold(` yarn run cli link-${packageType} ${options.targetDir}`));
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
"and when you don't need it anymore, run the following command to unlink it"
|
||||
)
|
||||
chalk.yellow("and when you don't need it anymore, run the following command to unlink it")
|
||||
);
|
||||
console.log();
|
||||
console.log(
|
||||
chalk.yellow(` yarn run cli unlink-${packageType} ${options.name}`)
|
||||
);
|
||||
console.log(chalk.yellow(` yarn run cli unlink-${packageType} ${options.name}`));
|
||||
console.log();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2,11 +2,7 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { execa } from 'execa';
|
||||
import { keywords } from './enums/index.js';
|
||||
import {
|
||||
validateYarn,
|
||||
addExtensionToConfig,
|
||||
addModeToConfig,
|
||||
} from './utils/index.js';
|
||||
import { validateYarn, addExtensionToConfig, addModeToConfig } from './utils/index.js';
|
||||
|
||||
async function linkPackage(packageDir, options, addToConfig, keyword) {
|
||||
const { viewerDirectory } = options;
|
||||
@@ -43,11 +39,7 @@ async function linkPackage(packageDir, options, addToConfig, keyword) {
|
||||
|
||||
// Add the node_modules of the linked package so that webpack
|
||||
// can find the linked package externals if there are
|
||||
const webpackPwaPath = path.join(
|
||||
viewerDirectory,
|
||||
'.webpack',
|
||||
'webpack.pwa.js'
|
||||
);
|
||||
const webpackPwaPath = path.join(viewerDirectory, '.webpack', 'webpack.pwa.js');
|
||||
|
||||
async function updateWebpackConfig(webpackConfigPath, packageDir) {
|
||||
const packageNodeModules = path.join(packageDir, 'node_modules');
|
||||
|
||||
@@ -19,8 +19,7 @@ export default async function removeExtension(packageName) {
|
||||
},
|
||||
{
|
||||
title: `Checking if ${packageName} is in use by an installed mode`,
|
||||
task: async () =>
|
||||
await throwIfExtensionUsedByInstalledMode(packageName),
|
||||
task: async () => await throwIfExtensionUsedByInstalledMode(packageName),
|
||||
},
|
||||
{
|
||||
title: `Uninstalling npm package: ${packageName}`,
|
||||
@@ -39,9 +38,7 @@ export default async function removeExtension(packageName) {
|
||||
await tasks
|
||||
.run()
|
||||
.then(() => {
|
||||
console.log(
|
||||
`${chalk.green.bold(`Removed ohif-extension ${packageName}`)} `
|
||||
);
|
||||
console.log(`${chalk.green.bold(`Removed ohif-extension ${packageName}`)} `);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message);
|
||||
|
||||
@@ -28,9 +28,7 @@ export default async function removeExtensions(ohifExtensionsToRemove) {
|
||||
extensonsString += ` ${packageName}`;
|
||||
});
|
||||
|
||||
console.log(
|
||||
`${chalk.green.bold(`Extensions removed:${extensonsString}`)} `
|
||||
);
|
||||
console.log(`${chalk.green.bold(`Extensions removed:${extensonsString}`)} `);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.message);
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { execa } from 'execa';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import {
|
||||
validateYarn,
|
||||
removeExtensionFromConfig,
|
||||
removeModeFromConfig,
|
||||
} from './utils/index.js';
|
||||
import { validateYarn, removeExtensionFromConfig, removeModeFromConfig } from './utils/index.js';
|
||||
|
||||
const linkPackage = async (packageName, options, removeFromConfig) => {
|
||||
const { viewerDirectory } = options;
|
||||
@@ -19,11 +15,7 @@ const linkPackage = async (packageName, options, removeFromConfig) => {
|
||||
const results = await execa(`yarn`, ['unlink', packageName]);
|
||||
console.log(results.stdout);
|
||||
|
||||
const webpackPwaPath = path.join(
|
||||
viewerDirectory,
|
||||
'.webpack',
|
||||
'webpack.pwa.js'
|
||||
);
|
||||
const webpackPwaPath = path.join(viewerDirectory, '.webpack', 'webpack.pwa.js');
|
||||
|
||||
await removePathFromWebpackConfig(webpackPwaPath, packageName);
|
||||
|
||||
@@ -58,8 +50,7 @@ async function removePathFromWebpackConfig(webpackConfigPath, packageName) {
|
||||
endIndex++;
|
||||
}
|
||||
|
||||
const modifiedFileContent =
|
||||
fileContent.slice(0, startIndex) + fileContent.slice(endIndex);
|
||||
const modifiedFileContent = fileContent.slice(0, startIndex) + fileContent.slice(endIndex);
|
||||
|
||||
await fs.promises.writeFile(webpackConfigPath, modifiedFileContent);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import fs from 'fs';
|
||||
|
||||
// https://github.dev/leoroese/template-cli/blob/628dd24db7df399ebb520edd0bc301bc7b5e8b66/index.js#L19
|
||||
const createDirectoryContents = (
|
||||
templatePath,
|
||||
targetDirPath,
|
||||
copyPrettierRules
|
||||
) => {
|
||||
const createDirectoryContents = (templatePath, targetDirPath, copyPrettierRules) => {
|
||||
const filesToCreate = fs.readdirSync(templatePath);
|
||||
|
||||
filesToCreate.forEach(file => {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { readPluginConfigFile } from './private/index.js';
|
||||
import getYarnInfo from './getYarnInfo.js';
|
||||
|
||||
export default async function findOhifExtensionsToRemoveAfterRemovingMode(
|
||||
removedModeYarnInfo
|
||||
) {
|
||||
export default async function findOhifExtensionsToRemoveAfterRemovingMode(removedModeYarnInfo) {
|
||||
const pluginConfig = readPluginConfigFile();
|
||||
|
||||
if (!pluginConfig) {
|
||||
@@ -13,27 +11,21 @@ export default async function findOhifExtensionsToRemoveAfterRemovingMode(
|
||||
|
||||
const { modes, extensions } = pluginConfig;
|
||||
|
||||
const registeredExtensions = extensions.map(
|
||||
extension => extension.packageName
|
||||
);
|
||||
const registeredExtensions = extensions.map(extension => extension.packageName);
|
||||
// TODO this is not a function
|
||||
const ohifExtensionsOfMode = Object.keys(
|
||||
removedModeYarnInfo.peerDependencies
|
||||
).filter(peerDependency => registeredExtensions.includes(peerDependency));
|
||||
|
||||
const ohifExtensionsUsedInOtherModes = ohifExtensionsOfMode.map(
|
||||
packageName => {
|
||||
return {
|
||||
packageName,
|
||||
used: false,
|
||||
};
|
||||
}
|
||||
const ohifExtensionsOfMode = Object.keys(removedModeYarnInfo.peerDependencies).filter(
|
||||
peerDependency => registeredExtensions.includes(peerDependency)
|
||||
);
|
||||
|
||||
const ohifExtensionsUsedInOtherModes = ohifExtensionsOfMode.map(packageName => {
|
||||
return {
|
||||
packageName,
|
||||
used: false,
|
||||
};
|
||||
});
|
||||
|
||||
// Check if other modes use each extension used by this mode
|
||||
const otherModes = modes.filter(
|
||||
mode => mode.packageName !== removedModeYarnInfo.name
|
||||
);
|
||||
const otherModes = modes.filter(mode => mode.packageName !== removedModeYarnInfo.name);
|
||||
|
||||
for (let i = 0; i < otherModes.length; i++) {
|
||||
const mode = otherModes[i];
|
||||
|
||||
@@ -10,10 +10,7 @@ import {
|
||||
import getYarnInfo from './getYarnInfo.js';
|
||||
import { addExtensionToConfig, addModeToConfig } from './addToConfig.js';
|
||||
import findRequiredOhifExtensionsForMode from './findRequiredOhifExtensionsForMode.js';
|
||||
import {
|
||||
removeExtensionFromConfig,
|
||||
removeModeFromConfig,
|
||||
} from './removeFromConfig.js';
|
||||
import { removeExtensionFromConfig, removeModeFromConfig } from './removeFromConfig.js';
|
||||
import throwIfExtensionUsedByInstalledMode from './throwIfExtensionUsedByInstalledMode.js';
|
||||
import findOhifExtensionsToRemoveAfterRemovingMode from './findOhifExtensionsToRemoveAfterRemovingMode.js';
|
||||
import initGit from './initGit.js';
|
||||
|
||||
@@ -17,9 +17,7 @@ function removeModeFromConfigJson(pluginConfig, { packageName }) {
|
||||
function removeFromList(listName, pluginConfig, { packageName }) {
|
||||
const list = pluginConfig[listName];
|
||||
|
||||
const indexOfExistingEntry = list.findIndex(
|
||||
entry => entry.packageName === packageName
|
||||
);
|
||||
const indexOfExistingEntry = list.findIndex(entry => entry.packageName === packageName);
|
||||
|
||||
if (indexOfExistingEntry !== -1) {
|
||||
pluginConfig[listName].splice(indexOfExistingEntry, 1);
|
||||
|
||||
@@ -25,9 +25,7 @@ async function validateExtensionYarnInfo(packageName) {
|
||||
function validateYarnInfo(packageName, keyword) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
function rejectIfNotFound() {
|
||||
const error = new Error(
|
||||
`${chalk.red.bold('Error')} extension ${packageName} not installed`
|
||||
);
|
||||
const error = new Error(`${chalk.red.bold('Error')} extension ${packageName} not installed`);
|
||||
reject(error);
|
||||
}
|
||||
|
||||
@@ -116,16 +114,11 @@ function validate(packageName, version, keyword) {
|
||||
Authorization: `Bearer ${process.env.NPM_TOKEN}`,
|
||||
};
|
||||
}
|
||||
const response = await fetch(
|
||||
`${registryUrlOfPackage}${packageName}`,
|
||||
options
|
||||
);
|
||||
const response = await fetch(`${registryUrlOfPackage}${packageName}`, options);
|
||||
const json = await response.json();
|
||||
|
||||
if (json.error && json.error === NOT_FOUND) {
|
||||
const error = new Error(
|
||||
`${chalk.red.bold('Error')} package ${packageName} not found`
|
||||
);
|
||||
const error = new Error(`${chalk.red.bold('Error')} package ${packageName} not found`);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
@@ -142,27 +135,18 @@ function validate(packageName, version, keyword) {
|
||||
resolve(true);
|
||||
} else {
|
||||
const error = new Error(
|
||||
`${chalk.red.bold(
|
||||
'Error'
|
||||
)} package ${packageName} is not an ${keyword}`
|
||||
`${chalk.red.bold('Error')} package ${packageName} is not an ${keyword}`
|
||||
);
|
||||
reject(error);
|
||||
}
|
||||
} else {
|
||||
// Particular version undefined
|
||||
const error = new Error(
|
||||
`${chalk.red.bold(
|
||||
'Error'
|
||||
)} version ${packageVersion} of package ${packageName} not found`
|
||||
`${chalk.red.bold('Error')} version ${packageVersion} of package ${packageName} not found`
|
||||
);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
validateMode,
|
||||
validateExtension,
|
||||
validateModeYarnInfo,
|
||||
validateExtensionYarnInfo,
|
||||
};
|
||||
export { validateMode, validateExtension, validateModeYarnInfo, validateExtensionYarnInfo };
|
||||
@@ -32,15 +32,11 @@ try {
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
if (packageJson.name !== 'ohif-monorepo-root') {
|
||||
console.log(packageJson);
|
||||
console.log(
|
||||
chalk.red('ohif-cli must run from the root of the OHIF platform')
|
||||
);
|
||||
console.log(chalk.red('ohif-cli must run from the root of the OHIF platform'));
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(
|
||||
chalk.red('ohif-cli must run from the root of the OHIF platform')
|
||||
);
|
||||
console.log(chalk.red('ohif-cli must run from the root of the OHIF platform'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -142,15 +138,11 @@ program
|
||||
|
||||
program
|
||||
.command('link-extension <packageDir>')
|
||||
.description(
|
||||
'Links a local OHIF Extension to the Viewer to be used for development'
|
||||
)
|
||||
.description('Links a local OHIF Extension to the Viewer to be used for development')
|
||||
.action(packageDir => {
|
||||
if (!fs.existsSync(packageDir)) {
|
||||
console.log(
|
||||
chalk.red(
|
||||
'The Extension directory does not exist, please provide a valid directory'
|
||||
)
|
||||
chalk.red('The Extension directory does not exist, please provide a valid directory')
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -171,16 +163,10 @@ program
|
||||
|
||||
program
|
||||
.command('link-mode <packageDir>')
|
||||
.description(
|
||||
'Links a local OHIF Mode to the Viewer to be used for development'
|
||||
)
|
||||
.description('Links a local OHIF Mode to the Viewer to be used for development')
|
||||
.action(packageDir => {
|
||||
if (!fs.existsSync(packageDir)) {
|
||||
console.log(
|
||||
chalk.red(
|
||||
'The Mode directory does not exist, please provide a valid directory'
|
||||
)
|
||||
);
|
||||
console.log(chalk.red('The Mode directory does not exist, please provide a valid directory'));
|
||||
process.exit(1);
|
||||
}
|
||||
linkMode(packageDir, { viewerDirectory });
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"plugins": ["prettier-plugin-tailwindcss"],
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 80,
|
||||
"printWidth": 100,
|
||||
"proseWrap": "always",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
"singleQuote": true,
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
@@ -16,44 +16,28 @@ export default {
|
||||
* (e.g. cornerstone, cornerstoneTools, ...) or registering any services that
|
||||
* this extension is providing.
|
||||
*/
|
||||
preRegistration: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
configuration = {},
|
||||
}) => {},
|
||||
preRegistration: ({ servicesManager, commandsManager, configuration = {} }) => {},
|
||||
/**
|
||||
* PanelModule should provide a list of panels that will be available in OHIF
|
||||
* for Modes to consume and render. Each panel is defined by a {name,
|
||||
* iconName, iconLabel, label, component} object. Example of a panel module
|
||||
* is the StudyBrowserPanel that is provided by the default extension in OHIF.
|
||||
*/
|
||||
getPanelModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getPanelModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* ViewportModule should provide a list of viewports that will be available in OHIF
|
||||
* for Modes to consume and use in the viewports. Each viewport is defined by
|
||||
* {name, component} object. Example of a viewport module is the CornerstoneViewport
|
||||
* that is provided by the Cornerstone extension in OHIF.
|
||||
*/
|
||||
getViewportModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getViewportModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* ToolbarModule should provide a list of tool buttons that will be available in OHIF
|
||||
* for Modes to consume and use in the toolbar. Each tool button is defined by
|
||||
* {name, defaultComponent, clickHandler }. Examples include radioGroupIcons and
|
||||
* splitButton toolButton that the default extension is providing.
|
||||
*/
|
||||
getToolbarModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getToolbarModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* LayoutTemplateMOdule should provide a list of layout templates that will be
|
||||
* available in OHIF for Modes to consume and use to layout the viewer.
|
||||
@@ -62,22 +46,14 @@ export default {
|
||||
* a Header, left and right sidebars, and a viewport section in the middle
|
||||
* of the viewer.
|
||||
*/
|
||||
getLayoutTemplateModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getLayoutTemplateModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* SopClassHandlerModule should provide a list of sop class handlers that will be
|
||||
* available in OHIF for Modes to consume and use to create displaySets from Series.
|
||||
* Each sop class handler is defined by a { name, sopClassUids, getDisplaySetsFromSeries}.
|
||||
* Examples include the default sop class handler provided by the default extension
|
||||
*/
|
||||
getSopClassHandlerModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getSopClassHandlerModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* HangingProtocolModule should provide a list of hanging protocols that will be
|
||||
* available in OHIF for Modes to use to decide on the structure of the viewports
|
||||
@@ -85,11 +61,7 @@ export default {
|
||||
* { name, protocols}. Examples include the default hanging protocol provided by
|
||||
* the default extension that shows 2x2 viewports.
|
||||
*/
|
||||
getHangingProtocolModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getHangingProtocolModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* CommandsModule should provide a list of commands that will be available in OHIF
|
||||
* for Modes to consume and use in the viewports. Each command is defined by
|
||||
@@ -97,30 +69,18 @@ export default {
|
||||
* object of functions, definitions is an object of available commands, their
|
||||
* options, and defaultContext is the default context for the command to run against.
|
||||
*/
|
||||
getCommandsModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getCommandsModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* ContextModule should provide a list of context that will be available in OHIF
|
||||
* and will be provided to the Modes. A context is a state that is shared OHIF.
|
||||
* Context is defined by an object of { name, context, provider }. Examples include
|
||||
* the measurementTracking context provided by the measurementTracking extension.
|
||||
*/
|
||||
getContextModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getContextModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
/**
|
||||
* DataSourceModule should provide a list of data sources to be used in OHIF.
|
||||
* DataSources can be used to map the external data formats to the OHIF's
|
||||
* native format. DataSources are defined by an object of { name, type, createDataSource }.
|
||||
*/
|
||||
getDataSourcesModule: ({
|
||||
servicesManager,
|
||||
commandsManager,
|
||||
extensionManager,
|
||||
}) => {},
|
||||
getDataSourcesModule: ({ servicesManager, commandsManager, extensionManager }) => {},
|
||||
};
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"plugins": ["prettier-plugin-tailwindcss"],
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 80,
|
||||
"printWidth": 100,
|
||||
"proseWrap": "always",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
"singleQuote": true,
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
modules: 'commonjs',
|
||||
debug: false,
|
||||
},
|
||||
"@babel/preset-typescript",
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
'@babel/preset-react',
|
||||
],
|
||||
@@ -26,7 +26,7 @@ module.exports = {
|
||||
// WebPack handles ES6 --> Target Syntax
|
||||
['@babel/preset-env', { modules: false }],
|
||||
'@babel/preset-react',
|
||||
"@babel/preset-typescript",
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
|
||||
},
|
||||
@@ -35,7 +35,7 @@ module.exports = {
|
||||
// WebPack handles ES6 --> Target Syntax
|
||||
['@babel/preset-env', { modules: false }],
|
||||
'@babel/preset-react',
|
||||
"@babel/preset-typescript",
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
plugins: ['react-hot-loader/babel'],
|
||||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
|
||||
|
||||
@@ -41,11 +41,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
* Services and other resources.
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
const {
|
||||
measurementService,
|
||||
toolbarService,
|
||||
toolGroupService,
|
||||
} = servicesManager.services;
|
||||
const { measurementService, toolbarService, toolGroupService } = servicesManager.services;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"files": [
|
||||
"README.md"
|
||||
],
|
||||
"files": ["README.md"],
|
||||
"imageSize": 100,
|
||||
"commit": false,
|
||||
"contributors": [
|
||||
@@ -10,83 +8,63 @@
|
||||
"name": "Erik Ziegler",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/607793?v=4",
|
||||
"profile": "https://github.com/swederik",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "evren217",
|
||||
"name": "Evren Ozkan",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/4920551?v=4",
|
||||
"profile": "https://github.com/evren217",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "galelis",
|
||||
"name": "Gustavo André Lelis",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/2378326?v=4",
|
||||
"profile": "https://github.com/galelis",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "dannyrb",
|
||||
"name": "Danny Brown",
|
||||
"avatar_url": "https://avatars1.githubusercontent.com/u/5797588?v=4",
|
||||
"profile": "http://dannyrb.com/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "allcontributors",
|
||||
"name": "allcontributors[bot]",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/46843839?v=4",
|
||||
"profile": "https://github.com/all-contributors/all-contributors-bot",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
"contributions": ["doc"]
|
||||
},
|
||||
{
|
||||
"login": "ivan-aksamentov",
|
||||
"name": "Ivan Aksamentov",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/9403403?v=4",
|
||||
"profile": "https://github.com/ivan-aksamentov",
|
||||
"contributions": [
|
||||
"code",
|
||||
"test"
|
||||
]
|
||||
"contributions": ["code", "test"]
|
||||
},
|
||||
{
|
||||
"login": "igoroctaviano",
|
||||
"name": "Igor Octaviano",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/13886933?v=4",
|
||||
"profile": "http://igoroctaviano.com",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
},
|
||||
{
|
||||
"login": "dlwire",
|
||||
"name": "David Wire",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/1167291?v=4",
|
||||
"profile": "https://github.com/dlwire",
|
||||
"contributions": [
|
||||
"code",
|
||||
"test"
|
||||
]
|
||||
"contributions": ["code", "test"]
|
||||
},
|
||||
{
|
||||
"login": "pavertomato",
|
||||
"name": "Egor Lezhnin",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/878990?v=4",
|
||||
"profile": "http://egor.lezhn.in",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
"contributions": ["code"]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -3,12 +3,10 @@ const webpackCommon = require('./../../../.webpack/webpack.base.js');
|
||||
const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
|
||||
};
|
||||
@@ -36,11 +36,6 @@ module.exports = (env, argv) => {
|
||||
libraryTarget: 'umd',
|
||||
filename: pkg.main,
|
||||
},
|
||||
externals: [
|
||||
/\b(vtk.js)/,
|
||||
/\b(dcmjs)/,
|
||||
/\b(gl-matrix)/,
|
||||
/^@cornerstonejs/,
|
||||
],
|
||||
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@cornerstonejs/],
|
||||
});
|
||||
};
|
||||
@@ -1 +1 @@
|
||||
module.exports = require("../../babel.config.js");
|
||||
module.exports = require('../../babel.config.js');
|
||||
@@ -26,9 +26,7 @@ describe('getAttribute', () => {
|
||||
|
||||
expect(getAttribute(nullElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getAttribute(undefinedElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getAttribute(noValuePresentElement, defaultValue)).toEqual(
|
||||
defaultValue
|
||||
);
|
||||
expect(getAttribute(noValuePresentElement, defaultValue)).toEqual(defaultValue);
|
||||
});
|
||||
|
||||
it('should return 48 for element with value 0', () => {
|
||||
|
||||
@@ -28,9 +28,7 @@ describe('getAuthorizationHeader', () => {
|
||||
};
|
||||
|
||||
const expectedAuthorizationHeader = {
|
||||
Authorization: `Basic ${btoa(
|
||||
validServerWithoutPassword.requestOptions.auth
|
||||
)}`,
|
||||
Authorization: `Basic ${btoa(validServerWithoutPassword.requestOptions.auth)}`,
|
||||
};
|
||||
|
||||
const authentication = getAuthorizationHeader(validServerWithoutPassword);
|
||||
|
||||
@@ -23,9 +23,7 @@ describe('getModalities', () => {
|
||||
vr: 'MOCKED_VALUE',
|
||||
};
|
||||
|
||||
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(
|
||||
ModalitiesInStudy
|
||||
);
|
||||
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(ModalitiesInStudy);
|
||||
});
|
||||
|
||||
test('should return only the modalitues that exists in ModalitiesInStudy', () => {
|
||||
@@ -67,8 +65,6 @@ describe('getModalities', () => {
|
||||
vr: 'ANOTHER_VR',
|
||||
};
|
||||
|
||||
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(
|
||||
ModalitiesInStudy
|
||||
);
|
||||
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(ModalitiesInStudy);
|
||||
});
|
||||
});
|
||||
@@ -32,12 +32,7 @@ describe('getName', () => {
|
||||
it('should return A for element when Alphabetic is [A, B, C, D]', () => {
|
||||
const returnValue = 'A';
|
||||
const element = {
|
||||
Value: [
|
||||
{ Alphabetic: 'A' },
|
||||
{ Alphabetic: 'B' },
|
||||
{ Alphabetic: 'C' },
|
||||
{ Alphabetic: 'D' },
|
||||
],
|
||||
Value: [{ Alphabetic: 'A' }, { Alphabetic: 'B' }, { Alphabetic: 'C' }, { Alphabetic: 'D' }],
|
||||
};
|
||||
expect(getName(element, null)).toEqual(returnValue);
|
||||
});
|
||||
|
||||
@@ -26,9 +26,7 @@ describe('getNumber', () => {
|
||||
|
||||
expect(getNumber(nullElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getNumber(undefinedElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getNumber(noValuePresentElement, defaultValue)).toEqual(
|
||||
defaultValue
|
||||
);
|
||||
expect(getNumber(noValuePresentElement, defaultValue)).toEqual(defaultValue);
|
||||
});
|
||||
|
||||
it('should return 2.0 for element when element.Value[0] = 2', () => {
|
||||
|
||||
@@ -26,9 +26,7 @@ describe('getString', () => {
|
||||
|
||||
expect(getString(nullElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getString(undefinedElement, defaultValue)).toEqual(defaultValue);
|
||||
expect(getString(noValuePresentElement, defaultValue)).toEqual(
|
||||
defaultValue
|
||||
);
|
||||
expect(getString(noValuePresentElement, defaultValue)).toEqual(defaultValue);
|
||||
});
|
||||
|
||||
it('should return A,B,C,D for element when element.Value[0] = [A, B, C, D]', () => {
|
||||
|
||||
@@ -14,13 +14,6 @@ const DICOMWeb = {
|
||||
getString,
|
||||
};
|
||||
|
||||
export {
|
||||
getAttribute,
|
||||
getAuthorizationHeader,
|
||||
getModalities,
|
||||
getName,
|
||||
getNumber,
|
||||
getString,
|
||||
};
|
||||
export { getAttribute, getAuthorizationHeader, getModalities, getName, getNumber, getString };
|
||||
|
||||
export default DICOMWeb;
|
||||
@@ -1,9 +1,9 @@
|
||||
// import { api } from 'dicomweb-client'
|
||||
|
||||
const api = {
|
||||
DICOMwebClient: jest.fn().mockImplementation(function() {
|
||||
DICOMwebClient: jest.fn().mockImplementation(function () {
|
||||
this.retrieveStudyMetadata = jest.fn().mockResolvedValue([]);
|
||||
this.retrieveSeriesMetadata = jest.fn(function(options) {
|
||||
this.retrieveSeriesMetadata = jest.fn(function (options) {
|
||||
const { studyInstanceUID, seriesInstanceUID } = options;
|
||||
return Promise.resolve([{ studyInstanceUID, seriesInstanceUID }]);
|
||||
});
|
||||
|
||||
@@ -94,10 +94,7 @@ describe('CommandsManager', () => {
|
||||
|
||||
describe('getCommand()', () => {
|
||||
it('returns undefined if context does not exist', () => {
|
||||
const result = commandsManager.getCommand(
|
||||
'TestCommand',
|
||||
'NonExistentContext'
|
||||
);
|
||||
const result = commandsManager.getCommand('TestCommand', 'NonExistentContext');
|
||||
|
||||
expect(result).toBe(undefined);
|
||||
});
|
||||
@@ -131,9 +128,7 @@ describe('CommandsManager', () => {
|
||||
|
||||
describe('runCommand()', () => {
|
||||
it('Logs a warning if commandName not found in context', () => {
|
||||
const result = commandsManager.runCommand(
|
||||
'CommandThatDoesNotExistInAnyContext'
|
||||
);
|
||||
const result = commandsManager.runCommand('CommandThatDoesNotExistInAnyContext');
|
||||
|
||||
expect(result).toBe(undefined);
|
||||
expect(log.warn.mock.calls[0][0]).toEqual(
|
||||
@@ -149,16 +144,8 @@ describe('CommandsManager', () => {
|
||||
};
|
||||
|
||||
commandsManager.createContext(contextName);
|
||||
commandsManager.registerCommand(
|
||||
contextName,
|
||||
'TestCommand',
|
||||
commandWithNoCommmandFn
|
||||
);
|
||||
const result = commandsManager.runCommand(
|
||||
'TestCommand',
|
||||
null,
|
||||
contextName
|
||||
);
|
||||
commandsManager.registerCommand(contextName, 'TestCommand', commandWithNoCommmandFn);
|
||||
const result = commandsManager.runCommand('TestCommand', null, contextName);
|
||||
|
||||
expect(result).toBe(undefined);
|
||||
expect(log.warn.mock.calls[0][0]).toEqual(
|
||||
@@ -192,9 +179,7 @@ describe('CommandsManager', () => {
|
||||
commandsManager.runCommand('TestCommand', runCommandOptions, 'VIEWER');
|
||||
|
||||
expect(command.commandFn.mock.calls.length).toBe(1);
|
||||
expect(command.commandFn.mock.calls[0][0].test).toEqual(
|
||||
runCommandOptions.test
|
||||
);
|
||||
expect(command.commandFn.mock.calls[0][0].test).toEqual(runCommandOptions.test);
|
||||
});
|
||||
|
||||
it('Returns the result of commandFn', () => {
|
||||
|
||||
@@ -181,30 +181,27 @@ export class CommandsManager {
|
||||
const commands =
|
||||
(Array.isArray(toRun) && toRun) ||
|
||||
((toRun as Command).commandName && [toRun]) ||
|
||||
(Array.isArray((toRun as Commands).commands) &&
|
||||
(toRun as Commands).commands);
|
||||
(Array.isArray((toRun as Commands).commands) && (toRun as Commands).commands);
|
||||
if (!commands) {
|
||||
console.log("Command isn't runnable", toRun);
|
||||
return;
|
||||
}
|
||||
|
||||
let result;
|
||||
(commands as Command[]).forEach(
|
||||
({ commandName, commandOptions, context }) => {
|
||||
if (commandName) {
|
||||
result = this.runCommand(
|
||||
commandName,
|
||||
{
|
||||
...commandOptions,
|
||||
...options,
|
||||
},
|
||||
context
|
||||
);
|
||||
} else {
|
||||
console.warn('No command name supplied in', toRun);
|
||||
}
|
||||
(commands as Command[]).forEach(({ commandName, commandOptions, context }) => {
|
||||
if (commandName) {
|
||||
result = this.runCommand(
|
||||
commandName,
|
||||
{
|
||||
...commandOptions,
|
||||
...options,
|
||||
},
|
||||
context
|
||||
);
|
||||
} else {
|
||||
console.warn('No command name supplied in', toRun);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,7 @@ describe('HotkeysManager', () => {
|
||||
});
|
||||
it('has expected properties', () => {
|
||||
const allProperties = Object.keys(hotkeysManager);
|
||||
const expectedProperties = [
|
||||
'hotkeyDefinitions',
|
||||
'hotkeyDefaults',
|
||||
'isEnabled',
|
||||
];
|
||||
const expectedProperties = ['hotkeyDefinitions', 'hotkeyDefaults', 'isEnabled'];
|
||||
|
||||
const containsAllExpectedProperties = expectedProperties.every(expected =>
|
||||
allProperties.includes(expected)
|
||||
@@ -134,21 +130,16 @@ describe('HotkeysManager', () => {
|
||||
|
||||
hotkeysManager.registerHotkeys(definition);
|
||||
|
||||
const numOfHotkeyDefinitions = Object.keys(
|
||||
hotkeysManager.hotkeyDefinitions
|
||||
).length;
|
||||
const numOfHotkeyDefinitions = Object.keys(hotkeysManager.hotkeyDefinitions).length;
|
||||
|
||||
const commandHash = objectHash({
|
||||
commandName: definition.commandName,
|
||||
commandOptions: definition.commandOptions,
|
||||
});
|
||||
const hotkeyDefinitionForRegisteredCommand =
|
||||
hotkeysManager.hotkeyDefinitions[commandHash];
|
||||
const hotkeyDefinitionForRegisteredCommand = hotkeysManager.hotkeyDefinitions[commandHash];
|
||||
|
||||
expect(numOfHotkeyDefinitions).toBe(1);
|
||||
expect(Object.keys(hotkeysManager.hotkeyDefinitions)[0]).toEqual(
|
||||
commandHash
|
||||
);
|
||||
expect(Object.keys(hotkeysManager.hotkeyDefinitions)[0]).toEqual(commandHash);
|
||||
expect(hotkeyDefinitionForRegisteredCommand).toEqual(definition);
|
||||
});
|
||||
it('calls hotkeys.bind for the group of keys', () => {
|
||||
@@ -182,9 +173,7 @@ describe('HotkeysManager', () => {
|
||||
|
||||
hotkeysManager.restoreDefaultBindings();
|
||||
|
||||
expect(hotkeysManager.setHotkeys.mock.calls[0][0]).toEqual(
|
||||
hotkeysManager.hotkeyDefaults
|
||||
);
|
||||
expect(hotkeysManager.setHotkeys.mock.calls[0][0]).toEqual(hotkeysManager.hotkeyDefaults);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -174,14 +174,7 @@ export class HotkeysManager {
|
||||
* @returns {undefined}
|
||||
*/
|
||||
registerHotkeys(
|
||||
{
|
||||
commandName,
|
||||
commandOptions = {},
|
||||
context,
|
||||
keys,
|
||||
label,
|
||||
isEditable,
|
||||
}: Hotkey = {},
|
||||
{ commandName, commandOptions = {}, context, keys, label, isEditable }: Hotkey = {},
|
||||
extension
|
||||
) {
|
||||
if (!commandName) {
|
||||
@@ -189,9 +182,7 @@ export class HotkeysManager {
|
||||
}
|
||||
|
||||
const commandHash = objectHash({ commandName, commandOptions });
|
||||
const options = Object.keys(commandOptions).length
|
||||
? JSON.stringify(commandOptions)
|
||||
: 'no';
|
||||
const options = Object.keys(commandOptions).length ? JSON.stringify(commandOptions) : 'no';
|
||||
const previouslyRegisteredDefinition = this.hotkeyDefinitions[commandHash];
|
||||
|
||||
if (previouslyRegisteredDefinition) {
|
||||
@@ -255,11 +246,7 @@ export class HotkeysManager {
|
||||
hotkeys.bind(combinedKeys, evt => {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this._commandsManager.runCommand(
|
||||
commandName,
|
||||
{ evt, ...commandOptions },
|
||||
context
|
||||
);
|
||||
this._commandsManager.runCommand(commandName, { evt, ...commandOptions }, context);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class ImageSet {
|
||||
)
|
||||
);
|
||||
|
||||
const distanceImagePairs = images.map(function(image: Image) {
|
||||
const distanceImagePairs = images.map(function (image: Image) {
|
||||
const ippVec = new Vector3(..._getImagePositionPatient(image));
|
||||
const positionVector = refIppVec.clone().sub(ippVec);
|
||||
const distance = positionVector.dot(scanAxisNormal);
|
||||
@@ -118,13 +118,13 @@ class ImageSet {
|
||||
};
|
||||
});
|
||||
|
||||
distanceImagePairs.sort(function(a, b) {
|
||||
distanceImagePairs.sort(function (a, b) {
|
||||
return b.distance - a.distance;
|
||||
});
|
||||
|
||||
const sortedImages = distanceImagePairs.map(a => a.image);
|
||||
|
||||
images.sort(function(a, b) {
|
||||
images.sort(function (a, b) {
|
||||
return sortedImages.indexOf(a) - sortedImages.indexOf(b);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,12 +58,7 @@ class MetadataProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
StudyInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
SOPInstanceUID,
|
||||
frameNumber,
|
||||
} = uids;
|
||||
const { StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID, frameNumber } = uids;
|
||||
|
||||
const instance = DicomMetadataStore.getInstance(
|
||||
StudyInstanceUID,
|
||||
@@ -75,9 +70,7 @@ class MetadataProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
(frameNumber && combineFrameInstance(frameNumber, instance)) || instance
|
||||
);
|
||||
return (frameNumber && combineFrameInstance(frameNumber, instance)) || instance;
|
||||
}
|
||||
|
||||
get(query, imageId, options = { fallback: false }) {
|
||||
@@ -107,11 +100,7 @@ class MetadataProvider {
|
||||
return this.get(INSTANCE, imageId);
|
||||
}
|
||||
|
||||
getTagFromInstance(
|
||||
naturalizedTagOrWADOImageLoaderTag,
|
||||
instance,
|
||||
options = { fallback: false }
|
||||
) {
|
||||
getTagFromInstance(naturalizedTagOrWADOImageLoaderTag, instance, options = { fallback: false }) {
|
||||
if (!instance) {
|
||||
return;
|
||||
}
|
||||
@@ -122,10 +111,7 @@ class MetadataProvider {
|
||||
}
|
||||
|
||||
// Maybe its a legacy dicomImageLoader tag then:
|
||||
return this._getCornerstoneDICOMImageLoaderTag(
|
||||
naturalizedTagOrWADOImageLoaderTag,
|
||||
instance
|
||||
);
|
||||
return this._getCornerstoneDICOMImageLoaderTag(naturalizedTagOrWADOImageLoaderTag, instance);
|
||||
}
|
||||
|
||||
_getCornerstoneDICOMImageLoaderTag(wadoImageLoaderTag, instance) {
|
||||
@@ -198,9 +184,7 @@ class MetadataProvider {
|
||||
imageOrientationPatient: toNumber(ImageOrientationPatient),
|
||||
rowCosines: toNumber(rowCosines || [0, 1, 0]),
|
||||
columnCosines: toNumber(columnCosines || [0, 0, -1]),
|
||||
imagePositionPatient: toNumber(
|
||||
instance.ImagePositionPatient || [0, 0, 0]
|
||||
),
|
||||
imagePositionPatient: toNumber(instance.ImagePositionPatient || [0, 0, 0]),
|
||||
sliceThickness: toNumber(instance.SliceThickness),
|
||||
sliceLocation: toNumber(instance.SliceLocation),
|
||||
pixelSpacing: toNumber(PixelSpacing || 1),
|
||||
@@ -254,12 +238,8 @@ class MetadataProvider {
|
||||
if (WindowCenter === undefined || WindowWidth === undefined) {
|
||||
return;
|
||||
}
|
||||
const windowCenter = Array.isArray(WindowCenter)
|
||||
? WindowCenter
|
||||
: [WindowCenter];
|
||||
const windowWidth = Array.isArray(WindowWidth)
|
||||
? WindowWidth
|
||||
: [WindowWidth];
|
||||
const windowCenter = Array.isArray(WindowCenter) ? WindowCenter : [WindowCenter];
|
||||
const windowWidth = Array.isArray(WindowWidth) ? WindowWidth : [WindowWidth];
|
||||
|
||||
metadata = {
|
||||
windowCenter: toNumber(windowCenter),
|
||||
@@ -296,16 +276,11 @@ class MetadataProvider {
|
||||
? RadiopharmaceuticalInformationSequence[0]
|
||||
: RadiopharmaceuticalInformationSequence;
|
||||
|
||||
const {
|
||||
RadiopharmaceuticalStartTime,
|
||||
RadionuclideTotalDose,
|
||||
RadionuclideHalfLife,
|
||||
} = RadiopharmaceuticalInformation;
|
||||
const { RadiopharmaceuticalStartTime, RadionuclideTotalDose, RadionuclideHalfLife } =
|
||||
RadiopharmaceuticalInformation;
|
||||
|
||||
const radiopharmaceuticalInfo = {
|
||||
radiopharmaceuticalStartTime: dicomParser.parseTM(
|
||||
RadiopharmaceuticalStartTime
|
||||
),
|
||||
radiopharmaceuticalStartTime: dicomParser.parseTM(RadiopharmaceuticalStartTime),
|
||||
radionuclideTotalDose: RadionuclideTotalDose,
|
||||
radionuclideHalfLife: RadionuclideHalfLife,
|
||||
};
|
||||
@@ -318,11 +293,7 @@ class MetadataProvider {
|
||||
case WADO_IMAGE_LOADER_TAGS.OVERLAY_PLANE_MODULE:
|
||||
const overlays = [];
|
||||
|
||||
for (
|
||||
let overlayGroup = 0x00;
|
||||
overlayGroup <= 0x1e;
|
||||
overlayGroup += 0x02
|
||||
) {
|
||||
for (let overlayGroup = 0x00; overlayGroup <= 0x1e; overlayGroup += 0x02) {
|
||||
let groupStr = `60${overlayGroup.toString(16)}`;
|
||||
|
||||
if (groupStr.length === 3) {
|
||||
|
||||
@@ -59,17 +59,11 @@ describe('ExtensionManager.ts', () => {
|
||||
extensionManager.registerExtension = jest.fn();
|
||||
|
||||
// SUT
|
||||
const fakeExtensions = [
|
||||
{ one: '1' },
|
||||
[{ two: '2' }, fakeConfiguration],
|
||||
{ three: '3 ' },
|
||||
];
|
||||
const fakeExtensions = [{ one: '1' }, [{ two: '2' }, fakeConfiguration], { three: '3 ' }];
|
||||
await extensionManager.registerExtensions(fakeExtensions);
|
||||
|
||||
// Assert
|
||||
expect(extensionManager.registerExtension.mock.calls[1][1]).toEqual(
|
||||
fakeConfiguration
|
||||
);
|
||||
expect(extensionManager.registerExtension.mock.calls[1][1]).toEqual(fakeConfiguration);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -104,15 +98,11 @@ describe('ExtensionManager.ts', () => {
|
||||
const undefinedExtension = undefined;
|
||||
const nullExtension = null;
|
||||
|
||||
await expect(
|
||||
extensionManager.registerExtension(undefinedExtension)
|
||||
).rejects.toThrow(
|
||||
await expect(extensionManager.registerExtension(undefinedExtension)).rejects.toThrow(
|
||||
new Error('Attempting to register a null/undefined extension.')
|
||||
);
|
||||
|
||||
await expect(
|
||||
extensionManager.registerExtension(nullExtension)
|
||||
).rejects.toThrow(
|
||||
await expect(extensionManager.registerExtension(nullExtension)).rejects.toThrow(
|
||||
new Error('Attempting to register a null/undefined extension.')
|
||||
);
|
||||
});
|
||||
@@ -120,9 +110,9 @@ describe('ExtensionManager.ts', () => {
|
||||
it('logs a warning if the extension does not have an id', async () => {
|
||||
const extensionWithoutId = {};
|
||||
|
||||
await expect(
|
||||
extensionManager.registerExtension(extensionWithoutId)
|
||||
).rejects.toThrow(new Error('Extension ID not set'));
|
||||
await expect(extensionManager.registerExtension(extensionWithoutId)).rejects.toThrow(
|
||||
new Error('Extension ID not set')
|
||||
);
|
||||
});
|
||||
|
||||
it('tracks which extensions have been registered', () => {
|
||||
@@ -156,9 +146,7 @@ describe('ExtensionManager.ts', () => {
|
||||
extensionManager.registerExtension(extensionWithBadModule);
|
||||
|
||||
expect(log.warn.mock.calls.length).toBe(1);
|
||||
expect(log.warn.mock.calls[0][0]).toContain(
|
||||
'Null or undefined returned when registering'
|
||||
);
|
||||
expect(log.warn.mock.calls[0][0]).toContain('Null or undefined returned when registering');
|
||||
});
|
||||
|
||||
it('logs an error if an exception is thrown while retrieving a module', async () => {
|
||||
@@ -169,9 +157,7 @@ describe('ExtensionManager.ts', () => {
|
||||
},
|
||||
};
|
||||
|
||||
await expect(
|
||||
extensionManager.registerExtension(extensionWithBadModule)
|
||||
).rejects.toThrow();
|
||||
await expect(extensionManager.registerExtension(extensionWithBadModule)).rejects.toThrow();
|
||||
});
|
||||
|
||||
it('successfully passes dependencies to each module along with extension configuration', () => {
|
||||
|
||||
@@ -145,12 +145,8 @@ export default class ExtensionManager extends PubSubService {
|
||||
}
|
||||
|
||||
public onModeExit(): void {
|
||||
const {
|
||||
registeredExtensionIds,
|
||||
_servicesManager,
|
||||
_commandsManager,
|
||||
_extensionLifeCycleHooks,
|
||||
} = this;
|
||||
const { registeredExtensionIds, _servicesManager, _commandsManager, _extensionLifeCycleHooks } =
|
||||
this;
|
||||
|
||||
registeredExtensionIds.forEach(extensionId => {
|
||||
const onModeExit = _extensionLifeCycleHooks.onModeExit[extensionId];
|
||||
@@ -181,10 +177,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
* @param {Object[]} extensions - Array of extensions
|
||||
*/
|
||||
public registerExtensions = async (
|
||||
extensions: (
|
||||
| ExtensionRegister
|
||||
| [ExtensionRegister, ExtensionConfiguration]
|
||||
)[],
|
||||
extensions: (ExtensionRegister | [ExtensionRegister, ExtensionConfiguration])[],
|
||||
dataSources: unknown[] = []
|
||||
): Promise<void> => {
|
||||
// Todo: we ideally should be able to run registrations in parallel
|
||||
@@ -203,11 +196,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
// for (const extension of extensions)
|
||||
const ohifExtension = extension[0];
|
||||
const configuration = extension[1];
|
||||
await this.registerExtension(
|
||||
ohifExtension,
|
||||
configuration,
|
||||
dataSources
|
||||
);
|
||||
await this.registerExtension(ohifExtension, configuration, dataSources);
|
||||
} else {
|
||||
await this.registerExtension(extension, {}, dataSources);
|
||||
}
|
||||
@@ -260,13 +249,11 @@ export default class ExtensionManager extends PubSubService {
|
||||
}
|
||||
|
||||
if (extension.onModeEnter) {
|
||||
this._extensionLifeCycleHooks.onModeEnter[extensionId] =
|
||||
extension.onModeEnter;
|
||||
this._extensionLifeCycleHooks.onModeEnter[extensionId] = extension.onModeEnter;
|
||||
}
|
||||
|
||||
if (extension.onModeExit) {
|
||||
this._extensionLifeCycleHooks.onModeExit[extensionId] =
|
||||
extension.onModeExit;
|
||||
this._extensionLifeCycleHooks.onModeExit[extensionId] = extension.onModeExit;
|
||||
}
|
||||
|
||||
// Register Modules
|
||||
@@ -284,11 +271,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
this._initCommandsModule(extensionModule);
|
||||
break;
|
||||
case MODULE_TYPES.DATA_SOURCE:
|
||||
this._initDataSourcesModule(
|
||||
extensionModule,
|
||||
extensionId,
|
||||
dataSources
|
||||
);
|
||||
this._initDataSourcesModule(extensionModule, extensionId, dataSources);
|
||||
break;
|
||||
case MODULE_TYPES.HANGING_PROTOCOL:
|
||||
this._initHangingProtocolsModule(extensionModule, extensionId);
|
||||
@@ -425,10 +408,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
* @param dataSourceDef the data source definition to be added
|
||||
* @param activate flag to indicate if the added data source should be set to the active data source
|
||||
*/
|
||||
addDataSource(
|
||||
dataSourceDef: DataSourceDefinition,
|
||||
options = { activate: false }
|
||||
) {
|
||||
addDataSource(dataSourceDef: DataSourceDefinition, options = { activate: false }) {
|
||||
const existingDataSource = this.getDataSources(dataSourceDef.sourceName);
|
||||
if (existingDataSource?.[0]) {
|
||||
// The data source already exists and cannot be added.
|
||||
@@ -448,10 +428,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
* @param dataSourceName the name of the data source to update
|
||||
* @param dataSourceConfiguration the new configuration to update the data source with
|
||||
*/
|
||||
updateDataSourceConfiguration(
|
||||
dataSourceName: string,
|
||||
dataSourceConfiguration: any
|
||||
) {
|
||||
updateDataSourceConfiguration(dataSourceName: string, dataSourceConfiguration: any) {
|
||||
const existingDataSource = this.getDataSources(dataSourceName);
|
||||
if (!existingDataSource?.[0]) {
|
||||
// Cannot update a non existent data source.
|
||||
@@ -465,10 +442,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
|
||||
if (this.activeDataSource === dataSourceName) {
|
||||
// When the active data source is changed/set, fire an event to indicate that its configuration has changed.
|
||||
this._broadcastEvent(
|
||||
ExtensionManager.EVENTS.ACTIVE_DATA_SOURCE_CHANGED,
|
||||
dataSourceDef
|
||||
);
|
||||
this._broadcastEvent(ExtensionManager.EVENTS.ACTIVE_DATA_SOURCE_CHANGED, dataSourceDef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,9 +476,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
dataSources: Array<DataSourceDefinition> = []
|
||||
): void {
|
||||
extensionModule.forEach(element => {
|
||||
this.modulesMap[
|
||||
`${extensionId}.${MODULE_TYPES.DATA_SOURCE}.${element.name}`
|
||||
] = element;
|
||||
this.modulesMap[`${extensionId}.${MODULE_TYPES.DATA_SOURCE}.${element.name}`] = element;
|
||||
});
|
||||
|
||||
extensionModule.forEach(element => {
|
||||
@@ -539,8 +511,7 @@ export default class ExtensionManager extends PubSubService {
|
||||
Object.keys(definitions).forEach(commandName => {
|
||||
const commandDefinition = definitions[commandName];
|
||||
const commandHasContextThatDoesNotExist =
|
||||
commandDefinition.context &&
|
||||
!this._commandsManager.getContext(commandDefinition.context);
|
||||
commandDefinition.context && !this._commandsManager.getContext(commandDefinition.context);
|
||||
|
||||
if (commandHasContextThatDoesNotExist) {
|
||||
this._commandsManager.createContext(commandDefinition.context);
|
||||
|
||||
@@ -33,10 +33,7 @@ import {
|
||||
PanelService,
|
||||
} from './services';
|
||||
|
||||
import {
|
||||
DisplaySetMessage,
|
||||
DisplaySetMessageList,
|
||||
} from './services/DisplaySetService';
|
||||
import { DisplaySetMessage, DisplaySetMessageList } from './services/DisplaySetService';
|
||||
|
||||
import IWebApiDataSource from './DataSources/IWebApiDataSource';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const extensionManager = {
|
||||
registeredExtensionIds: [],
|
||||
moduleEntries: {},
|
||||
|
||||
getModuleEntry: function(id) {
|
||||
getModuleEntry: function (id) {
|
||||
return this.moduleEntries[id];
|
||||
},
|
||||
};
|
||||
@@ -20,7 +20,7 @@ const commandsManager = {};
|
||||
|
||||
const ohifOverlayItem = {
|
||||
id: 'ohif.overlayItem',
|
||||
content: function(props) {
|
||||
content: function (props) {
|
||||
return {
|
||||
label: this.label,
|
||||
value: props[this.attribute],
|
||||
@@ -59,29 +59,27 @@ describe('CustomizationService.ts', () => {
|
||||
it('configurationRegistered', () => {
|
||||
configuration.testItem = testItem;
|
||||
customizationService.init(extensionManager);
|
||||
expect(customizationService.getGlobalCustomization('testItem')).toBe(
|
||||
testItem
|
||||
);
|
||||
expect(customizationService.getGlobalCustomization('testItem')).toBe(testItem);
|
||||
});
|
||||
|
||||
it('defaultRegistered', () => {
|
||||
extensionManager.registeredExtensionIds.push('@testExtension');
|
||||
extensionManager.moduleEntries[
|
||||
'@testExtension.customizationModule.default'
|
||||
] = { name: 'default', value: [testItem] };
|
||||
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
|
||||
name: 'default',
|
||||
value: [testItem],
|
||||
};
|
||||
customizationService.init(extensionManager);
|
||||
expect(customizationService.getGlobalCustomization('testItem')).toBe(
|
||||
testItem
|
||||
);
|
||||
expect(customizationService.getGlobalCustomization('testItem')).toBe(testItem);
|
||||
});
|
||||
});
|
||||
|
||||
describe('customizationType', () => {
|
||||
it('inherits type', () => {
|
||||
extensionManager.registeredExtensionIds.push('@testExtension');
|
||||
extensionManager.moduleEntries[
|
||||
'@testExtension.customizationModule.default'
|
||||
] = { name: 'default', value: [ohifOverlayItem] };
|
||||
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
|
||||
name: 'default',
|
||||
value: [ohifOverlayItem],
|
||||
};
|
||||
configuration.testItem = testItem;
|
||||
customizationService.init(extensionManager);
|
||||
|
||||
@@ -96,9 +94,10 @@ describe('CustomizationService.ts', () => {
|
||||
|
||||
it('inline default inherits type', () => {
|
||||
extensionManager.registeredExtensionIds.push('@testExtension');
|
||||
extensionManager.moduleEntries[
|
||||
'@testExtension.customizationModule.default'
|
||||
] = { name: 'default', value: [ohifOverlayItem] };
|
||||
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
|
||||
name: 'default',
|
||||
value: [ohifOverlayItem],
|
||||
};
|
||||
configuration.testItem = testItem;
|
||||
customizationService.init(extensionManager);
|
||||
|
||||
@@ -121,20 +120,17 @@ describe('CustomizationService.ts', () => {
|
||||
describe('mode customization', () => {
|
||||
it('onModeEnter can add extensions', () => {
|
||||
extensionManager.registeredExtensionIds.push('@testExtension');
|
||||
extensionManager.moduleEntries[
|
||||
'@testExtension.customizationModule.default'
|
||||
] = { name: 'default', value: [ohifOverlayItem] };
|
||||
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
|
||||
name: 'default',
|
||||
value: [ohifOverlayItem],
|
||||
};
|
||||
customizationService.init(extensionManager);
|
||||
|
||||
expect(
|
||||
customizationService.getModeCustomization('testItem')
|
||||
).toBeUndefined();
|
||||
expect(customizationService.getModeCustomization('testItem')).toBeUndefined();
|
||||
|
||||
customizationService.addModeCustomizations([testItem]);
|
||||
|
||||
expect(
|
||||
customizationService.getGlobalCustomization('testItem')
|
||||
).toBeUndefined();
|
||||
expect(customizationService.getGlobalCustomization('testItem')).toBeUndefined();
|
||||
|
||||
const item = customizationService.getModeCustomization('testItem');
|
||||
|
||||
@@ -147,16 +143,15 @@ describe('CustomizationService.ts', () => {
|
||||
|
||||
it('global customizations override modes', () => {
|
||||
extensionManager.registeredExtensionIds.push('@testExtension');
|
||||
extensionManager.moduleEntries[
|
||||
'@testExtension.customizationModule.default'
|
||||
] = { name: 'default', value: [ohifOverlayItem] };
|
||||
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
|
||||
name: 'default',
|
||||
value: [ohifOverlayItem],
|
||||
};
|
||||
configuration.testItem = testItem;
|
||||
customizationService.init(extensionManager);
|
||||
|
||||
// Add a mode customization that would otherwise fail below
|
||||
customizationService.addModeCustomizations([
|
||||
{ ...testItem, label: 'other' },
|
||||
]);
|
||||
customizationService.addModeCustomizations([{ ...testItem, label: 'other' }]);
|
||||
|
||||
const item = customizationService.getModeCustomization('testItem');
|
||||
|
||||
|
||||
Loaded 100 of 656 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user