More work on the tester
This commit is contained in:
parent
5615f9b7d7
commit
c20e7e450a
|
@ -39,6 +39,7 @@ public class PublicTesterServlet extends HttpServlet {
|
|||
public PublicTesterServlet() {
|
||||
myStaticResources = new HashMap<String, String>();
|
||||
myStaticResources.put("jquery-2.1.0.min.js", "text/javascript");
|
||||
myStaticResources.put("PublicTester.js", "text/javascript");
|
||||
myStaticResources.put("PublicTester.css", "text/css");
|
||||
myStaticResources.put("hapi_fhir_banner.png", "image/png");
|
||||
myStaticResources.put("hapi_fhir_banner_right.png", "image/png");
|
||||
|
|
|
@ -14,3 +14,9 @@ TD.propertyKeyCell {
|
|||
border-radius: 3px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
TD.testerNameCell {
|
||||
background-color: #E0FFE0;
|
||||
border-radius: 3px;
|
||||
padding: 3px;
|
||||
}
|
|
@ -8,6 +8,10 @@ This file is a Thymeleaf template for the
|
|||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="PublicTester.js"></script>
|
||||
<script type="text/javascript">
|
||||
var serverBase = "<th:block th:text="${base}"/>";
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="PublicTester.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -48,7 +52,7 @@ This file is a Thymeleaf template for the
|
|||
<td width="70%" valign="top">
|
||||
|
||||
<th:block th:each="rest : ${conf.rest}">
|
||||
<th:block th:each="resource : ${rest.resource}">
|
||||
<th:block th:each="resource, resIterStat : ${rest.resource}" th:with="expandoId='resExpando'+${resIterStat.count}">
|
||||
<div class="bodyHeaderBlock">
|
||||
Resource: <th:block th:text="${resource.type.valueAsString}"/>
|
||||
</div>
|
||||
|
@ -56,11 +60,16 @@ This file is a Thymeleaf template for the
|
|||
<tr>
|
||||
<td valign="top" class="propertyKeyCell">Supports operations:</td>
|
||||
<td valign="top">
|
||||
<th:block th:each="operation : ${resource.operation}">
|
||||
<th:block th:text="${operation.code.value}"/>
|
||||
</th:block>
|
||||
<th:span th:each="operation : ${resource.operation}">
|
||||
<th:block th:switch="${operation.code.value}">
|
||||
<a th:case="'read'" th:href="'javascript:displayRead(\'' + ${expandoId} + '\');'">read</a>
|
||||
<span th:case="*" th:text="${operation.code.value}"/>
|
||||
</th:block>
|
||||
</th:span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:id="${expandoId}" style="display: none;">
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
var currentForm;
|
||||
|
||||
/** Create a tester form for the 'read' method */
|
||||
function displayRead(expandoTr) {
|
||||
|
||||
$('#' + expandoTr).show();
|
||||
currentForm = $('#' + expandoTr).append(
|
||||
$('<td class="testerNameCell">Read</td>'),
|
||||
$('<td />').append(
|
||||
$('<form />', { action: '', method: 'POST' }).append(
|
||||
$('<input />', { name: 'method', value: 'read', type: 'hidden' }),
|
||||
$('<input />', { name: 'id', placeholder: 'Resource ID', type: 'text' }),
|
||||
$('<br />'),
|
||||
$('<input />', { type: 'submit', value: 'Submit' })
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
Loading…
Reference in New Issue