Skip to content

Commit

Permalink
feat: FHIR APIs should be easier to find in Swagger UI closes tech-by…
Browse files Browse the repository at this point in the history
  • Loading branch information
shah committed Jun 28, 2024
1 parent 64d4ff9 commit 1c7473a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hub-prime/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ springdoc:
api-docs:
path: /docs/api/openapi
swagger-ui.path: /docs/api/interactive/index.html
swagger-ui:
doc-expansion: none
show-actuator: true

server:
Expand Down
29 changes: 28 additions & 1 deletion hub-prime/src/main/resources/templates/page/docs/swagger-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,38 @@

<head>
<title>Documentation</title>
<script>
function finalizeDisplay(iframe) {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
let checkAndDisplayIntervalID = null;

function displayImportantGroups() {
const expandBtn = iframeDocument.querySelector(`#operations-tag-TechBD_Hub_FHIR_Endpoints > button`);
if (expandBtn) {
expandBtn.click();
clearInterval(checkAndDisplayIntervalID); // Stop checking once the button is found and clicked
}
}

function checkAndDisplay() {
checkAndDisplayIntervalID = setInterval(() => {
displayImportantGroups();
}, 250); // Check every 250 milliseconds until expand button is available
}

if (iframeDocument.readyState === 'complete') {
checkAndDisplay();
} else {
iframeDocument.addEventListener('DOMContentLoaded', checkAndDisplay);
}
}
</script>
</head>

<body>
<div layout:fragment="content">
<iframe th:src="@{/docs/api/interactive/index.html}" class="w-full min-h-screen"></iframe>
<iframe th:src="@{/docs/api/interactive/index.html}" onload="finalizeDisplay(this)"
class="w-full min-h-screen"></iframe>
</div>
</body>

Expand Down

0 comments on commit 1c7473a

Please sign in to comment.