From 0b7479fb9ae789fc91cc493cf30bc7968cf139f9 Mon Sep 17 00:00:00 2001 From: MoritzWeber Date: Wed, 4 Sep 2024 18:10:43 +0200 Subject: [PATCH] feat: Display usage of T4C repositories in projects --- README.md | 2 +- backend/capellacollab/projects/models.py | 9 ++ .../projects/toolmodels/backups/models.py | 2 +- .../projects/toolmodels/models.py | 15 +- .../toolmodels/modelsources/t4c/models.py | 28 +--- .../toolmodels/modelsources/t4c/models2.py | 11 ++ .../toolmodels/modelsources/t4c/routes.py | 8 +- .../modelsources/t4c/instance/models2.py | 12 ++ .../t4c/instance/repositories/crud.py | 4 +- .../t4c/instance/repositories/models.py | 10 +- .../t4c/instance/repositories/models2.py | 20 +++ .../t4c/instance/repositories/routes.py | 18 +-- .../modelsources/t4c/license_server/models.py | 11 +- .../tests/projects/test_projects_routes.py | 67 +++----- .../pipelines/{conftest.py => fixtures.py} | 4 +- .../toolmodels/pipelines/test_pipelines.py | 8 +- .../src/app/openapi/.openapi-generator/FILES | 12 +- .../api/projects-models-t4-c.service.ts | 36 ++--- ...ngs-modelsources-t4-c-instances.service.ts | 10 +- frontend/src/app/openapi/model/backup.ts | 4 +- frontend/src/app/openapi/model/models.ts | 12 +- ...mple-t4-c-repository-with-integrations.ts} | 6 +- frontend/src/app/openapi/model/project.ts | 1 + .../src/app/openapi/model/simple-project.ts | 26 +++ .../app/openapi/model/simple-t4-c-instance.ts | 21 +++ .../simple-t4-c-model-with-repository.ts | 20 +++ ...s => simple-t4-c-model-with-tool-model.ts} | 6 +- ...imple-t4-c-repository-with-integrations.ts | 27 ++++ ...4-c-model.ts => simple-t4-c-repository.ts} | 9 +- ...e-t4-c-instace.ts => simple-tool-model.ts} | 5 +- .../app/openapi/model/t4-c-license-server.ts | 4 +- frontend/src/app/openapi/model/tool-model.ts | 4 +- .../pipeline-deletion-dialog.component.html | 6 +- .../trigger-pipeline.component.html | 7 +- .../model-source/choose-source.component.html | 2 +- .../manage-t4c-model.component.ts | 4 +- .../t4c/service/t4c-model.service.ts | 14 +- .../edit-t4c-instance.component.html | 4 +- .../service/t4c-repos/t4c-repo.service.ts | 12 +- .../t4c-instance-settings.component.html | 153 +++++++++++------- .../t4c-instance-settings.component.ts | 6 +- .../t4c-instance-settings.stories.ts | 62 +++++++ frontend/src/storybook/backups.ts | 4 +- frontend/src/storybook/model.ts | 7 +- frontend/src/storybook/project.ts | 1 + frontend/src/storybook/t4c.ts | 24 ++- 46 files changed, 477 insertions(+), 261 deletions(-) create mode 100644 backend/capellacollab/projects/toolmodels/modelsources/t4c/models2.py create mode 100644 backend/capellacollab/settings/modelsources/t4c/instance/models2.py create mode 100644 backend/capellacollab/settings/modelsources/t4c/instance/repositories/models2.py rename backend/tests/projects/toolmodels/pipelines/{conftest.py => fixtures.py} (93%) rename frontend/src/app/openapi/model/{payload-response-model-list-t4-c-repository.ts => payload-response-model-list-simple-t4-c-repository-with-integrations.ts} (67%) create mode 100644 frontend/src/app/openapi/model/simple-project.ts create mode 100644 frontend/src/app/openapi/model/simple-t4-c-instance.ts create mode 100644 frontend/src/app/openapi/model/simple-t4-c-model-with-repository.ts rename frontend/src/app/openapi/model/{t4-c-model.ts => simple-t4-c-model-with-tool-model.ts} (75%) create mode 100644 frontend/src/app/openapi/model/simple-t4-c-repository-with-integrations.ts rename frontend/src/app/openapi/model/{simple-t4-c-model.ts => simple-t4-c-repository.ts} (68%) rename frontend/src/app/openapi/model/{simple-t4-c-instace.ts => simple-tool-model.ts} (75%) diff --git a/README.md b/README.md index 756c8ef9d5..2596f09866 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ The Capella Collaboration Manager consists of a couple of components: External software can also be linked. These parts can be installed separately: - Optional: A Git server (used for read-only sessions and Git backups) -- Optional: A Team4Capella server +- Optional: A Team for Capella server - Optional: A pure::variants server ## Contributing diff --git a/backend/capellacollab/projects/models.py b/backend/capellacollab/projects/models.py index 765e5a8206..3df62a3d48 100644 --- a/backend/capellacollab/projects/models.py +++ b/backend/capellacollab/projects/models.py @@ -36,6 +36,7 @@ class ProjectType(enum.Enum): class Project(core_pydantic.BaseModel): + id: int name: str slug: str description: str | None = None @@ -86,6 +87,14 @@ def transform_users(cls, data: t.Any): return data +class SimpleProject(core_pydantic.BaseModel): + id: int + name: str + slug: str + visibility: Visibility + type: ProjectType + + class PatchProject(core_pydantic.BaseModel): name: str | None = None description: str | None = None diff --git a/backend/capellacollab/projects/toolmodels/backups/models.py b/backend/capellacollab/projects/toolmodels/backups/models.py index 208dad9908..038649b6a0 100644 --- a/backend/capellacollab/projects/toolmodels/backups/models.py +++ b/backend/capellacollab/projects/toolmodels/backups/models.py @@ -49,7 +49,7 @@ class Backup(core_pydantic.BaseModel): id: int k8s_cronjob_id: str | None = None - t4c_model: t4c_models.SimpleT4CModel + t4c_model: t4c_models.SimpleT4CModelWithRepository git_model: git_models.GitModel run_nightly: bool include_commit_history: bool diff --git a/backend/capellacollab/projects/toolmodels/models.py b/backend/capellacollab/projects/toolmodels/models.py index b217b35ea9..1eb94bdc16 100644 --- a/backend/capellacollab/projects/toolmodels/models.py +++ b/backend/capellacollab/projects/toolmodels/models.py @@ -12,10 +12,13 @@ from capellacollab.core import database from capellacollab.core import pydantic as core_pydantic +from capellacollab.projects import models as projects_models # Importing the modules here does not work as it produces a pydantic error for the CapellaModel from capellacollab.projects.toolmodels.modelsources.git.models import GitModel -from capellacollab.projects.toolmodels.modelsources.t4c.models import T4CModel +from capellacollab.projects.toolmodels.modelsources.t4c.models import ( + SimpleT4CModelWithRepository, +) from capellacollab.tools import models as tools_models from .restrictions import models as restrictions_models @@ -132,6 +135,12 @@ class ToolModel(core_pydantic.BaseModel): version: tools_models.ToolVersion | None = None nature: tools_models.ToolNature | None = None git_models: list[GitModel] | None = None - t4c_models: list[T4CModel] | None = None - + t4c_models: list[SimpleT4CModelWithRepository] | None = None restrictions: restrictions_models.ToolModelRestrictions | None = None + + +class SimpleToolModel(core_pydantic.BaseModel): + id: int + slug: str + name: str + project: projects_models.SimpleProject diff --git a/backend/capellacollab/projects/toolmodels/modelsources/t4c/models.py b/backend/capellacollab/projects/toolmodels/modelsources/t4c/models.py index 619f21e593..3ac55fd15c 100644 --- a/backend/capellacollab/projects/toolmodels/modelsources/t4c/models.py +++ b/backend/capellacollab/projects/toolmodels/modelsources/t4c/models.py @@ -5,7 +5,6 @@ import typing as t -import pydantic import sqlalchemy as sa from sqlalchemy import orm @@ -37,7 +36,7 @@ class DatabaseT4CModel(database.Base): sa.ForeignKey("t4c_repositories.id"), init=False ) repository: orm.Mapped[DatabaseT4CRepository] = orm.relationship( - back_populates="models" + back_populates="integrations" ) model_id: orm.Mapped[int] = orm.mapped_column( @@ -60,28 +59,7 @@ class PatchT4CModel(core_pydantic.BaseModel): t4c_repository_id: int | None = None -class SimpleT4CModel(core_pydantic.BaseModel): - project_name: str - repository_name: str - instance_name: str - - @pydantic.model_validator(mode="before") - @classmethod - def transform_database_t4c_model(cls, data: t.Any) -> t.Any: - if isinstance(data, DatabaseT4CModel): - return SimpleT4CModel( - project_name=data.name, - repository_name=data.repository.name, - instance_name=data.repository.instance.name, - ) - return data - - -class T4CModel(core_pydantic.BaseModel): +class SimpleT4CModelWithRepository(core_pydantic.BaseModel): id: int name: str - repository: repositories_models.T4CRepository - - -class T4CRepositoryWithModels(repositories_models.T4CRepository): - models: list[T4CModel] + repository: repositories_models.SimpleT4CRepository diff --git a/backend/capellacollab/projects/toolmodels/modelsources/t4c/models2.py b/backend/capellacollab/projects/toolmodels/modelsources/t4c/models2.py new file mode 100644 index 0000000000..91266c8927 --- /dev/null +++ b/backend/capellacollab/projects/toolmodels/modelsources/t4c/models2.py @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 + +from capellacollab.core import pydantic as core_pydantic +from capellacollab.projects.toolmodels import models as toolmodels_models + + +class SimpleT4CModelWithToolModel(core_pydantic.BaseModel): + id: int + name: str + model: toolmodels_models.SimpleToolModel diff --git a/backend/capellacollab/projects/toolmodels/modelsources/t4c/routes.py b/backend/capellacollab/projects/toolmodels/modelsources/t4c/routes.py index 4950e4f24b..bd37877dc8 100644 --- a/backend/capellacollab/projects/toolmodels/modelsources/t4c/routes.py +++ b/backend/capellacollab/projects/toolmodels/modelsources/t4c/routes.py @@ -40,7 +40,7 @@ @router.get( "", - response_model=list[models.T4CModel], + response_model=list[models.SimpleT4CModelWithRepository], ) def list_t4c_models( model: toolmodels_models.DatabaseToolModel = fastapi.Depends( @@ -53,7 +53,7 @@ def list_t4c_models( @router.get( "/{t4c_model_id}", - response_model=models.T4CModel, + response_model=models.SimpleT4CModelWithRepository, responses=responses.api_exceptions( [ exceptions.T4CIntegrationNotFoundError(-1), @@ -71,7 +71,7 @@ def get_t4c_model( @router.post( "", - response_model=models.T4CModel, + response_model=models.SimpleT4CModelWithRepository, dependencies=[ fastapi.Depends( auth_injectables.RoleVerification( @@ -108,7 +108,7 @@ def create_t4c_model( @router.patch( "/{t4c_model_id}", - response_model=models.T4CModel, + response_model=models.SimpleT4CModelWithRepository, dependencies=[ fastapi.Depends( auth_injectables.RoleVerification( diff --git a/backend/capellacollab/settings/modelsources/t4c/instance/models2.py b/backend/capellacollab/settings/modelsources/t4c/instance/models2.py new file mode 100644 index 0000000000..2c776a27a8 --- /dev/null +++ b/backend/capellacollab/settings/modelsources/t4c/instance/models2.py @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 + +from capellacollab.core import pydantic as core_pydantic +from capellacollab.tools import models as tools_models + + +class SimpleT4CInstance(core_pydantic.BaseModel): + id: int + name: str + version: tools_models.SimpleToolVersion + is_archived: bool diff --git a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/crud.py b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/crud.py index a3f06f8116..24017bb2d3 100644 --- a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/crud.py +++ b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/crud.py @@ -89,7 +89,7 @@ def _get_user_write_t4c_repositories( ) -> abc.Sequence[models.DatabaseT4CRepository]: stmt = ( sa.select(models.DatabaseT4CRepository) - .join(models.DatabaseT4CRepository.models) + .join(models.DatabaseT4CRepository.integrations) .join(t4c_models.DatabaseT4CModel.model) .join(toolmodels_models.DatabaseToolModel.version) .where( @@ -114,7 +114,7 @@ def _get_admin_t4c_repositories( ) -> abc.Sequence[models.DatabaseT4CRepository]: stmt = ( sa.select(models.DatabaseT4CRepository) - .join(models.DatabaseT4CRepository.models) + .join(models.DatabaseT4CRepository.integrations) .join(t4c_models.DatabaseT4CModel.model) .join(toolmodels_models.DatabaseToolModel.version) .where( diff --git a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models.py b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models.py index 48e4468f36..6544f81036 100644 --- a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models.py +++ b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models.py @@ -15,6 +15,9 @@ from capellacollab.settings.modelsources.t4c.instance import ( models as t4c_models, ) +from capellacollab.settings.modelsources.t4c.instance import ( + models2 as t4c_models2, +) if t.TYPE_CHECKING: from capellacollab.projects.toolmodels.modelsources.t4c.models import ( @@ -45,7 +48,7 @@ class DatabaseT4CRepository(database.Base): back_populates="repositories" ) - models: orm.Mapped[list[DatabaseT4CModel]] = orm.relationship( + integrations: orm.Mapped[list[DatabaseT4CModel]] = orm.relationship( back_populates="repository", cascade="all, delete", default_factory=list, @@ -72,5 +75,6 @@ class T4CRepository(CreateT4CRepository): status: T4CRepositoryStatus | None = None -class T4CInstanceWithRepositories(t4c_models.T4CInstance): - repositories: list[T4CRepository] +class SimpleT4CRepository(CreateT4CRepository): + id: int + instance: t4c_models2.SimpleT4CInstance diff --git a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models2.py b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models2.py new file mode 100644 index 0000000000..9afb225aa8 --- /dev/null +++ b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/models2.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 + +from capellacollab.core import pydantic as core_pydantic +from capellacollab.projects.toolmodels.modelsources.t4c import ( + models2 as t4c_models2, +) +from capellacollab.settings.modelsources.t4c.instance import ( + models2 as settings_t4c_models2, +) + +from . import models + + +class SimpleT4CRepositoryWithIntegrations(core_pydantic.BaseModel): + id: int + name: str + status: models.T4CRepositoryStatus | None = None + instance: settings_t4c_models2.SimpleT4CInstance + integrations: list[t4c_models2.SimpleT4CModelWithToolModel] diff --git a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/routes.py b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/routes.py index 2882e7258c..c9ec3cb3f6 100644 --- a/backend/capellacollab/settings/modelsources/t4c/instance/repositories/routes.py +++ b/backend/capellacollab/settings/modelsources/t4c/instance/repositories/routes.py @@ -14,13 +14,13 @@ from .. import injectables as settings_t4c_injectables from .. import models as settings_t4c_models -from . import crud, exceptions, injectables, interface, models +from . import crud, exceptions, injectables, interface, models, models2 router = fastapi.APIRouter() log = logging.getLogger(__name__) T4CRepositoriesResponseModel: t.TypeAlias = core_models.PayloadResponseModel[ - list[models.T4CRepository] + list[models2.SimpleT4CRepositoryWithIntegrations] ] @@ -31,10 +31,10 @@ def list_t4c_repositories( settings_t4c_injectables.get_existing_instance ), ) -> T4CRepositoriesResponseModel: - repositories = models.T4CInstanceWithRepositories.model_validate( - instance - ).repositories - + repositories = [ + models2.SimpleT4CRepositoryWithIntegrations.model_validate(repository) + for repository in instance.repositories + ] try: server_repositories = interface.list_repositories(instance) except requests.RequestException: @@ -184,10 +184,10 @@ def recreate_t4c_repository( def sync_db_with_server_repositories( db: orm.Session, - db_repos: list[models.T4CRepository], + db_repos: list[models2.SimpleT4CRepositoryWithIntegrations], server_repos: dict, instance: settings_t4c_models.DatabaseT4CInstance, -) -> list[models.T4CRepository]: +) -> list[models2.SimpleT4CRepositoryWithIntegrations]: """ Synchronize the repository list in the database with the repository list from a server. @@ -231,7 +231,7 @@ def sync_db_with_server_repositories( server_not_db_repo_names = server_repos_names - db_repos_names for repo_name in server_not_db_repo_names: - repo = models.T4CRepository.model_validate( + repo = models2.SimpleT4CRepositoryWithIntegrations.model_validate( crud.create_t4c_repository( db=db, repo_name=repo_name, instance=instance ) diff --git a/backend/capellacollab/settings/modelsources/t4c/license_server/models.py b/backend/capellacollab/settings/modelsources/t4c/license_server/models.py index e51ff51a7a..96b6ac73a1 100644 --- a/backend/capellacollab/settings/modelsources/t4c/license_server/models.py +++ b/backend/capellacollab/settings/modelsources/t4c/license_server/models.py @@ -12,6 +12,9 @@ from capellacollab.core import exceptions as core_exceptions from capellacollab.core import models as core_models from capellacollab.core import pydantic as core_pydantic +from capellacollab.settings.modelsources.t4c.instance import ( + models2 as t4c_instance_models2, +) from . import interface @@ -56,18 +59,12 @@ class SimpleLicenseServer(T4CLicenseServerBase): id: int -class SimpleT4CInstace(core_pydantic.BaseModel): - # Class has to be in this module to avoid circular imports - id: int - name: str - - class T4CLicenseServer(T4CLicenseServerBase): id: int license_server_version: str | None = None usage: interface.T4CLicenseServerUsage | None = None warnings: list[core_models.Message] = [] - instances: list[SimpleT4CInstace] = [] + instances: list[t4c_instance_models2.SimpleT4CInstance] = [] @pydantic.model_validator(mode="after") def add_from_api(self) -> t.Any: diff --git a/backend/tests/projects/test_projects_routes.py b/backend/tests/projects/test_projects_routes.py index a989b530d0..a37e4fb066 100644 --- a/backend/tests/projects/test_projects_routes.py +++ b/backend/tests/projects/test_projects_routes.py @@ -14,8 +14,10 @@ import capellacollab.projects.users.models as projects_users_models import capellacollab.users.crud as users_crud import capellacollab.users.models as users_models -from capellacollab.__main__ import app -from capellacollab.projects import injectables as projects_injectables +from capellacollab.projects.toolmodels import models as toolmodels_models +from capellacollab.projects.toolmodels.backups import ( + models as pipelines_models, +) def test_get_internal_default_project_as_user( @@ -30,15 +32,9 @@ def test_get_internal_default_project_as_user( response = client.get("/api/v1/projects/default") assert response.status_code == 200 - assert { - "name": "default", - "slug": "default", - "description": "", - "visibility": "internal", - "type": "general", - "users": {"leads": 0, "contributors": 0, "subscribers": 0}, - "is_archived": False, - } == response.json() + assert response.json()["name"] == "default" + assert response.json()["visibility"] == "internal" + assert response.json()["slug"] == "default" def test_get_projects_as_user_only_shows_default_internal_project( @@ -222,7 +218,7 @@ def test_update_project_as_admin( assert project.slug == "new-project" assert project.visibility == projects_models.Visibility.PRIVATE - assert project.is_archived == False + assert project.is_archived is False response = client.patch( "/api/v1/projects/new-project", @@ -244,47 +240,20 @@ def test_update_project_as_admin( assert data["is_archived"] -@pytest.fixture(name="mock_project") -def fixture_mock_project(): - project = mock.Mock(name="DatabaseProject") - project.name = "Mock Project" - project.slug = "mock-project" - project.description = "Mock Description" - project.visibility = "private" - project.type = "general" - project.users.leads = 0 - project.users.contributors = 0 - project.users.subscribers = 0 - - return project - - -@pytest.fixture(name="override_dependency") -def fixture_override_dependency(mock_project): - def override_get_existing_project(): - return mock_project - - app.dependency_overrides[projects_injectables.get_existing_project] = ( - override_get_existing_project - ) - yield - del app.dependency_overrides[projects_injectables.get_existing_project] - - -@pytest.mark.usefixtures("override_dependency") +@pytest.mark.parametrize( + ("run_nightly, include_commit_history"), [(True, True)] +) def test_delete_pipeline_called_when_archiving_project( client: testclient.TestClient, db: orm.Session, executor_name: str, - mock_project, + project: projects_models.DatabaseProject, + capella_model: toolmodels_models.DatabaseToolModel, + pipeline: pipelines_models.DatabaseBackup, ): - mock_model = mock.Mock(name="DatabaseModel") - mock_pipeline = mock.Mock(name="DatabaseBackup") - users_crud.create_user( db, executor_name, executor_name, None, users_models.Role.ADMIN ) - mock_project.models = [mock_model] with ( mock.patch( @@ -296,18 +265,18 @@ def test_delete_pipeline_called_when_archiving_project( autospec=True, ) as mock_get_pipelines_for_tool_model, ): - mock_get_pipelines_for_tool_model.return_value = [mock_pipeline] + mock_get_pipelines_for_tool_model.return_value = [pipeline] response = client.patch( - "/api/v1/projects/any", json={"is_archived": "true"} + f"/api/v1/projects/{project.slug}", json={"is_archived": "true"} ) assert response.status_code == 200 mock_get_pipelines_for_tool_model.assert_called_once_with( - db, mock_model + db, capella_model ) mock_delete_pipeline.assert_called_once_with( - db, mock_pipeline, mock.ANY, True + db, pipeline, mock.ANY, True ) diff --git a/backend/tests/projects/toolmodels/pipelines/conftest.py b/backend/tests/projects/toolmodels/pipelines/fixtures.py similarity index 93% rename from backend/tests/projects/toolmodels/pipelines/conftest.py rename to backend/tests/projects/toolmodels/pipelines/fixtures.py index cfe7649c52..ecff4f050d 100644 --- a/backend/tests/projects/toolmodels/pipelines/conftest.py +++ b/backend/tests/projects/toolmodels/pipelines/fixtures.py @@ -34,9 +34,9 @@ def fixture_include_commit_history( @pytest.fixture(name="pipeline") def fixture_pipeline( db: orm.Session, - capella_model: toolmodels_models.ToolModel, + capella_model: toolmodels_models.DatabaseToolModel, git_model: git_models.DatabaseGitModel, - t4c_model: t4c_models.T4CModel, + t4c_model: t4c_models.DatabaseT4CModel, executor_name: str, run_nightly: bool, include_commit_history: bool, diff --git a/backend/tests/projects/toolmodels/pipelines/test_pipelines.py b/backend/tests/projects/toolmodels/pipelines/test_pipelines.py index 0c2d24a852..a77030d9de 100644 --- a/backend/tests/projects/toolmodels/pipelines/test_pipelines.py +++ b/backend/tests/projects/toolmodels/pipelines/test_pipelines.py @@ -55,8 +55,6 @@ def test_get_all_pipelines_of_capellamodel( project: project_models.DatabaseProject, capella_model: toolmodels_models.ToolModel, client: testclient.TestClient, - run_nightly: bool, - include_commit_history: bool, ): response = client.get( f"/api/v1/projects/{project.slug}/models/{capella_model.slug}/backups/pipelines" @@ -73,7 +71,7 @@ def test_get_all_pipelines_of_capellamodel( def test_create_pipeline_of_capellamodel_git_model_does_not_exist( project: project_models.DatabaseProject, capella_model: toolmodels_models.ToolModel, - t4c_model: models_t4c_models.T4CModel, + t4c_model: models_t4c_models.SimpleT4CModelWithRepository, client: testclient.TestClient, ): response = client.post( @@ -99,7 +97,7 @@ def test_create_pipeline( db: orm.Session, project: project_models.DatabaseProject, capella_model: toolmodels_models.ToolModel, - t4c_model: models_t4c_models.T4CModel, + t4c_model: models_t4c_models.SimpleT4CModelWithRepository, git_model: git_models.GitModel, client: testclient.TestClient, run_nightly: bool, @@ -129,7 +127,7 @@ def test_create_pipeline( def test_pipeline_creation_fails_if_t4c_server_not_available( project: project_models.DatabaseProject, capella_model: toolmodels_models.ToolModel, - t4c_model: models_t4c_models.T4CModel, + t4c_model: models_t4c_models.SimpleT4CModelWithRepository, git_model: git_models.GitModel, client: testclient.TestClient, monkeypatch: pytest.MonkeyPatch, diff --git a/frontend/src/app/openapi/.openapi-generator/FILES b/frontend/src/app/openapi/.openapi-generator/FILES index 639a9e004a..3001204963 100644 --- a/frontend/src/app/openapi/.openapi-generator/FILES +++ b/frontend/src/app/openapi/.openapi-generator/FILES @@ -106,7 +106,7 @@ model/patch-t4-c-model.ts model/patch-tool-model.ts model/patch-user.ts model/path-validation.ts -model/payload-response-model-list-t4-c-repository.ts +model/payload-response-model-list-simple-t4-c-repository-with-integrations.ts model/payload-response-model-session-connection-information.ts model/persistent-session-tool-configuration-input.ts model/persistent-session-tool-configuration-output.ts @@ -152,8 +152,13 @@ model/session-type.ts model/session.ts model/share-session-request.ts model/simple-license-server.ts -model/simple-t4-c-instace.ts -model/simple-t4-c-model.ts +model/simple-project.ts +model/simple-t4-c-instance.ts +model/simple-t4-c-model-with-repository.ts +model/simple-t4-c-model-with-tool-model.ts +model/simple-t4-c-repository-with-integrations.ts +model/simple-t4-c-repository.ts +model/simple-tool-model.ts model/simple-tool-version.ts model/status-response.ts model/submit-t4-c-model.ts @@ -161,7 +166,6 @@ model/t4-c-instance.ts model/t4-c-license-server-base.ts model/t4-c-license-server-usage.ts model/t4-c-license-server.ts -model/t4-c-model.ts model/t4-c-repository-status.ts model/t4-c-repository.ts model/token-request.ts diff --git a/frontend/src/app/openapi/api/projects-models-t4-c.service.ts b/frontend/src/app/openapi/api/projects-models-t4-c.service.ts index 0704a8a250..ec2f48cfd0 100644 --- a/frontend/src/app/openapi/api/projects-models-t4-c.service.ts +++ b/frontend/src/app/openapi/api/projects-models-t4-c.service.ts @@ -23,9 +23,9 @@ import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PatchT4CModel } from '../model/patch-t4-c-model'; // @ts-ignore -import { SubmitT4CModel } from '../model/submit-t4-c-model'; +import { SimpleT4CModelWithRepository } from '../model/simple-t4-c-model-with-repository'; // @ts-ignore -import { T4CModel } from '../model/t4-c-model'; +import { SubmitT4CModel } from '../model/submit-t4-c-model'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -106,9 +106,9 @@ export class ProjectsModelsT4CService { * @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. */ - public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; public createT4cModel(projectSlug: string, modelSlug: string, submitT4CModel: SubmitT4CModel, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (projectSlug === null || projectSlug === undefined) { throw new Error('Required parameter projectSlug was null or undefined when calling createT4cModel.'); @@ -173,7 +173,7 @@ export class ProjectsModelsT4CService { } let localVarPath = `/api/v1/projects/${this.configuration.encodeParam({name: "projectSlug", value: projectSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/models/${this.configuration.encodeParam({name: "modelSlug", value: modelSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/modelsources/t4c`; - return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, { context: localVarHttpContext, body: submitT4CModel, @@ -274,9 +274,9 @@ export class ProjectsModelsT4CService { * @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. */ - public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; public getT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (projectSlug === null || projectSlug === undefined) { throw new Error('Required parameter projectSlug was null or undefined when calling getT4cModel.'); @@ -332,7 +332,7 @@ export class ProjectsModelsT4CService { } let localVarPath = `/api/v1/projects/${this.configuration.encodeParam({name: "projectSlug", value: projectSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/models/${this.configuration.encodeParam({name: "modelSlug", value: modelSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/modelsources/t4c/${this.configuration.encodeParam({name: "t4cModelId", value: t4cModelId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, @@ -352,9 +352,9 @@ export class ProjectsModelsT4CService { * @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. */ - public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; - public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listT4cModels(projectSlug: string, modelSlug: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; public listT4cModels(projectSlug: string, modelSlug: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (projectSlug === null || projectSlug === undefined) { throw new Error('Required parameter projectSlug was null or undefined when calling listT4cModels.'); @@ -407,7 +407,7 @@ export class ProjectsModelsT4CService { } let localVarPath = `/api/v1/projects/${this.configuration.encodeParam({name: "projectSlug", value: projectSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/models/${this.configuration.encodeParam({name: "modelSlug", value: modelSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/modelsources/t4c`; - return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, + return this.httpClient.request>('get', `${this.configuration.basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, @@ -429,9 +429,9 @@ export class ProjectsModelsT4CService { * @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. */ - public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; public updateT4cModel(projectSlug: string, t4cModelId: number, modelSlug: string, patchT4CModel: PatchT4CModel, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (projectSlug === null || projectSlug === undefined) { throw new Error('Required parameter projectSlug was null or undefined when calling updateT4cModel.'); @@ -499,7 +499,7 @@ export class ProjectsModelsT4CService { } let localVarPath = `/api/v1/projects/${this.configuration.encodeParam({name: "projectSlug", value: projectSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/models/${this.configuration.encodeParam({name: "modelSlug", value: modelSlug, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/modelsources/t4c/${this.configuration.encodeParam({name: "t4cModelId", value: t4cModelId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; - return this.httpClient.request('patch', `${this.configuration.basePath}${localVarPath}`, + return this.httpClient.request('patch', `${this.configuration.basePath}${localVarPath}`, { context: localVarHttpContext, body: patchT4CModel, diff --git a/frontend/src/app/openapi/api/settings-modelsources-t4-c-instances.service.ts b/frontend/src/app/openapi/api/settings-modelsources-t4-c-instances.service.ts index 870fe106ad..906293aeb1 100644 --- a/frontend/src/app/openapi/api/settings-modelsources-t4-c-instances.service.ts +++ b/frontend/src/app/openapi/api/settings-modelsources-t4-c-instances.service.ts @@ -27,7 +27,7 @@ import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PatchT4CInstance } from '../model/patch-t4-c-instance'; // @ts-ignore -import { PayloadResponseModelListT4CRepository } from '../model/payload-response-model-list-t4-c-repository'; +import { PayloadResponseModelListSimpleT4CRepositoryWithIntegrations } from '../model/payload-response-model-list-simple-t4-c-repository-with-integrations'; // @ts-ignore import { ResponseModel } from '../model/response-model'; // @ts-ignore @@ -647,9 +647,9 @@ export class SettingsModelsourcesT4CInstancesService { * @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. */ - public listT4cRepositories(t4cInstanceId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public listT4cRepositories(t4cInstanceId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listT4cRepositories(t4cInstanceId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listT4cRepositories(t4cInstanceId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listT4cRepositories(t4cInstanceId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listT4cRepositories(t4cInstanceId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; public listT4cRepositories(t4cInstanceId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (t4cInstanceId === null || t4cInstanceId === undefined) { throw new Error('Required parameter t4cInstanceId was null or undefined when calling listT4cRepositories.'); @@ -699,7 +699,7 @@ export class SettingsModelsourcesT4CInstancesService { } let localVarPath = `/api/v1/settings/modelsources/t4c/instances/${this.configuration.encodeParam({name: "t4cInstanceId", value: t4cInstanceId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}/repositories`; - return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, { context: localVarHttpContext, responseType: responseType_, diff --git a/frontend/src/app/openapi/model/backup.ts b/frontend/src/app/openapi/model/backup.ts index fc690c3f38..50baba4a1d 100644 --- a/frontend/src/app/openapi/model/backup.ts +++ b/frontend/src/app/openapi/model/backup.ts @@ -10,13 +10,13 @@ */ import { GitModel } from './git-model'; -import { SimpleT4CModel } from './simple-t4-c-model'; +import { SimpleT4CModelWithRepository } from './simple-t4-c-model-with-repository'; export interface Backup { id: number; k8s_cronjob_id: string | null; - t4c_model: SimpleT4CModel; + t4c_model: SimpleT4CModelWithRepository; git_model: GitModel; run_nightly: boolean; include_commit_history: boolean; diff --git a/frontend/src/app/openapi/model/models.ts b/frontend/src/app/openapi/model/models.ts index fd0510589f..645353a7e9 100644 --- a/frontend/src/app/openapi/model/models.ts +++ b/frontend/src/app/openapi/model/models.ts @@ -84,7 +84,7 @@ export * from './patch-t4-c-model'; export * from './patch-tool-model'; export * from './patch-user'; export * from './path-validation'; -export * from './payload-response-model-list-t4-c-repository'; +export * from './payload-response-model-list-simple-t4-c-repository-with-integrations'; export * from './payload-response-model-session-connection-information'; export * from './persistent-session-tool-configuration-input'; export * from './persistent-session-tool-configuration-output'; @@ -130,8 +130,13 @@ export * from './session-tool-configuration-output'; export * from './session-type'; export * from './share-session-request'; export * from './simple-license-server'; -export * from './simple-t4-c-instace'; -export * from './simple-t4-c-model'; +export * from './simple-project'; +export * from './simple-t4-c-instance'; +export * from './simple-t4-c-model-with-repository'; +export * from './simple-t4-c-model-with-tool-model'; +export * from './simple-t4-c-repository'; +export * from './simple-t4-c-repository-with-integrations'; +export * from './simple-tool-model'; export * from './simple-tool-version'; export * from './status-response'; export * from './submit-t4-c-model'; @@ -139,7 +144,6 @@ export * from './t4-c-instance'; export * from './t4-c-license-server'; export * from './t4-c-license-server-base'; export * from './t4-c-license-server-usage'; -export * from './t4-c-model'; export * from './t4-c-repository'; export * from './t4-c-repository-status'; export * from './token-request'; diff --git a/frontend/src/app/openapi/model/payload-response-model-list-t4-c-repository.ts b/frontend/src/app/openapi/model/payload-response-model-list-simple-t4-c-repository-with-integrations.ts similarity index 67% rename from frontend/src/app/openapi/model/payload-response-model-list-t4-c-repository.ts rename to frontend/src/app/openapi/model/payload-response-model-list-simple-t4-c-repository-with-integrations.ts index c8f6af7c9d..7ac0b05783 100644 --- a/frontend/src/app/openapi/model/payload-response-model-list-t4-c-repository.ts +++ b/frontend/src/app/openapi/model/payload-response-model-list-simple-t4-c-repository-with-integrations.ts @@ -10,12 +10,12 @@ */ import { Message } from './message'; -import { T4CRepository } from './t4-c-repository'; +import { SimpleT4CRepositoryWithIntegrations } from './simple-t4-c-repository-with-integrations'; -export interface PayloadResponseModelListT4CRepository { +export interface PayloadResponseModelListSimpleT4CRepositoryWithIntegrations { warnings: Array | null; errors: Array | null; - payload: Array; + payload: Array; } diff --git a/frontend/src/app/openapi/model/project.ts b/frontend/src/app/openapi/model/project.ts index e21f7cca8e..dc3fc862f3 100644 --- a/frontend/src/app/openapi/model/project.ts +++ b/frontend/src/app/openapi/model/project.ts @@ -15,6 +15,7 @@ import { Visibility } from './visibility'; export interface Project { + id: number; name: string; slug: string; description: string | null; diff --git a/frontend/src/app/openapi/model/simple-project.ts b/frontend/src/app/openapi/model/simple-project.ts new file mode 100644 index 0000000000..fa356e51f8 --- /dev/null +++ b/frontend/src/app/openapi/model/simple-project.ts @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Capella Collaboration + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + + To generate a new version, run `make openapi` in the root directory of this repository. + */ + +import { ProjectType } from './project-type'; +import { Visibility } from './visibility'; + + +export interface SimpleProject { + id: number; + name: string; + slug: string; + visibility: Visibility; + type: ProjectType; +} +export namespace SimpleProject { +} + + diff --git a/frontend/src/app/openapi/model/simple-t4-c-instance.ts b/frontend/src/app/openapi/model/simple-t4-c-instance.ts new file mode 100644 index 0000000000..5ff5832d10 --- /dev/null +++ b/frontend/src/app/openapi/model/simple-t4-c-instance.ts @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Capella Collaboration + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + + To generate a new version, run `make openapi` in the root directory of this repository. + */ + +import { SimpleToolVersion } from './simple-tool-version'; + + +export interface SimpleT4CInstance { + id: number; + name: string; + version: SimpleToolVersion; + is_archived: boolean; +} + diff --git a/frontend/src/app/openapi/model/simple-t4-c-model-with-repository.ts b/frontend/src/app/openapi/model/simple-t4-c-model-with-repository.ts new file mode 100644 index 0000000000..a86e61a72f --- /dev/null +++ b/frontend/src/app/openapi/model/simple-t4-c-model-with-repository.ts @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Capella Collaboration + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + + To generate a new version, run `make openapi` in the root directory of this repository. + */ + +import { SimpleT4CRepository } from './simple-t4-c-repository'; + + +export interface SimpleT4CModelWithRepository { + id: number; + name: string; + repository: SimpleT4CRepository; +} + diff --git a/frontend/src/app/openapi/model/t4-c-model.ts b/frontend/src/app/openapi/model/simple-t4-c-model-with-tool-model.ts similarity index 75% rename from frontend/src/app/openapi/model/t4-c-model.ts rename to frontend/src/app/openapi/model/simple-t4-c-model-with-tool-model.ts index 63e9da201a..e928c46645 100644 --- a/frontend/src/app/openapi/model/t4-c-model.ts +++ b/frontend/src/app/openapi/model/simple-t4-c-model-with-tool-model.ts @@ -9,12 +9,12 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ -import { T4CRepository } from './t4-c-repository'; +import { SimpleToolModel } from './simple-tool-model'; -export interface T4CModel { +export interface SimpleT4CModelWithToolModel { id: number; name: string; - repository: T4CRepository; + model: SimpleToolModel; } diff --git a/frontend/src/app/openapi/model/simple-t4-c-repository-with-integrations.ts b/frontend/src/app/openapi/model/simple-t4-c-repository-with-integrations.ts new file mode 100644 index 0000000000..7874fd9a0d --- /dev/null +++ b/frontend/src/app/openapi/model/simple-t4-c-repository-with-integrations.ts @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Capella Collaboration + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit the class manually. + + To generate a new version, run `make openapi` in the root directory of this repository. + */ + +import { T4CRepositoryStatus } from './t4-c-repository-status'; +import { SimpleT4CModelWithToolModel } from './simple-t4-c-model-with-tool-model'; +import { SimpleT4CInstance } from './simple-t4-c-instance'; + + +export interface SimpleT4CRepositoryWithIntegrations { + id: number; + name: string; + status: T4CRepositoryStatus | null; + instance: SimpleT4CInstance; + integrations: Array; +} +export namespace SimpleT4CRepositoryWithIntegrations { +} + + diff --git a/frontend/src/app/openapi/model/simple-t4-c-model.ts b/frontend/src/app/openapi/model/simple-t4-c-repository.ts similarity index 68% rename from frontend/src/app/openapi/model/simple-t4-c-model.ts rename to frontend/src/app/openapi/model/simple-t4-c-repository.ts index da4e36481e..2f04363b19 100644 --- a/frontend/src/app/openapi/model/simple-t4-c-model.ts +++ b/frontend/src/app/openapi/model/simple-t4-c-repository.ts @@ -9,11 +9,12 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ +import { SimpleT4CInstance } from './simple-t4-c-instance'; -export interface SimpleT4CModel { - project_name: string; - repository_name: string; - instance_name: string; +export interface SimpleT4CRepository { + name: string; + id: number; + instance: SimpleT4CInstance; } diff --git a/frontend/src/app/openapi/model/simple-t4-c-instace.ts b/frontend/src/app/openapi/model/simple-tool-model.ts similarity index 75% rename from frontend/src/app/openapi/model/simple-t4-c-instace.ts rename to frontend/src/app/openapi/model/simple-tool-model.ts index 7cea56e878..a84a65bc13 100644 --- a/frontend/src/app/openapi/model/simple-t4-c-instace.ts +++ b/frontend/src/app/openapi/model/simple-tool-model.ts @@ -9,10 +9,13 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ +import { SimpleProject } from './simple-project'; -export interface SimpleT4CInstace { +export interface SimpleToolModel { id: number; + slug: string; name: string; + project: SimpleProject; } diff --git a/frontend/src/app/openapi/model/t4-c-license-server.ts b/frontend/src/app/openapi/model/t4-c-license-server.ts index ff37faa584..96dea3c66b 100644 --- a/frontend/src/app/openapi/model/t4-c-license-server.ts +++ b/frontend/src/app/openapi/model/t4-c-license-server.ts @@ -9,9 +9,9 @@ + To generate a new version, run `make openapi` in the root directory of this repository. */ -import { SimpleT4CInstace } from './simple-t4-c-instace'; import { T4CLicenseServerUsage } from './t4-c-license-server-usage'; import { Message } from './message'; +import { SimpleT4CInstance } from './simple-t4-c-instance'; export interface T4CLicenseServer { @@ -22,6 +22,6 @@ export interface T4CLicenseServer { license_server_version: string | null; usage: T4CLicenseServerUsage | null; warnings: Array; - instances: Array; + instances: Array; } diff --git a/frontend/src/app/openapi/model/tool-model.ts b/frontend/src/app/openapi/model/tool-model.ts index d20807d6ad..5084775cc1 100644 --- a/frontend/src/app/openapi/model/tool-model.ts +++ b/frontend/src/app/openapi/model/tool-model.ts @@ -10,7 +10,7 @@ */ import { GitModel } from './git-model'; -import { T4CModel } from './t4-c-model'; +import { SimpleT4CModelWithRepository } from './simple-t4-c-model-with-repository'; import { ToolVersion } from './tool-version'; import { ToolModelRestrictions } from './tool-model-restrictions'; import { Tool } from './tool'; @@ -27,7 +27,7 @@ export interface ToolModel { version: ToolVersion | null; nature: ToolNature | null; git_models: Array | null; - t4c_models: Array | null; + t4c_models: Array | null; restrictions: ToolModelRestrictions | null; } diff --git a/frontend/src/app/projects/models/backup-settings/pipeline-deletion-dialog/pipeline-deletion-dialog.component.html b/frontend/src/app/projects/models/backup-settings/pipeline-deletion-dialog/pipeline-deletion-dialog.component.html index ea6189d57d..ff2c7233d1 100644 --- a/frontend/src/app/projects/models/backup-settings/pipeline-deletion-dialog/pipeline-deletion-dialog.component.html +++ b/frontend/src/app/projects/models/backup-settings/pipeline-deletion-dialog/pipeline-deletion-dialog.component.html @@ -17,9 +17,9 @@

> TeamForCapella
- Instance {{ data.backup.t4c_model.instance_name }},
Repository {{ data.backup.t4c_model.repository_name }},
Project: {{ data.backup.t4c_model.project_name }}
{{ data.backup.t4c_model.repository.instance.name }},
Repository {{ data.backup.t4c_model.repository.name }},
Project: {{ data.backup.t4c_model.name }} arrow_forward diff --git a/frontend/src/app/projects/models/backup-settings/trigger-pipeline/trigger-pipeline.component.html b/frontend/src/app/projects/models/backup-settings/trigger-pipeline/trigger-pipeline.component.html index 8025afb695..d77b142721 100644 --- a/frontend/src/app/projects/models/backup-settings/trigger-pipeline/trigger-pipeline.component.html +++ b/frontend/src/app/projects/models/backup-settings/trigger-pipeline/trigger-pipeline.component.html @@ -37,11 +37,10 @@
TeamForCapella
- Instance {{ pipeline.t4c_model.instance_name }}{{ pipeline.t4c_model.repository.instance.name }},
Repository - {{ pipeline.t4c_model.repository_name }},
Project: - {{ pipeline.t4c_model.project_name }}
{{ pipeline.t4c_model.repository.name }},
Project: {{ pipeline.t4c_model.name }} arrow_forwardGit sources

userService.user?.role === 'administrator' " > -

Team4Capella sources

+

Team for Capella sources

diff --git a/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.component.ts b/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.component.ts index aa873ee842..8af041add7 100644 --- a/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.component.ts +++ b/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.component.ts @@ -32,7 +32,7 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { combineLatest, filter } from 'rxjs'; import { ConfirmationDialogComponent } from 'src/app/helpers/confirmation-dialog/confirmation-dialog.component'; import { ToastService } from 'src/app/helpers/toast/toast.service'; -import { SubmitT4CModel, T4CModel } from 'src/app/openapi'; +import { SimpleT4CModelWithRepository, SubmitT4CModel } from 'src/app/openapi'; import { T4CModelService } from 'src/app/projects/models/model-source/t4c/service/t4c-model.service'; import { ModelWrapperService } from 'src/app/projects/models/service/model.service'; import { ProjectWrapperService } from 'src/app/projects/service/project.service'; @@ -76,7 +76,7 @@ export class ManageT4CModelComponent implements OnInit, OnDestroy { selectedRepository?: ExtendedT4CRepository; - t4cModel?: T4CModel; + t4cModel?: SimpleT4CModelWithRepository; constructor( public projectService: ProjectWrapperService, diff --git a/frontend/src/app/projects/models/model-source/t4c/service/t4c-model.service.ts b/frontend/src/app/projects/models/model-source/t4c/service/t4c-model.service.ts index 2a7c6ca5c7..74a2ec86a3 100644 --- a/frontend/src/app/projects/models/model-source/t4c/service/t4c-model.service.ts +++ b/frontend/src/app/projects/models/model-source/t4c/service/t4c-model.service.ts @@ -18,8 +18,8 @@ import { } from 'rxjs'; import { ProjectsModelsT4CService, + SimpleT4CModelWithRepository, SubmitT4CModel, - T4CModel, } from 'src/app/openapi'; import { ModelWrapperService } from 'src/app/projects/models/service/model.service'; import { T4CInstanceWrapperService } from 'src/app/services/settings/t4c-instance.service'; @@ -34,10 +34,14 @@ export class T4CModelService { private t4cModelService: ProjectsModelsT4CService, ) {} - private _t4cModel = new BehaviorSubject(undefined); + private _t4cModel = new BehaviorSubject< + SimpleT4CModelWithRepository | undefined + >(undefined); public readonly t4cModel$ = this._t4cModel.asObservable(); - private _t4cModels = new BehaviorSubject(undefined); + private _t4cModels = new BehaviorSubject< + SimpleT4CModelWithRepository[] | undefined + >(undefined); public readonly t4cModels$ = this._t4cModels.asObservable(); compatibleT4CInstances$ = combineLatest([ @@ -72,7 +76,7 @@ export class T4CModelService { projectSlug: string, modelSlug: string, body: SubmitT4CModel, - ): Observable { + ): Observable { return this.t4cModelService .createT4cModel(projectSlug, modelSlug, body) .pipe( @@ -88,7 +92,7 @@ export class T4CModelService { modelSlug: string, t4cModelID: number, body: SubmitT4CModel, - ): Observable { + ): Observable { return this.t4cModelService .updateT4cModel(projectSlug, t4cModelID, modelSlug, body) .pipe( diff --git a/frontend/src/app/settings/modelsources/t4c-settings/edit-t4c-instance/edit-t4c-instance.component.html b/frontend/src/app/settings/modelsources/t4c-settings/edit-t4c-instance/edit-t4c-instance.component.html index 015c72ee25..5d51cdd215 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/edit-t4c-instance/edit-t4c-instance.component.html +++ b/frontend/src/app/settings/modelsources/t4c-settings/edit-t4c-instance/edit-t4c-instance.component.html @@ -8,9 +8,9 @@

@if (existing) { - Team4Capella Server + Team for Capella Server } @else { - Link a Team4Capella Server + Link a Team for Capella Server }

diff --git a/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts b/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts index f1e29a8f82..1bdeeaf342 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts +++ b/frontend/src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service.ts @@ -13,7 +13,7 @@ import { CreateT4CRepository, ResponseModel, SettingsModelsourcesT4CInstancesService, - T4CInstance, + SimpleT4CRepositoryWithIntegrations, T4CRepository, T4CRepositoryStatus, } from 'src/app/openapi'; @@ -125,9 +125,9 @@ export class T4CRepositoryWrapperService { export type ExtendedT4CRepositoryStatus = T4CRepositoryStatus | 'LOADING'; -export interface ExtendedT4CRepository { - name: string; - id: number; - instance: T4CInstance; +export type ExtendedT4CRepository = Omit< + SimpleT4CRepositoryWithIntegrations, + 'status' +> & { status: ExtendedT4CRepositoryStatus | null; -} +}; diff --git a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.html b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.html index 953df59658..2c42b44da5 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.html +++ b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.html @@ -3,7 +3,7 @@ ~ SPDX-License-Identifier: Apache-2.0 --> -
+

Repositories

+ } @else if (repository.status === "ONLINE") { + + } @else if (repository.status === "NOT_FOUND") { + + } +
-
-
} @@ -101,15 +134,15 @@

Repositories

Repository name - Please enter a name - Repository already exists - The following characters are allowed: A-Z, a-z, 0-9, _, - - + @if (form.controls.name.errors?.required) { + Please enter a name + } @else if (form.controls.name.errors?.uniqueName) { + Repository already exists + } @else if (form.controls.name.errors?.pattern) { + The following characters are allowed: A-Z, a-z, 0-9, _, - + + }