fix: view details of unknown projects on dashboard

This commit is contained in:
Ferdinand Mütsch 2023-04-03 20:30:23 +02:00
parent ca3320b174
commit 083fbf8633
9 changed files with 1269 additions and 1258 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@ func (f OrFilter) Exists() bool {
func (f OrFilter) MatchAny(search string) bool {
for _, s := range f {
if s == search {
if s == search || (s == "-" && search == "") {
return true
}
}

View File

@ -1,6 +1,7 @@
package repositories
import (
"github.com/duke-git/lancet/v2/slice"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"gorm.io/gorm"
@ -89,7 +90,13 @@ func (r *HeartbeatRepository) GetAllWithinByFilters(from, to time.Time, user *mo
Order("time asc")
for col, vals := range filterMap {
q = q.Where(col+" in ?", vals)
q = q.Where(col+" in ?", slice.Map[string, string](vals, func(i int, val string) string {
// query for "unknown" projects, languages, etc.
if val == "-" {
return ""
}
return val
}))
}
if err := q.Find(&heartbeats).Error; err != nil {

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -134,10 +134,9 @@ function draw(subselection) {
},
maintainAspectRatio: false,
onClick: (event, data) => {
const idx = data[0].index
const name = wakapiData.projects[idx].key
const url = new URL(window.location.href)
url.searchParams.set('project', name)
const name = wakapiData.projects[data[0].index].key
url.searchParams.set('project', name === 'unknown' ? '-' : name)
window.location.href = url.href
},
onHover: (event, elem) => {

View File

@ -70,7 +70,13 @@
</div>
{{ else }}
<div class="mb-8 w-full">
<h1 class="font-semibold text-3xl text-white">Project "{{ .GetProjectFilter }}"</h1>
<h1 class="font-semibold text-3xl text-white">
{{ if eq .GetProjectFilter "-" }}
Unknown project
{{ else }}
Project "{{ .GetProjectFilter }}"
{{ end }}
</h1>
<div class="flex space-x-4 items-center">
<h4 class="font-semibold text-lg text-gray-500">{{ .TotalTime | duration }}</h4>
<div v-cloak v-show="currentInterval">