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"
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"
}

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})
}
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})
}
}
if filter.Expiring {
sq = sq.Where("end_time IS NOT NULL")
}

1
models/project.go

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

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

@ -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("&")}` : "";

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

@ -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}

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

@ -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;
})
}
}

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

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

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

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

Loading…
Cancel
Save