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 {
|
func (f OrFilter) MatchAny(search string) bool {
|
||||||
for _, s := range f {
|
for _, s := range f {
|
||||||
if s == search {
|
if s == search || (s == "-" && search == "") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package repositories
|
package repositories
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/duke-git/lancet/v2/slice"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/models"
|
"github.com/muety/wakapi/models"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -89,7 +90,13 @@ func (r *HeartbeatRepository) GetAllWithinByFilters(from, to time.Time, user *mo
|
|||||||
Order("time asc")
|
Order("time asc")
|
||||||
|
|
||||||
for col, vals := range filterMap {
|
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 {
|
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,
|
maintainAspectRatio: false,
|
||||||
onClick: (event, data) => {
|
onClick: (event, data) => {
|
||||||
const idx = data[0].index
|
|
||||||
const name = wakapiData.projects[idx].key
|
|
||||||
const url = new URL(window.location.href)
|
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
|
window.location.href = url.href
|
||||||
},
|
},
|
||||||
onHover: (event, elem) => {
|
onHover: (event, elem) => {
|
||||||
|
@ -70,7 +70,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<div class="mb-8 w-full">
|
<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">
|
<div class="flex space-x-4 items-center">
|
||||||
<h4 class="font-semibold text-lg text-gray-500">{{ .TotalTime | duration }}</h4>
|
<h4 class="font-semibold text-lg text-gray-500">{{ .TotalTime | duration }}</h4>
|
||||||
<div v-cloak v-show="currentInterval">
|
<div v-cloak v-show="currentInterval">
|
||||||
|
Loading…
Reference in New Issue
Block a user