From f737797d7ab601634d34844b304ebe66407d6097 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Wed, 30 Apr 2014 09:03:02 -0400 Subject: [PATCH] More tester work --- .../fhir/rest/server/tester/PublicTester.html | 5 +- .../fhir/rest/server/tester/PublicTester.js | 156 +++++++++++------- 2 files changed, 99 insertions(+), 62 deletions(-) diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html index 47b0ca2b088..5130a31d70c 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.html @@ -57,7 +57,7 @@ This file is a Thymeleaf template for the
Resource:
- +
- -
Supports operations: @@ -65,13 +65,12 @@ This file is a Thymeleaf template for the read vread + search-type
diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.js b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.js index 04786989c38..f2f77740c7d 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.js +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/rest/server/tester/PublicTester.js @@ -1,75 +1,97 @@ -var currentForm; - /** Hide any currently displayed tester form */ function clearCurrentForm(postCompleteFunction) { - if (currentForm != null) { - var holder = currentForm; - holder.children().fadeOut(500).promise().then(function() { - holder.empty(); - holder.hide(); +/* $('.testerNameRow').each().fadeOut(500).promise().then(function(){ + if (postCompleteFunction != null) { + $('.testerNameRow').each().remove(); postCompleteFunction(); - }); - currentForm = null; - } else { + postCompleteFunction = null; + } + }); */ + var current = $('.testerNameRow'); + if (current.length == 0) { postCompleteFunction(); + } else { + current.first().fadeOut(300, function() { + current.first().remove(); + clearCurrentForm(postCompleteFunction); + }); } + } /** Create a tester form for the 'search' method */ -/* -function displayRead(expandoTr, resourceName) { +function displaySearchType(expandoTr, resourceName) { var postCompleteFunction = function() { - var contentCell = $(''); - currentForm = $('#' + expandoTr).append( - $('Search'), - contentCell - ); - + $('#' + expandoTr).append( + $('').append( + $('Search by Type'), + $('').append( + $('
', { action: 'PublicTesterResult.html', method: 'POST' }).append( + $('', { name: 'method', value: 'searchType', type: 'hidden' }), + $('', { name: 'resourceName', value: resourceName, type: 'hidden' }), + $('All Resources of Type
'), + $('', { type: 'submit', value: 'Submit' }) + ) + ) + ) + ); conformance.rest.forEach(function(rest){ rest.resource.forEach(function(restResource){ - if (restResource.type == 'Patient') { - restResource.searchParam.forEach(function(searchParam){ - var formElement = $('', { action: 'PublicTesterResult.html', method: 'POST' }); - contentCell.append( + if (restResource.type == resourceName) { + if (restResource.searchParam) { + restResource.searchParam.forEach(function(searchParam){ + var formElement = $('', { action: 'PublicTesterResult.html', method: 'POST' }); formElement.append( - $('', { name: 'method', value: 'read', type: 'hidden' }), - $('', { name: 'resourceName', value: resourceName, type: 'hidden' }), - $('', { name: 'id', placeholder: 'Resource ID', type: 'text' }), + $('', { name: 'method', value: 'searchType', type: 'hidden' }), + $('', { name: 'resourceName', value: resourceName, type: 'hidden' }) ) - ); - formElement.append( - $('
'), - $('', { type: 'submit', value: 'Submit' }) - ) - }); + var inputId = newUniqueId(); + formElement.append( + $('', { name: 'param.' + searchParam.name, placeholder: searchParam.name, type: 'text', id: inputId }), + $('