-
+}
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 fbcbb754f..d13aba6c7 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
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { NgIf, NgFor, AsyncPipe } from '@angular/common';
+import { AsyncPipe } from '@angular/common';
import {
Component,
EventEmitter,
@@ -41,12 +41,12 @@ import {
T4CModel,
T4CModelService,
} from 'src/app/projects/models/model-source/t4c/service/t4c-model.service';
-import { ModelService } from 'src/app/projects/models/service/model.service';
-import { ProjectService } from 'src/app/projects/service/project.service';
-import { T4CInstanceService } from 'src/app/services/settings/t4c-instance.service';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
+import { T4CInstanceWrapperService } from 'src/app/services/settings/t4c-instance.service';
import {
- T4CRepoService,
- T4CRepository,
+ ExtendedT4CRepository,
+ T4CRepositoryWrapperService,
} from 'src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service';
import { ButtonSkeletonLoaderComponent } from '../../../../../helpers/skeleton-loaders/button-skeleton-loader/button-skeleton-loader.component';
import { FormFieldSkeletonLoaderComponent } from '../../../../../helpers/skeleton-loaders/form-field-skeleton-loader/form-field-skeleton-loader.component';
@@ -58,14 +58,12 @@ import { FormFieldSkeletonLoaderComponent } from '../../../../../helpers/skeleto
styleUrls: ['./manage-t4c-model.component.css'],
standalone: true,
imports: [
- NgIf,
FormsModule,
ReactiveFormsModule,
FormFieldSkeletonLoaderComponent,
MatFormField,
MatLabel,
MatSelect,
- NgFor,
MatOption,
MatTooltip,
MatError,
@@ -87,17 +85,17 @@ export class ManageT4CModelComponent implements OnInit, OnDestroy {
loading = false;
- t4cRepositories?: T4CRepository[];
+ t4cRepositories?: ExtendedT4CRepository[];
- selectedRepository?: T4CRepository;
+ selectedRepository?: ExtendedT4CRepository;
t4cModel?: T4CModel;
constructor(
- public projectService: ProjectService,
- public modelService: ModelService,
- public t4cInstanceService: T4CInstanceService,
- public t4cRepositoryService: T4CRepoService,
+ public projectService: ProjectWrapperService,
+ public modelService: ModelWrapperService,
+ public t4cInstanceService: T4CInstanceWrapperService,
+ public t4cRepositoryService: T4CRepositoryWrapperService,
public t4cModelService: T4CModelService,
private router: Router,
private route: ActivatedRoute,
diff --git a/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.stories.ts b/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.stories.ts
new file mode 100644
index 000000000..8e387589d
--- /dev/null
+++ b/frontend/src/app/projects/models/model-source/t4c/manage-t4c-model/manage-t4c-model.stories.ts
@@ -0,0 +1,68 @@
+/*
+ * SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
+import { T4CInstanceWrapperService } from 'src/app/services/settings/t4c-instance.service';
+import { T4CRepositoryWrapperService } from 'src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service';
+import { mockModel, MockModelWrapperService } from 'src/storybook/model';
+import { mockProject, MockProjectWrapperService } from 'src/storybook/project';
+import {
+ mockExtendedT4CRepository,
+ mockT4CInstance,
+ MockT4CInstanceWrapperService,
+ MockT4CRepositoryWrapperService,
+} from 'src/storybook/t4c';
+import { ManageT4CModelComponent } from './manage-t4c-model.component';
+
+const meta: Meta
= {
+ title: 'Model Components / Model Sources / T4C',
+ component: ManageT4CModelComponent,
+ decorators: [
+ moduleMetadata({
+ providers: [
+ {
+ provide: ProjectWrapperService,
+ useFactory: () =>
+ new MockProjectWrapperService(mockProject, [mockProject]),
+ },
+ {
+ provide: ModelWrapperService,
+ useFactory: () => new MockModelWrapperService(mockModel, [mockModel]),
+ },
+ ],
+ }),
+ ],
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const Loading: Story = {
+ args: {},
+};
+
+export const General: Story = {
+ args: {},
+ decorators: [
+ moduleMetadata({
+ providers: [
+ {
+ provide: T4CInstanceWrapperService,
+ useFactory: () =>
+ new MockT4CInstanceWrapperService(mockT4CInstance, [
+ mockT4CInstance,
+ ]),
+ },
+ {
+ provide: T4CRepositoryWrapperService,
+ useFactory: () =>
+ new MockT4CRepositoryWrapperService([mockExtendedT4CRepository]),
+ },
+ ],
+ }),
+ ],
+};
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 704fc969f..44f7992f0 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
@@ -11,7 +11,7 @@ import {
ValidationErrors,
} from '@angular/forms';
import { BehaviorSubject, Observable, map, take, tap } from 'rxjs';
-import { T4CRepository } from 'src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service';
+import { T4CRepository } from 'src/app/openapi';
import { environment } from 'src/environments/environment';
@Injectable({
diff --git a/frontend/src/app/projects/models/model-wrapper/model-wrapper.component.ts b/frontend/src/app/projects/models/model-wrapper/model-wrapper.component.ts
index 65e1112e4..57f9dfc38 100644
--- a/frontend/src/app/projects/models/model-wrapper/model-wrapper.component.ts
+++ b/frontend/src/app/projects/models/model-wrapper/model-wrapper.component.ts
@@ -10,8 +10,8 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { combineLatest, filter, map } from 'rxjs';
import { BreadcrumbsService } from 'src/app/general/breadcrumbs/breadcrumbs.service';
import { T4CModelService } from 'src/app/projects/models/model-source/t4c/service/t4c-model.service';
-import { ModelService } from 'src/app/projects/models/service/model.service';
-import { ProjectService } from '../../service/project.service';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from '../../service/project.service';
@UntilDestroy()
@Component({
@@ -24,8 +24,8 @@ import { ProjectService } from '../../service/project.service';
export class ModelWrapperComponent implements OnInit, OnDestroy {
constructor(
private route: ActivatedRoute,
- public modelService: ModelService,
- private projectService: ProjectService,
+ public modelService: ModelWrapperService,
+ private projectService: ProjectWrapperService,
private t4cModelService: T4CModelService,
private breadcrumbService: BreadcrumbsService,
) {}
diff --git a/frontend/src/app/projects/models/service/model.service.ts b/frontend/src/app/projects/models/service/model.service.ts
index 87d58706d..797977b9a 100644
--- a/frontend/src/app/projects/models/service/model.service.ts
+++ b/frontend/src/app/projects/models/service/model.service.ts
@@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {
AbstractControl,
@@ -12,58 +11,53 @@ import {
} from '@angular/forms';
import { BehaviorSubject, forkJoin, map, Observable, take, tap } from 'rxjs';
import slugify from 'slugify';
-import { Tool, ToolNature, ToolVersion } from 'src/app/openapi';
-import { ModelRestrictions } from 'src/app/projects/models/model-restrictions/service/model-restrictions.service';
-import { T4CModel } from 'src/app/projects/models/model-source/t4c/service/t4c-model.service';
+import {
+ PatchToolModel,
+ PostToolModel,
+ ProjectsModelsService,
+ ToolModel,
+} from 'src/app/openapi';
import { GetGitModel } from 'src/app/projects/project-detail/model-overview/model-detail/git-model.service';
-import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root',
})
-export class ModelService {
- base_url = environment.backend_url + '/projects';
-
- constructor(private http: HttpClient) {}
+export class ModelWrapperService {
+ constructor(private modelsService: ProjectsModelsService) {}
- private _model = new BehaviorSubject(undefined);
- private _models = new BehaviorSubject(undefined);
+ private _model = new BehaviorSubject(undefined);
+ private _models = new BehaviorSubject(undefined);
public readonly model$ = this._model.asObservable();
public readonly models$ = this._models.asObservable();
- backendURLFactory(projectSlug: string, modelSlug: string) {
- return `${this.base_url}/${projectSlug}/models/${modelSlug}`;
- }
-
loadModels(projectSlug: string): void {
- this.http.get(`${this.base_url}/${projectSlug}/models`).subscribe({
+ this.modelsService.getModels(projectSlug).subscribe({
next: (models) => this._models.next(models),
error: () => this._models.next(undefined),
});
}
loadModelbySlug(modelSlug: string, projectSlug: string): void {
- this.http
- .get(`${this.base_url}/${projectSlug}/models/${modelSlug}`)
- .subscribe({
- next: (model) => this._model.next(model),
- error: () => this._model.next(undefined),
- });
+ this.modelsService.getModelBySlug(projectSlug, modelSlug).subscribe({
+ next: (model) => this._model.next(model),
+ error: () => this._model.next(undefined),
+ });
}
- createModel(projectSlug: string, model: NewModel): Observable {
- return this.http
- .post(`${this.base_url}/${projectSlug}/models`, model)
- .pipe(
- tap({
- next: (model) => {
- this.loadModels(projectSlug);
- this._model.next(model);
- },
- error: () => this._model.next(undefined),
- }),
- );
+ createModel(
+ projectSlug: string,
+ model: PostToolModel,
+ ): Observable {
+ return this.modelsService.createNewToolModel(projectSlug, model).pipe(
+ tap({
+ next: (model) => {
+ this.loadModels(projectSlug);
+ this._model.next(model);
+ },
+ error: () => this._model.next(undefined),
+ }),
+ );
}
setToolDetailsForModel(
@@ -71,9 +65,9 @@ export class ModelService {
modelSlug: string,
version_id: number,
nature_id: number,
- ): Observable {
- return this.http
- .patch(`${this.base_url}/${projectSlug}/models/${modelSlug}`, {
+ ): Observable {
+ return this.modelsService
+ .patchToolModel(projectSlug, modelSlug, {
version_id,
nature_id,
})
@@ -91,19 +85,16 @@ export class ModelService {
private applyModelPatch(
projectSlug: string,
modelSlug: string,
- patchData: PatchModel,
- ): Observable {
- return this.http.patch(
- `${this.base_url}/${projectSlug}/models/${modelSlug}`,
- patchData,
- );
+ patchData: PatchToolModel,
+ ): Observable {
+ return this.modelsService.patchToolModel(projectSlug, modelSlug, patchData);
}
updateModel(
projectSlug: string,
modelSlug: string,
- patchModel: PatchModel,
- ): Observable {
+ patchModel: PatchToolModel,
+ ): Observable {
return this.applyModelPatch(projectSlug, modelSlug, patchModel).pipe(
tap({
next: (model) => {
@@ -116,15 +107,15 @@ export class ModelService {
updateModels(
projectSlug: string,
- modelUpdates: { modelSlug: string; patchModel: PatchModel }[],
- ): Observable {
+ modelUpdates: { modelSlug: string; patchModel: PatchToolModel }[],
+ ): Observable {
const updateObservables = modelUpdates.map(({ modelSlug, patchModel }) =>
this.applyModelPatch(projectSlug, modelSlug, patchModel),
);
return forkJoin(updateObservables).pipe(
tap({
- next: (models: Model[]) => {
+ next: (models: ToolModel[]) => {
this.loadModels(projectSlug);
this._model.next(models[models.length - 1]);
},
@@ -133,14 +124,12 @@ export class ModelService {
}
deleteModel(projectSlug: string, modelSlug: string): Observable {
- return this.http
- .delete(`${this.base_url}/${projectSlug}/models/${modelSlug}`)
- .pipe(
- tap(() => {
- this.loadModels(projectSlug);
- this._model.next(undefined);
- }),
- );
+ return this.modelsService.deleteToolModel(projectSlug, modelSlug).pipe(
+ tap(() => {
+ this.loadModels(projectSlug);
+ this._model.next(undefined);
+ }),
+ );
}
clearModel(): void {
@@ -151,7 +140,7 @@ export class ModelService {
this._models.next(undefined);
}
- asyncSlugValidator(ignoreModel?: Model): AsyncValidatorFn {
+ asyncSlugValidator(ignoreModel?: ToolModel): AsyncValidatorFn {
const ignoreSlug = !!ignoreModel ? ignoreModel.slug : -1;
return (control: AbstractControl): Observable => {
const modelSlug = slugify(control.value, { lower: true });
@@ -167,55 +156,8 @@ export class ModelService {
);
};
}
-
- moveModelToProject(
- projectSlug: string,
- modelSlug: string,
- project_slug: string,
- ): Observable {
- return this.http
- .patch(`${this.backendURLFactory(projectSlug, modelSlug)}/move`, {
- project_slug,
- })
- .pipe(
- tap(() => {
- this.loadModels(projectSlug);
- this._model.next(undefined);
- }),
- );
- }
}
-export type NewModel = {
- name: string;
- description: string;
- tool_id: number;
-};
-
-export type Model = {
- id: number;
- project_slug: string;
- slug: string;
- name: string;
- description: string;
- tool: Tool;
- version?: ToolVersion;
- nature?: ToolNature;
- t4c_models: T4CModel[];
- git_models: GetGitModel[];
- restrictions: ModelRestrictions;
- display_order: number;
-};
-
-export type PatchModel = {
- name?: string;
- description?: string;
- nature_id?: number;
- version_id?: number;
- project_slug?: string;
- display_order?: number;
-};
-
-export function getPrimaryGitModel(model: Model): GetGitModel | undefined {
- return model.git_models.find((gitModel) => gitModel.primary);
+export function getPrimaryGitModel(model: ToolModel): GetGitModel | undefined {
+ return model.git_models?.find((gitModel) => gitModel.primary);
}
diff --git a/frontend/src/app/projects/project-detail/edit-project-metadata/edit-project-metadata.component.ts b/frontend/src/app/projects/project-detail/edit-project-metadata/edit-project-metadata.component.ts
index 8ef0c987d..3fb762eb2 100644
--- a/frontend/src/app/projects/project-detail/edit-project-metadata/edit-project-metadata.component.ts
+++ b/frontend/src/app/projects/project-detail/edit-project-metadata/edit-project-metadata.component.ts
@@ -27,9 +27,9 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { filter } from 'rxjs';
import slugify from 'slugify';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import { Project } from 'src/app/openapi';
+import { PatchProject, Project } from 'src/app/openapi';
import { ProjectUserService } from 'src/app/projects/project-detail/project-users/service/project-user.service';
-import { PatchProject, ProjectService } from '../../service/project.service';
+import { ProjectWrapperService } from '../../service/project.service';
@UntilDestroy()
@Component({
@@ -58,7 +58,7 @@ export class EditProjectMetadataComponent implements OnInit, OnChanges {
project?: Project;
constructor(
- public projectService: ProjectService,
+ public projectService: ProjectWrapperService,
public projectUserService: ProjectUserService,
private toastService: ToastService,
private router: Router,
diff --git a/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/model-complexity-badge.component.ts b/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/model-complexity-badge.component.ts
index 44d229755..062b918c6 100644
--- a/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/model-complexity-badge.component.ts
+++ b/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/model-complexity-badge.component.ts
@@ -11,7 +11,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { filter, map, switchMap } from 'rxjs';
import { ModelComplexityBadgeService } from 'src/app/projects/project-detail/model-overview/model-complexity-badge/service/model-complexity-badge.service';
-import { ProjectService } from 'src/app/projects/service/project.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-model-complexity-badge',
@@ -37,7 +37,7 @@ export class ModelComplexityBadgeComponent implements OnChanges {
constructor(
private modelComplexityBadgeService: ModelComplexityBadgeService,
- private projectService: ProjectService,
+ private projectService: ProjectWrapperService,
) {}
ngOnChanges(_: SimpleChanges) {
diff --git a/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/service/model-complexity-badge.service.ts b/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/service/model-complexity-badge.service.ts
index 857e436f9..6ecfea3c3 100644
--- a/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/service/model-complexity-badge.service.ts
+++ b/frontend/src/app/projects/project-detail/model-overview/model-complexity-badge/service/model-complexity-badge.service.ts
@@ -3,30 +3,28 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { HttpClient, HttpContext } from '@angular/common/http';
+import { HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { SKIP_ERROR_HANDLING } from 'src/app/general/error-handling/error-handling.interceptor';
-import { ModelService } from 'src/app/projects/models/service/model.service';
+import { ProjectsModelsService } from 'src/app/openapi';
@Injectable({
providedIn: 'root',
})
export class ModelComplexityBadgeService {
- constructor(
- private http: HttpClient,
- private modelService: ModelService,
- ) {}
+ constructor(private projectModelService: ProjectsModelsService) {}
getModelComplexityBadge(
projectSlug: string,
modelSlug: string,
): Observable {
- return this.http.get(
- this.modelService.backendURLFactory(projectSlug, modelSlug) +
- '/badges/complexity',
+ return this.projectModelService.getModelComplexityBadge(
+ projectSlug,
+ modelSlug,
+ undefined,
+ undefined,
{
- responseType: 'blob',
context: new HttpContext().set(SKIP_ERROR_HANDLING, true),
},
);
diff --git a/frontend/src/app/projects/project-detail/model-overview/model-overview.component.ts b/frontend/src/app/projects/project-detail/model-overview/model-overview.component.ts
index 85b6b926a..70be5c67c 100644
--- a/frontend/src/app/projects/project-detail/model-overview/model-overview.component.ts
+++ b/frontend/src/app/projects/project-detail/model-overview/model-overview.component.ts
@@ -18,12 +18,11 @@ import { RouterLink } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { first, filter } from 'rxjs';
-import { Project } from 'src/app/openapi';
+import { Project, ToolModel } from 'src/app/openapi';
import { ModelDiagramDialogComponent } from 'src/app/projects/models/diagrams/model-diagram-dialog/model-diagram-dialog.component';
import {
getPrimaryGitModel,
- Model,
- ModelService,
+ ModelWrapperService,
} from 'src/app/projects/models/service/model.service';
import { MoveModelComponent } from 'src/app/projects/project-detail/model-overview/move-model/move-model.component';
import { ReorderModelsDialogComponent } from 'src/app/projects/project-detail/model-overview/reorder-models-dialog/reorder-models-dialog.component';
@@ -31,7 +30,7 @@ import { ProjectUserService } from 'src/app/projects/project-detail/project-user
import { UserWrapperService } from 'src/app/services/user/user.service';
import { SessionService } from 'src/app/sessions/service/session.service';
import { TriggerPipelineComponent } from '../../models/backup-settings/trigger-pipeline/trigger-pipeline.component';
-import { ProjectService } from '../../service/project.service';
+import { ProjectWrapperService } from '../../service/project.service';
import { ModelComplexityBadgeComponent } from './model-complexity-badge/model-complexity-badge.component';
@UntilDestroy()
@@ -57,14 +56,14 @@ import { ModelComplexityBadgeComponent } from './model-complexity-badge/model-co
})
export class ModelOverviewComponent implements OnInit {
project?: Project;
- models?: Model[];
+ models?: ToolModel[];
constructor(
- public modelService: ModelService,
+ public modelService: ModelWrapperService,
public sessionService: SessionService,
public projectUserService: ProjectUserService,
public userService: UserWrapperService,
- public projectService: ProjectService,
+ public projectService: ProjectWrapperService,
private dialog: MatDialog,
) {}
@@ -85,16 +84,16 @@ export class ModelOverviewComponent implements OnInit {
});
}
- getPrimaryWorkingMode(model: Model): string {
- if (model.t4c_models.length) {
+ getPrimaryWorkingMode(model: ToolModel): string {
+ if (model.t4c_models?.length) {
return 'T4C';
- } else if (model.git_models.length) {
+ } else if (model.git_models?.length) {
return 'Git';
}
return 'Unset';
}
- openPipelineDialog(model: Model): void {
+ openPipelineDialog(model: ToolModel): void {
this.projectService.project$.pipe(first()).subscribe((project) => {
this.dialog.open(TriggerPipelineComponent, {
data: { projectSlug: project!.slug, modelSlug: model.slug },
@@ -102,7 +101,7 @@ export class ModelOverviewComponent implements OnInit {
});
}
- openDiagramsDialog(model: Model): void {
+ openDiagramsDialog(model: ToolModel): void {
this.dialog.open(ModelDiagramDialogComponent, {
maxWidth: '100vw',
panelClass: [
@@ -117,12 +116,12 @@ export class ModelOverviewComponent implements OnInit {
});
}
- getPrimaryGitModelURL(model: Model): string {
+ getPrimaryGitModelURL(model: ToolModel): string {
const primaryModel = getPrimaryGitModel(model);
return primaryModel ? primaryModel.path : '';
}
- openMoveToProjectDialog(model: Model): void {
+ openMoveToProjectDialog(model: ToolModel): void {
this.dialog.open(MoveModelComponent, {
maxWidth: '100vw',
maxHeight: '200vw',
@@ -130,7 +129,7 @@ export class ModelOverviewComponent implements OnInit {
});
}
- openReorderModelsDialog(models: Model[]): void {
+ openReorderModelsDialog(models: ToolModel[]): void {
if (this.project) {
this.dialog.open(ReorderModelsDialogComponent, {
data: { projectSlug: this.project.slug, models: models },
diff --git a/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts b/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts
index ad9537a91..a57a89a4a 100644
--- a/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts
+++ b/frontend/src/app/projects/project-detail/model-overview/move-model/move-model.component.ts
@@ -22,12 +22,9 @@ import { MatInput } from '@angular/material/input';
import { Observable, map } from 'rxjs';
import { ConfirmationDialogComponent } from 'src/app/helpers/confirmation-dialog/confirmation-dialog.component';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import { Project } from 'src/app/openapi';
-import {
- Model,
- ModelService,
-} from 'src/app/projects/models/service/model.service';
-import { ProjectService } from 'src/app/projects/service/project.service';
+import { Project, ToolModel } from 'src/app/openapi';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
@Component({
selector: 'app-move-model',
@@ -52,13 +49,13 @@ export class MoveModelComponent {
search = '';
filteredProjects$: Observable;
constructor(
- private modelService: ModelService,
+ private modelService: ModelWrapperService,
private dialogRef: MatDialogRef,
private toastService: ToastService,
- public projectService: ProjectService,
+ public projectService: ProjectWrapperService,
private dialog: MatDialog,
@Inject(MAT_DIALOG_DATA)
- public data: { projectSlug: string; model: Model },
+ public data: { projectSlug: string; model: ToolModel },
) {
this.projectService.loadProjects('manager');
this.filteredProjects$ = projectService.projects$.pipe(
diff --git a/frontend/src/app/projects/project-detail/model-overview/reorder-models-dialog/reorder-models-dialog.component.ts b/frontend/src/app/projects/project-detail/model-overview/reorder-models-dialog/reorder-models-dialog.component.ts
index 0078be065..63361a24b 100644
--- a/frontend/src/app/projects/project-detail/model-overview/reorder-models-dialog/reorder-models-dialog.component.ts
+++ b/frontend/src/app/projects/project-detail/model-overview/reorder-models-dialog/reorder-models-dialog.component.ts
@@ -15,10 +15,8 @@ import { MatButton } from '@angular/material/button';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { MatIcon } from '@angular/material/icon';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import {
- Model,
- ModelService,
-} from 'src/app/projects/models/service/model.service';
+import { ToolModel } from 'src/app/openapi';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
@Component({
selector: 'app-reorder-models',
@@ -32,18 +30,18 @@ import {
})
export class ReorderModelsDialogComponent {
constructor(
- public modelService: ModelService,
+ public modelService: ModelWrapperService,
private dialogRef: MatDialogRef,
private toastService: ToastService,
@Inject(MAT_DIALOG_DATA)
- public data: { projectSlug: string; models: Model[] },
+ public data: { projectSlug: string; models: ToolModel[] },
) {
this.models = [...data.models];
}
- models: Model[];
+ models: ToolModel[];
- drop(event: CdkDragDrop): void {
+ drop(event: CdkDragDrop): void {
moveItemInArray(this.models, event.previousIndex, event.currentIndex);
}
diff --git a/frontend/src/app/projects/project-detail/project-details.component.ts b/frontend/src/app/projects/project-detail/project-details.component.ts
index 4da2246f0..b81e3b412 100644
--- a/frontend/src/app/projects/project-detail/project-details.component.ts
+++ b/frontend/src/app/projects/project-detail/project-details.component.ts
@@ -7,7 +7,7 @@ import { NgIf } from '@angular/common';
import { Component } from '@angular/core';
import { ProjectUserService } from 'src/app/projects/project-detail/project-users/service/project-user.service';
import { CreateReadonlySessionComponent } from '../../sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component';
-import { ProjectService } from '../service/project.service';
+import { ProjectWrapperService } from '../service/project.service';
import { ModelOverviewComponent } from './model-overview/model-overview.component';
import { ProjectMetadataComponent } from './project-metadata/project-metadata.component';
import { ProjectUserSettingsComponent } from './project-users/project-user-settings.component';
@@ -27,7 +27,7 @@ import { ProjectUserSettingsComponent } from './project-users/project-user-setti
})
export class ProjectDetailsComponent {
constructor(
- public projectService: ProjectService,
+ public projectService: ProjectWrapperService,
public projectUserService: ProjectUserService,
) {}
}
diff --git a/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts b/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts
index bf0684662..7510bef5c 100644
--- a/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts
+++ b/frontend/src/app/projects/project-detail/project-metadata/project-metadata.component.ts
@@ -14,10 +14,10 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { filter } from 'rxjs';
import { ConfirmationDialogComponent } from 'src/app/helpers/confirmation-dialog/confirmation-dialog.component';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import { Project } from 'src/app/openapi';
-import { ModelService } from 'src/app/projects/models/service/model.service';
+import { PatchProject, Project } from 'src/app/openapi';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
import { ProjectUserService } from 'src/app/projects/project-detail/project-users/service/project-user.service';
-import { PatchProject, ProjectService } from '../../service/project.service';
+import { ProjectWrapperService } from '../../service/project.service';
@UntilDestroy()
@Component({
@@ -37,8 +37,8 @@ export class ProjectMetadataComponent implements OnInit {
canDelete = false;
constructor(
- public projectService: ProjectService,
- public modelService: ModelService,
+ public projectService: ProjectWrapperService,
+ public modelService: ModelWrapperService,
public projectUserService: ProjectUserService,
private toastService: ToastService,
private router: Router,
diff --git a/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts b/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts
index e52aea151..937b2cdfe 100644
--- a/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts
+++ b/frontend/src/app/projects/project-detail/project-users/project-audit-log/service/project-audit-log.service.ts
@@ -7,7 +7,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, map } from 'rxjs';
import { HistoryEvent } from 'src/app/openapi';
-import { ProjectService } from 'src/app/projects/service/project.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
import { Page, PageWrapper } from 'src/app/schemes';
import { environment } from 'src/environments/environment';
@@ -27,7 +27,7 @@ export class ProjectAuditLogService {
constructor(
private http: HttpClient,
- private projectService: ProjectService,
+ private projectService: ProjectWrapperService,
) {
this.resetProjectAuditLogOnPipelineChange();
}
diff --git a/frontend/src/app/projects/project-detail/project-users/project-user-settings.component.ts b/frontend/src/app/projects/project-detail/project-users/project-user-settings.component.ts
index 89ab8a814..6284cae54 100644
--- a/frontend/src/app/projects/project-detail/project-users/project-user-settings.component.ts
+++ b/frontend/src/app/projects/project-detail/project-users/project-user-settings.component.ts
@@ -35,7 +35,7 @@ import {
ProjectUserService,
} from 'src/app/projects/project-detail/project-users/service/project-user.service';
import { UserWrapperService } from 'src/app/services/user/user.service';
-import { ProjectService } from '../../service/project.service';
+import { ProjectWrapperService } from '../../service/project.service';
@UntilDestroy()
@Component({
@@ -69,7 +69,7 @@ export class ProjectUserSettingsComponent implements OnInit {
public projectUserService: ProjectUserService,
public userService: UserWrapperService,
private toastService: ToastService,
- private projectService: ProjectService,
+ private projectService: ProjectWrapperService,
private dialog: MatDialog,
private router: Router,
) {}
diff --git a/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts b/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts
index 54c273bf8..1bbc21635 100644
--- a/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts
+++ b/frontend/src/app/projects/project-detail/project-users/service/project-user.service.ts
@@ -15,7 +15,7 @@ import {
tap,
} from 'rxjs';
import { User } from 'src/app/openapi';
-import { ProjectService } from 'src/app/projects/service/project.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
import { environment } from 'src/environments/environment';
@Injectable({
@@ -24,7 +24,7 @@ import { environment } from 'src/environments/environment';
export class ProjectUserService {
constructor(
private http: HttpClient,
- private projectService: ProjectService,
+ private projectService: ProjectWrapperService,
) {
this.resetProjectUserOnProjectReset();
this.resetProjectUsersOnProjectReset();
diff --git a/frontend/src/app/projects/project-overview/project-overview.component.ts b/frontend/src/app/projects/project-overview/project-overview.component.ts
index aa31c4b4d..ae506022d 100644
--- a/frontend/src/app/projects/project-overview/project-overview.component.ts
+++ b/frontend/src/app/projects/project-overview/project-overview.component.ts
@@ -10,7 +10,7 @@ import { MatIcon } from '@angular/material/icon';
import { RouterLink } from '@angular/router';
import { MatIconComponent } from '../../helpers/mat-icon/mat-icon.component';
import { MatCardOverviewSkeletonLoaderComponent } from '../../helpers/skeleton-loaders/mat-card-overview-skeleton-loader/mat-card-overview-skeleton-loader.component';
-import { ProjectService, UserMetadata } from '../service/project.service';
+import { ProjectWrapperService } from '../service/project.service';
@Component({
selector: 'app-project-overview',
@@ -30,13 +30,9 @@ import { ProjectService, UserMetadata } from '../service/project.service';
],
})
export class ProjectOverviewComponent implements OnInit {
- constructor(public projectService: ProjectService) {}
+ constructor(public projectService: ProjectWrapperService) {}
ngOnInit() {
this.projectService.loadProjects();
}
-
- sumUsers(user: UserMetadata): number {
- return user.contributors + user.leads + user.subscribers;
- }
}
diff --git a/frontend/src/app/projects/project-wrapper/project-wrapper.component.ts b/frontend/src/app/projects/project-wrapper/project-wrapper.component.ts
index c1c3069b8..26b2c7529 100644
--- a/frontend/src/app/projects/project-wrapper/project-wrapper.component.ts
+++ b/frontend/src/app/projects/project-wrapper/project-wrapper.component.ts
@@ -8,8 +8,8 @@ import { ActivatedRoute, RouterOutlet } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { map } from 'rxjs';
import { BreadcrumbsService } from 'src/app/general/breadcrumbs/breadcrumbs.service';
-import { ModelService } from 'src/app/projects/models/service/model.service';
-import { ProjectService } from '../service/project.service';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from '../service/project.service';
@UntilDestroy()
@Component({
@@ -22,8 +22,8 @@ import { ProjectService } from '../service/project.service';
export class ProjectWrapperComponent implements OnInit, OnDestroy {
constructor(
private route: ActivatedRoute,
- public projectService: ProjectService,
- public modelService: ModelService,
+ public projectService: ProjectWrapperService,
+ public modelService: ModelWrapperService,
private breadcrumbsService: BreadcrumbsService,
) {}
diff --git a/frontend/src/app/projects/service/project.service.ts b/frontend/src/app/projects/service/project.service.ts
index ba1795df1..6c0cfd654 100644
--- a/frontend/src/app/projects/service/project.service.ts
+++ b/frontend/src/app/projects/service/project.service.ts
@@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {
AbstractControl,
@@ -12,19 +11,21 @@ import {
} from '@angular/forms';
import { BehaviorSubject, map, Observable, take, tap } from 'rxjs';
import slugify from 'slugify';
-import { Project, ProjectUserRole, ProjectsService } from 'src/app/openapi';
-import { environment } from 'src/environments/environment';
+import {
+ PatchProject,
+ PostProjectRequest,
+ Project,
+ ProjectType,
+ ProjectUserRole,
+ ProjectsService,
+ Visibility,
+} from 'src/app/openapi';
@Injectable({
providedIn: 'root',
})
-export class ProjectService {
- BACKEND_URL_PREFIX = environment.backend_url + '/projects';
-
- constructor(
- private http: HttpClient,
- private projectsService: ProjectsService,
- ) {}
+export class ProjectWrapperService {
+ constructor(private projectsService: ProjectsService) {}
private _project = new BehaviorSubject(undefined);
private _projects = new BehaviorSubject(undefined);
@@ -45,14 +46,14 @@ export class ProjectService {
}
loadProjectBySlug(slug: string): void {
- this.http.get(`${this.BACKEND_URL_PREFIX}/${slug}`).subscribe({
+ this.projectsService.getProjectBySlug(slug).subscribe({
next: (project) => this._project.next(project),
error: () => this._project.next(undefined),
});
}
- createProject(project: PostProject): Observable {
- return this.http.post(this.BACKEND_URL_PREFIX, project).pipe(
+ createProject(project: PostProjectRequest): Observable {
+ return this.projectsService.createProject(project).pipe(
tap({
next: (project) => {
this.loadProjects();
@@ -67,28 +68,24 @@ export class ProjectService {
project_slug: string,
project: PatchProject,
): Observable {
- return this.http
- .patch(`${this.BACKEND_URL_PREFIX}/${project_slug}`, project)
- .pipe(
- tap({
- next: (project) => {
- this.loadProjects();
- this._project.next(project);
- },
- error: () => this._project.next(undefined),
- }),
- );
+ return this.projectsService.updateProject(project_slug, project).pipe(
+ tap({
+ next: (project) => {
+ this.loadProjects();
+ this._project.next(project);
+ },
+ error: () => this._project.next(undefined),
+ }),
+ );
}
deleteProject(projectSlug: string): Observable {
- return this.http
- .delete(`${this.BACKEND_URL_PREFIX}/${projectSlug}`)
- .pipe(
- tap(() => {
- this.loadProjects();
- this._project.next(undefined);
- }),
- );
+ return this.deleteProject(projectSlug).pipe(
+ tap(() => {
+ this.loadProjects();
+ this._project.next(undefined);
+ }),
+ );
}
clearProject(): void {
@@ -113,12 +110,12 @@ export class ProjectService {
};
}
- getProjectVisibilityDescription(visibility: ProjectVisibility): string {
+ getProjectVisibilityDescription(visibility: Visibility): string {
return ProjectVisibilityDescriptions[visibility];
}
- getAvailableVisibilities(): ProjectVisibility[] {
- return Object.keys(ProjectVisibilityDescriptions) as ProjectVisibility[];
+ getAvailableVisibilities(): Visibility[] {
+ return Object.keys(ProjectVisibilityDescriptions) as Visibility[];
}
getProjectTypeDescription(type: ProjectType): string {
@@ -130,27 +127,6 @@ export class ProjectService {
}
}
-export type UserMetadata = {
- leads: number;
- contributors: number;
- subscribers: number;
-};
-
-export type PostProject = {
- name: string;
- description: string;
- visibility: ProjectVisibility;
- type: ProjectType;
-};
-
-export type PatchProject = Partial & {
- is_archived?: boolean;
-};
-
-export type ProjectVisibility = 'internal' | 'private';
-
-export type ProjectType = 'general' | 'training';
-
export const ProjectVisibilityDescriptions = {
internal: 'Internal (viewable by all logged in users)',
private: 'Private (only viewable by project members)',
diff --git a/frontend/src/app/services/settings/t4c-instance.service.ts b/frontend/src/app/services/settings/t4c-instance.service.ts
index bcccffdc7..0ac64f1a0 100644
--- a/frontend/src/app/services/settings/t4c-instance.service.ts
+++ b/frontend/src/app/services/settings/t4c-instance.service.ts
@@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {
AbstractControl,
@@ -11,50 +10,19 @@ import {
ValidationErrors,
} from '@angular/forms';
import { BehaviorSubject, Observable, map, take, tap } from 'rxjs';
-import { environment } from 'src/environments/environment';
-
-export type Protocol = 'tcp' | 'ssl' | 'ws' | 'wss';
-
-export type BaseT4CInstance = {
- version_id: number;
- license: string;
- host: string;
- port: number;
- cdo_port: number;
- http_port?: number;
- usage_api: string;
- rest_api: string;
- username: string;
- password: string;
- protocol: Protocol;
- is_archived: boolean;
-};
-
-export type PatchT4CInstance = Partial;
-
-export type NewT4CInstance = BaseT4CInstance & {
- name: string;
-};
-
-export type T4CInstance = NewT4CInstance & {
- id: number;
- version: {
- id: number;
- name: string;
- };
-};
+import {
+ CreateT4CInstance,
+ GetSessionUsageResponse,
+ PatchT4CInstance,
+ SettingsModelsourcesT4CService,
+ T4CInstance,
+} from 'src/app/openapi';
@Injectable({
providedIn: 'root',
})
-export class T4CInstanceService {
- constructor(private http: HttpClient) {}
-
- baseUrl = `${environment.backend_url}/settings/modelsources/t4c`;
-
- urlFactory(instanceId: number): string {
- return `${this.baseUrl}/${instanceId}`;
- }
+export class T4CInstanceWrapperService {
+ constructor(private t4cInstanceService: SettingsModelsourcesT4CService) {}
private _t4cInstances = new BehaviorSubject(
undefined,
@@ -73,21 +41,21 @@ export class T4CInstanceService {
);
loadInstances(): void {
- this.http.get(this.baseUrl).subscribe({
+ this.t4cInstanceService.getT4cInstances().subscribe({
next: (instances) => this._t4cInstances.next(instances),
error: () => this._t4cInstances.next(undefined),
});
}
loadInstance(instanceId: number): void {
- this.http.get(this.urlFactory(instanceId)).subscribe({
+ this.t4cInstanceService.getT4cInstance(instanceId).subscribe({
next: (instance) => this._t4cInstance.next(instance),
error: () => this._t4cInstance.next(undefined),
});
}
- createInstance(instance: NewT4CInstance): Observable {
- return this.http.post(this.baseUrl, instance).pipe(
+ createInstance(instance: CreateT4CInstance): Observable {
+ return this.t4cInstanceService.createT4cInstance(instance).pipe(
tap((instance) => {
this._t4cInstance.next(instance);
this.loadInstances();
@@ -99,14 +67,12 @@ export class T4CInstanceService {
instanceId: number,
instance: PatchT4CInstance,
): Observable {
- return this.http
- .patch(this.urlFactory(instanceId), instance)
- .pipe(
- tap((instance) => {
- this._t4cInstance.next(instance);
- this.loadInstances();
- }),
- );
+ return this.t4cInstanceService.editT4cInstance(instanceId, instance).pipe(
+ tap((instance) => {
+ this._t4cInstance.next(instance);
+ this.loadInstances();
+ }),
+ );
}
resetT4CInstance(): void {
@@ -118,10 +84,8 @@ export class T4CInstanceService {
this._t4cInstances.next(undefined);
}
- getLicenses(instanceId: number): Observable {
- return this.http.get(
- `${this.urlFactory(instanceId)}/licenses`,
- );
+ getLicenses(instanceId: number): Observable {
+ return this.t4cInstanceService.fetchT4cLicenses(instanceId);
}
asyncNameValidator(ignoreInstance?: T4CInstance): AsyncValidatorFn {
@@ -143,8 +107,3 @@ export class T4CInstanceService {
};
}
}
-
-export type SessionUsage = {
- free: number;
- total: number;
-};
diff --git a/frontend/src/app/sessions/service/session.service.ts b/frontend/src/app/sessions/service/session.service.ts
index c5181b54d..6ce920abe 100644
--- a/frontend/src/app/sessions/service/session.service.ts
+++ b/frontend/src/app/sessions/service/session.service.ts
@@ -13,6 +13,7 @@ import {
Project,
SessionProvisioningRequest,
SessionsService,
+ SessionConnectionInformation,
} from 'src/app/openapi';
import { SessionHistoryService } from 'src/app/sessions/user-sessions-wrapper/create-sessions/create-session-history/session-history.service';
import { environment } from 'src/environments/environment';
@@ -47,13 +48,6 @@ export interface PathNode {
children: PathNode[] | null;
}
-export type SessionConnectionInformation = {
- local_storage: LocalStorage;
- cookies: Cookies;
- t4c_token: string;
- redirect_url: string;
-};
-
@Injectable({
providedIn: 'root',
})
@@ -100,14 +94,6 @@ export class SessionService {
);
}
- getSessionConnectionInformation(
- sessionId: string,
- ): Observable {
- return this.http.get(
- `${this.BACKEND_URL_PREFIX}/${sessionId}/connection`,
- );
- }
-
deleteSession(id: string): Observable {
return this.http.delete(`${this.BACKEND_URL_PREFIX}/${id}`);
}
diff --git a/frontend/src/app/sessions/session/session-viewer.service.ts b/frontend/src/app/sessions/session/session-viewer.service.ts
index 6d224a171..a3cfaf48e 100644
--- a/frontend/src/app/sessions/session/session-viewer.service.ts
+++ b/frontend/src/app/sessions/session/session-viewer.service.ts
@@ -6,11 +6,9 @@
import { Injectable } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { BehaviorSubject, map } from 'rxjs';
-import { Session } from 'src/app/openapi';
-import {
- SessionConnectionInformation,
- SessionService,
-} from 'src/app/sessions/service/session.service';
+import { ToastService } from 'src/app/helpers/toast/toast.service';
+import { Session, SessionConnectionInformation } from 'src/app/openapi';
+import { SessionService } from 'src/app/sessions/service/session.service';
@Injectable({
providedIn: 'root',
@@ -19,6 +17,7 @@ export class SessionViewerService {
constructor(
private sessionService: SessionService,
private domSanitizer: DomSanitizer,
+ private toastService: ToastService,
) {}
private _sessions = new BehaviorSubject(
@@ -38,6 +37,14 @@ export class SessionViewerService {
): void {
const viewerSession = session as ViewerSession;
+ if (!connectionInfo.redirect_url) {
+ this.toastService.showError(
+ 'Session connection information is not available yet.',
+ 'Try again later.',
+ );
+ return;
+ }
+
this.sessionService.setConnectionInformation(session, connectionInfo);
viewerSession.focused = false;
viewerSession.safeResourceURL =
diff --git a/frontend/src/app/sessions/session/session.component.ts b/frontend/src/app/sessions/session/session.component.ts
index a33910b6e..63dabaa1a 100644
--- a/frontend/src/app/sessions/session/session.component.ts
+++ b/frontend/src/app/sessions/session/session.component.ts
@@ -14,7 +14,7 @@ import { MatTooltip } from '@angular/material/tooltip';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { filter, take } from 'rxjs';
-import { Session } from 'src/app/openapi';
+import { Session, SessionsService } from 'src/app/openapi';
import { FullscreenService } from 'src/app/sessions/service/fullscreen.service';
import { SessionService } from 'src/app/sessions/service/session.service';
import { UserSessionService } from 'src/app/sessions/service/user-session.service';
@@ -55,6 +55,7 @@ export class SessionComponent implements OnInit, OnDestroy {
constructor(
public userSessionService: UserSessionService,
public sessionService: SessionService,
+ private sessionsService: SessionsService,
public sessionViewerService: SessionViewerService,
public fullscreenService: FullscreenService,
) {
@@ -101,10 +102,13 @@ export class SessionComponent implements OnInit, OnDestroy {
selectSessions() {
this.checkedSessions?.forEach((session) => {
- this.sessionService
+ this.sessionsService
.getSessionConnectionInformation(session.id)
.subscribe((connectionInfo) => {
- this.sessionViewerService.pushSession(session, connectionInfo);
+ this.sessionViewerService.pushSession(
+ session,
+ connectionInfo.payload,
+ );
});
});
}
diff --git a/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.html b/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.html
index acbe46018..bc9a07905 100644
--- a/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.html
+++ b/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.html
@@ -18,7 +18,7 @@ Connect to Session
You can always return to this dialog by clicking on "Connect" in the
"Active sessions" overview.
diff --git a/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.ts b/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.ts
index 1f27f70e0..22f4ff8d6 100644
--- a/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.ts
+++ b/frontend/src/app/sessions/user-sessions-wrapper/active-sessions/connection-dialog/connection-dialog.component.ts
@@ -7,10 +7,13 @@ import { Component, Inject } from '@angular/core';
import { MatButton } from '@angular/material/button';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import { Session } from 'src/app/openapi';
-import { UserWrapperService } from 'src/app/services/user/user.service';
import {
+ Session,
SessionConnectionInformation,
+ SessionsService,
+} from 'src/app/openapi';
+import { UserWrapperService } from 'src/app/services/user/user.service';
+import {
SessionService,
isPersistentSession,
} from 'src/app/sessions/service/session.service';
@@ -31,14 +34,15 @@ export class ConnectionDialogComponent {
constructor(
public userService: UserWrapperService,
private sessionService: SessionService,
+ private sessionsService: SessionsService,
@Inject(MAT_DIALOG_DATA) public session: Session,
public dialogRef: MatDialogRef,
private toastService: ToastService,
) {
- this.sessionService
+ this.sessionsService
.getSessionConnectionInformation(this.session.id)
.subscribe((connectionInfo) => {
- this.connectionInfo = connectionInfo;
+ this.connectionInfo = connectionInfo.payload;
});
}
diff --git a/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts b/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts
index b5decd62b..8b3b8dae8 100644
--- a/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts
+++ b/frontend/src/app/sessions/user-sessions-wrapper/create-session/create-readonly-session/create-readonly-session.component.ts
@@ -24,12 +24,9 @@ import { RouterLink } from '@angular/router';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { combineLatest, filter, map, Observable, take, tap } from 'rxjs';
-import { Tool, ToolVersion } from 'src/app/openapi';
-import {
- Model,
- ModelService,
-} from 'src/app/projects/models/service/model.service';
-import { ProjectService } from 'src/app/projects/service/project.service';
+import { Tool, ToolModel, ToolVersion } from 'src/app/openapi';
+import { ModelWrapperService } from 'src/app/projects/models/service/model.service';
+import { ProjectWrapperService } from 'src/app/projects/service/project.service';
import { UserSessionService } from 'src/app/sessions/service/user-session.service';
import {
ToolWrapperService,
@@ -79,8 +76,8 @@ export class CreateReadonlySessionComponent implements OnInit {
constructor(
private toolWrapperService: ToolWrapperService,
private userSessionService: UserSessionService,
- private projectService: ProjectService,
- private modelService: ModelService,
+ private projectService: ProjectWrapperService,
+ private modelService: ModelWrapperService,
private dialog: MatDialog,
private fb: FormBuilder,
) {}
@@ -97,7 +94,7 @@ export class CreateReadonlySessionComponent implements OnInit {
this.userSessionService.loadSessions();
}
- loadToolsAndModels(): Observable<[Model[], ToolVersionWithTool[]]> {
+ loadToolsAndModels(): Observable<[ToolModel[], ToolVersionWithTool[]]> {
return combineLatest([
this.modelService.models$.pipe(untilDestroyed(this), filter(Boolean)),
this.toolWrapperService.getVersionsForTools(),
@@ -109,7 +106,7 @@ export class CreateReadonlySessionComponent implements OnInit {
}
resolveVersionCompatibility(
- models: Model[],
+ models: ToolModel[],
allVersions: ToolVersionWithTool[],
): void {
this.models = [];
@@ -232,4 +229,4 @@ export class CreateReadonlySessionComponent implements OnInit {
type ModelWithCompatibility = {
compatibleVersions: ToolVersionWithTool[];
-} & Model;
+} & ToolModel;
diff --git a/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-model-options/create-readonly-model-options.component.ts b/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-model-options/create-readonly-model-options.component.ts
index cc45e19f2..c95636a5a 100644
--- a/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-model-options/create-readonly-model-options.component.ts
+++ b/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-model-options/create-readonly-model-options.component.ts
@@ -22,8 +22,7 @@ import { MatError, MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { MatSlideToggle } from '@angular/material/slide-toggle';
import { filter } from 'rxjs';
-import { Tool, ToolVersion } from 'src/app/openapi';
-import { Model } from 'src/app/projects/models/service/model.service';
+import { Tool, ToolModel, ToolVersion } from 'src/app/openapi';
import { GetGitModel } from 'src/app/projects/project-detail/model-overview/model-detail/git-model.service';
import {
Revisions,
@@ -32,7 +31,7 @@ import {
} from 'src/app/services/git/git.service';
export type ModelOptions = {
- model: Model;
+ model: ToolModel;
primaryGitModel: GetGitModel;
include: boolean;
revision: string;
diff --git a/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-session-dialog.component.ts b/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-session-dialog.component.ts
index 9671c7121..890e0e5cc 100644
--- a/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-session-dialog.component.ts
+++ b/frontend/src/app/sessions/user-sessions-wrapper/create-sessions/create-readonly-session/create-readonly-session-dialog.component.ts
@@ -21,11 +21,8 @@ import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
import { Router } from '@angular/router';
import { UntilDestroy } from '@ngneat/until-destroy';
import { ToastService } from 'src/app/helpers/toast/toast.service';
-import { Tool, ToolVersion } from 'src/app/openapi';
-import {
- getPrimaryGitModel,
- Model,
-} from 'src/app/projects/models/service/model.service';
+import { Tool, ToolModel, ToolVersion } from 'src/app/openapi';
+import { getPrimaryGitModel } from 'src/app/projects/models/service/model.service';
import { SessionService } from 'src/app/sessions/service/session.service';
import {
CreateReadonlyModelOptionsComponent,
@@ -59,7 +56,7 @@ export class CreateReadonlySessionDialogComponent implements OnInit {
@Inject(MAT_DIALOG_DATA)
public data: {
projectSlug: string;
- models: Model[];
+ models: ToolModel[];
tool: Tool;
toolVersion: ToolVersion;
},
diff --git a/frontend/src/app/settings/modelsources/git-settings/git-settings.stories.ts b/frontend/src/app/settings/modelsources/git-settings/git-settings.stories.ts
index 9e0005d67..2026e5a37 100644
--- a/frontend/src/app/settings/modelsources/git-settings/git-settings.stories.ts
+++ b/frontend/src/app/settings/modelsources/git-settings/git-settings.stories.ts
@@ -13,7 +13,7 @@ import {
import { GitSettingsComponent } from './git-settings.component';
const meta: Meta = {
- title: 'Settings Components / Modelsources / Git Instances',
+ title: 'Settings Components / Modelsources / Git / Instances',
component: GitSettingsComponent,
};
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 2986ff407..d324d5769 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
@@ -9,9 +9,13 @@
Add a Team4Capella instance
-