Compare commits

..
Author SHA1 Message Date
ohif-bot fd1a9e2abe chore(release): publish [skip ci]
- @ohif/viewer@2.11.1
2019-11-27 21:04:00 +00:00
Egor Lezhnin e34a057263 fix: of undefined name of project (#1231) 2019-11-27 16:02:12 -05:00
ohif-bot 27e02825a4 chore(release): publish [skip ci]
- @ohif/extension-cornerstone@1.7.0
 - @ohif/extension-vtk@0.54.0
 - @ohif/core@1.13.0
 - @ohif/ui@0.65.0
 - @ohif/viewer@2.11.0
2019-11-25 22:16:35 +00:00
Igor Octaviano 8fd3af1e13 feat: Add new annotate tool using new dialog service (#1211)
* Testing dialog

* Refactor modal and add dialog component to simple dialog

* Use existent dialog

* Expect event from getText callback (annotation)

* Bump cornerstone-tools version

* Use simple dialog

* bump cornersotne version

* CR Update: Update dialgo method names and default values

* CR Update: Bump overlay and show only if theres at least one overlay prop set to true

* CR Update: Use percentage over view height in draggable area

* Fix broken test vtk checks WWWC tool

* Comment test (non-deterministic)
2019-11-25 17:13:42 -05:00
ohif-bot 1334ba8eb0 chore(release): publish [skip ci]
- @ohif/extension-vtk@0.53.13
 - @ohif/ui@0.64.2
 - @ohif/viewer@2.10.2
2019-11-25 15:50:36 +00:00
Danny Brown a870b3cc60 fix: Issue branch from danny experimental changes pr 1128 (#1150)
* fix: study list translations

* Don't render until translations are ready

* Try to wait for translations to load

* Use null to render "nothing"

* Try toggling useSuspense off up a layer

* logging

* Remove useSuspense false flags

* DO NOT OPEN A PR WITH IT.
Experimental changes only.
Try to solve issues with useTranslation hooks
 #Please enter the commit message for your changes. Lines starting

* Remove unecessary changes

* feat: 🎸 useMedia hook to not use one more prop for upd state vl

* docs: Add license scan report and status (#1161)

Signed-off-by: fossabot <badges@fossa.io>

* fix: 🐛 Fix for JS breaking on header (#1164)

* feat: 🎸 Code review and refact

Revised code based on PRs(variable alias,...). Changed hook for
useMedia. Now, it provides two hooks: one to get displayMediaSize and
other to get Entity(component, objects...) based on displayMediaSize.
Implemented a similar solution for state manager to store
mediaQueryList(s) and displaySize for app.

* feat: 🎸 Fine tunning on mediaQuery value, fixed issue about it

* chore(release): publish [skip ci]

 - @ohif/extension-vtk@0.53.6
 - @ohif/ui@0.62.1
 - @ohif/viewer@2.8.2

* Add new modal service

* Change serviceManager prop to servicesManager

* CR Update: fix casing and add required proptypes to providers

* CR Update: Improve ohifmodal proptypes

* CR Update: Fix typo in extensionmanager

* CR Update: add default props to service and check service in provider

* Refactor modal provider to better use its own state

* ci: don't build our master branch (#1177)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* Use modal instead of modal context

* Ci/promotable builds (#1179)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Change modal children order

* Ci/promotable builds (#1180)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* Ci/promotable builds (#1181)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* ci: make sure netlify command is available

* Ci/promotable builds (#1182)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* ci: make sure netlify command is available

* ci: use sudo for global command

* Fix OHIFModal proptypes

* Ci/promotable builds (#1183)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* ci: make sure netlify command is available

* ci: use sudo for global command

* Inline personal access token w/ env var

* Ci/promotable builds (#1184)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* ci: make sure netlify command is available

* ci: use sudo for global command

* Inline personal access token w/ env var

* ci: workaround for sudo limitations

* ci: restore release workflow (#1185)

* ci: don't build our master branch

* Add netlify-cli as a dev dependency

* ci: trying a sheltered merge flow for promotions

* ci: try building with QUICK_BUILD flag

* Try using ~/repo prefix in command

* ci: make sure netlify command is available

* ci: use sudo for global command

* Inline personal access token w/ env var

* ci: workaround for sudo limitations

* ci: restore release workflow

* Pass services to each module, improve tests

* Add servicesManager test and registerServices method

* Fix key warning of snackbar elements

* Remove netlify-cli; we';ll install this on CI server

* Update staging and prod netlify site IDs

* Clean up NPM_PUBLISH step

* Clean up DOCS_PUBLISH step

* Clean up Deploy workflow

* Custom executor to override cypress config

* Spacing

* Use an existing docker hub image

* Switch to npx instead of digging into npm bin location

* Remove e2e test before prod deploy

* Add workflow images

* docs: continous integrationn

* Add default props to modal

* chore(release): publish [skip ci]

 - @ohif/extension-cornerstone@1.5.1
 - @ohif/extension-vtk@0.53.7
 - @ohif/core@1.9.1
 - @ohif/ui@0.62.2
 - @ohif/viewer@2.8.3

* chore(release): publish [skip ci]

 - @ohif/extension-vtk@0.53.8
 - @ohif/core@1.10.0
 - @ohif/ui@0.62.3
 - @ohif/viewer@2.8.4

* ci: Redirect site traffic to index.html if file is not resolved

* ci: fix typo

* fix: 🐛 Code review. Remove 'global state' for displaySize

* fix: 🐛 Code review. Ref back to useMedia and pass value down

Code review. Ref back to useMedia and pass value down (components)
instead of creating a specialized hook to tied any component on it

* Merge from master. Missing files changes

* feat: 🎸 Code review. Fix issues with DatePicker

Fixed at least the minimum issue with datePicker and update some content
on every translation changed
2019-11-25 10:45:37 -05:00
ohif-bot 52687a7113 chore(release): publish [skip ci]
- @ohif/extension-vtk@0.53.12
 - @ohif/ui@0.64.1
 - @ohif/viewer@2.10.1
2019-11-20 19:17:36 +00:00
Mirna Silva 421de23ba3 test: Test Cases for User Preferences (#1195)
* Test Cases for User Preferences

* CI fix

* Fix for CI

* Fix based on PR review comments

* Fix for script-tag issue on CI

* Fix for new selectors on Preferences Modal and CI failure
2019-11-20 14:15:10 -05:00
35 changed files with 1492 additions and 386 deletions

No files matched your search

+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.7.0](https://github.com/OHIF/Viewers/compare/@ohif/extension-cornerstone@1.6.0...@ohif/extension-cornerstone@1.7.0) (2019-11-25)
### Features
* Add new annotate tool using new dialog service ([#1211](https://github.com/OHIF/Viewers/issues/1211)) ([8fd3af1](https://github.com/OHIF/Viewers/commit/8fd3af1e137e793f1b482760a22591c64a072047))
# [1.6.0](https://github.com/OHIF/Viewers/compare/@ohif/extension-cornerstone@1.5.1...@ohif/extension-cornerstone@1.6.0) (2019-11-19)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone",
"version": "1.6.0",
"version": "1.7.0",
"description": "OHIF extension for Cornerstone",
"author": "OHIF",
"license": "MIT",
@@ -32,7 +32,7 @@
"@ohif/ui": "^0.50.0",
"cornerstone-core": "^2.2.8",
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "^4.0.9",
"cornerstone-tools": "^4.8.0",
"cornerstone-wado-image-loader": "^3.0.0",
"dcmjs": "^0.6.1",
"dicom-parser": "^1.8.3",
+32 -2
View File
@@ -3,6 +3,7 @@ import cornerstone from 'cornerstone-core';
import csTools from 'cornerstone-tools';
import initCornerstoneTools from './initCornerstoneTools.js';
import queryString from 'query-string';
import { SimpleDialog } from '@ohif/ui';
function fallbackMetaDataProvider(type, imageId) {
if (!imageId.includes('wado?requestType=WADO')) {
@@ -29,6 +30,28 @@ cornerstone.metaData.addProvider(fallbackMetaDataProvider, -1);
* @param {Object|Array} configuration.csToolsConfig
*/
export default function init({ servicesManager, configuration = {} }) {
const { UIDialogService } = servicesManager.services;
const callInputDialog = (data, event, callback) => {
let dialogId = UIDialogService.create({
content: SimpleDialog.InputDialog,
defaultPosition: {
x: (event && event.currentPoints.canvas.x) || 0,
y: (event && event.currentPoints.canvas.y) || 0,
},
showOverlay: true,
contentProps: {
title: 'Enter your annotation',
label: 'New label',
measurementData: data ? { description: data.text } : {},
onClose: () => UIDialogService.dismiss({ id: dialogId }),
onSubmit: value => {
callback(value);
UIDialogService.dismiss({ id: dialogId });
},
},
});
};
const { csToolsConfig } = configuration;
const { StackManager } = OHIF.utils;
const metadataProvider = new OHIF.cornerstone.MetadataProvider();
@@ -62,7 +85,6 @@ export default function init({ servicesManager, configuration = {} }) {
ZoomTouchPinchTool,
// Annotations
EraserTool,
ArrowAnnotateTool,
BidirectionalTool,
LengthTool,
AngleTool,
@@ -85,7 +107,6 @@ export default function init({ servicesManager, configuration = {} }) {
ZoomTouchPinchTool,
// Annotations
EraserTool,
ArrowAnnotateTool,
BidirectionalTool,
LengthTool,
AngleTool,
@@ -99,6 +120,15 @@ export default function init({ servicesManager, configuration = {} }) {
tools.forEach(tool => csTools.addTool(tool));
csTools.addTool(csTools.ArrowAnnotateTool, {
configuration: {
getTextCallback: (callback, eventDetails) =>
callInputDialog(null, eventDetails, callback),
changeTextCallback: (data, eventDetails, callback) =>
callInputDialog(data, eventDetails, callback),
},
});
csTools.setToolActive('Pan', { mouseButtonMask: 4 });
csTools.setToolActive('Zoom', { mouseButtonMask: 2 });
csTools.setToolActive('Wwwc', { mouseButtonMask: 1 });
+27
View File
@@ -3,6 +3,33 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.54.0](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.53.13...@ohif/extension-vtk@0.54.0) (2019-11-25)
### Features
* Add new annotate tool using new dialog service ([#1211](https://github.com/OHIF/Viewers/issues/1211)) ([8fd3af1](https://github.com/OHIF/Viewers/commit/8fd3af1e137e793f1b482760a22591c64a072047))
## [0.53.13](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.53.12...@ohif/extension-vtk@0.53.13) (2019-11-25)
**Note:** Version bump only for package @ohif/extension-vtk
## [0.53.12](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.53.11...@ohif/extension-vtk@0.53.12) (2019-11-20)
**Note:** Version bump only for package @ohif/extension-vtk
## [0.53.11](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.53.10...@ohif/extension-vtk@0.53.11) (2019-11-19)
**Note:** Version bump only for package @ohif/extension-vtk
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-vtk",
"version": "0.53.11",
"version": "0.54.0",
"description": "OHIF extension for VTK.js",
"author": "OHIF",
"license": "MIT",
@@ -52,9 +52,9 @@
"react-vtkjs-viewport": "^0.3.9"
},
"devDependencies": {
"@ohif/core": "^1.12.0",
"@ohif/ui": "^0.64.0",
"cornerstone-tools": "^4.0.9",
"@ohif/core": "^1.13.0",
"@ohif/ui": "^0.65.0",
"cornerstone-tools": "^4.8.0",
"cornerstone-wado-image-loader": "^3.0.0",
"dcmjs": "^0.6.1",
"dicom-parser": "^1.8.3",
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.13.0](https://github.com/OHIF/Viewers/compare/@ohif/core@1.12.0...@ohif/core@1.13.0) (2019-11-25)
### Features
* Add new annotate tool using new dialog service ([#1211](https://github.com/OHIF/Viewers/issues/1211)) ([8fd3af1](https://github.com/OHIF/Viewers/commit/8fd3af1e137e793f1b482760a22591c64a072047))
# [1.12.0](https://github.com/OHIF/Viewers/compare/@ohif/core@1.11.0...@ohif/core@1.12.0) (2019-11-19)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/core",
"version": "1.12.0",
"version": "1.13.0",
"description": "Generic business logic for web-based medical imaging applications",
"author": "OHIF Core Team",
"license": "MIT",
@@ -32,7 +32,7 @@
},
"peerDependencies": {
"cornerstone-core": "^2.2.8",
"cornerstone-tools": "^4.0.9",
"cornerstone-tools": "^4.8.0",
"cornerstone-wado-image-loader": "^3.0.0",
"dicom-parser": "^1.8.3"
},
@@ -1,11 +1,5 @@
/**
* A UI Element
*
* @typedef {ReactElement|HTMLElement} DialogContent
*/
/**
* A UI Position
* A UI Element Position
*
* @typedef {Object} ElementPosition
* @property {number} top -
@@ -18,16 +12,16 @@
* UI Dialog
*
* @typedef {Object} DialogProps
* @property {string} id -
* @property {DialogContent} content -
* @property {boolean} isDraggable -
* @property {ElementPosition} defaultPosition -
* @property {ElementPosition} position -
* @property {Function} onSubmit -
* @property {Function} onClose -
* @property {Function} onStart -
* @property {Function} onStop -
* @property {Function} onDrag -
* @property {string} id The dialog id.
* @property {ReactElement|HTMLElement} content The dialog content.
* @property {Object} contentProps The dialog content props.
* @property {boolean} [isDraggable=true] Controls if dialog content is draggable or not.
* @property {boolean} [showOverlay=false] Controls dialog overlay.
* @property {ElementPosition} defaultPosition Specifies the `x` and `y` that the dragged item should start at.
* @property {ElementPosition} position If this property is present, the item becomes 'controlled' and is not responsive to user input.
* @property {Function} onStart Called when dragging starts. If `false` is returned any handler, the action will cancel.
* @property {Function} onStop Called when dragging stops.
* @property {Function} onDrag Called while dragging.
*/
const uiDialogServicePublicAPI = {
@@ -51,29 +45,29 @@ function createUIDialogService() {
/**
* Show a new UI dialog;
*
* @param {DialogProps} props { id, content, onSubmit, onClose, onStart, onDrag, onStop, isDraggable, defaultPosition, position }
* @param {DialogProps} props { id, content, contentProps, onStart, onDrag, onStop, isDraggable, showOverlay, defaultPosition, position }
*/
function create({
id,
content,
onSubmit,
onClose,
contentProps,
onStart,
onDrag,
onStop,
isDraggable,
isDraggable = true,
showOverlay = false,
defaultPosition,
position,
}) {
return uiDialogServiceImplementation._create({
id,
content,
onSubmit,
onClose,
contentProps,
onStart,
onDrag,
onStop,
isDraggable,
showOverlay,
defaultPosition,
position,
});
@@ -1,18 +1,14 @@
/**
* A UI Element
*
* @typedef {ReactElement|HTMLElement} Modal
*/
/**
* UI Modal
*
* @typedef {Object} ModalProps
* @property {boolean} [shouldCloseOnEsc=false] -
* @property {boolean} [isOpen=true] -
* @property {boolean} [closeButton=true] -
* @property {string} [title=null] - 'Modal Title'
* @property {string} [customClassName=null] - '.ModalClass'
* @property {ReactElement|HTMLElement} [content=null] Modal content.
* @property {Object} [contentProps=null] Modal content props.
* @property {boolean} [shouldCloseOnEsc=false] Modal is dismissible via the esc key.
* @property {boolean} [isOpen=true] Make the Modal visible or hidden.
* @property {boolean} [closeButton=true] Should the modal body render the close button.
* @property {string} [title=null] Should the modal render the title independently of the body content.
* @property {string} [customClassName=null] The custom class to style the modal.
*/
const uiModalServicePublicAPI = {
@@ -34,20 +30,26 @@ function createUIModalService() {
/**
* Show a new UI modal;
*
* @param {Modal} component React component
* @param {ModalProps} props { shouldCloseOnEsc, isOpen, closeButton, title, customClassName }
* @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, closeButton, title, customClassName }
*/
function show(
component,
props = {
shouldCloseOnEsc: false,
isOpen: true,
closeButton: true,
title: null,
customClassName: null,
}
) {
return uiModalServiceImplementation._show(component, props);
function show({
content = null,
contentProps = null,
shouldCloseOnEsc = false,
isOpen = true,
closeButton = true,
title = null,
customClassName = null,
}) {
return uiModalServiceImplementation._show({
content,
contentProps,
shouldCloseOnEsc,
isOpen,
closeButton,
title,
customClassName,
});
}
/**
+30
View File
@@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [0.65.0](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.64.2...@ohif/ui@0.65.0) (2019-11-25)
### Features
* Add new annotate tool using new dialog service ([#1211](https://github.com/OHIF/Viewers/issues/1211)) ([8fd3af1](https://github.com/OHIF/Viewers/commit/8fd3af1e137e793f1b482760a22591c64a072047))
## [0.64.2](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.64.1...@ohif/ui@0.64.2) (2019-11-25)
### Bug Fixes
* Issue branch from danny experimental changes pr 1128 ([#1150](https://github.com/OHIF/Viewers/issues/1150)) ([a870b3c](https://github.com/OHIF/Viewers/commit/a870b3cc6056cf824af422e46f1ad674910b534e)), closes [#1161](https://github.com/OHIF/Viewers/issues/1161) [#1164](https://github.com/OHIF/Viewers/issues/1164) [#1177](https://github.com/OHIF/Viewers/issues/1177) [#1179](https://github.com/OHIF/Viewers/issues/1179) [#1180](https://github.com/OHIF/Viewers/issues/1180) [#1181](https://github.com/OHIF/Viewers/issues/1181) [#1182](https://github.com/OHIF/Viewers/issues/1182) [#1183](https://github.com/OHIF/Viewers/issues/1183) [#1184](https://github.com/OHIF/Viewers/issues/1184) [#1185](https://github.com/OHIF/Viewers/issues/1185)
## [0.64.1](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.64.0...@ohif/ui@0.64.1) (2019-11-20)
**Note:** Version bump only for package @ohif/ui
# [0.64.0](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.63.0...@ohif/ui@0.64.0) (2019-11-19)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/ui",
"version": "0.64.0",
"version": "0.65.0",
"description": "A set of React components for Medical Imaging Viewers",
"author": "OHIF Contributors",
"license": "MIT",
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import React, { Component, useState } from 'react';
import PropTypes from 'prop-types';
import { TextInput } from '@ohif/ui';
import './SimpleDialog.styl';
@@ -21,6 +22,31 @@ class SimpleDialog extends Component {
rootClass: '',
};
static InputDialog = ({ onSubmit, defaultValue, title, label, onClose }) => {
const [value, setValue] = useState(defaultValue);
const onSubmitHandler = () => {
onSubmit(value);
};
return (
<div className="InputDialog">
<SimpleDialog
headerTitle={title}
onClose={onClose}
onConfirm={onSubmitHandler}
>
<TextInput
type="text"
value={value}
onChange={event => setValue(event.target.value)}
label={label}
/>
</SimpleDialog>
</div>
);
};
render() {
return (
<React.Fragment>
@@ -1,6 +1,10 @@
@import './../../design/styles/common/button.styl'
@import './../../design/styles/common/global.styl'
.InputDialog
.simpleDialog
position: relative
.simpleDialog
position: fixed;
top: 0px;
@@ -3,11 +3,22 @@ import './StudyList.styl';
import React from 'react';
import classNames from 'classnames';
import TableSearchFilter from './TableSearchFilter.js';
import useMedia from '../../hooks/useMedia.js';
import PropTypes from 'prop-types';
import { StudyListLoadingText } from './StudyListLoadingText.js';
import { withTranslation } from '../../contextProviders';
import { useTranslation } from 'react-i18next';
const getContentFromUseMediaValue = (
displaySize,
contentArrayMap,
defaultContent
) => {
const content =
displaySize in contentArrayMap
? contentArrayMap[displaySize]
: defaultContent;
return content;
};
/**
*
*
@@ -24,9 +35,10 @@ function StudyList(props) {
filterValues,
onFilterChange: handleFilterChange,
onSelectItem: handleSelectItem,
t,
studyListDateFilterNumDays,
displaySize,
} = props;
const { t, ready: translationsAreReady } = useTranslation('StudyList');
const largeTableMeta = [
{
@@ -69,13 +81,13 @@ function StudyList(props) {
const mediumTableMeta = [
{
displayText: 'Patient / MRN',
displayText: `${t('Patient')} / ${t('MRN')}`,
fieldName: 'patientNameOrId',
inputType: 'text',
size: 250,
},
{
displayText: 'Description',
displayText: t('Description'),
fieldName: 'accessionOrModalityOrDescription',
inputType: 'text',
size: 350,
@@ -90,16 +102,16 @@ function StudyList(props) {
const smallTableMeta = [
{
displayText: 'Search',
displayText: t('Search'),
fieldName: 'allFields',
inputType: 'text',
size: 100,
},
];
const tableMeta = useMedia(
['(min-width: 1750px)', '(min-width: 1000px)', '(min-width: 768px)'],
[largeTableMeta, mediumTableMeta, smallTableMeta],
const tableMeta = getContentFromUseMediaValue(
displaySize,
{ large: largeTableMeta, medium: mediumTableMeta, small: smallTableMeta },
smallTableMeta
);
@@ -107,7 +119,7 @@ function StudyList(props) {
.map(field => field.size)
.reduce((prev, next) => prev + next);
return (
return translationsAreReady ? (
<table className="table table--striped table--hoverable">
<colgroup>
{tableMeta.map((field, i) => {
@@ -176,11 +188,12 @@ function StudyList(props) {
studyDescription={study.studyDescription || ''}
studyInstanceUid={study.studyInstanceUid}
t={t}
displaySize={displaySize}
/>
))}
</tbody>
</table>
);
) : null;
}
StudyList.propTypes = {
@@ -205,9 +218,12 @@ StudyList.propTypes = {
patientNameOrId: PropTypes.string.isRequired,
accessionOrModalityOrDescription: PropTypes.string.isRequired,
allFields: PropTypes.string.isRequired,
studyDateTo: PropTypes.any,
studyDateFrom: PropTypes.any,
}).isRequired,
onFilterChange: PropTypes.func.isRequired,
studyListDateFilterNumDays: PropTypes.number,
displaySize: PropTypes.string,
};
StudyList.defaultProps = {};
@@ -224,6 +240,7 @@ function TableRow(props) {
studyInstanceUid,
onClick: handleClick,
t,
displaySize,
} = props;
const largeRowTemplate = (
@@ -360,9 +377,13 @@ function TableRow(props) {
</tr>
);
const rowTemplate = useMedia(
['(min-width: 1750px)', '(min-width: 1000px)', '(min-width: 768px)'],
[largeRowTemplate, mediumRowTemplate, smallRowTemplate],
const rowTemplate = getContentFromUseMediaValue(
displaySize,
{
large: largeRowTemplate,
medium: mediumRowTemplate,
small: smallRowTemplate,
},
smallRowTemplate
);
@@ -378,11 +399,11 @@ TableRow.propTypes = {
studyDate: PropTypes.string.isRequired,
studyDescription: PropTypes.string.isRequired,
studyInstanceUid: PropTypes.string.isRequired,
displaySize: PropTypes.string,
};
TableRow.defaultProps = {
isHighlighted: false,
};
const connectedComponent = withTranslation('StudyList')(StudyList);
export { connectedComponent as StudyList };
export { StudyList };
@@ -6,6 +6,22 @@ import CustomDateRangePicker from './CustomDateRangePicker.js';
import { Icon } from './../../elements/Icon';
import { useTranslation } from 'react-i18next';
const getDateEntry = (datePicked, rangeDatePicked) => {
return rangeDatePicked || datePicked || null;
};
const getDateEntryFromRange = (today, numOfDays, edge = 'start') => {
if (typeof numOfDays !== 'number') {
return;
}
if (edge === 'end') {
return today;
} else {
today.subtract(numOfDays, 'days');
}
};
function TableSearchFilter(props) {
const {
meta,
@@ -17,20 +33,30 @@ function TableSearchFilter(props) {
// TODO: Rename
studyListDateFilterNumDays,
} = props;
const { studyDateTo, studyDateFrom } = values || {};
const [focusedInput, setFocusedInput] = useState(null);
const [t] = useTranslation(); // 'Common'?
const { t, ready: translationsAreReady } = useTranslation('Common');
const sortIcons = ['sort', 'sort-up', 'sort-down'];
const sortIconForSortField =
sortDirection === 'asc' ? sortIcons[1] : sortIcons[2];
const today = moment();
const lastWeek = moment().subtract(7, 'day');
const lastMonth = moment().subtract(1, 'month');
const defaultStartDate = moment().subtract(
const defaultStartDate = getDateEntryFromRange(
today,
studyListDateFilterNumDays,
'days'
'start'
);
const defaultEndDate = today;
const defaultEndDate = getDateEntryFromRange(
today,
studyListDateFilterNumDays,
'end'
);
const studyDatePresets = [
{
text: t('Today'),
@@ -49,56 +75,59 @@ function TableSearchFilter(props) {
},
];
return meta.map((field, i) => {
const { displayText, fieldName, inputType } = field;
const isSortField = sortFieldName === fieldName;
const sortIcon = isSortField ? sortIconForSortField : sortIcons[0];
return translationsAreReady
? meta.map((field, i) => {
const { displayText, fieldName, inputType } = field;
const isSortField = sortFieldName === fieldName;
const sortIcon = isSortField ? sortIconForSortField : sortIcons[0];
return (
<th key={`${fieldName}-${i}`}>
<label
htmlFor={`filter-${fieldName}`}
onClick={() => onSort(fieldName)}
>
{`${displayText} `}
<Icon name={sortIcon} style={{ fontSize: '12px' }} />
</label>
{inputType === 'text' && (
<input
type="text"
id={`filter-${fieldName}`}
className="form-control studylist-search"
value={values[fieldName]}
onChange={e => onValueChange(fieldName, e.target.value)}
/>
)}
{inputType === 'date-range' && (
// https://github.com/airbnb/react-dates
<CustomDateRangePicker
// Required
startDate={studyListDateFilterNumDays ? defaultStartDate : null}
startDateId="start-date"
endDate={studyListDateFilterNumDays ? defaultEndDate : null}
endDateId="end-date"
// TODO: We need a dynamic way to determine which fields values to update
onDatesChange={({ startDate, endDate, preset = false }) => {
onValueChange('studyDateFrom', startDate);
onValueChange('studyDateTo', endDate);
}}
focusedInput={focusedInput}
onFocusChange={updatedVal => setFocusedInput(updatedVal)}
// Optional
numberOfMonths={1} // For med and small screens? 2 for large?
showClearDates={true}
anchorDirection="left"
presets={studyDatePresets}
hideKeyboardShortcutsPanel={true}
isOutsideRange={day => !isInclusivelyBeforeDay(day, moment())}
/>
)}
</th>
);
});
return (
<th key={`${fieldName}-${i}`}>
<label
htmlFor={`filter-${fieldName}`}
onClick={() => onSort(fieldName)}
>
{`${displayText}`}
<Icon name={sortIcon} style={{ fontSize: '12px' }} />
</label>
{inputType === 'text' && (
<input
type="text"
id={`filter-${fieldName}`}
className="form-control studylist-search"
value={values[fieldName]}
onChange={e => onValueChange(fieldName, e.target.value)}
/>
)}
{inputType === 'date-range' && (
// https://github.com/airbnb/react-dates
<CustomDateRangePicker
// Required
startDate={getDateEntry(studyDateTo, defaultStartDate)}
startDateId="start-date"
endDate={getDateEntry(studyDateFrom, defaultEndDate)}
endDateId="end-date"
autoFocus={false}
// TODO: We need a dynamic way to determine which fields values to update
onDatesChange={({ startDate, endDate, preset = false }) => {
onValueChange('studyDateTo', startDate);
onValueChange('studyDateFrom', endDate);
}}
focusedInput={focusedInput}
onFocusChange={updatedVal => setFocusedInput(updatedVal)}
// Optional
numberOfMonths={1} // For med and small screens? 2 for large?
showClearDates={true}
anchorDirection="left"
presets={studyDatePresets}
hideKeyboardShortcutsPanel={true}
isOutsideRange={day => !isInclusivelyBeforeDay(day, moment())}
/>
)}
</th>
);
})
: null;
}
TableSearchFilter.propTypes = {
@@ -67,15 +67,24 @@ class UserPreferencesForm extends Component {
<div className="footer">
<button
className="btn btn-danger pull-left"
data-cy="reset-default-btn"
onClick={this.props.onResetToDefaults}
>
{this.props.t('Reset to Defaults')}
</button>
<div>
<div onClick={this.props.onClose} className="btn btn-default">
<div
onClick={this.props.onClose}
className="btn btn-default"
data-cy="cancel-btn"
>
{this.props.t('Cancel')}
</div>
<button className="btn btn-primary" onClick={this.save}>
<button
className="btn btn-primary"
data-cy="save-btn"
onClick={this.save}
>
{this.props.t('Save')}
</button>
</div>
+143 -109
View File
@@ -34,49 +34,45 @@ const DialogProvider = ({ children, service }) => {
}, [create, dismiss, service]);
/**
* Creates a dialog and return its id.
* UI Dialog
*
* @returns id
* @typedef {Object} DialogProps
* @property {string} id The dialog id.
* @property {DialogContent} content The dialog content.
* @property {Object} contentProps The dialog content props.
* @property {boolean} isDraggable Controls if dialog content is draggable or not.
* @property {boolean} showOverlay Controls dialog overlay.
* @property {ElementPosition} defaultPosition Specifies the `x` and `y` that the dragged item should start at.
* @property {ElementPosition} position If this property is present, the item becomes 'controlled' and is not responsive to user input.
* @property {Function} onStart Called when dragging starts. If `false` is returned any handler, the action will cancel.
* @property {Function} onStop Called when dragging stops.
* @property {Function} onDrag Called while dragging.
*/
const create = useCallback(
({
id,
content,
onSubmit,
onClose,
onDrag,
onStop,
isDraggable,
defaultPosition,
position,
}) => {
let dialogId = id;
if (!dialogId) {
dialogId = utils.guid();
}
const newDialog = {
id: dialogId,
content,
onSubmit,
onClose,
onDrag,
onStop,
isDraggable,
defaultPosition,
position,
};
/**
* Creates a new dialog and return its id.
*
* @param {DialogProps} props The dialog props.
* @returns The new dialog id.
*/
const create = useCallback(props => {
const { id } = props;
setDialogs(dialogs => [...dialogs, newDialog]);
let dialogId = id;
if (!dialogId) {
dialogId = utils.guid();
}
return dialogId;
},
[]
);
setDialogs(dialogs => [...dialogs, { ...props, id: dialogId }]);
return dialogId;
}, []);
/**
* Dismisses the dialog with a given id.
*
* @param {Object} props -
* @property {string} props.id The dialog id.
* @returns void
*/
const dismiss = useCallback(({ id }) => {
@@ -92,18 +88,102 @@ const DialogProvider = ({ children, service }) => {
setDialogs([]);
};
/**
* Indicate if there are no dialogs present.
*
* @returns True if no dialogs are present.
*/
const isEmpty = () => dialogs && dialogs.length < 1;
/**
* Moves the dialog to the foreground if clicked.
*
* @param {string} id The dialog id.
* @returns void
*/
const _bringToFront = id => {
setDialogs(dialogs => {
const topDialog = dialogs.find(dialog => dialog.id === id);
return topDialog
? [...dialogs.filter(dialog => dialog.id !== id), topDialog]
: [];
});
};
const renderDialogs = () =>
dialogs.map(dialog => {
const {
id,
content: DialogContent,
contentProps,
position,
defaultPosition,
isDraggable = true,
onStart,
onStop,
onDrag,
} = dialog;
return (
<Draggable
key={id}
disabled={!isDraggable}
position={position}
defaultPosition={lastDialogPosition || defaultPosition}
bounds="parent"
onStart={event => {
const e = event || window.event;
const target = e.target || e.srcElement;
const BLACKLIST = [
'SVG',
'BUTTON',
'PATH',
'INPUT',
'SPAN',
'LABEL',
];
if (BLACKLIST.includes(target.tagName.toUpperCase())) {
return false;
}
if (validCallback(onStart)) {
return onStart(event);
}
}}
onStop={event => {
setIsDragging(false);
if (validCallback(onStop)) {
return onStop(event);
}
}}
onDrag={event => {
setIsDragging(true);
_bringToFront(id);
_updateLastDialogPosition(id);
if (validCallback(onDrag)) {
return onDrag(event);
}
}}
>
<div
id={`draggableItem-${id}`}
className={classNames('DraggableItem', isDragging && 'dragging')}
style={{ zIndex: '999', position: 'absolute' }}
onClick={() => _bringToFront(id)}
>
<DialogContent {...dialog} {...contentProps} />
</div>
</Draggable>
);
});
/**
* Update the last dialog position to be used as the new default position.
*
* @returns void
*/
const _reorder = id => {
setDialogs(dialogs => [
...dialogs.filter(dialog => dialog.id !== id),
dialogs.find(dialog => dialog.id === id),
]);
};
const _updateLastDialogPosition = dialogId => {
const draggableItemBounds = document
.querySelector(`#draggableItem-${dialogId}`)
@@ -114,70 +194,36 @@ const DialogProvider = ({ children, service }) => {
});
};
const validCallback = callback => callback && typeof callback === 'function';
return (
<DialogContext.Provider value={{ create, dismiss, dismissAll, dialogs }}>
<DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}>
<div className="DraggableArea">
{dialogs.map(dialog => {
const {
id,
content: Dialog,
position /* Position of the dialog. {{x: 0, y: 0}} */,
defaultPosition,
isDraggable = true,
onStart = () => {},
onStop = () => {},
onDrag = () => {},
} = dialog;
return (
<Draggable
key={id}
disabled={!isDraggable}
position={position}
defaultPosition={lastDialogPosition || defaultPosition}
bounds="parent"
onStart={event => {
const e = event || window.event;
const target = e.target || e.srcElement;
const BLACKLIST = ['SVG', 'BUTTON', 'PATH', 'INPUT'];
if (BLACKLIST.includes(target.tagName.toUpperCase())) {
return false;
}
onStart(event);
}}
onStop={event => {
onStop(event);
setIsDragging(false);
return;
}}
onDrag={event => {
setIsDragging(true);
_reorder(id);
_updateLastDialogPosition(id);
onDrag(event);
}}
>
<div
id={`draggableItem-${id}`}
className={classNames(
'DraggableItem',
isDragging && 'dragging'
)}
style={{ zIndex: '999', position: 'absolute' }}
onClick={() => _reorder(id)}
>
<Dialog {...dialog} />
</div>
</Draggable>
);
})}
{dialogs.some(dialog => dialog.showOverlay) ? (
<div className="Overlay active">{renderDialogs()}</div>
) : (
renderDialogs()
)}
</div>
{children}
</DialogContext.Provider>
);
};
/**
*
* High Order Component to use the dialog methods through a Class Component
*
*/
export const withDialog = Component => {
return function WrappedComponent(props) {
const { create, dismiss, dismissAll, isEmpty } = useDialog();
return (
<Component {...props} dialog={{ create, dismiss, dismissAll, isEmpty }} />
);
};
};
DialogProvider.defaultProps = {
service: null,
};
@@ -193,16 +239,4 @@ DialogProvider.propTypes = {
}),
};
/**
*
* High Order Component to use the dialog methods through a Class Component
*
*/
export const withDialog = Component => {
return function WrappedComponent(props) {
const { create, dismiss, dismissAll } = useDialog();
return <Component {...props} dialog={{ create, dismiss, dismissAll }} />;
};
};
export default DialogProvider;
@@ -6,7 +6,17 @@
div
cursor: grabbing !important
.DraggableArea
width: 100vw
height: 100vh
.DraggableArea, .Overlay
width: 100%
height: 100%
position: absolute
.Overlay.active
position: fixed
z-index: 999
left: 0
top: 0
width: 100%
height: 100%
overflow: auto
background: rgba(0,0,0,.1)
@@ -13,14 +13,28 @@ const { Provider } = ModalContext;
export const useModal = () => useContext(ModalContext);
/**
* UI Modal
*
* @typedef {Object} ModalProps
* @property {ReactElement|HTMLElement} [content=null] Modal content.
* @property {Object} [contentProps=null] Modal content props.
* @property {boolean} [shouldCloseOnEsc=false] Modal is dismissible via the esc key.
* @property {boolean} [isOpen=true] Make the Modal visible or hidden.
* @property {boolean} [closeButton=true] Should the modal body render the close button.
* @property {string} [title=null] Should the modal render the title independently of the body content.
* @property {string} [customClassName=null] The custom class to style the modal.
*/
const ModalProvider = ({ children, modal: Modal, service }) => {
const DEFAULT_OPTIONS = {
component: null /* The component instance inside the modal. */,
shouldCloseOnEsc: false /* Modal is dismissible via the esc key. */,
isOpen: true /* Make the Modal visible or hidden. */,
closeButton: true /* Should the modal body render the close button. */,
title: null /* Should the modal render the title independently of the body content. */,
customClassName: '' /* The custom class to style the modal. */,
content: null,
contentProps: null,
shouldCloseOnEsc: false,
isOpen: true,
closeButton: true,
title: null,
customClassName: '',
};
const [options, setOptions] = useState(DEFAULT_OPTIONS);
@@ -39,13 +53,12 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
/**
* Show the modal and override its configuration props.
*
* @param {ModalProps} props { content, contentProps, shouldCloseOnEsc, isOpen, closeButton, title, customClassName }
* @returns void
*/
const show = useCallback(
(component, props = {}) =>
setOptions(Object.assign({}, options, props, { component })),
[options]
);
const show = useCallback(props => setOptions({ ...options, ...props }), [
options,
]);
/**
* Hide the modal and set its properties to default.
@@ -56,23 +69,28 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
DEFAULT_OPTIONS,
]);
const { component: Component } = options;
const {
content: ModalContent,
contentProps,
isOpen,
title,
customClassName,
shouldCloseOnEsc,
closeButton,
} = options;
return (
<Provider value={{ show, hide }}>
{options.component && (
{ModalContent && (
<Modal
className={classNames(
options.customClassName,
options.component.className
)}
shouldCloseOnEsc={options.keyboard}
isOpen={options.isOpen}
title={options.title}
closeButton={options.closeButton}
className={classNames(customClassName, ModalContent.className)}
shouldCloseOnEsc={shouldCloseOnEsc}
isOpen={isOpen}
title={title}
closeButton={closeButton}
onClose={hide}
>
<Component {...options} show={show} hide={hide} />
<ModalContent {...contentProps} show={show} hide={hide} />
</Modal>
)}
{children}
@@ -80,6 +98,18 @@ const ModalProvider = ({ children, modal: Modal, service }) => {
);
};
/**
* Higher Order Component to use the modal methods through a Class Component.
*
* @returns
*/
export const withModal = Component => {
return function WrappedComponent(props) {
const { show, hide } = useModal();
return <Component {...props} modal={{ show, hide }} />;
};
};
ModalProvider.defaultProps = {
service: null,
};
@@ -99,18 +129,6 @@ ModalProvider.propTypes = {
}),
};
/**
* Higher Order Component to use the modal methods through a Class Component.
*
* @returns
*/
export const withModal = Component => {
return function WrappedComponent(props) {
const { show, hide } = useModal();
return <Component {...props} modal={{ show, hide }} />;
};
};
export default ModalProvider;
export const ModalConsumer = ModalContext.Consumer;
+1 -1
View File
@@ -1,4 +1,4 @@
import useMedia from './useMedia.js';
import { useMedia } from './useMedia.js';
import useDebounce from './useDebounce.js';
export { useDebounce, useMedia };
+165 -41
View File
@@ -1,54 +1,178 @@
import { useState, useEffect } from 'react';
import { useState, useEffect, useRef, useCallback } from 'react';
import isEqual from 'lodash.isequal';
/**
* Get display size value for matched mediaQueryList
* @param {MediaQueryList[]} mediaQueryMap - Array of mappings, containing MediaQueryLists
* @param {Array} mediaTypesAliases - Array of strings representing each mediaQueryAlias.
* @param {string} defaultDisplaySize - default display size value. Fallback value.
*/
const getDisplaySize = (
mediaQueryMap,
mediaTypesAliases,
defaultDisplaySize
) => {
if ((!mediaTypesAliases && !defaultDisplaySize) || !mediaQueryMap) {
return;
}
// Get index of first media query that matches
const index = mediaQueryMap.findIndex(mql => mql.matches);
// Return related value or defaultDisplaySize if none
return index >= 0 && typeof mediaTypesAliases[index] !== 'undefined'
? mediaTypesAliases[index]
: defaultDisplaySize;
};
/**
* Map each window MediaQueryLists
* @param {Array} mediaQueriesStringList - array of string media queries to be parsed
*/
const getMediaQueryMap = mediaQueriesStringList => {
return (
mediaQueriesStringList &&
mediaQueriesStringList.map(q => window.matchMedia(q))
);
};
const getMediaTypeAlias = (mediaQuery, state) => {
const { media } = mediaQuery;
const { mediaQueriesStringList, mediaTypesAliases } = state;
const index = mediaQueriesStringList.findIndex(originalMediaQuery => {
const { media: toCompareMedia } = window.matchMedia(originalMediaQuery);
return toCompareMedia === media;
});
return mediaTypesAliases[index];
};
/**
* Hook to get current displaySize value.
*
* Its state changes and also displaySize value changes in case viewport is resized.
* Its state changes in case mediaQueriesStringList or mediaTypesAliases changes.
*
* Current hook only offers displayMedia size, it wont expose method to change its state.
* @param {Array} mediaQueriesStringList - array of string media queries to be parsed
* @param {Array} mediaTypesAliases - array of aliases. Each value represents one mediaQueryList from array mediaQueriesStringList
* @param {String} defaultMediaType - default mediaTypeAlias
* @returns {String} current displayMedia size based on viewport size.
*
* @example <caption>Example to getDisplayMedia Size based on viewport size</caption>
*
* const displaySize = useMedia(
* ['(min-width: 1500px)', '(min-width: 1000px)', '(min-width: 600px)'],
* // Value to return for matched media query
* ['large', 'medium', 'small'],
* // Default value
* 'medium');
*
* const currentDisplaySize = useMedia();
*
* @example <caption></caption>
* const currentViewportSize = useMedia(
* // Media queries
* ['(min-width: 1500px)', '(min-width: 1000px)', '(min-width: 600px)'],
* // Value to return for matched media query
* ['large', 'medium', 'small'],
* // Default value
* 'medium'
* );
* @param {string[]} queries
* @param {*} values
* @param {*} defaultValue
* @returns
*/
function useMedia(queries, values, defaultValue) {
// Array containing a media query list for each query
const mediaQueryLists = queries.map(q => window.matchMedia(q));
const useMedia = (
mediaQueriesStringList,
mediaTypesAliases,
defaultMediaType
) => {
// MediaQuery.state is the source of truth. This hook will be dependent on it.
const [state, setState] = useState(() => {
const _mediaQueryMap = getMediaQueryMap(mediaQueriesStringList);
const _displaySize = getDisplaySize(
_mediaQueryMap,
mediaTypesAliases,
defaultMediaType
);
// Function that gets value based on matching media query
const getValue = () => {
// Get index of first media query that matches
const index = mediaQueryLists.findIndex(mql => mql.matches);
return {
mediaQueryMap: _mediaQueryMap,
displaySize: _displaySize,
mediaQueriesStringList,
mediaTypesAliases,
defaultMediaType,
};
});
let mount = useRef(false);
// Return related value or defaultValue if none
return typeof values[index] !== 'undefined' ? values[index] : defaultValue;
const updateDisplaySize = displaySize => {
if (mount.current) {
setState({ ...state, displaySize });
}
};
// State and setter for matched value
const [value, setValue] = useState(getValue);
const updateState = value => {
const {
mediaQueriesStringList,
mediaTypesAliases,
defaultMediaType,
} = value;
useEffect(
() => {
// Event listener callback
// Note: By defining getValue outside of useEffect we ensure that it has ...
// ... current values of hook args (as this hook callback is created once on mount).
const handler = () => setValue(getValue);
const mediaQueryMap = getMediaQueryMap(mediaQueriesStringList);
const displaySize = getDisplaySize(
mediaQueryMap,
mediaTypesAliases,
defaultMediaType
);
// immutable state
// last chance to avoid setState of unmount component
if (mount.current) {
setState({
...state,
mediaQueriesStringList,
mediaTypesAliases,
displaySize,
mediaQueryMap,
});
}
};
// Set a listener for each media query with above handler as callback.
mediaQueryLists.forEach(mql => mql.addListener(handler));
const onMediaQueryChange = useCallback(mediaQuery => {
if (mediaQuery.matches) {
const nextDisplaySize = getMediaTypeAlias(mediaQuery, state);
updateDisplaySize(nextDisplaySize);
}
}, []);
// Remove listeners on cleanup
return () => mediaQueryLists.forEach(mql => mql.removeListener(handler));
},
[] // Empty array ensures effect is only run on mount and unmount
);
// update state of MediaQuery in case mediaQueriesStringList or mediaTypesAliases has changed
useEffect(() => {
const {
mediaQueriesStringList: _mediaQueriesStringList,
mediaTypesAliases: _mediaTypesAliases,
} = state;
if (
(mediaQueriesStringList &&
!isEqual(mediaQueriesStringList, _mediaQueriesStringList)) ||
(mediaTypesAliases && !isEqual(mediaTypesAliases, _mediaTypesAliases))
) {
updateState({
mediaQueriesStringList,
mediaTypesAliases,
});
}
}, [mediaQueriesStringList, mediaTypesAliases]);
return value;
}
// re-assign window resizing listeners
useEffect(() => {
const { mediaQueryMap } = state;
mediaQueryMap.forEach(mql => {
mql.removeListener(onMediaQueryChange);
mql.addListener(onMediaQueryChange);
});
}, [state.mediaQueryMap]);
export default useMedia;
useEffect(() => {
mount.current = true;
return () => {
mount.current = false;
const { mediaQueryMap } = state;
mediaQueryMap.forEach(mql => {
mql.removeListener(onMediaQueryChange);
});
};
}, []);
return state.displaySize;
};
export { useMedia };
+41
View File
@@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.11.1](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.11.0...@ohif/viewer@2.11.1) (2019-11-27)
### Bug Fixes
* of undefined name of project ([#1231](https://github.com/OHIF/Viewers/issues/1231)) ([e34a057](https://github.com/OHIF/Viewers/commit/e34a05726319e3e70279c43d5bf976d33cdf71f7))
# [2.11.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.10.2...@ohif/viewer@2.11.0) (2019-11-25)
### Features
* Add new annotate tool using new dialog service ([#1211](https://github.com/OHIF/Viewers/issues/1211)) ([8fd3af1](https://github.com/OHIF/Viewers/commit/8fd3af1e137e793f1b482760a22591c64a072047))
## [2.10.2](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.10.1...@ohif/viewer@2.10.2) (2019-11-25)
### Bug Fixes
* Issue branch from danny experimental changes pr 1128 ([#1150](https://github.com/OHIF/Viewers/issues/1150)) ([a870b3c](https://github.com/OHIF/Viewers/commit/a870b3cc6056cf824af422e46f1ad674910b534e)), closes [#1161](https://github.com/OHIF/Viewers/issues/1161) [#1164](https://github.com/OHIF/Viewers/issues/1164) [#1177](https://github.com/OHIF/Viewers/issues/1177) [#1179](https://github.com/OHIF/Viewers/issues/1179) [#1180](https://github.com/OHIF/Viewers/issues/1180) [#1181](https://github.com/OHIF/Viewers/issues/1181) [#1182](https://github.com/OHIF/Viewers/issues/1182) [#1183](https://github.com/OHIF/Viewers/issues/1183) [#1184](https://github.com/OHIF/Viewers/issues/1184) [#1185](https://github.com/OHIF/Viewers/issues/1185)
## [2.10.1](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.10.0...@ohif/viewer@2.10.1) (2019-11-20)
**Note:** Version bump only for package @ohif/viewer
# [2.10.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.9.0...@ohif/viewer@2.10.0) (2019-11-19)
@@ -85,6 +85,7 @@ describe('OHIF Cornerstone Hotkeys', () => {
cy.get('@layoutBtn').click();
//Select 3 viewports
cy.get('tbody > :nth-child(1) > :nth-child(3)').click();
cy.waitViewportImageLoading();
// Press multiples hotkeys on viewport #1
cy.get('body').type('VL+++I');
@@ -0,0 +1,601 @@
describe('OHIF User Preferences', () => {
context('Study List Page', function() {
before(() => {
cy.visit('/');
});
beforeEach(() => {
// Open User Preferences modal
cy.openPreferences();
cy.initPreferencesModalAliases();
});
it('checks displayed information on User Preferences modal', function() {
cy.get('@preferencesModal').should('contain.text', 'User Preferences');
cy.get('@userPreferencesHotkeysTab')
.should('have.text', 'Hotkeys')
.and('have.class', 'active');
cy.get('@userPreferencesGeneralTab').should('have.text', 'General');
cy.get('@restoreBtn')
.scrollIntoView()
.should('have.text', 'Reset to Defaults');
cy.get('@cancelBtn').should('have.text', 'Cancel');
cy.get('@saveBtn').should('have.text', 'Save');
// Visual comparison
cy.screenshot(
'User Preferences Modal - Hotkeys tab initial state in Study Viewer page'
);
cy.percyCanvasSnapshot(
'User Preferences Modal - Hotkeys tab initial state in Study Viewer page'
);
cy.get('[data-cy="close-button"]').click();
});
it('checks translation by selecting Spanish language', function() {
cy.get('@userPreferencesGeneralTab')
.click()
.should('have.class', 'active');
// Language dropdown should be displayed
cy.get('#language-select').should('be.visible');
// Visual comparison
cy.screenshot(
'User Preferences Modal - General tab initial state in Study Viewer page'
);
cy.percyCanvasSnapshot(
'User Preferences Modal - General tab initial state in Study Viewer page'
);
// Select Spanish and Save
cy.get('#language-select').select('Spanish');
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Header should be translated to Spanish
cy.get('.research-use')
.scrollIntoView()
.should('have.text', 'SOLO USO PARA INVESTIGACIÓN');
// Options menu should be translated
cy.get('[data-cy="options-menu"]').should('have.text', 'Opciones');
//TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
//Once the issue is fixed, the following code should be uncommented
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'Acerca de');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferencias');
});
it('checks if user can cancel the language selection and application will be in English', function() {
cy.get('@userPreferencesGeneralTab')
.click()
.should('have.class', 'active');
// Language dropdown should be displayed
cy.get('#language-select').should('be.visible');
// Select Spanish and Cancel
cy.get('#language-select').select('Spanish');
cy.get('@cancelBtn')
.scrollIntoView()
.click();
// TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
// Once the issue is fixed, the following code should be uncommented
// // Header should be kept in English
// cy.get('.research-use')
// .scrollIntoView()
// .should('have.text', 'INVESTIGATIONAL USE ONLY');
//
// // Options menu should be translated
// cy.get('[data-cy="options-menu"]').should('have.text', 'Options');
//
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'About');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferences');
});
// TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
// Once the issue is fixed, the following code should be uncommented
// it('checks if user can restore to default the language selection and application will be in English', function() {
// cy.get('@userPreferencesGeneralTab')
// .click()
// .should('have.class', 'active');
// // Language dropdown should be displayed
// cy.get('#language-select').should('be.visible');
// // Select Spanish and Save
// cy.get('#language-select').select('Spanish');
// cy.get('@saveBtn')
// .scrollIntoView()
// .click();
// //Open Preferences again
// cy.openPreferences();
// // Go to general tab
// cy.get('@userPreferencesGeneralTab').click();
// cy.get('@restoreBtn')
// .scrollIntoView()
// .click();
// Header should be in English
// cy.get('.research-use')
// .scrollIntoView()
// .should('have.text', 'INVESTIGATIONAL USE ONLY');
//
// Options menu should be in English
// cy.get('[data-cy="options-menu"]').should('have.text', 'Options');
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'About');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferences');
// });
it('checks if Preferences set in Study List Page will be consistent on Viewer Page', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab')
.click()
.should('have.class', 'active');
// Set new hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal('Rotate Right', '{shift}Q');
// Save new hotkey
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Open User Preferences modal again
cy.openPreferences();
// Go to General tab
cy.get('@userPreferencesGeneralTab').click();
// Select Spanish and Save
cy.get('#language-select').select('Spanish');
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Go to Study Viewer page
cy.openStudy('MISTER^MR');
cy.waitDicomImage();
cy.expectMinimumThumbnails(5);
cy.initCommonElementsAliases();
// Check if application is in Spanish
// Header should be translated to Spanish
cy.get('.research-use')
.scrollIntoView()
.should('have.text', 'SOLO USO PARA INVESTIGACIÓN');
// Options menu should be translated
cy.get('[data-cy="options-menu"]')
.should('have.text', 'Opciones')
.click();
cy.get('[data-cy="about-item-menu"]')
.first()
.should('contain.text', 'Acerca de');
cy.get('[data-cy="options-menu"]').click(); //Close Options overlay
//TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
//Once the issue is fixed, the following code should be uncommented
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferencias');
// Check if new hotkey is working on viewport
cy.get('body').type('{shift}Q', { release: false });
cy.get('@viewportInfoMidTop').should('contains.text', 'R');
});
});
context('Study Viewer Page', function() {
before(() => {
cy.openStudy('MISTER^MR');
cy.expectMinimumThumbnails(5);
});
beforeEach(() => {
cy.initCommonElementsAliases();
cy.resetViewport();
cy.resetUserHoktkeyPreferences();
// Open User Preferences modal
cy.openPreferences();
});
it('checks displayed information on User Preferences modal', function() {
cy.get('@preferencesModal').should('contain.text', 'User Preferences');
cy.get('@userPreferencesHotkeysTab')
.should('have.text', 'Hotkeys')
.and('have.class', 'active');
cy.get('@userPreferencesGeneralTab').should('have.text', 'General');
cy.get('@restoreBtn')
.scrollIntoView()
.should('have.text', 'Reset to Defaults');
cy.get('@cancelBtn').should('have.text', 'Cancel');
cy.get('@saveBtn').should('have.text', 'Save');
// Visual comparison
cy.screenshot(
'User Preferences Modal - Hotkeys tab initial state in Study List page'
);
cy.percyCanvasSnapshot(
'User Preferences Modal - Hotkeys tab initial state in Study List page'
);
cy.get('[data-cy="close-button"]').click(); //close User Preferences modal
});
it('checks translation by selecting Spanish language', function() {
cy.get('@userPreferencesGeneralTab')
.click()
.should('have.class', 'active');
// Language dropdown should be displayed
cy.get('#language-select').should('be.visible');
// Visual comparison
cy.screenshot(
'User Preferences Modal - General tab initial state in Study List page'
);
cy.percyCanvasSnapshot(
'User Preferences Modal - General tab initial state in Study List page'
);
// Select Spanish and Save
cy.get('#language-select').select('Spanish');
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Header should be translated to Spanish
cy.get('.research-use')
.scrollIntoView()
.should('have.text', 'SOLO USO PARA INVESTIGACIÓN');
// Options menu should be translated
cy.get('[data-cy="options-menu"]').should('have.text', 'Opciones');
//TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
//Once the issue is fixed, the following code should be uncommented
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'Acerca de');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferencias');
});
it('checks if user can cancel the language selection and application will be in English', function() {
cy.get('@userPreferencesGeneralTab')
.click()
.should('have.class', 'active');
// Language dropdown should be displayed
cy.get('#language-select').should('be.visible');
// Select Spanish and Cancel
cy.get('#language-select').select('Spanish');
cy.get('@cancelBtn')
.scrollIntoView()
.click();
// TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
// Once the issue is fixed, the following code should be uncommented
// // Header should be kept in English
// cy.get('.research-use')
// .scrollIntoView()
// .should('have.text', 'INVESTIGATIONAL USE ONLY');
//
// // Options menu should be translated
// cy.get('[data-cy="options-menu"]').should('have.text', 'Options');
//
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'About');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferences');
});
// TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
// Once the issue is fixed, the following code should be uncommented
// it('checks if user can restore to default the language selection and application will be in English', function() {
// cy.get('@userPreferencesGeneralTab')
// .click()
// .should('have.class', 'active');
// // Language dropdown should be displayed
// cy.get('#language-select').should('be.visible');
// // Select Spanish and Save
// cy.get('#language-select').select('Spanish');
// cy.get('@saveBtn')
// .scrollIntoView()
// .click();
// //Open Preferences again
// cy.get('[data-cy="options-menu"]')
// .scrollIntoView()
// .click();
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .click();
// // Go to general tab
// cy.get('@userPreferencesGeneralTab').click();
// cy.get('@restoreBtn')
// .scrollIntoView()
// .click();
// Header should be in English
// cy.get('.research-use')
// .scrollIntoView()
// .should('have.text', 'INVESTIGATIONAL USE ONLY');
//
// Options menu should be in English
// cy.get('[data-cy="options-menu"]').should('have.text', 'Options');
// cy.get('[data-cy="about-item-menu"]')
// .first()
// .should('have.text', 'About');
// cy.get('[data-cy="about-item-menu"]')
// .last()
// .should('have.text', 'Preferences');
//});
it('checks new hotkeys for "Rotate Right" and "Rotate Left"', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab')
.click()
.should('have.class', 'active');
// Set new hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Rotate Right',
'{shift}{rightarrow}'
);
// Set new hotkey for 'Rotate Left' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Rotate Left',
'{shift}{leftarrow}'
);
//Save new hotkeys
cy.get('@saveBtn')
.scrollIntoView()
.click();
//Rotate Right with new Hotkey
cy.get('body').type('{shift}{rightarrow}');
cy.get('@viewportInfoMidTop').should('contains.text', 'R');
//Rotate Left with new Hotkey
cy.get('body').type('{shift}{leftarrow}');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
});
it('checks new hotkeys for "Next" and "Previous" Image on Viewport', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab')
.click()
.should('have.class', 'active');
// Set new hotkey for 'Next Image Viewport' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Next Image Viewport',
'{shift}{rightarrow}'
);
// Set new hotkey for 'Previous Image Viewport' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Previous Image Viewport',
'{shift}{leftarrow}'
);
// Save new hotkeys
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Set 3 viewports layout
cy.setLayout(3, 1);
cy.waitViewportImageLoading();
// Rotate Right and Invert colors on Viewport #1
cy.get('body').type('RI');
// Check that image was rotated
cy.get('@viewportInfoMidTop').should('contains.text', 'R');
//Move to Next Viewport
cy.get('body').type('{shift}{rightarrow}');
// Rotate Left and Invert colors on Viewport #2
cy.get('body').type('LI');
// Get overlay information from viewport #2
cy.get(
':nth-child(2) > .viewport-wrapper > .viewport-element > .ViewportOrientationMarkers.noselect > .top-mid.orientation-marker'
).as('viewport2InfoMidTop');
// Check that image was rotated
cy.get('@viewport2InfoMidTop').should('contains.text', 'P');
//Move to Previous Viewport
cy.get('body').type('{shift}{leftarrow}');
// Reset viewport #1 with spacebar hotkey
cy.get('body').type(' ');
cy.get('@viewportInfoMidTop').should('contains.text', 'A');
// Visual comparison
cy.screenshot('Viewport Navigation - 2nd viewport inverted and rotated');
cy.percyCanvasSnapshot(
'Viewport Navigation - 2nd viewport inverted and rotated'
);
// Set 1 viewport layout
cy.setLayout(1, 1);
});
it('checks error message when duplicated hotkeys are inserted', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab').click();
// Set duplicated hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Rotate Right',
'{rightarrow}'
);
// Check error message
cy.get('.HotKeysPreferences').within(() => {
cy.contains('Rotate Right') // label we're looking for
.parent()
.find('.errorMessage')
.as('errorMsg')
.should(
'have.text',
'"Next Image Viewport" is already using the "right" shortcut.'
);
});
//Cancel hotkeys
cy.get('@cancelBtn')
.scrollIntoView()
.click();
});
it('checks error message when invalid hotkey is inserted', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab').click();
// Set invalid hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal('Rotate Right', '{ctrl}Z');
// Check error message
cy.get('.HotKeysPreferences').within(() => {
cy.contains('Rotate Right') // label we're looking for
.parent()
.find('.errorMessage')
.as('errorMsg')
.should('have.text', '"ctrl+z" shortcut combination is not allowed');
});
//Cancel hotkeys
cy.get('@cancelBtn')
.scrollIntoView()
.click();
});
it('checks error message when only modifier keys are inserted', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab').click();
// Set invalid modifier key: ctrl
cy.setNewHotkeyShortcutOnUserPreferencesModal('Zoom Out', '{ctrl}');
// Check error message
cy.get('.HotKeysPreferences').within(() => {
cy.contains('Zoom Out') // label we're looking for
.parent()
.find('.errorMessage')
.as('errorMsg')
.should(
'have.text',
"It's not possible to define only modifier keys (ctrl, alt and shift) as a shortcut"
);
});
// Set invalid modifier key: shift
cy.setNewHotkeyShortcutOnUserPreferencesModal('Zoom Out', '{shift}');
// Check error message
cy.get('@errorMsg').should(
'have.text',
"It's not possible to define only modifier keys (ctrl, alt and shift) as a shortcut"
);
// Set invalid modifier key: alt
cy.setNewHotkeyShortcutOnUserPreferencesModal('Zoom Out', '{alt}');
// Check error message
cy.get('@errorMsg').should(
'have.text',
"It's not possible to define only modifier keys (ctrl, alt and shift) as a shortcut"
);
//Cancel hotkeys
cy.get('@cancelBtn')
.scrollIntoView()
.click();
});
it('checks if user can cancel changes made on User Preferences Hotkeys tab', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab').click();
// Set new hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Rotate Right',
'{ctrl}{shift}S'
);
//Cancel hotkeys
cy.get('@cancelBtn')
.scrollIntoView()
.click();
// Open User Preferences modal again
cy.openPreferences();
//Check that hotkey for 'Rotate Right' function was not changed
cy.get('.HotKeysPreferences').within(() => {
cy.contains('Rotate Right') // label we're looking for
.parent()
.find('input')
.should('have.value', 'r');
});
cy.get('[data-cy="close-button"]').click();
});
it('checks if user can reset to default values on User Preferences Hotkeys tab', function() {
// Go go hotkeys tab
cy.get('@userPreferencesHotkeysTab').click();
// Set new hotkey for 'Rotate Right' function
cy.setNewHotkeyShortcutOnUserPreferencesModal(
'Rotate Right',
'{ctrl}{shift}S'
);
//Save hotkeys
cy.get('@saveBtn')
.scrollIntoView()
.click();
// Open User Preferences modal again
cy.openPreferences();
//Restore Default hotkeys
cy.get('@restoreBtn')
.scrollIntoView()
.click();
// Open User Preferences modal again
cy.openPreferences();
//Check that hotkey for 'Rotate Right' function was not changed
cy.get('.HotKeysPreferences').within(() => {
cy.contains('Rotate Right') // label we're looking for
.parent()
.find('input')
.should('have.value', 'r');
});
cy.get('[data-cy="close-button"]').click();
});
});
});
@@ -81,6 +81,7 @@ describe('OHIF VTK Extension', () => {
);
});
/* TODO: Non-deterministic behavior (const expectedText = 'W: 350 L: -1044';)
it('checks WWWC tool', () => {
cy.get('@wwwcBtn').click();
@@ -92,7 +93,7 @@ describe('OHIF VTK Extension', () => {
.trigger('mousemove', 'top', { which: 1 })
.trigger('mouseup', { which: 1 })
.then(() => {
const expectedText = 'W: 350 L: -1044';
const expectedText = 'W: 350 L: 40';
cy.get('.ViewportOverlay > div.bottom-right.overlay-element').should(
'contains.text',
expectedText
@@ -102,7 +103,7 @@ describe('OHIF VTK Extension', () => {
// Visual comparison
cy.screenshot('VTK WWWC tool - Canvas should be bright');
cy.percyCanvasSnapshot('VTK WWWC tool - Canvas should be bright');
});
}); */
it('checks Rotate tool', () => {
cy.get('@rotateBtn').click();
@@ -77,3 +77,17 @@ export function initStudyListAliasesOnTablet() {
cy.get('#end-date').as('studyListEndDate');
cy.get('[data-cy="study-list-results"] > tr').as('searchResult');
}
//Creating aliases for User Preferences modal
export function initPreferencesModalAliases() {
cy.get('.OHIFModal').as('preferencesModal');
cy.get('.nav-link')
.first()
.as('userPreferencesHotkeysTab');
cy.get('.nav-link')
.last()
.as('userPreferencesGeneralTab');
cy.get('[data-cy="reset-default-btn"]').as('restoreBtn');
cy.get('[data-cy="cancel-btn"]').as('cancelBtn');
cy.get('[data-cy="save-btn"]').as('saveBtn');
}
+62 -7
View File
@@ -7,6 +7,7 @@ import {
initVTKToolsAliases,
initStudyListAliasesOnDesktop,
initStudyListAliasesOnTablet,
initPreferencesModalAliases,
} from './aliases.js';
// ***********************************************
@@ -102,6 +103,13 @@ Cypress.Commands.add('waitVTKReformatting', () => {
});
});
Cypress.Commands.add('waitViewportImageLoading', () => {
// Wait for finish loading
cy.get('[data-cy="viewprt-grid"]', { timeout: 20000 }).should($grid => {
expect($grid).not.to.contain.text('Load');
});
});
/**
* Command to perform a drag and drop action. Before using this command, we must get the element that should be dragged first.
* Example of usage: cy.get(element-to-be-dragged).drag(dropzone-element)
@@ -200,10 +208,10 @@ Cypress.Commands.add('waitDicomImage', (timeout = 20000) => {
//Command to reset and clear all the changes made to the viewport
Cypress.Commands.add('resetViewport', () => {
cy.initCornerstoneToolsAliases();
//Click on More button
cy.get('@moreBtn').click();
cy.get('.expandableToolMenu')
.as('moreBtn')
.click();
//Verify if overlay is displayed
cy.get('body').then(body => {
if (body.find('.tooltip-toolbar-overlay').length == 0) {
@@ -215,7 +223,9 @@ Cypress.Commands.add('resetViewport', () => {
.as('clearBtn')
.click();
//Click on Reset button
cy.get('@resetBtn').click();
cy.get('.ToolbarRow > :nth-child(9)')
.as('resetBtn')
.click();
});
Cypress.Commands.add('imageZoomIn', () => {
@@ -359,9 +369,7 @@ Cypress.Commands.add('percyCanvasSnapshot', (name, options = {}) => {
});
Cypress.Commands.add('setLayout', (columns = 1, rows = 1) => {
cy.get('.toolbar-button-label')
.contains('Layout')
.click();
cy.get('.btn-group > .toolbar-button').click();
cy.get('.layoutChooser')
.find('tr')
@@ -410,3 +418,50 @@ function canvasToImage(selectorOrEl) {
canvas.parentElement.appendChild(image);
canvas.style = 'display: none';
}
//Initialize aliases for User Preferences modal
Cypress.Commands.add('initPreferencesModalAliases', () => {
initPreferencesModalAliases();
});
Cypress.Commands.add('openPreferences', () => {
cy.log('Open User Preferences Modal');
// Open User Preferences modal
cy.get('[data-cy="options-menu"]')
.scrollIntoView()
.click()
.then(() => {
cy.get('[data-cy="about-item-menu"]')
.last()
.click()
.wait(200);
});
});
Cypress.Commands.add('resetUserHoktkeyPreferences', () => {
// Open User Preferences modal
cy.openPreferences();
cy.initPreferencesModalAliases();
cy.log('Reset to Default Preferences');
cy.get('@restoreBtn').click();
//TODO: the following code is blocked by issue 1193: https://github.com/OHIF/Viewers/issues/1193
//Once the issue is fixed, the following code should be uncommented
//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
});
}
);
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/viewer",
"version": "2.10.0",
"version": "2.11.1",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
"license": "MIT",
@@ -45,20 +45,20 @@
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"@ohif/core": "^1.12.0",
"@ohif/core": "^1.13.0",
"@ohif/extension-cornerstone": "^2.0.0",
"@ohif/extension-dicom-html": "^1.0.1",
"@ohif/extension-dicom-microscopy": "^0.50.6",
"@ohif/extension-dicom-pdf": "^1.0.0",
"@ohif/extension-vtk": "^0.53.11",
"@ohif/extension-vtk": "^0.54.0",
"@ohif/i18n": "^0.52.1",
"@ohif/ui": "^0.64.0",
"@ohif/ui": "^0.65.0",
"@tanem/react-nprogress": "^1.1.25",
"classnames": "^2.2.6",
"core-js": "^3.2.1",
"cornerstone-core": "^2.2.8",
"cornerstone-math": "^0.1.8",
"cornerstone-tools": "^4.0.9",
"cornerstone-tools": "^4.8.0",
"cornerstone-wado-image-loader": "^3.0.0",
"dcmjs": "^0.6.1",
"dicom-parser": "^1.8.3",
@@ -8,6 +8,7 @@ import {
getResetLabellingAndContextMenu,
} from './labelingFlowCallbacks.js';
import throttle from 'lodash.throttle';
import { SimpleDialog } from '@ohif/ui';
// TODO: This only works because we have a hard dependency on this extension
// We need to decouple and make stuff like this possible w/o bundling this at
@@ -35,6 +36,28 @@ const MEASUREMENT_ACTION_MAP = {
* @param {*} configuration
*/
export default function init({ servicesManager, configuration = {} }) {
const { UIDialogService } = servicesManager.services;
const callInputDialog = (data, event, callback) => {
let dialogId = UIDialogService.create({
content: SimpleDialog.InputDialog,
defaultPosition: {
x: (event && event.currentPoints.canvas.x) || 0,
y: (event && event.currentPoints.canvas.y) || 0,
},
showOverlay: true,
contentProps: {
title: 'Enter your annotation',
label: 'New label',
defaultValue: data ? data.text : '',
onClose: () => UIDialogService.dismiss({ id: dialogId }),
onSubmit: value => {
callback(value);
UIDialogService.dismiss({ id: dialogId });
},
},
});
};
// If these tools were already added by a different extension, we want to replace
// them with the same tools that have an alternative configuration. By passing in
// our custom `getMeasurementLocationCallback`, we can...
@@ -90,6 +113,10 @@ export default function init({ servicesManager, configuration = {} }) {
csTools.addTool(csTools.ArrowAnnotateTool, {
configuration: {
getMeasurementLocationCallback: toolLabellingFlowCallback,
getTextCallback: (callback, eventDetails) =>
callInputDialog(null, eventDetails, callback),
changeTextCallback: (data, eventDetails, callback) =>
callInputDialog(data, eventDetails, callback),
},
});
@@ -36,18 +36,14 @@ class Header extends Component {
}
loadOptions() {
const {
t,
user,
userManager,
modal: { show },
} = this.props;
const { t, user, userManager, modal } = this.props;
this.options = [
{
title: t('About'),
icon: { name: 'info' },
onClick: () =>
show(AboutContent, {
modal.show({
content: AboutContent,
title: t('OHIF Viewer - About'),
}),
},
@@ -57,7 +53,8 @@ class Header extends Component {
name: 'user',
},
onClick: () =>
show(ConnectedUserPreferencesForm, {
modal.show({
content: ConnectedUserPreferencesForm,
title: t('User Preferences'),
}),
},
@@ -308,7 +308,8 @@ function _handleBuiltIn(button) {
}
if (options.behavior === 'DOWNLOAD_SCREEN_SHOT') {
modal.show(ConnectedViewportDownloadForm, {
modal.show({
content: ConnectedViewportDownloadForm,
title: t('Download High Quality Image'),
});
}
@@ -1,20 +1,20 @@
.dicom-uploader .button {
float: left;
margin: 5px;
float: left;
margin: 5px;
}
.invisible-input {
position: absolute;
display: none;
z-index: -1000;
max-width: 0 !important;
max-height: 0 !important;
position: absolute;
display: none;
z-index: -1000;
max-width: 0 !important;
max-height: 0 !important;
}
.dicom-uploader .table-header {
color: #ffffff;
font-size: 16px;
font-weight: 28px;
text-align: left;
margin: 20px auto;
color: #ffffff;
font-size: 16px;
font-weight: 28px;
text-align: left;
margin: 20px auto;
}
@@ -63,9 +63,18 @@ class ProjectsList extends Component {
if (loading) {
return loadingIcon;
}
const lowerCaseFilter = filter.toLowerCase();
const filteredProjects = projects.filter(project =>
typeof project.name === 'string' &&
(filter === "" || project.name.toLowerCase().includes(lowerCaseFilter))
);
const body = (
<tbody id="ProjectList">
{projects.filter(project => (project.name.toLowerCase().includes(filter.toLowerCase()) || filter=="")).map(this.renderTableRow)}
{
filteredProjects.map(this.renderTableRow)
}
</tbody>
);
@@ -58,7 +58,11 @@ function StudyListRoute(props) {
const appContext = useContext(AppContext);
// ~~ RESPONSIVE
const displaySize = useMedia(
['(min-width: 1750px)', '(min-width: 1000px)', '(min-width: 768px)'],
[
'(min-width: 1750px)',
'(min-width: 1000px) and (max-width: 1749px)',
'(max-width: 999px)',
],
['large', 'medium', 'small'],
'small'
);
@@ -257,6 +261,7 @@ function StudyListRoute(props) {
filterValues={filterValues}
onFilterChange={handleFilterChange}
studyListDateFilterNumDays={appConfig.studyListDateFilterNumDays}
displaySize={displaySize}
/>
{/* PAGINATION FOOTER */}
<TablePagination
+5 -31
View File
@@ -1100,34 +1100,13 @@
pirates "^4.0.0"
source-map-support "^0.5.9"
"@babel/runtime@7.1.2":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.1.2.tgz#81c89935f4647706fc54541145e6b4ecfef4b8e3"
integrity sha512-Y3SCjmhSupzFB6wcv1KmmFucH6gDVnI30WjOcicV10ju0cZjak3Jcs67YLIXBrmZYw1xCrVeJPbycFwrqNyxpg==
dependencies:
regenerator-runtime "^0.12.0"
"@babel/runtime@7.6.0":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205"
integrity sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ==
dependencies:
regenerator-runtime "^0.13.2"
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5":
"@babel/runtime@7.1.2", "@babel/runtime@7.5.5", "@babel/runtime@7.6.0", "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.3":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132"
integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==
dependencies:
regenerator-runtime "^0.13.2"
"@babel/runtime@^7.6.0", "@babel/runtime@^7.6.3":
version "7.7.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a"
integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw==
dependencies:
regenerator-runtime "^0.13.2"
"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6"
@@ -5993,10 +5972,10 @@ cornerstone-math@^0.1.8:
resolved "https://registry.yarnpkg.com/cornerstone-math/-/cornerstone-math-0.1.8.tgz#68ab1f9e4fdcd7c5cb23a0d2eb4263f9f894f1c5"
integrity sha512-x7NEQHBtVG7j1yeyj/aRoKTpXv1Vh2/H9zNLMyqYJDtJkNng8C4Q8M3CgZ1qer0Yr7eVq2x+Ynmj6kfOm5jXKw==
cornerstone-tools@^4.0.9:
version "4.6.2"
resolved "https://registry.yarnpkg.com/cornerstone-tools/-/cornerstone-tools-4.6.2.tgz#f46eac15ac027ed8649eced46ab0ed6f71ada982"
integrity sha512-YlUBkMr0B1PPA/mKPgqyedvOYHNXXLyDmH3I59ipDRi2Huuw64hOxwxPiknibPHD9mBv6SpHN1ybD9i5KOTExQ==
cornerstone-tools@^4.8.0:
version "4.8.0"
resolved "https://registry.yarnpkg.com/cornerstone-tools/-/cornerstone-tools-4.8.0.tgz#1972546e13e9a09b8aa25a3541ffc345283eec01"
integrity sha512-PO7/jYbVwc+ddF9JW/o/JXqNPFZV7y1PUTzlRATC9FeXLXNKIkSFBCF5SA1EGJoyjzRYGDBgTZuTYhfm96AlAA==
dependencies:
"@babel/runtime" "7.1.2"
cornerstone-math "0.1.7"
@@ -16657,11 +16636,6 @@ regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
regenerator-runtime@^0.12.0:
version "0.12.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"
integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==
regenerator-runtime@^0.13.1, regenerator-runtime@^0.13.2:
version "0.13.3"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"