fix(worker): history add

This commit is contained in:
Tine 2024-02-23 15:16:51 +01:00
parent cb690409f4
commit 53be510c0c
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
4 changed files with 24 additions and 13 deletions

View file

@ -47,16 +47,8 @@ func (h *BaseHandler) ApiV1HealthchecksHistoryPOST(c echo.Context) error {
slug := c.Param("slug") slug := c.Param("slug")
worker, err := services.GetWorker(ctx, h.query, slug)
if err != nil {
return err
}
if worker == nil {
return echo.NewHTTPError(http.StatusNotFound, "Worker not found")
}
var body api.ApiV1HealthchecksHistoryPOSTBody var body api.ApiV1HealthchecksHistoryPOSTBody
err = (&echo.DefaultBinder{}).BindBody(c, &body) err := (&echo.DefaultBinder{}).BindBody(c, &body)
if err != nil { if err != nil {
return err return err
} }

View file

@ -17,6 +17,10 @@ p > a {
@apply font-medium text-blue-700 hover:underline; @apply font-medium text-blue-700 hover:underline;
} }
code {
@apply font-mono text-sm bg-gray-100 rounded-lg p-1;
}
.navbar { .navbar {
@apply justify-center flex flex-wrap space-x-2 gap-2 mt-10; @apply justify-center flex flex-wrap space-x-2 gap-2 mt-10;
} }

View file

@ -1157,6 +1157,16 @@ p > a:hover {
text-decoration-line: underline; text-decoration-line: underline;
} }
code {
border-radius: 0.5rem;
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
padding: 0.25rem;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 0.875rem;
line-height: 1.25rem;
}
.navbar { .navbar {
margin-top: 2.5rem; margin-top: 2.5rem;
display: flex; display: flex;

View file

@ -3,13 +3,18 @@
<form action="/settings/healthchecks/create" method="post"> <form action="/settings/healthchecks/create" method="post">
<label for="name">Name</label> <label for="name">Name</label>
<input type="name" name="name" id="name" placeholder="Github.com"> <input type="name" name="name" id="name" placeholder="Github.com">
<p> Name of the healthcheck can be anything.</p> <p>Name of the healthcheck can be anything.</p>
<label for="workergroups">Worker Groups</label> <label for="workergroups">Worker Groups</label>
<input type="text" name="workergroups" id="workergroups" placeholder="NA EU"/> <input type="text" name="workergroups" id="workergroups" placeholder="NA EU"/>
<p> Worker groups are used to distribute the healthcheck to specific workers.</p> <p>Worker groups are used to distribute the healthcheck to specific workers.</p>
<label for="schedule">Schedule</label> <label for="schedule">Schedule</label>
<input type="text" name="schedule" id="schedule" placeholder="* * * * *"/> <input type="text" name="schedule" id="schedule" placeholder="@every 1m"/>
<p> Schedule is a cron expression that defines when the healthcheck should be executed.</p> <p>
Schedule is a cron expression that defines when the healthcheck should be executed.
</br>
You can also use <code>@every [interval]</code> where interval is a duration like 5m, 1h, 60s.
Or use <code>@hourly</code>, <code>@daily</code>, <code>@weekly</code>, <code>@monthly</code>, <code>@yearly</code>.
</p>
<label for="script">Script</label> <label for="script">Script</label>
<input required type="hidden" id="script" name="script"> <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 id="editor" class="block w-full h-96 rounded-lg border border-gray-300 overflow-hidden"></div>