Merge pull request 'issue-93' (#108) from issue-93 into master
All checks were successful
Java CI with Maven / build-and-push-frontend (push) Successful in 2m8s
Java CI with Maven / build-and-push-backend (push) Successful in 1m18s

Reviewed-on: #108
This commit is contained in:
sebastian 2024-03-17 09:34:13 +01:00
commit 2215fe2ff8
4 changed files with 35 additions and 14 deletions

View File

@ -55,6 +55,7 @@ public class TaskSchedulingService {
public void sendRunningTaskNotification(AbstractSchedule abstractSchedule) {
HttpClient httpClient = HttpClient.newHttpClient();
User user = abstractSchedule.getTask().getTaskgroup().getUser();
if(user.getNtfy_host() != null && user.getNtfy_topic() != null) {
try {
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(user.getNtfy_host()+ "/" + user.getNtfy_topic()))
@ -70,6 +71,8 @@ public class TaskSchedulingService {
}
}
}
private static Date calculateDelayInMillis(LocalDateTime executionTime) {
return Date.from(executionTime.atZone(ZoneId.systemDefault()).toInstant());
}

View File

@ -23,3 +23,8 @@
table {
width: 100%;
}
.mat-column-delete {
width: 32px;
text-align: center;
}

View File

@ -35,6 +35,10 @@
<th mat-header-cell *matHeaderCellDef> Duration </th>
<td mat-cell *matCellDef="let element"> {{calcDuration(element.startTime, element.finishedTime)}} </td>
</ng-container>
<ng-container matColumnDef="delete">
<th mat-header-cell *matHeaderCellDef> </th>
<td mat-cell *matCellDef="let element"> <button mat-icon-button color="warn" (click)="deleteSchedule(element)"><mat-icon>delete</mat-icon></button> </td>
</ng-container>

View File

@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {HistoryService, ScheduleInfo, TaskgroupEntityInfo} from "../../../api";
import {HistoryService, ScheduleInfo, ScheduleService, TaskgroupEntityInfo} from "../../../api";
import * as moment from "moment";
import {NavigationLink} from "../../navigation-link-list/navigation-link-list.component";
@ -27,7 +27,7 @@ export class ScheduleHistoryComponent implements OnInit{
selectedDate: Date = new Date();
schedules: ScheduleInfo[] = []
displayedColumns: string[] = ['taskgroup', 'task', 'start', 'end', 'duration'];
displayedColumns: string[] = ['taskgroup', 'task', 'start', 'end', 'duration', 'delete'];
ngOnInit() {
this.historyService.historySchedulesDateGet(moment(this.selectedDate).format("YYYY-MM-DD")).subscribe({
@ -37,7 +37,8 @@ export class ScheduleHistoryComponent implements OnInit{
})
}
constructor(private historyService: HistoryService) {
constructor(private historyService: HistoryService,
private scheduleService: ScheduleService) {
}
computeTaskgroupPath(taskgroupPath: TaskgroupEntityInfo[]) {
@ -67,4 +68,12 @@ export class ScheduleHistoryComponent implements OnInit{
}
})
}
deleteSchedule(deletedSchedule: ScheduleInfo) {
this.scheduleService.schedulesScheduleIDDelete(deletedSchedule.scheduleID).subscribe({
next: resp => {
this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID)
}
})
}
}