LT-67 Implementing server's data retrieve and update

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-08-04 16:49:51 +02:00
1 parent e28f4b9a95
commit 3873ac6b3b
11 files changed
+288 -50

No files matched your search

@@ -0,0 +1,74 @@
<template name="serverInformationDicomWeb">
<div class="row">
{{>serverInformationDicomWebField name="wadoUriRoot" label="WADO URI root"}}
{{>serverInformationDicomWebField name="wadoUriRootNOTE" label="WADO URI root note"}}
{{>serverInformationDicomWebField 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>
</div>
{{>serverInformationDicomWebField 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">
<span>QIDO supports including fields</span>
</label>
</div>
</div>
</div>
</div>
</div>
<hr>
<h4>Request options</h4>
<div class="row">
{{>serverInformationDicomWebField name="requestOptions.auth" label="Authentication"}}
<div class="col-lg-6">
<strong>Logging options</strong>
<div class="form-group">
<div class="form-control clearfix">
<div class="checkbox pull-left">
<label>
<input type="checkbox" name="requestOptions.logRequests">
<span>Requests</span>
</label>
</div>
<div class="checkbox pull-left">
<label>
<input type="checkbox" name="requestOptions.logResponses">
<span>Responses</span>
</label>
</div>
<div class="checkbox pull-left">
<label>
<input type="checkbox" name="requestOptions.logTiming">
<span>Timing</span>
</label>
</div>
</div>
</div>
</div>
</div>
</template>
<template name="serverInformationDicomWebField">
<div class="col-lg-6">
<div class="form-group">
<label class="wrapper">
<span>{{this.label}}</span>
<input type="text" name="{{this.name}}" class="form-control">
</label>
</div>
</div>
</template>
@@ -0,0 +1,10 @@
Template.serverInformationDicomWeb.onRendered(function() {
var instance = Template.instance();
instance.autorun(function() {
var mode = instance.data.mode.get();
if (mode === 'edit') {
var data = instance.data.currentItem.get();
FormUtils.setFormData(instance.data.$form, data);
}
});
});
@@ -1,26 +1,39 @@
<template name="serverInformationForm">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="serverName">Server Name</label>
<input type="text" class="form-control" id="serverName">
<form class="server-information-form">
<input type="hidden" name="_id">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="wrapper">
<strong>Server Name</strong>
<input type="text" name="name" class="form-control">
</label>
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label class="wrapper">
<strong>Server Type</strong>
<select name="type" class="form-control js-server-type">
<option>Select</option>
<option value="dicomWeb">DICOM Web</option>
<option value="dimse">DIMSE</option>
</select>
</label>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="serverType">Server Type</label>
<select class="form-control js-server-type">
<option>Select</option>
<option value="dicomWeb">DICOM Web</option>
<option value="dimse">DIMSE</option>
</select>
<hr>
{{#if equals serverType.get "dicomWeb"}}
{{>serverInformationDicomWeb this}}
{{/if}}
{{#if equals serverType.get "dimse"}}
TODO: Print DIMSE form
{{/if}}
{{#if serverType.get}}
<div>
<input type="submit" class="btn btn-primary" value="Save">
</div>
</div>
</div>
{{#if equals serverType.get "dicomWeb"}}
TODO: Print DICOM Web form
{{/if}}
{{#if equals serverType.get "dimse"}}
TODO: Print DIMSE form
{{/if}}
{{/if}}
</form>
</template>
@@ -1,7 +1,31 @@
Template.serverInformationForm.onRendered(function() {
var instance = Template.instance();
instance.data.$form = instance.$('form');
instance.autorun(function() {
var mode = instance.data.mode.get();
if (mode === 'edit') {
var data = instance.data.currentItem.get();
FormUtils.setFormData(instance.data.$form, data);
}
});
});
Template.serverInformationForm.events({
'change .js-server-type': function(event, instance) {
console.debug(instance);
var value = $(event.currentTarget).val();
instance.data.serverType.set(value);
},
submit: function(event, instance) {
event.preventDefault();
var formData = FormUtils.getFormData(instance.data.$form);
Meteor.call('saveServer', formData, function(error) {
if (error) {
// TODO: check for errors: not-authorized, data-write
console.log('>>>>ERROR', error);
}
instance.data.mode.set('list');
});
}
});
@@ -8,10 +8,10 @@
</tr>
</thead>
<tbody>
{{#each server in servers}}
{{#each servers}}
<tr>
<td>{{server.name}}</td>
<td>{{server.type}}</td>
<td>{{this.name}}</td>
<td>{{this.type}}</td>
<td class="text-right">
<div class="btn-group" role="group" aria-label="Actions">
<button class="btn btn-sm btn-default editServer" {{tooltipTop "Edit"}}>
@@ -28,6 +28,7 @@ Template.serverInformationList.events({
instance.data.mode.set('create');
},
'click .editServer': function(event, instance) {
instance.data.currentItem.set(this);
instance.data.mode.set('edit');
}
});
@@ -2,14 +2,16 @@ Template.serverInformationModal.onCreated(function() {
var instance = Template.instance();
instance.container = {
mode: new ReactiveVar('list'),
serverType: new ReactiveVar(null)
serverType: new ReactiveVar(null),
currentItem: new ReactiveVar(null),
$form: null
};
});
Template.serverInformationModal.events({
'click .js-back' (event, instance) {
var container = instance.container;
container.mode.set('list');
container.serverType.set(null);
}
'click .js-back': function(event, instance) {
var container = instance.container;
container.mode.set('list');
container.serverType.set(null);
}
});
@@ -0,0 +1,5 @@
.server-information-form
label.wrapper
display: block
.checkbox
margin: 0 8px 0 0