Files
helm-dashboard/pkg/dashboard/static/api-docs.html
2023-03-13 17:11:20 +00:00

71 lines
1.9 KiB
HTML

<html lang="">
<head>
<link rel="icon" href="../static/logo.png"/>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.15.5/swagger-ui.css"/>
<title>
Helm Dashboard API
</title>
</head>
<body>
<div id="swagger-ui">
<div class="center_progress">
<div class="lds-dual-ring"></div>
</div>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.15.5/swagger-ui-bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.15.5/swagger-ui-standalone-preset.js"></script>
<script>
let swaggerUrl = "openapi.json";
function reqOas() {
const request = new XMLHttpRequest();
request.open('GET', swaggerUrl, true);
request.setRequestHeader('Accept', 'application/json');
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
// Success!
const data = JSON.parse(request.responseText);
display(data);
} else {
alert("Failed to get " + swaggerUrl)
}
};
request.onerror = function () {
alert("Failed to get " + swaggerUrl)
};
request.send();
}
function display(data) {
const parent = document.querySelectorAll('#swagger-ui')[0];
parent.innerHTML = '';
let el = document.createElement('div');
el.id = "swDocs";
parent.appendChild(el);
SwaggerUIBundle({
spec: data,
dom_id: '#' + el.id,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
]
});
}
$(function () {
reqOas();
});
</script>
<script src="analytics.js"></script>
</html>