[IDC-2006] - optional mailTo for debugging extension. (#2027)
* WIP debug dialog * Rename the p10 downloader extension to debugger extension, add button to toolbar. Deactivate it by default. * Fix unit tests * WIP * WIP * Finish mailTo
This commit is contained in:
parent
5a78da8ff6
commit
42803b0ae8
@ -2,3 +2,8 @@
|
||||
padding: 10px 0 10px;
|
||||
color: var(--active-color);
|
||||
}
|
||||
|
||||
.debug-report-modal-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@ -1,22 +1,108 @@
|
||||
import React from 'react';
|
||||
import { detect } from 'detect-browser';
|
||||
import './DebugReportModal.css';
|
||||
import { ToolbarButton } from '@ohif/ui';
|
||||
|
||||
const DubugReportModal = ({
|
||||
viewports,
|
||||
studies,
|
||||
servers,
|
||||
extensionManager,
|
||||
mailTo,
|
||||
}) => {
|
||||
const mailToFunction = () => {
|
||||
const StudyInstanceUID = Object.keys(studies.studyData)[0];
|
||||
|
||||
const subject = encodeURI(`Issue with Study: ${StudyInstanceUID}`);
|
||||
|
||||
let body = `Enter the description of your problem here: \n\n\n`;
|
||||
|
||||
body += `============= SESSION INFO =============\n\n`;
|
||||
|
||||
// App version
|
||||
|
||||
body += '== App ==\n';
|
||||
body += `version\t${window.version}\n\n`;
|
||||
|
||||
// Extensions Versions
|
||||
|
||||
body += '== Extensions Versions ==\n';
|
||||
|
||||
const { registeredExtensionVesions } = extensionManager;
|
||||
|
||||
Object.keys(registeredExtensionVesions).forEach(extensionId => {
|
||||
const version = registeredExtensionVesions[extensionId];
|
||||
|
||||
body += `${extensionId}\t${version}\n`;
|
||||
});
|
||||
|
||||
body += '\n';
|
||||
|
||||
// Browser Info
|
||||
|
||||
const browser = detect();
|
||||
|
||||
const { name, os, type, version } = browser;
|
||||
|
||||
body += '== Browser Info ==\n';
|
||||
body += `name\t ${name}\n`;
|
||||
body += `os\t ${os}\n`;
|
||||
body += `type\t ${type}\n`;
|
||||
body += `version\t ${version}\n\n`;
|
||||
|
||||
// Study URL
|
||||
body += '== URL ==\n';
|
||||
body += `URL\t ${window.location.href}\n\n`;
|
||||
|
||||
// Layout
|
||||
|
||||
const { numRows, numColumns, viewportSpecificData } = viewports;
|
||||
|
||||
body += '== Viewport Layout ==\n';
|
||||
body += `Rows\t${numRows}\n`;
|
||||
body += `Columns\t${numColumns}\n\n`;
|
||||
|
||||
body += '== Viewports ==\n';
|
||||
|
||||
Object.keys(viewportSpecificData).forEach(viewportIndex => {
|
||||
const vsd = viewportSpecificData[viewportIndex];
|
||||
|
||||
const [row, column] = _viewportIndexToViewportPosition(
|
||||
viewportIndex,
|
||||
numColumns
|
||||
);
|
||||
|
||||
body += `[${row},${column}]\t${vsd.SeriesInstanceUID}\n`;
|
||||
});
|
||||
|
||||
// TODO Text dump of rest of stuff.
|
||||
|
||||
body = encodeURI(body);
|
||||
|
||||
window.location.href = `mailto:${mailTo}?subject=${subject}&body=${body}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<table>
|
||||
{getAppVersion()}
|
||||
{getExtensionVersions(extensionManager)}
|
||||
{getBrowserInfo()}
|
||||
{getCurrentStudyUrl()}
|
||||
{getLayout(viewports)}
|
||||
</table>
|
||||
<div className="debug-report-modal-container">
|
||||
{mailTo ? (
|
||||
<div>
|
||||
<ToolbarButton
|
||||
label={'Send Bug Report'}
|
||||
onClick={mailToFunction}
|
||||
icon={'envelope-square'}
|
||||
isActive={false}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
<div>
|
||||
<table>
|
||||
{getAppVersion()}
|
||||
{getExtensionVersions(extensionManager)}
|
||||
{getBrowserInfo()}
|
||||
{getCurrentStudyUrl()}
|
||||
{getLayout(viewports)}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@ -39,7 +125,7 @@ const getCurrentStudyUrl = () => {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<tr>
|
||||
<th className="debugReportModalHeader">App</th>
|
||||
<th className="debugReportModalHeader">URL</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
|
||||
@ -11,6 +11,8 @@ import _downloadAndZip, { downloadInstances } from './downloadAndZip';
|
||||
import DebugReportModal from './DebugReportModal';
|
||||
import React from 'react';
|
||||
|
||||
import state from './state';
|
||||
|
||||
const {
|
||||
utils: { Queue },
|
||||
} = OHIF;
|
||||
@ -99,6 +101,7 @@ export function getCommands(context, servicesManager, extensionManager) {
|
||||
studies={studies}
|
||||
servers={servers}
|
||||
extensionManager={extensionManager}
|
||||
mailTo={state.mailTo}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@ import { getDicomWebClientFromConfig } from './utils';
|
||||
import { getCommands } from './commandsModule';
|
||||
import { version } from '../package.json';
|
||||
import toolbarModule from './toolbarModule';
|
||||
import state from './state';
|
||||
|
||||
/**
|
||||
* Constants
|
||||
@ -29,11 +30,15 @@ export default {
|
||||
* LIFECYCLE HOOKS
|
||||
*/
|
||||
|
||||
preRegistration({ appConfig }) {
|
||||
preRegistration({ appConfig, configuration }) {
|
||||
const dicomWebClient = getDicomWebClientFromConfig(appConfig);
|
||||
if (dicomWebClient) {
|
||||
sharedContext.dicomWebClient = dicomWebClient;
|
||||
}
|
||||
|
||||
if (configuration && configuration.mailTo) {
|
||||
state.mailTo = configuration.mailTo;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
3
extensions/debugging/src/state.js
Normal file
3
extensions/debugging/src/state.js
Normal file
@ -0,0 +1,3 @@
|
||||
const state = { mailTo: undefined };
|
||||
|
||||
export default state;
|
||||
@ -87,6 +87,7 @@ import user from './icons/user.svg';
|
||||
import youtube from './icons/youtube.svg';
|
||||
import eye from './icons/eye.svg';
|
||||
import eyeClosed from './icons/eye-closed.svg';
|
||||
import envelopeSquare from './icons/envelope-square.svg';
|
||||
|
||||
const ICONS = {
|
||||
eye,
|
||||
@ -176,6 +177,7 @@ const ICONS = {
|
||||
lung,
|
||||
liver,
|
||||
save: saveRegular,
|
||||
'envelope-square': envelopeSquare,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
10
platform/ui/src/elements/Icon/icons/envelope-square.svg
Normal file
10
platform/ui/src/elements/Icon/icons/envelope-square.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 448 512"
|
||||
aria-labelledby="envelope-square"
|
||||
width="1em"
|
||||
height="1em"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M400 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM178.117 262.104C87.429 196.287 88.353 196.121 64 177.167V152c0-13.255 10.745-24 24-24h272c13.255 0 24 10.745 24 24v25.167c-24.371 18.969-23.434 19.124-114.117 84.938-10.5 7.655-31.392 26.12-45.883 25.894-14.503.218-35.367-18.227-45.883-25.895zM384 217.775V360c0 13.255-10.745 24-24 24H88c-13.255 0-24-10.745-24-24V217.775c13.958 10.794 33.329 25.236 95.303 70.214 14.162 10.341 37.975 32.145 64.694 32.01 26.887.134 51.037-22.041 64.72-32.025 61.958-44.965 81.325-59.406 95.283-70.199z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 811 B |
@ -54,8 +54,8 @@ const appProps = {
|
||||
OHIFDicomPDFExtension,
|
||||
OHIFDicomSegmentationExtension,
|
||||
OHIFDicomRtExtension,
|
||||
OHIFDicomTagBrowserExtension,
|
||||
//OHIFDebuggingExtension,
|
||||
//[OHIFDebuggingExtension, { mailTo: 'support@canceridc.dev' }],
|
||||
//OHIFDicomTagBrowserExtension,
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user