mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-26 17:27:59 +00:00
69 lines
2.8 KiB
Cheetah
69 lines
2.8 KiB
Cheetah
{{define "settings"}}
|
|
<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>
|
|
<form class="mt-4" action="/settings/healthchecks/create" method="post">
|
|
<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>
|
|
<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>
|
|
<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">
|
|
<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';
|
|
|
|
export const options = {
|
|
thresholds: {
|
|
// http errors should be less than 1%
|
|
http_req_failed: ['rate<0.01'],
|
|
},
|
|
vus: 10,
|
|
duration: '5s',
|
|
};
|
|
|
|
export default function () {
|
|
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 },
|
|
codeLens: false,
|
|
contextmenu: false,
|
|
});
|
|
|
|
const divElem = document.getElementById('editor');
|
|
const resizeObserver = new ResizeObserver(entries => {
|
|
window.editor.layout();
|
|
});
|
|
resizeObserver.observe(divElem);
|
|
});
|
|
</script>
|
|
{{end}}
|