Frontend Components for Creating Daily Repeating Tasks
All checks were successful
Java CI with Maven / build-and-push-frontend (push) Successful in 8s
Java CI with Maven / build-and-push-backend (push) Successful in 7s

This commit is contained in:
Sebastian Böckelmann 2024-03-15 09:43:23 +01:00
parent 3f58fe3600
commit a3723e3459
11 changed files with 32 additions and 10 deletions

View File

@ -1,5 +1,7 @@
package core.api.models.timemanager.tasks.repeatinginfo; package core.api.models.timemanager.tasks.repeatinginfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDate; import java.time.LocalDate;
public class TaskRepeatDayInfo { public class TaskRepeatDayInfo {
@ -7,7 +9,8 @@ public class TaskRepeatDayInfo {
private int offset; private int offset;
private DeadlineStrategy deadlineStrategy; private DeadlineStrategy deadlineStrategy;
private LocalDate endDate; @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private LocalDate endingDate;
public int getOffset() { public int getOffset() {
return offset; return offset;
@ -25,11 +28,11 @@ public class TaskRepeatDayInfo {
this.deadlineStrategy = deadlineStrategy; this.deadlineStrategy = deadlineStrategy;
} }
public LocalDate getEndDate() { public LocalDate getEndingDate() {
return endDate; return endingDate;
} }
public void setEndDate(LocalDate endDate) { public void setEndingDate(LocalDate endingDate) {
this.endDate = endDate; this.endingDate = endingDate;
} }
} }

View File

@ -30,7 +30,7 @@ public class TaskSeriesService {
LocalDate currentTaskDate = rootTask.getStartDate().plusDays(taskRepeatInfo.getOffset()); LocalDate currentTaskDate = rootTask.getStartDate().plusDays(taskRepeatInfo.getOffset());
TaskSerie taskSerie = new TaskSerie(); TaskSerie taskSerie = new TaskSerie();
int index = 1; int index = 1;
while(currentTaskDate.isBefore(taskRepeatInfo.getEndDate())) { while(currentTaskDate.isBefore(taskRepeatInfo.getEndingDate())) {
Task task = Task.cloneTask(rootTask); Task task = Task.cloneTask(rootTask);
task.setStartDate(currentTaskDate); task.setStartDate(currentTaskDate);
if(taskRepeatInfo.getDeadlineStrategy() == DeadlineStrategy.DEADLINE_EQUAL_START) { if(taskRepeatInfo.getDeadlineStrategy() == DeadlineStrategy.DEADLINE_EQUAL_START) {
@ -45,6 +45,7 @@ public class TaskSeriesService {
index++; index++;
} }
taskSeriesRepository.save(taskSerie);
taskRepository.saveAll(taskSerie.getTasks()); taskRepository.saveAll(taskSerie.getTasks());
return ServiceExitCode.OK; return ServiceExitCode.OK;
} }

View File

@ -10,6 +10,7 @@ api/properties.service.ts
api/schedule.service.ts api/schedule.service.ts
api/task.service.ts api/task.service.ts
api/taskgroup.service.ts api/taskgroup.service.ts
api/taskseries.service.ts
api/users.service.ts api/users.service.ts
configuration.ts configuration.ts
encoder.ts encoder.ts
@ -47,6 +48,7 @@ model/simpleStatusResponse.ts
model/taskEntityInfo.ts model/taskEntityInfo.ts
model/taskFieldInfo.ts model/taskFieldInfo.ts
model/taskOverviewInfo.ts model/taskOverviewInfo.ts
model/taskRepeatDayInfo.ts
model/taskScheduleStopResponse.ts model/taskScheduleStopResponse.ts
model/taskShortInfo.ts model/taskShortInfo.ts
model/taskTaskgroupInfo.ts model/taskTaskgroupInfo.ts

View File

@ -10,6 +10,7 @@ import { PropertiesService } from './api/properties.service';
import { ScheduleService } from './api/schedule.service'; import { ScheduleService } from './api/schedule.service';
import { TaskService } from './api/task.service'; import { TaskService } from './api/task.service';
import { TaskgroupService } from './api/taskgroup.service'; import { TaskgroupService } from './api/taskgroup.service';
import { TaskseriesService } from './api/taskseries.service';
import { UsersService } from './api/users.service'; import { UsersService } from './api/users.service';
@NgModule({ @NgModule({

View File

@ -14,6 +14,8 @@ export * from './task.service';
import { TaskService } from './task.service'; import { TaskService } from './task.service';
export * from './taskgroup.service'; export * from './taskgroup.service';
import { TaskgroupService } from './taskgroup.service'; import { TaskgroupService } from './taskgroup.service';
export * from './taskseries.service';
import { TaskseriesService } from './taskseries.service';
export * from './users.service'; export * from './users.service';
import { UsersService } from './users.service'; import { UsersService } from './users.service';
export const APIS = [AccountService, HistoryService, LoginService, NtfyService, PropertiesService, ScheduleService, TaskService, TaskgroupService, UsersService]; export const APIS = [AccountService, HistoryService, LoginService, NtfyService, PropertiesService, ScheduleService, TaskService, TaskgroupService, TaskseriesService, UsersService];

View File

@ -29,6 +29,7 @@ export * from './simpleStatusResponse';
export * from './taskEntityInfo'; export * from './taskEntityInfo';
export * from './taskFieldInfo'; export * from './taskFieldInfo';
export * from './taskOverviewInfo'; export * from './taskOverviewInfo';
export * from './taskRepeatDayInfo';
export * from './taskScheduleStopResponse'; export * from './taskScheduleStopResponse';
export * from './taskShortInfo'; export * from './taskShortInfo';
export * from './taskTaskgroupInfo'; export * from './taskTaskgroupInfo';

View File

@ -23,7 +23,7 @@ export interface NtfyInformation {
/** /**
* username of ntfy account for publishing news * username of ntfy account for publishing news
*/ */
ntfy_user: string; ntfy_user?: string;
/** /**
* token to ntfy useraccount * token to ntfy useraccount
*/ */

View File

@ -91,6 +91,8 @@ import {MatGridListModule} from "@angular/material/grid-list";
import { StopScheduleManuallyComponent } from './dashboard/active-schedule/stop-schedule-manually/stop-schedule-manually.component'; import { StopScheduleManuallyComponent } from './dashboard/active-schedule/stop-schedule-manually/stop-schedule-manually.component';
import { ConnectionSettingsComponent } from './user-settings/connection-settings/connection-settings.component'; import { ConnectionSettingsComponent } from './user-settings/connection-settings/connection-settings.component';
import { NtfySettingsComponent } from './user-settings/connection-settings/ntfy-settings/ntfy-settings.component'; import { NtfySettingsComponent } from './user-settings/connection-settings/ntfy-settings/ntfy-settings.component';
import { TaskSeriesCreatorComponent } from './tasks/task-series-creator/task-series-creator.component';
import {MatStepperModule} from "@angular/material/stepper";
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
@ -138,6 +140,7 @@ import { NtfySettingsComponent } from './user-settings/connection-settings/ntfy-
StopScheduleManuallyComponent, StopScheduleManuallyComponent,
ConnectionSettingsComponent, ConnectionSettingsComponent,
NtfySettingsComponent, NtfySettingsComponent,
TaskSeriesCreatorComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -181,6 +184,7 @@ import { NtfySettingsComponent } from './user-settings/connection-settings/ntfy-
NgApexchartsModule, NgApexchartsModule,
MatButtonToggleModule, MatButtonToggleModule,
MatGridListModule, MatGridListModule,
MatStepperModule,
], ],
providers: [ providers: [
HttpClientModule, HttpClientModule,

View File

@ -29,7 +29,7 @@
<button mat-flat-button class="borderless-btn" color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule']">Schedule</button> <button mat-flat-button class="borderless-btn" color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule']">Schedule</button>
<button mat-flat-button class="yellowBtn" (click)="startTaskNow()">Start now</button> <button mat-flat-button class="yellowBtn" (click)="startTaskNow()">Start now</button>
<button mat-flat-button class="grayBtn" (click)="openTaskEditor()">Edit</button> <button mat-flat-button class="grayBtn" (click)="openTaskEditor()">Edit</button>
<!--<button mat-raised-button>Copy</button>--> <button mat-flat-button class="lightBlueBtn" (click)="openRepeatingTaskEditor()">Copy</button>
<button mat-flat-button class="greenBtn" *ngIf="task!.finishable" (click)="finishTask()">{{task!.finished ? 'Reopen':'Finish'}}</button> <button mat-flat-button class="greenBtn" *ngIf="task!.finishable" (click)="finishTask()">{{task!.finished ? 'Reopen':'Finish'}}</button>
</div> </div>

View File

@ -17,6 +17,7 @@ import {TaskEditorData} from "../task-editor/TaskEditorData";
import * as moment from "moment"; import * as moment from "moment";
import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component"; import {ScheduleDashboardComponent} from "../../schedules/schedule-dashboard/schedule-dashboard.component";
import {TaskStatusService} from "../task-status.service"; import {TaskStatusService} from "../task-status.service";
import {TaskSeriesCreatorComponent} from "../task-series-creator/task-series-creator.component";
@Component({ @Component({
selector: 'app-task-detail-overview', selector: 'app-task-detail-overview',
@ -158,4 +159,11 @@ export class TaskDetailOverviewComponent implements OnInit {
} }
}) })
} }
openRepeatingTaskEditor() {
const dialogRef = this.dialog.open(TaskSeriesCreatorComponent, {
data: this.task!,
minWidth: "400px"
})
}
} }

View File

@ -24,7 +24,7 @@ export class NtfySettingsComponent {
next: resp => { next: resp => {
this.host_formCtrl.setValue(resp.ntfy_host); this.host_formCtrl.setValue(resp.ntfy_host);
this.topic_formCtrl.setValue(resp.ntfy_topic); this.topic_formCtrl.setValue(resp.ntfy_topic);
this.user_formCtrl.setValue(resp.ntfy_user); this.user_formCtrl.setValue(resp.ntfy_user!);
this.token_formCtrl.setValue(resp.ntfy_token!); this.token_formCtrl.setValue(resp.ntfy_token!);
} }
}) })