issue-10 #17
@ -5,9 +5,16 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Datastructure for Tasks">
|
||||
<change afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/TaskEditorData.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" 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/TaskController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskEntityInfo.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Task.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/package-lock.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/app.module.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/tasks/task-editor/task-editor.component.ts" afterDir="false" />
|
||||
</list>
|
||||
@ -41,31 +48,31 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "issue-11-angular-update",
|
||||
"last_directory_selection": "D:/Programmierprojekte/TimeManager/backend/src/main/java/core/api/models/timemanager",
|
||||
"last_opened_file_path": "D:/Programmierprojekte/Dicewars/client",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "issue-11-angular-update",
|
||||
"last_directory_selection": "D:/Programmierprojekte/TimeManager/backend/src/main/java/core/api/models/timemanager",
|
||||
"last_opened_file_path": "D:/Programmierprojekte/Dicewars/client",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"mariadb"
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"mariadb"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="DemoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="demo" />
|
||||
@ -88,6 +95,7 @@
|
||||
<workItem from="1696399523081" duration="666000" />
|
||||
<workItem from="1696517800445" duration="3887000" />
|
||||
<workItem from="1696573678147" duration="111000" />
|
||||
<workItem from="1697923629354" duration="1218000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
||||
<option name="closed" value="true" />
|
||||
|
@ -51,7 +51,7 @@ public class TaskController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/tasks/{taskgroupID}")
|
||||
@PutMapping("/tasks/{taskgroupID}")
|
||||
public ResponseEntity<?> createTask(@PathVariable long taskgroupID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
||||
|
@ -18,6 +18,8 @@ public class TaskEntityInfo {
|
||||
|
||||
private boolean overdue;
|
||||
|
||||
private boolean finished;
|
||||
|
||||
public TaskEntityInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
@ -25,6 +27,7 @@ public class TaskEntityInfo {
|
||||
this.startDate = task.getStartDate();
|
||||
this.deadline = task.getDeadline();
|
||||
this.overdue = LocalDate.now().isAfter(task.getDeadline());
|
||||
this.finished = task.isFinished();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -74,4 +77,12 @@ public class TaskEntityInfo {
|
||||
public void setOverdue(boolean overdue) {
|
||||
this.overdue = overdue;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public void setFinished(boolean finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,15 @@ public class Task {
|
||||
|
||||
private int eta;
|
||||
|
||||
private boolean finished;
|
||||
|
||||
public Task(Taskgroup taskgroup, String taskName, LocalDate startDate, LocalDate deadline, int eta) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.taskName = taskName;
|
||||
this.startDate = startDate;
|
||||
this.deadline = deadline;
|
||||
this.eta = eta;
|
||||
this.finished = false;
|
||||
}
|
||||
|
||||
public Task() {
|
||||
@ -76,4 +79,16 @@ public class Task {
|
||||
public void setEta(int eta) {
|
||||
this.eta = eta;
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
this.finished = true;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public void setFinished(boolean finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
}
|
||||
|
6
frontend/package-lock.json
generated
6
frontend/package-lock.json
generated
@ -2597,9 +2597,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/traverse": {
|
||||
"version": "7.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
|
||||
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
|
||||
"version": "7.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz",
|
||||
"integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
|
@ -47,6 +47,10 @@ import {MatCardModule} from "@angular/material/card";
|
||||
import {MatListModule} from "@angular/material/list";
|
||||
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule} from "@angular/material/core";
|
||||
import {MatMomentDateModule, MomentDateModule} from "@angular/material-moment-adapter";
|
||||
import { TaskDashboardComponent } from './tasks/task-dashboard/task-dashboard.component';
|
||||
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
|
||||
import {MatSortModule} from "@angular/material/sort";
|
||||
import {MatPaginatorModule} from "@angular/material/paginator";
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -67,36 +71,40 @@ import {MatMomentDateModule, MomentDateModule} from "@angular/material-moment-ad
|
||||
TaskgroupDashboardComponent,
|
||||
TaskgroupCreationComponent,
|
||||
TaskgroupDeletionComponent,
|
||||
TaskEditorComponent
|
||||
TaskEditorComponent,
|
||||
TaskDashboardComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
ApiModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
MatToolbarModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSnackBarModule,
|
||||
MatMenuModule,
|
||||
MatTabsModule,
|
||||
MatTableModule,
|
||||
MatCheckboxModule,
|
||||
MatCardModule,
|
||||
ReactiveFormsModule,
|
||||
MatListModule,
|
||||
MatDatepickerModule,
|
||||
MatInputModule,
|
||||
MatDatepickerModule,
|
||||
MatMomentDateModule,
|
||||
FormsModule,
|
||||
MatSlideToggleModule,
|
||||
MatSortModule,
|
||||
MatPaginatorModule
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
ApiModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
MatToolbarModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSnackBarModule,
|
||||
MatMenuModule,
|
||||
MatTabsModule,
|
||||
MatTableModule,
|
||||
MatCheckboxModule,
|
||||
MatCardModule,
|
||||
ReactiveFormsModule,
|
||||
MatListModule,
|
||||
MatDatepickerModule,
|
||||
MatInputModule,
|
||||
MatDatepickerModule,
|
||||
MatMomentDateModule,
|
||||
FormsModule
|
||||
],
|
||||
providers: [
|
||||
HttpClientModule,
|
||||
/*
|
||||
|
@ -45,3 +45,9 @@
|
||||
background-color: #6e6e6e;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#task-dashboard-container {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,16 @@
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
<div>
|
||||
|
||||
<mat-card style="width: 100%">
|
||||
<mat-card-content>
|
||||
<app-task-dashboard [taskgroupID]="taskgroupID"></app-task-dashboard>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<div style="width: 100%">
|
||||
<button id="addTaskBtn" mat-raised-button color="primary" (click)="openTaskCreation()">Create New Task</button>
|
||||
<button id="addTaskgroupBtn" mat-raised-button color="primary" (click)="openTaskgroupCreation()">Create new Taskgroup</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@ import {TaskgroupEntityInfo, TaskgroupService} from "../../../api";
|
||||
import {TaskgroupDeletionComponent} from "../taskgroup-deletion/taskgroup-deletion.component";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {TaskEditorComponent} from "../../tasks/task-editor/task-editor.component";
|
||||
import {TaskEditorData} from "../../tasks/task-editor/TaskEditorData";
|
||||
|
||||
@Component({
|
||||
selector: 'app-taskgroup-dashboard',
|
||||
@ -68,6 +69,10 @@ export class TaskgroupDashboardComponent implements OnInit {
|
||||
}
|
||||
|
||||
openTaskCreation() {
|
||||
const dialogRef = this.dialog.open(TaskEditorComponent, {minWidth: "400px"})
|
||||
const editorData: TaskEditorData = {
|
||||
task: undefined,
|
||||
taskgroupID: this.taskgroupID
|
||||
}
|
||||
const dialogRef = this.dialog.open(TaskEditorComponent, {data: editorData, minWidth: "400px"})
|
||||
}
|
||||
}
|
||||
|
6
frontend/src/app/tasks/task-editor/TaskEditorData.ts
Normal file
6
frontend/src/app/tasks/task-editor/TaskEditorData.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import {TaskEntityInfo} from "../../../api";
|
||||
|
||||
export interface TaskEditorData {
|
||||
taskgroupID: number;
|
||||
task: TaskEntityInfo | undefined
|
||||
}
|
@ -24,3 +24,8 @@
|
||||
<mat-datepicker #deadlinepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions align="end">
|
||||
<button mat-raised-button (click)="cancel()">Cancel</button>
|
||||
<button mat-raised-button (click)="submit()">Add Task</button>
|
||||
</div>
|
||||
|
@ -1,8 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {FormControl, UntypedFormControl, Validators} from "@angular/forms";
|
||||
import * as _moment from 'moment';
|
||||
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from "@angular/material/core";
|
||||
import {MomentDateAdapter} from "@angular/material-moment-adapter";
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {TaskService} from "../../../api";
|
||||
import {TaskEditorData} from "./TaskEditorData";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
|
||||
|
||||
@Component({
|
||||
@ -16,9 +20,39 @@ export class TaskEditorComponent implements OnInit {
|
||||
etaCtrl: FormControl = new FormControl(0, [Validators.required, Validators.min(0)])
|
||||
startDate: FormControl = new FormControl(Date.now(), [Validators.required])
|
||||
endDate: FormControl = new FormControl('');
|
||||
constructor() { }
|
||||
constructor(private dialog: MatDialogRef<TaskEditorComponent>,
|
||||
private taskService: TaskService,
|
||||
@Inject(MAT_DIALOG_DATA) public editorData: TaskEditorData,
|
||||
private snackbar: MatSnackBar) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.dialog.close();
|
||||
}
|
||||
|
||||
submit() {
|
||||
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
|
||||
taskName: this.nameCtrl.value,
|
||||
eta: this.etaCtrl.value,
|
||||
startDate: this.startDate.value,
|
||||
deadline: this.endDate.value
|
||||
}).subscribe({
|
||||
next: resp => {
|
||||
this.dialog.close(resp);
|
||||
},
|
||||
error: err => {
|
||||
if(err.status == 403) {
|
||||
this.snackbar.open("No permission", "", {duration: 2000});
|
||||
} else if(err.status == 404) {
|
||||
this.snackbar.open("Taskgroup not found", "", {duration: 2000});
|
||||
} else if(err.status == 409) {
|
||||
this.snackbar.open("Task already exists", "", {duration: 2000});
|
||||
} else {
|
||||
this.snackbar.open("Unexpected error", "", {duration: 3000});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user