From 51c95219f6f38881b57ad9f6ed61f50636a1cfac Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Wed, 30 Apr 2014 07:47:05 -0400 Subject: [PATCH] Tester work --- .../fhir/rest/server/tester/PublicTester.html | 6 +-- .../fhir/rest/server/tester/PublicTester.js | 41 ++++++++++++++++++- .../ca/uhn/fhir/rest/server/TesterTest.java | 2 +- 3 files changed, 43 insertions(+), 6 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 6d8566d2be7..47b0ca2b088 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 @@ -7,12 +7,12 @@ This file is a Thymeleaf template for the - - + + 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 8d1dc2d15f7..04786989c38 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 @@ -16,6 +16,43 @@ function clearCurrentForm(postCompleteFunction) { } } +/** Create a tester form for the 'search' method */ +/* +function displayRead(expandoTr, resourceName) { + var postCompleteFunction = function() { + var contentCell = $(''); + currentForm = $('#' + expandoTr).append( + $('Search'), + contentCell + ); + + 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( + formElement.append( + $('', { name: 'method', value: 'read', type: 'hidden' }), + $('', { name: 'resourceName', value: resourceName, type: 'hidden' }), + $('', { name: 'id', placeholder: 'Resource ID', type: 'text' }), + ) + ); + formElement.append( + $('
'), + $('', { type: 'submit', value: 'Submit' }) + ) + }); + } + }); + }); + + $('#' + expandoTr).fadeIn(500); + } + clearCurrentForm(postCompleteFunction); +} +*/ + /** Create a tester form for the 'read' method */ function displayRead(expandoTr, resourceName) { var postCompleteFunction = function() { @@ -23,7 +60,7 @@ function displayRead(expandoTr, resourceName) { currentForm = $('#' + expandoTr).append( $('Read'), $('').append( - $('', { id: 'testerform', action: 'PublicTesterResult.html', method: 'POST' }).append( + $('', { action: 'PublicTesterResult.html', method: 'POST' }).append( $('', { name: 'method', value: 'read', type: 'hidden' }), $('', { name: 'resourceName', value: resourceName, type: 'hidden' }), $('', { name: 'id', placeholder: 'Resource ID', type: 'text' }), @@ -44,7 +81,7 @@ function displayVRead(expandoTr, resourceName) { currentForm = $('#' + expandoTr).append( $('VRead'), $('').append( - $('', { id: 'testerform', action: 'PublicTesterResult.html', method: 'POST' }).append( + $('', { action: 'PublicTesterResult.html', method: 'POST' }).append( $('', { name: 'method', value: 'vread', type: 'hidden' }), $('', { name: 'resourceName', value: resourceName, type: 'hidden' }), $('', { name: 'id', placeholder: 'Resource ID', type: 'text' }), diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TesterTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TesterTest.java index 78c22e31ad0..f2fd73d753e 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TesterTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/TesterTest.java @@ -55,7 +55,7 @@ public class TesterTest { PublicTesterServlet testerServlet = new PublicTesterServlet(); testerServlet.setServerBase("http://localhost:" + myPort + "/fhir/context"); - testerServlet.setServerBase("http://fhir.healthintersections.com.au/open"); +// testerServlet.setServerBase("http://fhir.healthintersections.com.au/open"); ServletHolder handler = new ServletHolder(); handler.setServlet(testerServlet); proxyHandler.addServlet(handler, "/fhir/tester/*");