mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: view details of unknown projects on dashboard
This commit is contained in:
parent
ca3320b174
commit
083fbf8633
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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.
@ -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) => {
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user