From d4ca2a3fd251f1374b6aeaa3c37d534ad68457e4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 28 Oct 2023 13:18:24 +0200 Subject: [PATCH] Implement Task Overview --- frontend/src/app/app.module.ts | 4 ++- .../src/app/dashboard/dashboard.component.css | 3 +- .../app/dashboard/dashboard.component.html | 7 +++-- .../src/app/dashboard/dashboard.component.ts | 10 ++++++- .../task-overview/task-overview.component.css | 28 +++++++++++++++++++ .../task-overview.component.html | 14 ++++++++++ .../task-overview.component.spec.ts | 21 ++++++++++++++ .../task-overview/task-overview.component.ts | 12 ++++++++ .../taskgroup-overview.component.css | 2 +- .../taskgroup-overview.component.html | 5 ++-- .../taskgroup-overview.component.ts | 19 +++++++++---- 11 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 frontend/src/app/dashboard/task-overview/task-overview.component.css create mode 100644 frontend/src/app/dashboard/task-overview/task-overview.component.html create mode 100644 frontend/src/app/dashboard/task-overview/task-overview.component.spec.ts create mode 100644 frontend/src/app/dashboard/task-overview/task-overview.component.ts diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 8043478..a9d9233 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -66,6 +66,7 @@ import { DashboardComponent } from './dashboard/dashboard.component'; import { ActiveScheduleComponent } from './dashboard/active-schedule/active-schedule.component'; import {MatTreeModule} from "@angular/material/tree"; import { TaskgroupOverviewComponent } from './dashboard/taskgroup-overview/taskgroup-overview.component'; +import { TaskOverviewComponent } from './dashboard/task-overview/task-overview.component'; @NgModule({ declarations: [ AppComponent, @@ -95,7 +96,8 @@ import { TaskgroupOverviewComponent } from './dashboard/taskgroup-overview/taskg ScheduleDashboardComponent, DashboardComponent, ActiveScheduleComponent, - TaskgroupOverviewComponent + TaskgroupOverviewComponent, + TaskOverviewComponent ], imports: [ BrowserModule, diff --git a/frontend/src/app/dashboard/dashboard.component.css b/frontend/src/app/dashboard/dashboard.component.css index d6a2964..93f55f9 100644 --- a/frontend/src/app/dashboard/dashboard.component.css +++ b/frontend/src/app/dashboard/dashboard.component.css @@ -75,8 +75,9 @@ } .taskgroup-overview { - width: 25%; + width: 30%; float: right; + margin-right: 20px; } .spacer { diff --git a/frontend/src/app/dashboard/dashboard.component.html b/frontend/src/app/dashboard/dashboard.component.html index a516d20..dc0c2cf 100644 --- a/frontend/src/app/dashboard/dashboard.component.html +++ b/frontend/src/app/dashboard/dashboard.component.html @@ -38,10 +38,13 @@ - +
+ +
- + +
diff --git a/frontend/src/app/dashboard/dashboard.component.ts b/frontend/src/app/dashboard/dashboard.component.ts index ccc66d2..72b2802 100644 --- a/frontend/src/app/dashboard/dashboard.component.ts +++ b/frontend/src/app/dashboard/dashboard.component.ts @@ -1,7 +1,8 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import {ScheduleInfo, ScheduleService} from "../../api"; +import {ScheduleInfo, ScheduleService, TaskOverviewInfo} from "../../api"; import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component"; import {StopActiveScheduleInfo} from "./active-schedule/StopActiveScheduleInfo"; +import {TaskOverviewComponent} from "./task-overview/task-overview.component"; @Component({ selector: 'app-dashboard', @@ -14,6 +15,8 @@ export class DashboardComponent implements OnInit{ schedules: ScheduleInfo[] = [] workedMinutesToday: number = 0 + tasks: TaskOverviewInfo[] = [] + @ViewChild('activeSchedule') activeScheduleComponent: ActiveScheduleComponent | undefined constructor(private scheduleService: ScheduleService) { } @@ -44,4 +47,9 @@ export class DashboardComponent implements OnInit{ } + protected readonly TaskOverviewComponent = TaskOverviewComponent; + + onSelectTaskgroup(tasks: TaskOverviewInfo[]) { + this.tasks = tasks; + } } diff --git a/frontend/src/app/dashboard/task-overview/task-overview.component.css b/frontend/src/app/dashboard/task-overview/task-overview.component.css new file mode 100644 index 0000000..178ad85 --- /dev/null +++ b/frontend/src/app/dashboard/task-overview/task-overview.component.css @@ -0,0 +1,28 @@ +.greenBtn { + background-color: #00bc8c; + color: white; +} + +.btn-without-radius { + border-radius: 0; +} + +.task-info { + line-height: .75em; +} + +.progress { + margin-bottom: 10px; + margin-top: -5px; +} + +.long-btn { + width: 100%; +} + + +.yellowBtn { + background-color: #f39c12; + color: white; + border-radius: 0; +} diff --git a/frontend/src/app/dashboard/task-overview/task-overview.component.html b/frontend/src/app/dashboard/task-overview/task-overview.component.html new file mode 100644 index 0000000..0bca0db --- /dev/null +++ b/frontend/src/app/dashboard/task-overview/task-overview.component.html @@ -0,0 +1,14 @@ + + + +

{{task.taskName}}

+ +

ETA: {{task.activeTime}} / {{task.eta}}

+

Limit: {{task.limit}}

+
+ + + + + +
diff --git a/frontend/src/app/dashboard/task-overview/task-overview.component.spec.ts b/frontend/src/app/dashboard/task-overview/task-overview.component.spec.ts new file mode 100644 index 0000000..ae6373b --- /dev/null +++ b/frontend/src/app/dashboard/task-overview/task-overview.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TaskOverviewComponent } from './task-overview.component'; + +describe('TaskOverviewComponent', () => { + let component: TaskOverviewComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [TaskOverviewComponent] + }); + fixture = TestBed.createComponent(TaskOverviewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/dashboard/task-overview/task-overview.component.ts b/frontend/src/app/dashboard/task-overview/task-overview.component.ts new file mode 100644 index 0000000..186a7eb --- /dev/null +++ b/frontend/src/app/dashboard/task-overview/task-overview.component.ts @@ -0,0 +1,12 @@ +import {Component, Input} from '@angular/core'; +import {TaskOverviewInfo} from "../../../api"; + +@Component({ + selector: 'app-task-overview', + templateUrl: './task-overview.component.html', + styleUrls: ['./task-overview.component.css'] +}) +export class TaskOverviewComponent { + + @Input() tasks: TaskOverviewInfo[] = [] + } diff --git a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.css b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.css index 53bc088..3d7fabd 100644 --- a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.css +++ b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.css @@ -163,5 +163,5 @@ } .overdue-taskgroup { - background-color: #ff6354; + background-color: #ff695b; } diff --git a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.html b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.html index 493b18b..5da9649 100644 --- a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.html +++ b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.html @@ -7,7 +7,7 @@
- +
{{node.activeTasks}}
@@ -21,10 +21,9 @@
- +
{{node.activeTasks}}
-
diff --git a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.ts b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.ts index 5b4dd9f..4cebf7c 100644 --- a/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.ts +++ b/frontend/src/app/dashboard/taskgroup-overview/taskgroup-overview.component.ts @@ -1,9 +1,10 @@ -import { Component } from '@angular/core'; +import {Component, EventEmitter, Output} from '@angular/core'; import {MatIconModule} from "@angular/material/icon"; import {MatButtonModule} from "@angular/material/button"; import {MatTreeFlatDataSource, MatTreeFlattener, MatTreeModule} from "@angular/material/tree"; import {FlatTreeControl} from "@angular/cdk/tree"; -import {RecursiveTaskgroupInfo, TaskgroupService} from "../../../api"; +import {RecursiveTaskgroupInfo, TaskgroupService, TaskOverviewInfo} from "../../../api"; +import {TaskOverviewComponent} from "../task-overview/task-overview.component"; @@ -11,10 +12,11 @@ import {RecursiveTaskgroupInfo, TaskgroupService} from "../../../api"; /** Flat node with expandable and level information */ interface ExampleFlatNode { expandable: boolean; - name: string; level: number; + name: string activeTasks: number; - hasOverdueTask: boolean + hasOverdueTask: boolean; + tasks: TaskOverviewInfo[]; } @Component({ selector: 'app-taskgroup-overview', @@ -22,13 +24,16 @@ interface ExampleFlatNode { styleUrls: ['./taskgroup-overview.component.css'] }) export class TaskgroupOverviewComponent { + + @Output('taskgroupSelected') taskgroupSelected: EventEmitter = new EventEmitter(); private _transformer = (node: RecursiveTaskgroupInfo, level: number) => { return { expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0, name: node.taskgroupName, level: level, activeTasks: node.amountActiveTasks, - hasOverdueTask: node.hasOverdueTask + hasOverdueTask: node.hasOverdueTask, + tasks: node.activeTasks }; }; @@ -59,4 +64,8 @@ export class TaskgroupOverviewComponent { } hasChild = (_: number, node: ExampleFlatNode) => node.expandable; + + onSelectTaskgroup(tasks: TaskOverviewInfo[]) { + this.taskgroupSelected.emit(tasks) + } }