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 d324d5769..5f447366d 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 @@ -4,249 +4,251 @@ -->
-
-
-

- Add a Team4Capella instance +
+
+

+ @if (existing) { + Team4Capella Server + } @else { + Link a Team4Capella Server + }

-
-
- - Name - - - The name is required. - - An instance with the same name already exists. - - - - Capella version - - - {{ version.name }} - - - @if ( - (t4cInstanceService.t4cInstance$ | async) !== undefined && - (t4cInstanceService.t4cInstance$ | async)!.version.id !== - form.value.version_id - ) { - Models are not auto-migrated on version change. - } @else if (form.controls.version_id.errors?.required) { - The version is required. - } - -
-
- - License configuration - - @if (form.controls.license.errors?.required) { - The license configuration is required. - } - -
-
- - Protocol - - {{ protocol }} - - - - Host - - -
+
-
- - Port - - +
+ + Name + + + The name is required. + + An instance with the same name already exists. + + + + Capella version + + - Valid ports are between 0 and 65535. - - - We only support numerical ports :( - - - The port is required. - - - - - CDO port - - + + @if ( + (t4cInstanceService.t4cInstance$ | async) !== undefined && + (t4cInstanceService.t4cInstance$ | async)!.version.id !== + form.value.version_id + ) { + Models are not auto-migrated on version change. + } @else if (form.controls.version_id.errors?.required) { + The version is required. + } + +
+
+ + License configuration + + @if (form.controls.license.errors?.required) { + The license configuration is required. + } + +
+
+ + Protocol + + {{ protocol }} - Valid CDO ports are between 0 and 65535. - - - We only support numerical CDO ports :( - - - The CDO port is required. - - + + + + Host + + +
- + + Port + + - HTTP port - - - Valid ports are between 0 and 65535. - - - We only support numerical ports :( - - -
-
- - License server API - - - The URL should start with “http(s)://” - - - The license server API is required. - - - - Experimental REST API - - - The URL should start with “http(s)://” - - - The REST server URL is required. - - -
-
- - Username - - - The username is required. - - - - Password - - - The password is required. - - Is not changed if empty - -
-
- - -
-
+ + We only support numerical CDO ports :( + + + The CDO port is required. + + + + -
- -
- -
-
- -
-
- + +
+
+
+
- -
+ +
+
+ +
+
+ +
+

-
- + @if ((t4cInstanceService.t4cInstance$ | async) !== undefined) { -
+ + }
diff --git a/frontend/src/app/settings/modelsources/t4c-settings/licences/licences.component.html b/frontend/src/app/settings/modelsources/t4c-settings/licences/licences.component.html index 1bcde7356..76119bf38 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/licences/licences.component.html +++ b/frontend/src/app/settings/modelsources/t4c-settings/licences/licences.component.html @@ -4,7 +4,7 @@ -->
-

License Server Status

+

License Server Status

Used licences: {{ sessionUsage.total - sessionUsage.free }}/{{ sessionUsage.total 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 1f894d07a..5e338f7a8 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 @@ -121,7 +121,7 @@ export class T4CRepositoryWrapperService { } } -type ExtendedT4CRepositoryStatus = T4CRepositoryStatus | 'LOADING'; +export type ExtendedT4CRepositoryStatus = T4CRepositoryStatus | 'LOADING'; export interface ExtendedT4CRepository { name: string; 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 8066ad1ed..b0abeff08 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,8 +3,8 @@ ~ SPDX-License-Identifier: Apache-2.0 --> -
-
+
+

Repositories

+ + Search + + search + -
-
- - Search - - search - -
- -
-
-
-
- sync - cloud_off - cloud_queue - block - cloud_upload - sync_problem -
- -
-
- {{ repository.name }} +
+
+ @for ( + repository of getFilteredRepositories( + t4cRepoService.repositories$ | async + ); + track repository.id + ) { +
+
+
+ No. {{ repository.id }} + {{ + mapStatusToText(repository.status).icon + }}
+
- Repository ID: {{ repository.id }}
- status: {{ repository.status }} +
+ {{ repository.name }} +
+
+ {{ mapStatusToText(repository.status).text }}
+
-
-
- +
+ - + - + - + +
-
+ }
- -
-
- - Repository name - - Please enter a name - Repository already exists - The following characters are allowed: A-Z, a-z, 0-9, _, - - - - -
-
+
+
+ + Repository name + + Please enter a name + Repository already exists + The following characters are allowed: A-Z, a-z, 0-9, _, - + + + +
+
diff --git a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.ts b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.ts index a19e3f258..c338b4ffd 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.ts +++ b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.component.ts @@ -33,6 +33,7 @@ import { MatTooltip } from '@angular/material/tooltip'; import { CreateT4CRepository, T4CInstance } from 'src/app/openapi'; import { ExtendedT4CRepository, + ExtendedT4CRepositoryStatus, T4CRepositoryWrapperService, } from 'src/app/settings/modelsources/t4c-settings/service/t4c-repos/t4c-repo.service'; import { T4CRepoDeletionDialogComponent } from './t4c-repo-deletion-dialog/t4c-repo-deletion-dialog.component'; @@ -134,4 +135,34 @@ export class T4CInstanceSettingsComponent implements OnChanges, OnDestroy { .recreateRepository(repository.instance.id, repository.id) .subscribe(); } + + mapStatusToText(status: ExtendedT4CRepositoryStatus | null): StatusMapping { + switch (status) { + case 'LOADING': + return { + icon: 'sync', + text: 'Hang tight while we refresh the list.', + }; + case 'INITIAL': + return { icon: 'cloud_upload', text: 'Repository is started.' }; + case 'INSTANCE_UNREACHABLE': + return { icon: 'sync_problem', text: 'The instance is unreachable.' }; + case 'NOT_FOUND': + return { + icon: 'block', + text: 'Repository not found on the TeamForCapella server.', + }; + case 'OFFLINE': + return { icon: 'cloud_off', text: 'Repository is offline.' }; + case 'ONLINE': + return { icon: 'cloud_queue', text: 'Repository is up & running' }; + case null: + return { icon: 'error', text: 'Unknown status' }; + } + } +} + +interface StatusMapping { + icon: string; + text: string; } diff --git a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.docs.mdx b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.docs.mdx index e91bd8654..184163ff6 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.docs.mdx +++ b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.docs.mdx @@ -17,3 +17,11 @@ This is an example story for the component:
+ +Here is another example where the form to create a new repository is visible: + + +
+ +
+
diff --git a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.stories.ts b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.stories.ts index 31dbe9f30..96a67260d 100644 --- a/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.stories.ts +++ b/frontend/src/app/settings/modelsources/t4c-settings/t4c-instance-settings/t4c-instance-settings.stories.ts @@ -72,3 +72,25 @@ export const Repositories: Story = { }), ], }; + +export const AddRepositories: Story = { + args: {}, + decorators: [ + moduleMetadata({ + providers: [ + { + provide: T4CRepositoryWrapperService, + useFactory: () => + new MockT4CRepositoryWrapperService([ + { + id: 1, + name: 'test', + instance: mockT4CInstance, + status: 'ONLINE', + }, + ]), + }, + ], + }), + ], +};