More tester work

This commit is contained in:
jamesagnew 2014-04-30 09:03:02 -04:00
parent 51c95219f6
commit f737797d7a
2 changed files with 99 additions and 62 deletions

View File

@ -57,7 +57,7 @@ This file is a Thymeleaf template for the
<div class="bodyHeaderBlock"> <div class="bodyHeaderBlock">
Resource: <th:block th:text="${resource.type.valueAsString}"/> Resource: <th:block th:text="${resource.type.valueAsString}"/>
</div> </div>
<table border="0"> <table border="0" th:id="${expandoId}">
<tr> <tr>
<td valign="top" class="propertyKeyCell">Supports operations:</td> <td valign="top" class="propertyKeyCell">Supports operations:</td>
<td valign="top"> <td valign="top">
@ -65,13 +65,12 @@ This file is a Thymeleaf template for the
<th:block th:switch="${operation.code.value}"> <th:block th:switch="${operation.code.value}">
<a th:case="'read'" th:href="'javascript:displayRead(\'' + ${expandoId} + '\', \'' + ${resource.type.valueAsString} + '\');'">read</a> <a th:case="'read'" th:href="'javascript:displayRead(\'' + ${expandoId} + '\', \'' + ${resource.type.valueAsString} + '\');'">read</a>
<a th:case="'vread'" th:href="'javascript:displayVRead(\'' + ${expandoId} + '\', \'' + ${resource.type.valueAsString} + '\');'">vread</a> <a th:case="'vread'" th:href="'javascript:displayVRead(\'' + ${expandoId} + '\', \'' + ${resource.type.valueAsString} + '\');'">vread</a>
<a th:case="'search-type'" th:href="'javascript:displaySearchType(\'' + ${expandoId} + '\', \'' + ${resource.type.valueAsString} + '\');'">search-type</a>
<span th:case="*" th:text="${operation.code.value}"/> <span th:case="*" th:text="${operation.code.value}"/>
</th:block> </th:block>
</th:span> </th:span>
</td> </td>
</tr> </tr>
<tr th:id="${expandoId}" style="display: none;">
</tr>
</table> </table>
<div> <div>

View File

@ -1,75 +1,97 @@
var currentForm;
/** Hide any currently displayed tester form */ /** Hide any currently displayed tester form */
function clearCurrentForm(postCompleteFunction) { function clearCurrentForm(postCompleteFunction) {
if (currentForm != null) { /* $('.testerNameRow').each().fadeOut(500).promise().then(function(){
var holder = currentForm; if (postCompleteFunction != null) {
holder.children().fadeOut(500).promise().then(function() { $('.testerNameRow').each().remove();
holder.empty();
holder.hide();
postCompleteFunction(); postCompleteFunction();
}); postCompleteFunction = null;
currentForm = null; }
} else { }); */
var current = $('.testerNameRow');
if (current.length == 0) {
postCompleteFunction(); postCompleteFunction();
} else {
current.first().fadeOut(300, function() {
current.first().remove();
clearCurrentForm(postCompleteFunction);
});
} }
} }
/** Create a tester form for the 'search' method */ /** Create a tester form for the 'search' method */
/* function displaySearchType(expandoTr, resourceName) {
function displayRead(expandoTr, resourceName) {
var postCompleteFunction = function() { var postCompleteFunction = function() {
var contentCell = $('<td />'); $('#' + expandoTr).append(
currentForm = $('#' + expandoTr).append( $('<tr class="testerNameRow" style="display: none;" />').append(
$('<td class="testerNameCell">Search</td>'), $('<td class="testerNameCell">Search by Type</td>'),
contentCell $('<td />').append(
); $('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }).append(
$('<input />', { name: 'method', value: 'searchType', type: 'hidden' }),
$('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }),
$('<span>All Resources of Type</span><br />'),
$('<input />', { type: 'submit', value: 'Submit' })
)
)
)
);
conformance.rest.forEach(function(rest){ conformance.rest.forEach(function(rest){
rest.resource.forEach(function(restResource){ rest.resource.forEach(function(restResource){
if (restResource.type == 'Patient') { if (restResource.type == resourceName) {
restResource.searchParam.forEach(function(searchParam){ if (restResource.searchParam) {
var formElement = $('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }); restResource.searchParam.forEach(function(searchParam){
contentCell.append( var formElement = $('<form/>', { action: 'PublicTesterResult.html', method: 'POST' });
formElement.append( formElement.append(
$('<input />', { name: 'method', value: 'read', type: 'hidden' }), $('<input />', { name: 'method', value: 'searchType', type: 'hidden' }),
$('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }), $('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' })
$('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }),
) )
); var inputId = newUniqueId();
formElement.append( formElement.append(
$('<br />'), $('<input />', { name: 'param.' + searchParam.name, placeholder: searchParam.name, type: 'text', id: inputId }),
$('<input />', { type: 'submit', value: 'Submit' }) $('<label for="' + inputId + '">' + searchParam.name + '</input>')
) );
}); formElement.append(
$('<br />'),
$('<input />', { type: 'submit', value: 'Submit' })
)
$('#' + expandoTr).append(
$('<tr class="testerNameRow" style="display: none;" />').append(
$('<td class="testerNameCell">Search by Type</td>'),
$('<td />').append(
formElement
)
)
);
});
}
} }
}); });
}); });
$('#' + expandoTr).fadeIn(500); showNewForm();
} }
clearCurrentForm(postCompleteFunction); clearCurrentForm(postCompleteFunction);
} }
*/
/** Create a tester form for the 'read' method */ /** Create a tester form for the 'read' method */
function displayRead(expandoTr, resourceName) { function displayRead(expandoTr, resourceName) {
var postCompleteFunction = function() { var postCompleteFunction = function() {
//$('#' + expandoTr).show(); $('#' + expandoTr).append(
currentForm = $('#' + expandoTr).append( $('<tr class="testerNameRow" style="display: none;" />').append(
$('<td class="testerNameCell">Read</td>'), $('<td class="testerNameCell">Read</td>'),
$('<td />').append( $('<td />').append(
$('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }).append( $('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }).append(
$('<input />', { name: 'method', value: 'read', type: 'hidden' }), $('<input />', { name: 'method', value: 'read', type: 'hidden' }),
$('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }), $('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }),
$('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }), $('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }),
$('<br />'), $('<br />'),
$('<input />', { type: 'submit', value: 'Submit' }) $('<input />', { type: 'submit', value: 'Submit' })
) )
)
) )
); );
$('#' + expandoTr).fadeIn(500); showNewForm();
} }
clearCurrentForm(postCompleteFunction); clearCurrentForm(postCompleteFunction);
} }
@ -77,21 +99,37 @@ function displayRead(expandoTr, resourceName) {
/** Create a tester form for the 'read' method */ /** Create a tester form for the 'read' method */
function displayVRead(expandoTr, resourceName) { function displayVRead(expandoTr, resourceName) {
var postCompleteFunction = function() { var postCompleteFunction = function() {
//$('#' + expandoTr).show(); $('#' + expandoTr).append(
currentForm = $('#' + expandoTr).append( $('<tr class="testerNameRow" style="display: none;" />').append(
$('<td class="testerNameCell">VRead</td>'), $('<td class="testerNameCell">Read</td>'),
$('<td />').append( $('<td />').append(
$('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }).append( $('<form/>', { action: 'PublicTesterResult.html', method: 'POST' }).append(
$('<input />', { name: 'method', value: 'vread', type: 'hidden' }), $('<input />', { name: 'method', value: 'vread', type: 'hidden' }),
$('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }), $('<input />', { name: 'resourceName', value: resourceName, type: 'hidden' }),
$('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }), $('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }),
$('<input />', { name: 'versionid', placeholder: 'Version ID', type: 'text' }), $('<input />', { name: 'versionid', placeholder: 'Version ID', type: 'text' }),
$('<br />'), $('<br />'),
$('<input />', { type: 'submit', value: 'Submit' }) $('<input />', { type: 'submit', value: 'Submit' })
) )
)
) )
); );
$('#' + expandoTr).fadeIn(500); showNewForm();
} }
clearCurrentForm(postCompleteFunction); clearCurrentForm(postCompleteFunction);
} }
var uniqueIdSeed = 1;
/** Generate a unique ID */
function newUniqueId() {
return "uid" + uniqueIdSeed++;
}
/** Show a newly created tester form */
function showNewForm() {
var time = 0;
$('.testerNameRow').each(function() {
$(this).delay(time).fadeIn(200);
time += 200;
});
}