Taskgroup-Navigation (Issue 13)

This commit is contained in:
Sebastian 2023-10-22 11:39:25 +02:00
parent d6116729fd
commit 32142c759f
20 changed files with 265 additions and 65 deletions

View File

@ -4,13 +4,21 @@
<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="Implementing edit route for tasks"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Delete and clear Tasks (Frontend)">
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/TaskgroupDetailInfo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/TaskgroupShortInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.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/controller/TaskgroupController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskgroupController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskgroupController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/TaskgroupController.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$/src/main/java/core/api/models/timemanager/taskgroup/TaskgroupEntityInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskgroup/TaskgroupEntityInfo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/TaskRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/TaskRepository.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/entities/timemanager/Taskgroup.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/api/.openapi-generator/FILES" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/.openapi-generator/FILES" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/api/taskgroup.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/api/taskgroup.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/api/model/models.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/api/model/models.ts" 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/taskgroups/taskgroup-dashboard/taskgroup-dashboard.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/taskgroups/taskgroup-dashboard/taskgroup-dashboard.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$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" 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" />
@ -94,7 +102,7 @@
<workItem from="1696573678147" duration="111000" /> <workItem from="1696573678147" duration="111000" />
<workItem from="1697923629354" duration="3164000" /> <workItem from="1697923629354" duration="3164000" />
<workItem from="1697958018921" duration="91000" /> <workItem from="1697958018921" duration="91000" />
<workItem from="1697958118995" duration="2830000" /> <workItem from="1697958118995" duration="5749000" />
</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" />
@ -120,7 +128,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1697929392755</updated> <updated>1697929392755</updated>
</task> </task>
<option name="localTasksCounter" value="4" /> <task id="LOCAL-00004" summary="Delete and clear Tasks">
<option name="closed" value="true" />
<created>1697962016013</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1697962016013</updated>
</task>
<task id="LOCAL-00005" summary="Delete and clear Tasks (Frontend)">
<option name="closed" value="true" />
<created>1697962125518</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1697962125518</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -131,7 +155,9 @@
<MESSAGE value="Update gitignore for idea folder" /> <MESSAGE value="Update gitignore for idea folder" />
<MESSAGE value="Datastructure for Tasks" /> <MESSAGE value="Datastructure for Tasks" />
<MESSAGE value="Implementing edit route for tasks" /> <MESSAGE value="Implementing edit route for tasks" />
<option name="LAST_COMMIT_MESSAGE" value="Implementing edit route for tasks" /> <MESSAGE value="Delete and clear Tasks" />
<MESSAGE value="Delete and clear Tasks (Frontend)" />
<option name="LAST_COMMIT_MESSAGE" value="Delete and clear Tasks (Frontend)" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -1,6 +1,7 @@
package core.api.controller; package core.api.controller;
import core.api.models.auth.SimpleStatusResponse; import core.api.models.auth.SimpleStatusResponse;
import core.api.models.timemanager.taskgroup.TaskgroupDetailInfo;
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo; import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo; import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo;
import core.entities.timemanager.Taskgroup; import core.entities.timemanager.Taskgroup;
@ -90,8 +91,7 @@ public class TaskgroupController {
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed")); return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
} }
Set<Taskgroup> children = taskgroupPermissionResult.getResult().getChildren(); return ResponseEntity.ok(new TaskgroupDetailInfo(taskgroupPermissionResult.getResult()));
return ResponseEntity.ok(children.stream().map(TaskgroupEntityInfo::new));
} }
@DeleteMapping("/taskgroups/{taskgroupID}/clear") @DeleteMapping("/taskgroups/{taskgroupID}/clear")

View File

@ -0,0 +1,45 @@
package core.api.models.timemanager.taskgroup;
import core.entities.timemanager.Taskgroup;
import org.springframework.scheduling.config.Task;
import java.util.ArrayList;
import java.util.List;
public class TaskgroupDetailInfo {
private List<TaskgroupEntityInfo> children;
private List<TaskgroupEntityInfo> ancestors;
private TaskgroupEntityInfo taskgroupInfo;
public TaskgroupDetailInfo(Taskgroup taskgroup) {
this.children = taskgroup.getChildren().stream().map(TaskgroupEntityInfo::new).toList();
List<Taskgroup> ancestorList = Taskgroup.getAncestorList(taskgroup);
this.ancestors = ancestorList.stream().map(TaskgroupEntityInfo::new).toList();
this.taskgroupInfo = new TaskgroupEntityInfo(taskgroup);
}
public List<TaskgroupEntityInfo> getChildren() {
return children;
}
public void setChildren(List<TaskgroupEntityInfo> children) {
this.children = children;
}
public List<TaskgroupEntityInfo> getAncestors() {
return ancestors;
}
public void setAncestors(List<TaskgroupEntityInfo> ancestors) {
this.ancestors = ancestors;
}
public TaskgroupEntityInfo getTaskgroupInfo() {
return taskgroupInfo;
}
public void setTaskgroupInfo(TaskgroupEntityInfo taskgroupInfo) {
this.taskgroupInfo = taskgroupInfo;
}
}

View File

@ -7,17 +7,9 @@ public class TaskgroupEntityInfo {
private long taskgroupID; private long taskgroupID;
private String taskgroupName; private String taskgroupName;
private TaskgroupEntityInfo parentTaskgroup;
public TaskgroupEntityInfo(Taskgroup taskgroup) { public TaskgroupEntityInfo(Taskgroup taskgroup) {
this.taskgroupID = taskgroup.getTaskgroupID(); this.taskgroupID = taskgroup.getTaskgroupID();
this.taskgroupName = taskgroup.getTaskgroupName(); this.taskgroupName = taskgroup.getTaskgroupName();
if(taskgroup.getParent() == null) {
this.parentTaskgroup = null;
} else {
this.parentTaskgroup = new TaskgroupEntityInfo(taskgroup.getParent());
}
} }
public long getTaskgroupID() { public long getTaskgroupID() {
@ -35,12 +27,4 @@ public class TaskgroupEntityInfo {
public void setTaskgroupName(String taskgroupName) { public void setTaskgroupName(String taskgroupName) {
this.taskgroupName = taskgroupName; this.taskgroupName = taskgroupName;
} }
public TaskgroupEntityInfo getParentTaskgroup() {
return parentTaskgroup;
}
public void setParentTaskgroup(TaskgroupEntityInfo parentTaskgroup) {
this.parentTaskgroup = parentTaskgroup;
}
} }

View File

@ -0,0 +1,7 @@
package core.api.models.timemanager.taskgroup;
public class TaskgroupShortInfo {
private long taskgroupID;
private String taskgroupName;
}

View File

@ -4,7 +4,7 @@ import core.entities.User;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.Set; import java.util.*;
@Entity @Entity
@Table(name= "taskgroups") @Table(name= "taskgroups")
@ -87,4 +87,14 @@ public class Taskgroup {
public void setTasks(Set<Task> tasks) { public void setTasks(Set<Task> tasks) {
this.tasks = tasks; this.tasks = tasks;
} }
public static List<Taskgroup> getAncestorList(Taskgroup taskgroup) {
List<Taskgroup> ancestors = new ArrayList<>();
Taskgroup currentTaskgroup = taskgroup;
while(currentTaskgroup.parent != null) {
ancestors.add(currentTaskgroup.parent);
currentTaskgroup = currentTaskgroup.parent;
}
return ancestors;
}
} }

View File

@ -29,6 +29,7 @@ model/signUpRequest.ts
model/simpleStatusResponse.ts model/simpleStatusResponse.ts
model/taskEntityInfo.ts model/taskEntityInfo.ts
model/taskFieldInfo.ts model/taskFieldInfo.ts
model/taskgroupDetailInfo.ts
model/taskgroupEntityInfo.ts model/taskgroupEntityInfo.ts
model/taskgroupFieldInfo.ts model/taskgroupFieldInfo.ts
model/userAddInfo.ts model/userAddInfo.ts

View File

@ -21,6 +21,7 @@ import { Observable } from 'rxjs';
import { InlineResponse200 } from '../model/models'; import { InlineResponse200 } from '../model/models';
import { InlineResponse403 } from '../model/models'; import { InlineResponse403 } from '../model/models';
import { SimpleStatusResponse } from '../model/models'; import { SimpleStatusResponse } from '../model/models';
import { TaskgroupDetailInfo } from '../model/models';
import { TaskgroupEntityInfo } from '../model/models'; import { TaskgroupEntityInfo } from '../model/models';
import { TaskgroupFieldInfo } from '../model/models'; import { TaskgroupFieldInfo } from '../model/models';
@ -390,9 +391,9 @@ export class TaskgroupService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress. * @param reportProgress flag to report request and response progress.
*/ */
public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskgroupEntityInfo>>; public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<TaskgroupDetailInfo>;
public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskgroupEntityInfo>>>; public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<TaskgroupDetailInfo>>;
public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskgroupEntityInfo>>>; public taskgroupsTaskgroupIDGet(taskgroupID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<TaskgroupDetailInfo>>;
public taskgroupsTaskgroupIDGet(taskgroupID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> { public taskgroupsTaskgroupIDGet(taskgroupID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
if (taskgroupID === null || taskgroupID === undefined) { if (taskgroupID === null || taskgroupID === undefined) {
throw new Error('Required parameter taskgroupID was null or undefined when calling taskgroupsTaskgroupIDGet.'); throw new Error('Required parameter taskgroupID was null or undefined when calling taskgroupsTaskgroupIDGet.');
@ -430,7 +431,7 @@ export class TaskgroupService {
responseType_ = 'text'; responseType_ = 'text';
} }
return this.httpClient.get<Array<TaskgroupEntityInfo>>(`${this.configuration.basePath}/taskgroups/${encodeURIComponent(String(taskgroupID))}`, return this.httpClient.get<TaskgroupDetailInfo>(`${this.configuration.basePath}/taskgroups/${encodeURIComponent(String(taskgroupID))}`,
{ {
context: localVarHttpContext, context: localVarHttpContext,
responseType: <any>responseType_, responseType: <any>responseType_,

View File

@ -14,6 +14,7 @@ export * from './signUpRequest';
export * from './simpleStatusResponse'; export * from './simpleStatusResponse';
export * from './taskEntityInfo'; export * from './taskEntityInfo';
export * from './taskFieldInfo'; export * from './taskFieldInfo';
export * from './taskgroupDetailInfo';
export * from './taskgroupEntityInfo'; export * from './taskgroupEntityInfo';
export * from './taskgroupFieldInfo'; export * from './taskgroupFieldInfo';
export * from './userAddInfo'; export * from './userAddInfo';

View File

@ -0,0 +1,20 @@
/**
* API Title
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
export interface TaskgroupDetailInfo {
children: Array<TaskgroupEntityInfo>;
ancestors: Array<TaskgroupEntityInfo>;
taskgroupInfo: TaskgroupEntityInfo;
}

View File

@ -20,6 +20,5 @@ export interface TaskgroupEntityInfo {
* name of taskgroup * name of taskgroup
*/ */
taskgroupName: string; taskgroupName: string;
parentTaskgroup: TaskgroupEntityInfo;
} }

View File

@ -52,6 +52,7 @@ import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {MatSortModule} from "@angular/material/sort"; import {MatSortModule} from "@angular/material/sort";
import {MatPaginatorModule} from "@angular/material/paginator"; import {MatPaginatorModule} from "@angular/material/paginator";
import { ClearTaskDialogComponent } from './tasks/clear-task-dialog/clear-task-dialog.component'; import { ClearTaskDialogComponent } from './tasks/clear-task-dialog/clear-task-dialog.component';
import { NavigationLinkListComponent } from './navigation-link-list/navigation-link-list.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -74,7 +75,8 @@ import { ClearTaskDialogComponent } from './tasks/clear-task-dialog/clear-task-d
TaskgroupDeletionComponent, TaskgroupDeletionComponent,
TaskEditorComponent, TaskEditorComponent,
TaskDashboardComponent, TaskDashboardComponent,
ClearTaskDialogComponent ClearTaskDialogComponent,
NavigationLinkListComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -0,0 +1,23 @@
.navLink {
text-decoration: underline;
color: black;
margin-right: 5px;
margin-left: 3px;
}
.navLink-disabled {
text-decoration: none;
color: grey;
}
.navLink-bar {
margin-bottom: 20px;
}
.link-separation {
text-decoration: none;
padding-right: 5px;
}

View File

@ -0,0 +1,8 @@
<mat-card class="navLink-bar">
<mat-card-content>
<span *ngFor="let navigationLink of navigationLinks; index as i">
<span class="link-seperation" *ngIf="i !== 0">/</span>
<a class="navLink" [routerLink]="navigationLink.routerLink" [class.navLink-disabled]="i == navigationLinks.length-1">{{navigationLink.linkText}}</a>
</span>
</mat-card-content>
</mat-card>

View File

@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavigationLinkListComponent } from './navigation-link-list.component';
describe('NavigationLinkListComponent', () => {
let component: NavigationLinkListComponent;
let fixture: ComponentFixture<NavigationLinkListComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [NavigationLinkListComponent]
});
fixture = TestBed.createComponent(NavigationLinkListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,40 @@
import {Component, Input, OnInit} from '@angular/core';
export interface NavigationLink {
routerLink: string[],
linkText: string
}
@Component({
selector: 'app-navigation-link-list',
templateUrl: './navigation-link-list.component.html',
styleUrls: ['./navigation-link-list.component.css']
})
export class NavigationLinkListComponent implements OnInit{
@Input() navigationLinks: NavigationLink[] = []
ngOnInit(): void {
}
addNavigationLink(linkText: string, link: string[]) {
const navigationLink: NavigationLink = {
linkText: linkText,
routerLink: link
}
if(this.navigationLinks.find(searchedLink => searchedLink.linkText === linkText) === undefined) {
this.navigationLinks.push(navigationLink);
}
}
removeLink(linkText: string) {
this.navigationLinks = this.navigationLinks.filter(link => link.linkText === linkText);
}
}

View File

@ -15,22 +15,6 @@
} }
} }
.navLink {
text-decoration: underline;
color: black;
margin-right: 5px;
}
.navLink-disabled {
text-decoration: none;
color: grey;
}
.navLink-bar {
margin-bottom: 20px;
}
#addTaskgroupBtn { #addTaskgroupBtn {
margin-top: 20px; margin-top: 20px;
float: right; float: right;

View File

@ -1,10 +1,5 @@
<div class="container"> <div class="container">
<mat-card class="navLink-bar"> <app-navigation-link-list #navLinkList [navigationLinks]="defaultNavigationLinkPath"></app-navigation-link-list>
<mat-card-content>
<a class="navLink" routerLink="/">Dashboard</a>
<a class="navLink-disabled">/ Taskgroups</a>
</mat-card-content>
</mat-card>
<mat-card *ngFor="let taskgroup of taskgroups"> <mat-card *ngFor="let taskgroup of taskgroups">
<mat-card-content> <mat-card-content>
@ -16,13 +11,13 @@
</mat-card> </mat-card>
<mat-card style="width: 100%"> <mat-card style="width: 100%" *ngIf="taskgroupID >= 0">
<mat-card-content> <mat-card-content>
<app-task-dashboard #taskDashboard [taskgroupID]="taskgroupID"></app-task-dashboard> <app-task-dashboard #taskDashboard [taskgroupID]="taskgroupID"></app-task-dashboard>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
<div style="width: 100%"> <div style="width: 100%">
<button id="addTaskBtn" mat-raised-button color="primary" (click)="openTaskCreation()">Create New Task</button> <button id="addTaskBtn" *ngIf="taskgroupID >= 0" 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> <button id="addTaskgroupBtn" mat-raised-button color="primary" (click)="openTaskgroupCreation()">Create new Taskgroup</button>
</div> </div>

View File

@ -7,6 +7,7 @@ import {ActivatedRoute} from "@angular/router";
import {TaskEditorComponent} from "../../tasks/task-editor/task-editor.component"; import {TaskEditorComponent} from "../../tasks/task-editor/task-editor.component";
import {TaskEditorData} from "../../tasks/task-editor/TaskEditorData"; import {TaskEditorData} from "../../tasks/task-editor/TaskEditorData";
import {TaskDashboardComponent} from "../../tasks/task-dashboard/task-dashboard.component"; import {TaskDashboardComponent} from "../../tasks/task-dashboard/task-dashboard.component";
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
@Component({ @Component({
selector: 'app-taskgroup-dashboard', selector: 'app-taskgroup-dashboard',
@ -20,8 +21,21 @@ export class TaskgroupDashboardComponent implements OnInit {
private activatedRoute: ActivatedRoute) { } private activatedRoute: ActivatedRoute) { }
taskgroups: TaskgroupEntityInfo[] = [] taskgroups: TaskgroupEntityInfo[] = []
taskgroup: TaskgroupEntityInfo | undefined
taskgroupPath: TaskgroupEntityInfo[] = []
taskgroupID: number = -1; taskgroupID: number = -1;
@ViewChild("taskDashboard") taskDashboard: TaskDashboardComponent | undefined @ViewChild("taskDashboard") taskDashboard: TaskDashboardComponent | undefined
@ViewChild('navLinkList') navLinkListComponent: NavigationLinkListComponent | undefined
defaultNavigationLinkPath: NavigationLink[] = [
{
linkText: "Dashboard",
routerLink: ['/']
},
{
linkText: "Taskgroups",
routerLink: ["/taskgroups"]
}
]
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@ -29,7 +43,13 @@ export class TaskgroupDashboardComponent implements OnInit {
this.taskgroupID = Number(params.get('taskgroupID')); this.taskgroupID = Number(params.get('taskgroupID'));
this.taskgroupService.taskgroupsTaskgroupIDGet(this.taskgroupID).subscribe({ this.taskgroupService.taskgroupsTaskgroupIDGet(this.taskgroupID).subscribe({
next: resp => { next: resp => {
this.taskgroups = resp this.taskgroups = resp.children
this.taskgroupPath = resp.ancestors
this.taskgroup = resp.taskgroupInfo;
this.navLinkListComponent!.addNavigationLink(this.taskgroup.taskgroupName, ['/taskgroups', this.taskgroup.taskgroupID.toString()])
this.taskgroupPath.forEach(taskgroupEntity => {
this.navLinkListComponent!.addNavigationLink(taskgroupEntity.taskgroupName, ['/taskgroups', taskgroupEntity.taskgroupID.toString()]);
})
} }
}) })
} else { } else {

View File

@ -654,9 +654,8 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
type: array type: object
items: $ref: '#/components/schemas/TaskgroupDetailInfo'
$ref: '#/components/schemas/TaskgroupEntityInfo'
403: 403:
description: No permission description: No permission
content: content:
@ -1328,7 +1327,6 @@ components:
required: required:
- taskgroupID - taskgroupID
- taskgroupName - taskgroupName
- parentTaskgroup
additionalProperties: false additionalProperties: false
properties: properties:
taskgroupID: taskgroupID:
@ -1341,9 +1339,6 @@ components:
example: Taskgroup 1 example: Taskgroup 1
maxLength: 255 maxLength: 255
minLength: 1 minLength: 1
parentTaskgroup:
type: object
$ref: '#/components/schemas/TaskgroupEntityInfo'
TaskgroupFieldInfo: TaskgroupFieldInfo:
required: required:
- name - name
@ -1360,6 +1355,24 @@ components:
type: number type: number
description: internal id of parent Taskgroup description: internal id of parent Taskgroup
example: 1 example: 1
TaskgroupDetailInfo:
required:
- children
- ancestors
- taskgroupInfo
additionalProperties: false
properties:
children:
type: array
items:
$ref: '#/components/schemas/TaskgroupEntityInfo'
ancestors:
type: array
items:
$ref: '#/components/schemas/TaskgroupEntityInfo'
taskgroupInfo:
type: object
$ref: '#/components/schemas/TaskgroupEntityInfo'
TaskEntityInfo: TaskEntityInfo:
required: required:
- taskID - taskID