1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: minor ui improvements

This commit is contained in:
Ferdinand Mütsch 2021-06-12 12:01:20 +02:00
parent 7c4a2024b6
commit 561198b203
3 changed files with 55 additions and 14 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/muety/wakapi/repositories"
"github.com/muety/wakapi/utils"
"github.com/patrickmn/go-cache"
"strings"
"time"
"github.com/muety/wakapi/models"
@ -90,8 +91,16 @@ func (srv *HeartbeatService) GetEntitySetByUser(entityType uint8, user *models.U
if err != nil {
return nil, err
}
srv.cache.Set(cacheKey, utils.StringsToSet(results), cache.DefaultExpiration)
return results, nil
filtered := make([]string, 0, len(results))
for _, r := range results {
if strings.TrimSpace(r) != "" {
filtered = append(filtered, r)
}
}
srv.cache.Set(cacheKey, utils.StringsToSet(filtered), cache.DefaultExpiration)
return filtered, nil
}
func (srv *HeartbeatService) DeleteBefore(t time.Time) error {

View File

@ -641,6 +641,12 @@ video {
background-color: rgba(47, 133, 90, var(--bg-opacity));
}
.hover\:bg-gray-700:hover {
--bg-opacity: 1;
background-color: #4a5568;
background-color: rgba(74, 85, 104, var(--bg-opacity));
}
.hover\:bg-red-600:hover {
--bg-opacity: 1;
background-color: #e53e3e;
@ -713,6 +719,10 @@ video {
border-radius: 0.375rem;
}
.rounded-full {
border-radius: 9999px;
}
.border {
border-width: 1px;
}
@ -753,6 +763,10 @@ video {
display: flex;
}
.inline-flex {
display: inline-flex;
}
.table {
display: table;
}
@ -821,6 +835,10 @@ video {
font-weight: 600;
}
.h-4 {
height: 1rem;
}
.h-8 {
height: 2rem;
}
@ -853,6 +871,10 @@ video {
font-size: 2.25rem;
}
.leading-none {
line-height: 1;
}
.list-inside {
list-style-position: inside;
}
@ -1186,6 +1208,10 @@ video {
overflow-wrap: break-word;
}
.w-4 {
width: 1rem;
}
.w-1\/2 {
width: 50%;
}

View File

@ -244,18 +244,24 @@
<h3 class="inline-block font-semibold text-md border-b border-green-700 text-white mb-2">Add Label</h3>
<form action="" method="post">
<input type="hidden" name="action" value="add_label">
<div class="flex items-center mt-2 w-full text-gray-500 text-sm">
<span class="mr-2">Project:</span>
<select name="key" id="select-project"
class="shadow appearance-nonshadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded py-1 px-3 cursor-pointer">
{{ range $i, $p := .Projects }}
<option value="{{ $p }}">{{ $p }}</option>
{{ end }}
</select>
<span class="ml-8 mr-2">Label:</span>
<input class="shadow appearance-nonshadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded py-1 px-3"
type="text" id="label-value" style="width: 130px;"
name="value" placeholder="work" minlength="1" required>
<div class="flex flex-col space-y-4">
<div class="flex justify-between items-center mt-2 w-full text-gray-500 text-sm space-x-4">
<div class="w-1/2 flex flex-col flex-grow">
<span>Project</span>
<select name="key" id="select-project"
class="shadow appearance-nonshadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded py-1 px-3 cursor-pointer">
{{ range $i, $p := .Projects }}
<option value="{{ $p }}">{{ $p }}</option>
{{ end }}
</select>
</div>
<div class="w-1/2 flex flex-col flex-grow">
<span>Label</span>
<input class="shadow appearance-nonshadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded py-1 px-3"
type="text" id="label-value"
name="value" placeholder="work" minlength="1" required>
</div>
</div>
<div class="flex-grow flex justify-end">
<button type="submit"
class="py-1 px-3 rounded bg-green-700 hover:bg-green-800 text-white text-sm">