add background/to do tasks to front page if they have deadline, add some workflow buttons on the front page tasks.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
+6
-5
@@ -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 {
|
||||
|
||||
@@ -60,7 +60,7 @@ export class StufflogClient {
|
||||
return data.project;
|
||||
}
|
||||
|
||||
async listProjects({active, expiring, favorite}: ProjectFilter): Promise<ProjectResult[]> {
|
||||
async listProjects({active, expiring, favorite, includeSemiActive}: ProjectFilter): Promise<ProjectResult[]> {
|
||||
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("&")}` : "";
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<Option open={mdTaskLink}>Link</Option>
|
||||
<Option open={mdTaskDelete}>Delete</Option>
|
||||
·
|
||||
·
|
||||
{#if !isMoving && (!task.active) }
|
||||
<Option on:click={moveToActive}>Active</Option>
|
||||
{/if}
|
||||
@@ -116,6 +117,20 @@
|
||||
<Option color="red" on:click={moveToFailed}>Failed</Option>
|
||||
{/if}
|
||||
{/if}
|
||||
{:else}
|
||||
·
|
||||
{#if !isMoving && (!task.active) }
|
||||
<Option on:click={moveToActive}>Active</Option>
|
||||
{/if}
|
||||
{#if !isMoving && (task.statusTag !== "to do") }
|
||||
<Option color="yellow" on:click={moveToToDo}>To Do</Option>
|
||||
{/if}
|
||||
{#if !isMoving && (task.statusTag !== "on hold") }
|
||||
<Option color="blue" on:click={moveToOnHold}>On Hold</Option>
|
||||
{/if}
|
||||
{#if !isMoving && task.active }
|
||||
<Option color="green" on:click={moveToCompleted}>Completed</Option>
|
||||
{/if}
|
||||
{/if}
|
||||
</OptionRow>
|
||||
{#if showLogs && task.logs.length > 0}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<script lang="ts" context="module">
|
||||
let lastProjectId = "";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import stuffLogClient from "../clients/stufflog";
|
||||
import Modal from "../components/Modal.svelte";
|
||||
@@ -20,7 +24,7 @@
|
||||
taskId = md.task.id;
|
||||
verb = "Delete";
|
||||
} else if (md.name === "tasklink.add") {
|
||||
projectId = (md.project||{id:""}).id;
|
||||
projectId = (md.project||{id:""}).id || lastProjectId;
|
||||
taskId = (md.task||{id:""}).id;
|
||||
} else {
|
||||
throw new Error(`Wrong form ${md.name}`)
|
||||
@@ -41,6 +45,7 @@
|
||||
error = err.message ? err.message : err.toString();
|
||||
}).finally(() => {
|
||||
loading = false;
|
||||
lastProjectId = projectId;
|
||||
})
|
||||
} else if (deletion) {
|
||||
stuffLogClient.deleteTaskLink(projectId, taskId).then(() => {
|
||||
@@ -50,6 +55,7 @@
|
||||
error = err.message ? err.message : err.toString();
|
||||
}).finally(() => {
|
||||
loading = false;
|
||||
lastProjectId = projectId;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface ProjectFilter {
|
||||
active?: boolean
|
||||
favorite?: boolean
|
||||
expiring?: boolean
|
||||
includeSemiActive?: boolean
|
||||
}
|
||||
|
||||
export interface ProjectInput {
|
||||
|
||||
@@ -40,6 +40,7 @@ import ParentEntry from "../components/ParentEntry.svelte";
|
||||
fpProjectStore.load({
|
||||
active: true,
|
||||
expiring: true,
|
||||
includeSemiActive: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user