Include status of task in taskdashboard
All checks were successful
Java CI with Maven / test (push) Successful in 35s
Java CI with Maven / build-and-push-frontend (push) Successful in 7s
Java CI with Maven / build-and-push-backend (push) Successful in 7s

This commit is contained in:
Sebastian Böckelmann 2023-11-18 10:21:37 +01:00
parent cf7e2c5377
commit 297bef284d
7 changed files with 31 additions and 5 deletions

View File

@ -24,6 +24,8 @@ public class TaskEntityInfo {
private boolean finishable; private boolean finishable;
private boolean hasActiveSchedules;
public TaskEntityInfo(Task task) { public TaskEntityInfo(Task task) {
this.taskID = task.getTaskID(); this.taskID = task.getTaskID();
this.taskName = task.getTaskName(); this.taskName = task.getTaskName();
@ -36,6 +38,7 @@ public class TaskEntityInfo {
this.finished = task.isFinished(); this.finished = task.isFinished();
this.workTime = task.getWorkTime(); this.workTime = task.getWorkTime();
this.finishable = task.isFinishable(); this.finishable = task.isFinishable();
this.hasActiveSchedules = task.hasActiveSchedule();
} }
public long getTaskID() { public long getTaskID() {
@ -109,4 +112,12 @@ public class TaskEntityInfo {
public void setFinishable(boolean finishable) { public void setFinishable(boolean finishable) {
this.finishable = finishable; this.finishable = finishable;
} }
public boolean isHasActiveSchedules() {
return hasActiveSchedules;
}
public void setHasActiveSchedules(boolean hasActiveSchedules) {
this.hasActiveSchedules = hasActiveSchedules;
}
} }

View File

@ -48,5 +48,9 @@ export interface TaskEntityInfo {
* determines whether the task can be finished * determines whether the task can be finished
*/ */
finishable: boolean; finishable: boolean;
/**
* determines whether the task has active schedules
*/
hasActiveSchedules: boolean;
} }

View File

@ -35,7 +35,7 @@
<ng-container matColumnDef="status"> <ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
<td mat-cell *matCellDef="let task"> <td mat-cell *matCellDef="let task">
<div class="status-indicator" [style.background-color]="getStatusOfTask(task)"></div> <p>{{getStatusOfTask(task)}}</p>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="edit"> <ng-container matColumnDef="edit">

View File

@ -8,6 +8,7 @@ import {TaskEditorData} from "../task-editor/TaskEditorData";
import {MatDialog} from "@angular/material/dialog"; import {MatDialog} from "@angular/material/dialog";
import {MatSnackBar} from "@angular/material/snack-bar"; import {MatSnackBar} from "@angular/material/snack-bar";
import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component"; import {ClearTaskDialogComponent, ClearTaskDialogData} from "../clear-task-dialog/clear-task-dialog.component";
import * as moment from "moment/moment";
@Component({ @Component({
selector: 'app-task-dashboard', selector: 'app-task-dashboard',
@ -52,7 +53,13 @@ export class TaskDashboardComponent implements OnChanges{
} }
getStatusOfTask(task: TaskEntityInfo) { getStatusOfTask(task: TaskEntityInfo) {
return "green"; if(moment(task.deadline, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isBefore(moment())) {
return "🔴";
} else if(task.finishable){
return "🟠";
} else {
return "🟢";
}
} }
deleteTask(deletedTask: TaskEntityInfo) { deleteTask(deletedTask: TaskEntityInfo) {

View File

@ -1,6 +1,6 @@
import {TaskEntityInfo} from "../../../api"; import {TaskEntityInfo, TaskTaskgroupInfo} from "../../../api";
export interface TaskEditorData { export interface TaskEditorData {
taskgroupID: number; taskgroupID: number;
task: TaskEntityInfo | undefined task: TaskTaskgroupInfo | TaskEntityInfo | undefined
} }

View File

@ -65,7 +65,7 @@ export class TaskEditorComponent implements OnInit {
eta: this.etaCtrl.value, eta: this.etaCtrl.value,
startDate: startDate_formatted, startDate: startDate_formatted,
deadline: endDate_formatted, deadline: endDate_formatted,
finishable: this.finishable finishable: this.finishable,
}).subscribe({ }).subscribe({
next: resp => { next: resp => {
this.dialog.close(resp); this.dialog.close(resp);

View File

@ -2148,6 +2148,7 @@ components:
- finished - finished
- workTime - workTime
- finishable - finishable
- hasActiveSchedules
additionalProperties: false additionalProperties: false
properties: properties:
taskID: taskID:
@ -2186,6 +2187,9 @@ components:
finishable: finishable:
type: boolean type: boolean
description: determines whether the task can be finished description: determines whether the task can be finished
hasActiveSchedules:
type: boolean
description: determines whether the task has active schedules
TaskTaskgroupInfo: TaskTaskgroupInfo:
required: required:
- taskID - taskID