LT-67: Migrating DICOMWeb form inputs to components

This commit is contained in:
Bruno Alves de Faria committed 2016-08-29 18:22:40 -03:00
1 parent 6cbfc1c180
commit 4e70e62b7b
7 files changed
+97 -77

No files matched your search

@@ -1,28 +1,28 @@
<template name="serverInformationDicomWeb">
<div class="row">
{{>serverInformationFormField name="wadoUriRoot" label="WADO URI root"}}
{{>serverInformationFormField name="wadoUriRootNOTE" label="WADO URI root note"}}
{{>serverInformationFormField name="wadoRoot" label="WADO root"}}
<div class="col-lg-6">
<div class="form-group">
<label class="wrapper">
<strong>Image rendering</strong>
<select name="imageRendering" class="form-control">
<option>Select</option>
<option value="wadouri">WADO URI</option>
<option value="orthanc">ORTHANC</option>
</select>
</label>
</div>
{{>inputText labelClass='form-group' key='wadoUriRoot'}}
</div>
<div class="col-lg-6">
{{>inputText labelClass='form-group' key='wadoUriRootNOTE'}}
</div>
<div class="col-lg-6">
{{>inputText labelClass='form-group' key='wadoRoot'}}
</div>
<div class="col-lg-6">
{{>inputSelect labelClass='form-group' key='imageRendering' hideSearch=true
options=(clone placeholder='Select an option...')}}
</div>
<div class="col-lg-6">
{{>inputText labelClass='form-group' key='qidoRoot'}}
</div>
{{>serverInformationFormField name="qidoRoot" label="QIDO root"}}
<div class="col-lg-6">
<strong>QIDO options</strong>
<div class="form-group">
<div class="form-control">
<div class="checkbox">
<label>
<input type="checkbox" name="qidoSupportsIncludeField">
<input type="checkbox" name="">
<span>QIDO supports including fields</span>
</label>
</div>
@@ -6,7 +6,8 @@
{{>inputText labelClass='form-group' key='name'}}
</div>
<div class="col-lg-6">
{{>inputSelect labelClass='form-group' key='type' hideSearch=true}}
{{>inputSelect labelClass='form-group' key='type' hideSearch=true
options=(clone placeholder='Choose a server type...')}}
</div>
</div>
<hr>
@@ -13,18 +13,38 @@ Template.serverInformationForm.onRendered(() => {
const instance = Template.instance();
instance.data.$form = instance.$('form');
instance.data.form = instance.data.$form.data('component');
// Handle the server type
instance.autorun(() => {
// Get the server type component
const typeComponent = instance.$('[data-key=type]').data('component');
// Run this computation every time the user change the server type
typeComponent.changeObserver.depend();
instance.data.serverType.set(typeComponent.value());
// Get the current server type value
const type = typeComponent.value();
// Set the serverType reactive value
instance.data.serverType.set(type);
// Change the schema based on the selected server type
if (type === 'dimse') {
instance.currentSchema.set(dimseSchema);
} else {
instance.currentSchema.set(dicomSchema);
}
});
// Handle the form mode (edit or add)
instance.autorun(() => {
const mode = instance.data.mode.get();
// Check if it is on edit mode and load the saved data
if (mode === 'edit') {
var data = instance.data.currentItem.get();
FormUtils.setFormData(instance.data.$form, data);
instance.data.form.value(data);
}
});
});