Browse Source

add background/to do tasks to front page if they have deadline, add some workflow buttons on the front page tasks.

main
Gisle Aune 4 years ago
parent
commit
019d31600d
  1. 3
      api/project.go
  2. 10
      database/postgres/project.go
  3. 1
      models/project.go
  4. 5
      svelte-ui/src/clients/stufflog.ts
  5. 15
      svelte-ui/src/components/TaskEntry.svelte
  6. 8
      svelte-ui/src/forms/TaskLinkForm.svelte
  7. 1
      svelte-ui/src/models/project.ts
  8. 1
      svelte-ui/src/pages/FrontPage.svelte

3
api/project.go

@ -20,6 +20,9 @@ func Project(g *gin.RouterGroup, db database.Database) {
active := setting == "true" active := setting == "true"
filter.Active = &active filter.Active = &active
} }
if setting := c.Query("include-semi-active"); setting != "" {
filter.IncludeSemiActive = setting == "true"
}
if setting := c.Query("expiring"); setting != "" { if setting := c.Query("expiring"); setting != "" {
filter.Expiring = setting == "true" filter.Expiring = setting == "true"
} }

10
database/postgres/project.go

@ -34,8 +34,18 @@ func (r *projectRepository) List(ctx context.Context, filter models.ProjectFilte
sq = sq.Where(squirrel.Eq{"project_id": filter.IDs}) sq = sq.Where(squirrel.Eq{"project_id": filter.IDs})
} }
if filter.Active != nil { if filter.Active != nil {
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}) sq = sq.Where(squirrel.Eq{"active": *filter.Active})
} }
}
if filter.Expiring { if filter.Expiring {
sq = sq.Where("end_time IS NOT NULL") sq = sq.Where("end_time IS NOT NULL")
} }

1
models/project.go

@ -75,6 +75,7 @@ type ProjectFilter struct {
Active *bool Active *bool
Favorite *bool Favorite *bool
Expiring bool Expiring bool
IncludeSemiActive bool
IDs []string IDs []string
} }

5
svelte-ui/src/clients/stufflog.ts

@ -60,7 +60,7 @@ export class StufflogClient {
return data.project; return data.project;
} }
async listProjects({active, expiring, favorite}: ProjectFilter): Promise<ProjectResult[]> {
async listProjects({active, expiring, favorite, includeSemiActive}: ProjectFilter): Promise<ProjectResult[]> {
let queries = []; let queries = [];
if (active != null) { if (active != null) {
queries.push(`active=${active}`); queries.push(`active=${active}`);
@ -71,6 +71,9 @@ export class StufflogClient {
if (favorite != null) { if (favorite != null) {
queries.push(`favorite=${favorite}`) queries.push(`favorite=${favorite}`)
} }
if (includeSemiActive != null) {
queries.push(`include-semi-active=${includeSemiActive}`)
}
const query = queries.length > 0 ? `?${queries.join("&")}` : ""; const query = queries.length > 0 ? `?${queries.join("&")}` : "";

15
svelte-ui/src/components/TaskEntry.svelte

@ -97,6 +97,7 @@
<Option open={mdTaskLink}>Link</Option> <Option open={mdTaskLink}>Link</Option>
<Option open={mdTaskDelete}>Delete</Option> <Option open={mdTaskDelete}>Delete</Option>
· ·
·
{#if !isMoving && (!task.active) } {#if !isMoving && (!task.active) }
<Option on:click={moveToActive}>Active</Option> <Option on:click={moveToActive}>Active</Option>
{/if} {/if}
@ -116,6 +117,20 @@
<Option color="red" on:click={moveToFailed}>Failed</Option> <Option color="red" on:click={moveToFailed}>Failed</Option>
{/if} {/if}
{/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} {/if}
</OptionRow> </OptionRow>
{#if showLogs && task.logs.length > 0} {#if showLogs && task.logs.length > 0}

8
svelte-ui/src/forms/TaskLinkForm.svelte

@ -1,3 +1,7 @@
<script lang="ts" context="module">
let lastProjectId = "";
</script>
<script lang="ts"> <script lang="ts">
import stuffLogClient from "../clients/stufflog"; import stuffLogClient from "../clients/stufflog";
import Modal from "../components/Modal.svelte"; import Modal from "../components/Modal.svelte";
@ -20,7 +24,7 @@
taskId = md.task.id; taskId = md.task.id;
verb = "Delete"; verb = "Delete";
} else if (md.name === "tasklink.add") { } else if (md.name === "tasklink.add") {
projectId = (md.project||{id:""}).id;
projectId = (md.project||{id:""}).id || lastProjectId;
taskId = (md.task||{id:""}).id; taskId = (md.task||{id:""}).id;
} else { } else {
throw new Error(`Wrong form ${md.name}`) throw new Error(`Wrong form ${md.name}`)
@ -41,6 +45,7 @@
error = err.message ? err.message : err.toString(); error = err.message ? err.message : err.toString();
}).finally(() => { }).finally(() => {
loading = false; loading = false;
lastProjectId = projectId;
}) })
} else if (deletion) { } else if (deletion) {
stuffLogClient.deleteTaskLink(projectId, taskId).then(() => { stuffLogClient.deleteTaskLink(projectId, taskId).then(() => {
@ -50,6 +55,7 @@
error = err.message ? err.message : err.toString(); error = err.message ? err.message : err.toString();
}).finally(() => { }).finally(() => {
loading = false; loading = false;
lastProjectId = projectId;
}) })
} }
} }

1
svelte-ui/src/models/project.ts

@ -21,6 +21,7 @@ export interface ProjectFilter {
active?: boolean active?: boolean
favorite?: boolean favorite?: boolean
expiring?: boolean expiring?: boolean
includeSemiActive?: boolean
} }
export interface ProjectInput { export interface ProjectInput {

1
svelte-ui/src/pages/FrontPage.svelte

@ -40,6 +40,7 @@ import ParentEntry from "../components/ParentEntry.svelte";
fpProjectStore.load({ fpProjectStore.load({
active: true, active: true,
expiring: true, expiring: true,
includeSemiActive: true,
}); });
} }
} }

Loading…
Cancel
Save