Implement routing to schedule from TaskOverviewCard

This commit is contained in:
Sebastian 2023-10-28 19:05:20 +02:00
parent cc83aa0895
commit 217e48aead
8 changed files with 48 additions and 21 deletions

View File

@ -4,14 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Start task now from Taskoverview in Dashboard"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Load worked minutes when reloading dashboard">
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ActiveMinutesInformation.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/schedule.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/dashboard.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/task-overview/task-overview.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/task-overview/task-overview.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/dashboard/task-overview/task-overview.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/dashboard/task-overview/task-overview.component.ts" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -108,7 +104,7 @@
<workItem from="1698298897364" duration="4242000" /> <workItem from="1698298897364" duration="4242000" />
<workItem from="1698426430946" duration="665000" /> <workItem from="1698426430946" duration="665000" />
<workItem from="1698474363766" duration="3686000" /> <workItem from="1698474363766" duration="3686000" />
<workItem from="1698499063683" duration="6495000" /> <workItem from="1698499063683" duration="7085000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies"> <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -222,7 +218,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1698500028161</updated> <updated>1698500028161</updated>
</task> </task>
<option name="localTasksCounter" value="15" /> <task id="LOCAL-00015" summary="Load worked minutes when reloading dashboard">
<option name="closed" value="true" />
<created>1698512058945</created>
<option name="number" value="00015" />
<option name="presentableId" value="LOCAL-00015" />
<option name="project" value="LOCAL" />
<updated>1698512058945</updated>
</task>
<task id="LOCAL-00016" summary="Load worked minutes when reloading dashboard">
<option name="closed" value="true" />
<created>1698512069065</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1698512069065</updated>
</task>
<option name="localTasksCounter" value="17" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -245,7 +257,8 @@
<MESSAGE value="Fix starting schedule and returning active time of schedule after stop" /> <MESSAGE value="Fix starting schedule and returning active time of schedule after stop" />
<MESSAGE value="Remove update spamming in console" /> <MESSAGE value="Remove update spamming in console" />
<MESSAGE value="Start task now from Taskoverview in Dashboard" /> <MESSAGE value="Start task now from Taskoverview in Dashboard" />
<option name="LAST_COMMIT_MESSAGE" value="Start task now from Taskoverview in Dashboard" /> <MESSAGE value="Load worked minutes when reloading dashboard" />
<option name="LAST_COMMIT_MESSAGE" value="Load worked minutes when reloading dashboard" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -75,7 +75,7 @@
} }
.taskgroup-overview { .taskgroup-overview {
width: 30%; width: 35%;
float: right; float: right;
margin-right: 20px; margin-right: 20px;
} }

View File

@ -39,7 +39,7 @@
</div> </div>
<div class="taskgroup-overview"> <div class="taskgroup-overview">
<app-task-overview [tasks]="tasks" (onStartNow)="onStartTaskNow($event)" (onFinished)="onFinishTask($event)"></app-task-overview> <app-task-overview [tasks]="tasks" (onStartNow)="onStartTaskNow($event)" [taskgroupID]="selectedTaskgroupID" (onFinished)="onFinishTask($event)"></app-task-overview>
</div> </div>
<div class="taskgroup-overview"> <div class="taskgroup-overview">

View File

@ -3,6 +3,7 @@ import {BasicScheduleEntityInfo, ScheduleInfo, ScheduleService, TaskOverviewInfo
import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component"; import {ActiveScheduleComponent} from "./active-schedule/active-schedule.component";
import {StopActiveScheduleInfo} from "./active-schedule/StopActiveScheduleInfo"; import {StopActiveScheduleInfo} from "./active-schedule/StopActiveScheduleInfo";
import {TaskOverviewComponent} from "./task-overview/task-overview.component"; import {TaskOverviewComponent} from "./task-overview/task-overview.component";
import {TaskOverviewData} from "./taskgroup-overview/taskgroup-overview.component";
@Component({ @Component({
selector: 'app-dashboard', selector: 'app-dashboard',
@ -16,6 +17,7 @@ export class DashboardComponent implements OnInit{
workedMinutesToday: number = 0 workedMinutesToday: number = 0
tasks: TaskOverviewInfo[] = [] tasks: TaskOverviewInfo[] = []
selectedTaskgroupID: number | undefined
@ViewChild('activeSchedule') activeScheduleComponent: ActiveScheduleComponent | undefined @ViewChild('activeSchedule') activeScheduleComponent: ActiveScheduleComponent | undefined
constructor(private scheduleService: ScheduleService) { constructor(private scheduleService: ScheduleService) {
@ -55,8 +57,9 @@ export class DashboardComponent implements OnInit{
protected readonly TaskOverviewComponent = TaskOverviewComponent; protected readonly TaskOverviewComponent = TaskOverviewComponent;
onSelectTaskgroup(tasks: TaskOverviewInfo[]) { onSelectTaskgroup(taskOverviewData: TaskOverviewData) {
this.tasks = tasks; this.tasks = taskOverviewData.tasks;
this.selectedTaskgroupID = taskOverviewData.taskgroupID;
} }
onStartTaskNow(schedule: ScheduleInfo) { onStartTaskNow(schedule: ScheduleInfo) {

View File

@ -8,7 +8,7 @@
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<button mat-raised-button color="primary" class="btn-without-radius" (click)="startTaskNow(task)">Start now</button> <button mat-raised-button color="primary" class="btn-without-radius" (click)="startTaskNow(task)">Start now</button>
<button mat-raised-button class="yellowBtn btn-without-radius">Schedule</button> <button *ngIf="taskgroupID != undefined" mat-raised-button class="yellowBtn btn-without-radius" [routerLink]="['/taskgroups', taskgroupID!, 'tasks', task.taskID, 'schedule']">Schedule</button>
<button mat-raised-button class="greenBtn btn-without-radius" (click)="finishTask(task)">Finish</button> <button mat-raised-button class="greenBtn btn-without-radius" (click)="finishTask(task)">Finish</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>

View File

@ -10,6 +10,7 @@ import {MatSnackBar} from "@angular/material/snack-bar";
export class TaskOverviewComponent { export class TaskOverviewComponent {
@Input() tasks: TaskOverviewInfo[] = [] @Input() tasks: TaskOverviewInfo[] = []
@Input() taskgroupID: number | undefined
@Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>(); @Output('onStartNow') startNowEmitter: EventEmitter<ScheduleInfo> = new EventEmitter<ScheduleInfo>();
@Output('onFinished') finishedEmitter: EventEmitter<TaskOverviewInfo> = new EventEmitter<TaskOverviewInfo>(); @Output('onFinished') finishedEmitter: EventEmitter<TaskOverviewInfo> = new EventEmitter<TaskOverviewInfo>();

View File

@ -7,7 +7,7 @@
<!-- use a disabled button to provide padding for tree leaf --> <!-- use a disabled button to provide padding for tree leaf -->
<button mat-icon-button disabled></button> <button mat-icon-button disabled></button>
<div class="treenode-content-container"> <div class="treenode-content-container">
<button mat-button class="node-name" (click)="onSelectTaskgroup(node.tasks)">{{node.name}}</button> <button mat-button class="node-name" (click)="onSelectTaskgroup(node.tasks, node.taskgroupID)">{{node.name}}</button>
<span class="spacer"></span> <span class="spacer"></span>
<div class="task-number">{{node.activeTasks}}</div> <div class="task-number">{{node.activeTasks}}</div>
</div> </div>
@ -21,7 +21,7 @@
</mat-icon> </mat-icon>
</button> </button>
<div class="treenode-content-container"> <div class="treenode-content-container">
<button mat-button class="node-name" (click)="onSelectTaskgroup(node.tasks)">{{node.name}}</button> <button mat-button class="node-name" (click)="onSelectTaskgroup(node.tasks, node.taskgroupID)">{{node.name}}</button>
<span class="spacer"></span> <span class="spacer"></span>
<div class="task-number">{{node.activeTasks}}</div> <div class="task-number">{{node.activeTasks}}</div>
</div> </div>

View File

@ -17,6 +17,12 @@ interface ExampleFlatNode {
activeTasks: number; activeTasks: number;
hasOverdueTask: boolean; hasOverdueTask: boolean;
tasks: TaskOverviewInfo[]; tasks: TaskOverviewInfo[];
taskgroupID: number
}
export interface TaskOverviewData {
tasks: TaskOverviewInfo[],
taskgroupID: number
} }
@Component({ @Component({
selector: 'app-taskgroup-overview', selector: 'app-taskgroup-overview',
@ -25,7 +31,7 @@ interface ExampleFlatNode {
}) })
export class TaskgroupOverviewComponent { export class TaskgroupOverviewComponent {
@Output('taskgroupSelected') taskgroupSelected: EventEmitter<TaskOverviewInfo[]> = new EventEmitter<TaskOverviewInfo[]>(); @Output('taskgroupSelected') taskgroupSelected: EventEmitter<TaskOverviewData> = new EventEmitter<TaskOverviewData>();
private _transformer = (node: RecursiveTaskgroupInfo, level: number) => { private _transformer = (node: RecursiveTaskgroupInfo, level: number) => {
return { return {
expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0, expandable: !!node.childTaskgroups && node.childTaskgroups.length > 0,
@ -33,7 +39,8 @@ export class TaskgroupOverviewComponent {
level: level, level: level,
activeTasks: node.amountActiveTasks, activeTasks: node.amountActiveTasks,
hasOverdueTask: node.hasOverdueTask, hasOverdueTask: node.hasOverdueTask,
tasks: node.activeTasks tasks: node.activeTasks,
taskgroupID: node.taskgroupID
}; };
}; };
@ -65,7 +72,10 @@ export class TaskgroupOverviewComponent {
hasChild = (_: number, node: ExampleFlatNode) => node.expandable; hasChild = (_: number, node: ExampleFlatNode) => node.expandable;
onSelectTaskgroup(tasks: TaskOverviewInfo[]) { onSelectTaskgroup(tasks: TaskOverviewInfo[], taskgroupID: number) {
this.taskgroupSelected.emit(tasks) this.taskgroupSelected.emit({
tasks: tasks,
taskgroupID: taskgroupID
})
} }
} }