diff --git a/backend/capellacollab/projects/models.py b/backend/capellacollab/projects/models.py index 0927ba6253..461956c394 100644 --- a/backend/capellacollab/projects/models.py +++ b/backend/capellacollab/projects/models.py @@ -107,6 +107,7 @@ class PostProjectRequest(core_pydantic.BaseModel): name: str description: str | None = None visibility: Visibility = Visibility.PRIVATE + type: ProjectType = ProjectType.GENERAL class DatabaseProject(database.Base): diff --git a/backend/capellacollab/projects/routes.py b/backend/capellacollab/projects/routes.py index a26c4f9414..86bdff1273 100644 --- a/backend/capellacollab/projects/routes.py +++ b/backend/capellacollab/projects/routes.py @@ -141,6 +141,7 @@ def create_project( post_project.name, post_project.description or "", post_project.visibility, + post_project.type, ) if user.role != users_models.Role.ADMIN: diff --git a/frontend/src/app/openapi/model/post-project-request.ts b/frontend/src/app/openapi/model/post-project-request.ts index f6733829a3..ee169e6a7b 100644 --- a/frontend/src/app/openapi/model/post-project-request.ts +++ b/frontend/src/app/openapi/model/post-project-request.ts @@ -9,6 +9,7 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ +import { ProjectType } from './project-type'; import { Visibility } from './visibility'; @@ -16,6 +17,7 @@ export interface PostProjectRequest { name: string; description?: string | null; visibility?: Visibility; + type?: ProjectType; } export namespace PostProjectRequest { } diff --git a/frontend/src/app/projects/create-project/create-project.component.html b/frontend/src/app/projects/create-project/create-project.component.html index e835217a5a..25e904b0a0 100644 --- a/frontend/src/app/projects/create-project/create-project.component.html +++ b/frontend/src/app/projects/create-project/create-project.component.html @@ -53,16 +53,33 @@

Create new project

formControlName="visibility" class="flex flex-col" > - - {{ - projectService.getProjectVisibilityDescription(visibility) - }} - + @for ( + visibility of projectService.getAvailableVisibilities(); + track visibility + ) { + + {{ + projectService.getProjectVisibilityDescription( + visibility + ) + }} + + } + + + +
+
+ Project type + + @for ( + type of projectService.getAvailableProjectTypes(); + track type + ) { + + {{ projectService.getProjectTypeDescription(type) }} + + }
diff --git a/frontend/src/app/projects/create-project/create-project.component.ts b/frontend/src/app/projects/create-project/create-project.component.ts index 14deacbc71..5a577084ec 100644 --- a/frontend/src/app/projects/create-project/create-project.component.ts +++ b/frontend/src/app/projects/create-project/create-project.component.ts @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors * SPDX-License-Identifier: Apache-2.0 */ -import { NgFor, AsyncPipe } from '@angular/common'; +import { AsyncPipe } from '@angular/common'; import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { FormControl, @@ -18,7 +18,7 @@ import { MatInput } from '@angular/material/input'; import { MatRadioGroup, MatRadioButton } from '@angular/material/radio'; import { MatStepper, MatStep, MatStepLabel } from '@angular/material/stepper'; import { RouterLink } from '@angular/router'; -import { Visibility } from 'src/app/openapi'; +import { ProjectType, Visibility } from 'src/app/openapi'; import { CreateModelComponent, CreateModelStep, @@ -44,7 +44,6 @@ import { ProjectWrapperService } from '../service/project.service'; MatInput, MatError, MatRadioGroup, - NgFor, MatRadioButton, MatButton, MatIcon, @@ -73,6 +72,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy { }), description: new FormControl(''), visibility: new FormControl('private'), + type: new FormControl('general'), }); ngOnInit(): void { @@ -90,6 +90,7 @@ export class CreateProjectComponent implements OnInit, OnDestroy { name: this.form.value.name!, description: this.form.value.description!, visibility: this.form.value.visibility! as Visibility, + type: this.form.value.type! as ProjectType, }) .subscribe((project) => { this.toastService.showSuccess( diff --git a/frontend/src/app/projects/service/project.service.ts b/frontend/src/app/projects/service/project.service.ts index aaae0867fa..3330afd275 100644 --- a/frontend/src/app/projects/service/project.service.ts +++ b/frontend/src/app/projects/service/project.service.ts @@ -132,6 +132,6 @@ export const ProjectVisibilityDescriptions = { }; export const ProjectTypeDescriptions = { - general: 'General (a project that contains multiple related models)', + general: 'General (a project that contains related models)', training: 'Training (special project containing training material)', }; diff --git a/frontend/src/storybook/project.ts b/frontend/src/storybook/project.ts index a8230b6e23..e2ce65390d 100644 --- a/frontend/src/storybook/project.ts +++ b/frontend/src/storybook/project.ts @@ -4,8 +4,9 @@ */ import { AsyncValidatorFn, ValidationErrors } from '@angular/forms'; import { BehaviorSubject, Observable, of } from 'rxjs'; -import { Project, Visibility } from 'src/app/openapi'; +import { Project, ProjectType, Visibility } from 'src/app/openapi'; import { + ProjectTypeDescriptions, ProjectVisibilityDescriptions, ProjectWrapperService, } from 'src/app/projects/service/project.service'; @@ -51,6 +52,14 @@ export class MockProjectWrapperService getAvailableVisibilities(): Visibility[] { return Object.keys(ProjectVisibilityDescriptions) as Visibility[]; } + + getProjectTypeDescription(type: ProjectType): string { + return ProjectTypeDescriptions[type]; + } + + getAvailableProjectTypes(): ProjectType[] { + return Object.keys(ProjectTypeDescriptions) as ProjectType[]; + } createProject(project: Project): Observable { return of(project); }