2024-02-15 22:47:56 +00:00
|
|
|
{{define "settings"}}
|
2024-02-16 12:07:29 +00:00
|
|
|
<section class="relative overflow-x-auto shadow-md sm:rounded-lg p-5 text-gray-500 bg-white">
|
|
|
|
<h1 class="text-lg font-semibold text-gray-900">
|
|
|
|
Creating new Healthcheck.
|
|
|
|
</h1>
|
2024-02-21 22:15:21 +00:00
|
|
|
<form class="mt-4" action="/settings/healthchecks/create" method="post">
|
2024-02-16 12:07:29 +00:00
|
|
|
<div class="mb-5">
|
|
|
|
<label for="name" class="block mb-2 text-sm font-medium text-gray-900">Name</label>
|
|
|
|
<input type="name" name="name" id="name" placeholder="Github.com" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"/>
|
|
|
|
</div>
|
2024-02-19 10:43:43 +00:00
|
|
|
<div class="mb-5">
|
|
|
|
<label for="workergroups" class="block mb-2 text-sm font-medium text-gray-900">Worker Groups</label>
|
|
|
|
<input type="text" name="workergroups" id="workergroups" placeholder="europe,asia" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"/>
|
|
|
|
</div>
|
2024-02-16 12:07:29 +00:00
|
|
|
<div class="mb-5">
|
|
|
|
<label for="schedule" class="block mb-2 text-sm font-medium text-gray-900">Schedule</label>
|
|
|
|
<input type="text" name="schedule" id="schedule" placeholder="* * * * *" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5"/>
|
|
|
|
</div>
|
|
|
|
<div class="mb-5">
|
2024-02-21 22:15:21 +00:00
|
|
|
<label for="script" class="block mb-2 text-sm font-medium text-gray-900">Script</label>
|
|
|
|
<input required type="hidden" id="script" name="script">
|
|
|
|
<div id="editor" class="block w-full h-96 rounded-lg border border-gray-300 overflow-hidden"></div>
|
|
|
|
</div>
|
|
|
|
<button type="submit" onclick="save()" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center">Create</button>
|
|
|
|
</form>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="/static/monaco/vs/loader.js"></script>
|
|
|
|
<script>
|
|
|
|
function save() {
|
|
|
|
const script = window.editor.getValue();
|
|
|
|
document.getElementById('script').value = script;
|
|
|
|
}
|
|
|
|
|
|
|
|
script = `import http from 'k6/http';
|
2024-02-21 09:06:54 +00:00
|
|
|
|
|
|
|
export const options = {
|
2024-02-21 22:15:21 +00:00
|
|
|
thresholds: {
|
|
|
|
// http errors should be less than 1%
|
|
|
|
http_req_failed: ['rate<0.01'],
|
|
|
|
},
|
|
|
|
vus: 10,
|
|
|
|
duration: '5s',
|
2024-02-21 09:06:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function () {
|
2024-02-21 22:15:21 +00:00
|
|
|
http.get('https://example.com');
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
require.config({ paths: { vs: '/static/monaco/vs' } });
|
|
|
|
require(['vs/editor/editor.main'], function () {
|
|
|
|
window.editor = monaco.editor.create(document.getElementById('editor'), {
|
|
|
|
value: script,
|
|
|
|
language: 'javascript',
|
|
|
|
minimap: { enabled: false },
|
2024-02-22 16:29:17 +00:00
|
|
|
codeLens: false,
|
|
|
|
contextmenu: false,
|
2024-02-21 22:15:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const divElem = document.getElementById('editor');
|
|
|
|
const resizeObserver = new ResizeObserver(entries => {
|
|
|
|
window.editor.layout();
|
|
|
|
});
|
|
|
|
resizeObserver.observe(divElem);
|
|
|
|
});
|
|
|
|
</script>
|
2024-02-15 22:47:56 +00:00
|
|
|
{{end}}
|