New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(Mode): Ability to overwrite mode configuration and small improvements #3580
Conversation
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for ohif-platform-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
@@ Coverage Diff @@
## master #3580 +/- ##
==========================================
- Coverage 42.93% 42.87% -0.06%
==========================================
Files 80 80
Lines 1444 1446 +2
Branches 338 339 +1
==========================================
Hits 620 620
- Misses 661 662 +1
- Partials 163 164 +1
Continue to review full report in Codecov by Sentry.
|
- Example config: | ||
```js | ||
modesConfiguration: { | ||
['@ohif/mode-longitudinal']: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it is an array here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if you can add an example of changing the mode path too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array is just to define a property with special characters like the mode id (just a map).
I'll add more examples 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you can't say [{ '@ohif/mode-longitudinal': {...}, { '@ohif/mode-segmentation':{...}]
and you need to say ['@ohif/mode-longitudinal']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you can't say [{ '@ohif/mode-longitudinal': {...}, { '@ohif/mode-segmentation':{...}]
and you need to say ['@ohif/mode-longitudinal']
I can use array but I think its a lot easier to use a map instead? so later I can just const config = modesConfiguration[modeId] instead of iterating the array looking for the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, I am trying to test this PR and when I go to save the configuration js file, the ['@ohif/mode-longitudinal']:
automatically changes to '@ohif/mode-longitudinal':
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not required to use the brackets, this is just an explicit way of doing it. I'll update the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth mentioning in the docs that although the modeConfiguration
is passed to the mode factory it is up to the particular mode itself if and how it applies the configuration? That is, for example, basic-dev-mode
and basic-test-mode
do not currently use this modeConfiguration
. Just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comments
Updated, is this what you meant? |
// Todo: Handle parameters in a better way. | ||
const query = new URLSearchParams(window.location.search); | ||
const configUrl = query.get('configUrl'); | ||
|
||
const dataSourceName = pathname.substring(dataSourceIdx + 1); | ||
const existingDataSource = extensionManager.getDataSources(dataSourceName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we anticipating a data source to be in the URL that is NOT an actual, configured data source? If so, under what circumstances would this occur? I am a bit confused as to why we need this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have a mode that does not use /${mode.routeName}/${dataSourceName}
. This means that my mode can rely on the defaultDataSource from the viewer config to define its dataSource. This way I don't need to add the datasources query param and change the defaultDataSource of the worklist coming from a random mode URL e.g. /myModeURL/otherParamWhichIsNotNecessarilyADataSourceName (no dataSource being used)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Approved.
Context
Allowing the override of mode's configuration through viewer config and small improvements.
Changes & Results
What are the effects of this change?
-->
Testing
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment