Task Creation add Health Filter
This commit is contained in:
parent
f15cb98b70
commit
ec645f6162
2 changed files with 10 additions and 2 deletions
|
@ -169,10 +169,11 @@ func createTask(ctx context.Context, r *http.Request) error {
|
|||
return fmt.Errorf("Parseing Form: %w", err)
|
||||
}
|
||||
library := r.FormValue("library")
|
||||
health := r.FormValue("health")
|
||||
typ := r.FormValue("type")
|
||||
slog.Info("Got Task Create", "library", library, "type", typ)
|
||||
slog.Info("Got Task Create", "library", library, "health", health, "type", typ)
|
||||
|
||||
rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, md5 FROM files where library_id = $1 AND status = $2", library, constants.FILE_STATUS_EXISTS)
|
||||
rows, err := db.Query(r.Context(), "SELECT id, path, size, status, health, md5 FROM files where library_id = $1 AND status = $2 AND (-1 = $3 OR health = $3)", library, constants.FILE_STATUS_EXISTS, health)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Query Files: %w", err)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
<option value="{{$l.ID}}">{{$l.Name}}</option>
|
||||
{{end}}
|
||||
</select><br />
|
||||
<label for="health">Health</label><br />
|
||||
<select id="health" name="health">
|
||||
<option value="-1">All</option>
|
||||
<option value="0">Unknown</option>
|
||||
<option value="1">Damaged</option>
|
||||
<option value="2">Healthy</option>
|
||||
</select> <br />
|
||||
<label for="type">Type</label><br />
|
||||
<select id="type" name="type">
|
||||
<option value="0">Health Check</option>
|
||||
|
|
Loading…
Add table
Reference in a new issue