From 6e79fcc6c5d3191346830e45ccbc0813e7de13ff Mon Sep 17 00:00:00 2001 From: Steffi Erne Date: Mon, 21 Aug 2023 13:35:33 +0200 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=A7=20enable=20'run=20all'=20for?= =?UTF-8?q?=20visual=20e2e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress.config.ts b/cypress.config.ts index 47d314e7..88848354 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -14,5 +14,6 @@ export default defineConfig({ printLogsToConsole: 'always', }); }, + experimentalRunAllSpecs: true, }, }); From ec9a418dc0cb6e394faffdb228166e4bc3debb10 Mon Sep 17 00:00:00 2001 From: Steffi Erne Date: Mon, 21 Aug 2023 15:22:34 +0200 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=92=84=20use=20display=20name=20whe?= =?UTF-8?q?re=20available=20as=20title,=20otherwise=20fallback=20to=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../billing-entity.component.html | 8 ++++++- .../billingentity/billing-entity.component.ts | 2 ++ .../billing-entity-detail.component.html | 2 +- .../billing-entity-detail.component.ts | 2 ++ .../billing-entity-form.component.html | 3 +-- .../billing-entity-members.component.html | 2 +- .../billing-entity-members.component.ts | 2 ++ .../billing-entity-view.component.html | 4 ++++ src/app/display-name.pipe.ts | 11 ++++++++++ .../organization-edit.component.html | 2 +- .../organization-edit.component.ts | 2 ++ .../organization-members-edit.component.html | 2 +- .../organization-members-edit.component.ts | 15 +++++++++---- .../organizations.component.html | 22 +++++++++++++++++-- .../organizations/organizations.component.ts | 4 ++-- .../teams/team-edit/team-edit.component.html | 2 +- .../teams/team-edit/team-edit.component.ts | 2 ++ src/app/teams/teams.component.html | 8 ++++++- src/app/teams/teams.component.ts | 2 ++ 19 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 src/app/display-name.pipe.ts diff --git a/src/app/billingentity/billing-entity.component.html b/src/app/billingentity/billing-entity.component.html index 26b6b1fe..475bf410 100644 --- a/src/app/billingentity/billing-entity.component.html +++ b/src/app/billingentity/billing-entity.component.html @@ -34,7 +34,7 @@

Billing

- {{ p.billingEntity.metadata.name }} + {{ p.billingEntity | displayName }}
Billing {{ p.billingEntity.spec.name }}
+
  • +
    ID
    +
    + {{ p.billingEntity.metadata.name }} +
    +
  • diff --git a/src/app/billingentity/billing-entity.component.ts b/src/app/billingentity/billing-entity.component.ts index 68c12210..2e5688af 100644 --- a/src/app/billingentity/billing-entity.component.ts +++ b/src/app/billingentity/billing-entity.component.ts @@ -22,6 +22,7 @@ import { RippleModule } from 'primeng/ripple'; import { ButtonModule } from 'primeng/button'; import { NgIf, NgFor } from '@angular/common'; import { LetDirective } from '@ngrx/component'; +import { DisplayNamePipe } from '../display-name.pipe'; @Component({ selector: 'app-billing-entity', @@ -39,6 +40,7 @@ import { LetDirective } from '@ngrx/component'; NgFor, MessagesModule, SharedModule, + DisplayNamePipe, ], }) export class BillingEntityComponent implements OnInit { diff --git a/src/app/billingentity/billingentity-detail/billing-entity-detail.component.html b/src/app/billingentity/billingentity-detail/billing-entity-detail.component.html index 607c5130..4a6d7111 100644 --- a/src/app/billingentity/billingentity-detail/billing-entity-detail.component.html +++ b/src/app/billingentity/billingentity-detail/billing-entity-detail.component.html @@ -3,7 +3,7 @@
    - {{ vm.billingEntity.metadata.name }} + {{ vm.billingEntity | displayName }} New Billing diff --git a/src/app/billingentity/billingentity-detail/billing-entity-detail.component.ts b/src/app/billingentity/billingentity-detail/billing-entity-detail.component.ts index a44c04db..412d7191 100644 --- a/src/app/billingentity/billingentity-detail/billing-entity-detail.component.ts +++ b/src/app/billingentity/billingentity-detail/billing-entity-detail.component.ts @@ -12,6 +12,7 @@ import { BackLinkDirective } from '../../shared/back-link.directive'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { NgIf } from '@angular/common'; import { LetDirective, PushPipe } from '@ngrx/component'; +import { DisplayNamePipe } from '../../display-name.pipe'; @Component({ selector: 'app-billingentity-detail', @@ -30,6 +31,7 @@ import { LetDirective, PushPipe } from '@ngrx/component'; MessagesModule, SharedModule, PushPipe, + DisplayNamePipe, ], }) export class BillingEntityDetailComponent implements OnInit { diff --git a/src/app/billingentity/billingentity-form/billing-entity-form.component.html b/src/app/billingentity/billingentity-form/billing-entity-form.component.html index e96d897f..e2c68b64 100644 --- a/src/app/billingentity/billingentity-form/billing-entity-form.component.html +++ b/src/app/billingentity/billingentity-form/billing-entity-form.component.html @@ -124,9 +124,8 @@ By registering a billing address, you agree that you will get charged for using VSHN products. You also agree to our - general terms and conditions + general terms and conditions. - .
  • +
  • +
    ID
    +
    {{ billingEntity.metadata.name }}
    +
  • Company Email
    diff --git a/src/app/display-name.pipe.ts b/src/app/display-name.pipe.ts new file mode 100644 index 00000000..2731db3a --- /dev/null +++ b/src/app/display-name.pipe.ts @@ -0,0 +1,11 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'displayName', + standalone: true, +}) +export class DisplayNamePipe implements PipeTransform { + transform(value: { spec?: { name?: string; displayName?: string }; metadata?: { name: string } }): string { + return value.spec?.displayName || value.spec?.name || value.metadata?.name || ''; + } +} diff --git a/src/app/organizations/organization-edit/organization-edit.component.html b/src/app/organizations/organization-edit/organization-edit.component.html index 947e3994..ab8f4146 100644 --- a/src/app/organizations/organization-edit/organization-edit.component.html +++ b/src/app/organizations/organization-edit/organization-edit.component.html @@ -5,7 +5,7 @@
    New Organization - {{ payload.organization.metadata.name }} + {{ payload.organization | displayName }}
    diff --git a/src/app/organizations/organization-edit/organization-edit.component.ts b/src/app/organizations/organization-edit/organization-edit.component.ts index 99b1db4e..45f9f674 100644 --- a/src/app/organizations/organization-edit/organization-edit.component.ts +++ b/src/app/organizations/organization-edit/organization-edit.component.ts @@ -13,6 +13,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { BackLinkDirective } from '../../shared/back-link.directive'; import { NgIf } from '@angular/common'; import { LetDirective } from '@ngrx/component'; +import { DisplayNamePipe } from '../../display-name.pipe'; interface Payload { organization: Organization; @@ -33,6 +34,7 @@ interface Payload { OrganizationFormComponent, MessagesModule, SharedModule, + DisplayNamePipe, ], }) export class OrganizationEditComponent implements OnInit { diff --git a/src/app/organizations/organization-members-edit/organization-members-edit.component.html b/src/app/organizations/organization-members-edit/organization-members-edit.component.html index 82f08b49..ff209d8a 100644 --- a/src/app/organizations/organization-members-edit/organization-members-edit.component.html +++ b/src/app/organizations/organization-members-edit/organization-members-edit.component.html @@ -3,7 +3,7 @@
    - {{ payload.members.metadata.namespace }} + {{ payload.organization | displayName }} Members
    diff --git a/src/app/organizations/organization-members-edit/organization-members-edit.component.ts b/src/app/organizations/organization-members-edit/organization-members-edit.component.ts index 49009ff3..a685e5dd 100644 --- a/src/app/organizations/organization-members-edit/organization-members-edit.component.ts +++ b/src/app/organizations/organization-members-edit/organization-members-edit.component.ts @@ -20,11 +20,15 @@ import { BackLinkDirective } from '../../shared/back-link.directive'; import { NgIf, NgFor } from '@angular/common'; import { LetDirective } from '@ngrx/component'; import { NotificationService } from '../../core/notification.service'; +import { OrganizationCollectionService } from '../../store/organization-collection.service'; +import { Organization } from '../../types/organization'; +import { DisplayNamePipe } from '../../display-name.pipe'; interface Payload { members: OrganizationMembers; roleBindings: RoleBinding[]; canEdit: boolean; + organization: Organization; } @Component({ @@ -47,6 +51,7 @@ interface Payload { RippleModule, MessagesModule, SharedModule, + DisplayNamePipe, ], }) export class OrganizationMembersEditComponent implements OnInit { @@ -76,7 +81,8 @@ export class OrganizationMembersEditComponent implements OnInit { private membersService: OrganizationMembersCollectionService, private rolebindingService: RolebindingCollectionService, private navigationService: NavigationService, - private notificationService: NotificationService + private notificationService: NotificationService, + private organizationService: OrganizationCollectionService ) {} get userRefs(): FormArray | undefined { @@ -92,10 +98,11 @@ export class OrganizationMembersEditComponent implements OnInit { this.payload$ = this.membersService.getByKeyMemoized(`${name}/members`).pipe( combineLatestWith( this.membersService.canEditMembers(name), - this.rolebindingService.getAllInNamespaceMemoized(name) + this.rolebindingService.getAllInNamespaceMemoized(name), + this.organizationService.getByKeyMemoized(name) ), - map(([members, canEdit, roleBindings]) => { - const payload = { members, canEdit, roleBindings } satisfies Payload; + map(([members, canEdit, roleBindings, organization]) => { + const payload = { members, canEdit, roleBindings, organization } satisfies Payload; this.initForm(payload); return payload; }) diff --git a/src/app/organizations/organizations.component.html b/src/app/organizations/organizations.component.html index 11567558..2714eb1e 100644 --- a/src/app/organizations/organizations.component.html +++ b/src/app/organizations/organizations.component.html @@ -29,7 +29,7 @@

    Organizations

    diff --git a/src/app/organizations/organizations.component.ts b/src/app/organizations/organizations.component.ts index ebcce0d7..8f307406 100644 --- a/src/app/organizations/organizations.component.ts +++ b/src/app/organizations/organizations.component.ts @@ -9,7 +9,6 @@ import { faUserGroup, faWarning, } from '@fortawesome/free-solid-svg-icons'; -import { DialogService } from 'primeng/dynamicdialog'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { OrganizationCollectionService } from '../store/organization-collection.service'; import { Organization } from '../types/organization'; @@ -23,6 +22,7 @@ import { RippleModule } from 'primeng/ripple'; import { ButtonModule } from 'primeng/button'; import { NgIf, NgFor } from '@angular/common'; import { LetDirective } from '@ngrx/component'; +import { DisplayNamePipe } from '../display-name.pipe'; @Component({ selector: 'app-organizations', @@ -40,6 +40,7 @@ import { LetDirective } from '@ngrx/component'; NgFor, MessagesModule, SharedModule, + DisplayNamePipe, ], }) export class OrganizationsComponent implements OnInit, OnDestroy { @@ -55,7 +56,6 @@ export class OrganizationsComponent implements OnInit, OnDestroy { organizations$?: Observable; constructor( - private dialogService: DialogService, private router: Router, private activatedRoute: ActivatedRoute, public organizationService: OrganizationCollectionService, diff --git a/src/app/teams/team-edit/team-edit.component.html b/src/app/teams/team-edit/team-edit.component.html index 2563450b..b7fcf291 100644 --- a/src/app/teams/team-edit/team-edit.component.html +++ b/src/app/teams/team-edit/team-edit.component.html @@ -5,7 +5,7 @@
    New Team - {{ team.metadata.name }} + {{ team | displayName }}
    diff --git a/src/app/teams/team-edit/team-edit.component.ts b/src/app/teams/team-edit/team-edit.component.ts index 0863c0f6..b2715b2d 100644 --- a/src/app/teams/team-edit/team-edit.component.ts +++ b/src/app/teams/team-edit/team-edit.component.ts @@ -17,6 +17,7 @@ import { BackLinkDirective } from '../../shared/back-link.directive'; import { NgIf, NgFor } from '@angular/common'; import { LetDirective, PushPipe } from '@ngrx/component'; import { NotificationService } from '../../core/notification.service'; +import { DisplayNamePipe } from '../../display-name.pipe'; @Component({ selector: 'app-team-edit', @@ -38,6 +39,7 @@ import { NotificationService } from '../../core/notification.service'; MessagesModule, SharedModule, PushPipe, + DisplayNamePipe ], }) export class TeamEditComponent implements OnInit { diff --git a/src/app/teams/teams.component.html b/src/app/teams/teams.component.html index ff71049a..d70a39b8 100644 --- a/src/app/teams/teams.component.html +++ b/src/app/teams/teams.component.html @@ -31,7 +31,7 @@

    Teams

    - {{ team.metadata.name }} + {{ team | displayName }}
    Teams