diff --git a/api/project.go b/api/project.go index 6fc4d9d..f685215 100644 --- a/api/project.go +++ b/api/project.go @@ -20,6 +20,9 @@ func Project(g *gin.RouterGroup, db database.Database) { active := setting == "true" filter.Active = &active } + if setting := c.Query("include-semi-active"); setting != "" { + filter.IncludeSemiActive = setting == "true" + } if setting := c.Query("expiring"); setting != "" { filter.Expiring = setting == "true" } diff --git a/database/postgres/project.go b/database/postgres/project.go index fdd626b..f7d9d63 100644 --- a/database/postgres/project.go +++ b/database/postgres/project.go @@ -34,7 +34,17 @@ func (r *projectRepository) List(ctx context.Context, filter models.ProjectFilte sq = sq.Where(squirrel.Eq{"project_id": filter.IDs}) } if filter.Active != nil { - sq = sq.Where(squirrel.Eq{"active": *filter.Active}) + if filter.IncludeSemiActive { + sq = sq.Where(squirrel.Or{ + squirrel.Eq{"active": *filter.Active}, + squirrel.Eq{"status_tag": []string{ + "to do", "background", "on hold", "progress", + }}, + }) + } else { + sq = sq.Where(squirrel.Eq{"active": *filter.Active}) + } + } if filter.Expiring { sq = sq.Where("end_time IS NOT NULL") diff --git a/models/project.go b/models/project.go index 6866845..89e8e56 100644 --- a/models/project.go +++ b/models/project.go @@ -71,11 +71,12 @@ type ProjectResult struct { } type ProjectFilter struct { - UserID string - Active *bool - Favorite *bool - Expiring bool - IDs []string + UserID string + Active *bool + Favorite *bool + Expiring bool + IncludeSemiActive bool + IDs []string } type ProjectRepository interface { diff --git a/svelte-ui/src/clients/stufflog.ts b/svelte-ui/src/clients/stufflog.ts index 65fba9b..c4ae943 100644 --- a/svelte-ui/src/clients/stufflog.ts +++ b/svelte-ui/src/clients/stufflog.ts @@ -60,7 +60,7 @@ export class StufflogClient { return data.project; } - async listProjects({active, expiring, favorite}: ProjectFilter): Promise { + async listProjects({active, expiring, favorite, includeSemiActive}: ProjectFilter): Promise { let queries = []; if (active != null) { queries.push(`active=${active}`); @@ -71,6 +71,9 @@ export class StufflogClient { if (favorite != null) { queries.push(`favorite=${favorite}`) } + if (includeSemiActive != null) { + queries.push(`include-semi-active=${includeSemiActive}`) + } const query = queries.length > 0 ? `?${queries.join("&")}` : ""; diff --git a/svelte-ui/src/components/TaskEntry.svelte b/svelte-ui/src/components/TaskEntry.svelte index 02550a0..f79c2bf 100644 --- a/svelte-ui/src/components/TaskEntry.svelte +++ b/svelte-ui/src/components/TaskEntry.svelte @@ -97,6 +97,7 @@ · + · {#if !isMoving && (!task.active) } {/if} @@ -116,6 +117,20 @@ {/if} {/if} + {:else} + · + {#if !isMoving && (!task.active) } + + {/if} + {#if !isMoving && (task.statusTag !== "to do") } + + {/if} + {#if !isMoving && (task.statusTag !== "on hold") } + + {/if} + {#if !isMoving && task.active } + + {/if} {/if} {#if showLogs && task.logs.length > 0} diff --git a/svelte-ui/src/forms/TaskLinkForm.svelte b/svelte-ui/src/forms/TaskLinkForm.svelte index 38d7c60..81898f3 100644 --- a/svelte-ui/src/forms/TaskLinkForm.svelte +++ b/svelte-ui/src/forms/TaskLinkForm.svelte @@ -1,3 +1,7 @@ + +