From fb988610db8ce9a758ac4e13a1e81c53fda50e68 Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Tue, 23 Apr 2024 11:19:13 +0200 Subject: [PATCH 1/7] 114599: Added loading animation after creating collection or community --- .../create-collection-page.component.html | 21 ++++++++++++------- .../create-collection-page.component.ts | 2 ++ .../create-community-page.component.html | 9 ++++++-- .../create-community-page.component.ts | 2 ++ .../create-comcol-page.component.ts | 9 +++++++- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.html b/src/app/collection-page/create-collection-page/create-collection-page.component.html index f3f9785692..94f1536b88 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.html +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.html @@ -1,10 +1,15 @@ -
-
-
-

{{'collection.create.sub-head' | translate:{ parent: dsoNameService.getName((parentRD$| async)?.payload) } }}

-
+
+
+
+

{{ 'collection.create.sub-head' | translate:{ parent: dsoNameService.getName((parentRD$| async)?.payload) } }}

- +
+ +
+ +
+
diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index a3594ef152..9483679469 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -15,6 +15,7 @@ import { Collection } from '../../core/shared/collection.model'; import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Collection @@ -27,6 +28,7 @@ import { CollectionFormComponent } from '../collection-form/collection-form.comp CollectionFormComponent, TranslateModule, AsyncPipe, + ThemedLoadingComponent, ], standalone: true, }) diff --git a/src/app/community-page/create-community-page/create-community-page.component.html b/src/app/community-page/create-community-page/create-community-page.component.html index 57039040c2..be9127eb2a 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.html +++ b/src/app/community-page/create-community-page/create-community-page.component.html @@ -1,9 +1,10 @@ -
+
-

{{ 'community.create.sub-head' | translate:{ parent: dsoNameService.getName(parent) } }}

+

{{ 'community.create.sub-head' | translate:{ parent: dsoNameService.getName(parent) } }}

@@ -11,3 +12,7 @@ (back)="navigateToHome()" (finish)="navigateToNewPage()">
+ +
+ +
diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index acc5279a5c..44580afd89 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -18,6 +18,7 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Community @@ -32,6 +33,7 @@ import { CommunityFormComponent } from '../community-form/community-form.compone VarDirective, NgIf, AsyncPipe, + ThemedLoadingComponent, ], standalone: true, }) diff --git a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts index 398ffeb6ba..6c475be0c4 100644 --- a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts +++ b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts @@ -4,7 +4,7 @@ import { } from '@angular/core'; import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; -import { Observable } from 'rxjs'; +import { BehaviorSubject, Observable } from 'rxjs'; import { mergeMap, take, @@ -62,6 +62,11 @@ export class CreateComColPageComponent i */ protected type: ResourceType; + /** + * The + */ + isLoading$: BehaviorSubject = new BehaviorSubject(false); + public constructor( protected dsoDataService: ComColDataService, public dsoNameService: DSONameService, @@ -89,6 +94,7 @@ export class CreateComColPageComponent i * @param event The event returned by the community/collection form. Contains the new dso and logo uploader */ onSubmit(event) { + this.isLoading$.next(true); const dso = event.dso; const uploader = event.uploader; @@ -101,6 +107,7 @@ export class CreateComColPageComponent i ); })) .subscribe((dsoRD: TDomain) => { + this.isLoading$.next(false); if (isNotUndefined(dsoRD)) { this.newUUID = dsoRD.uuid; if (uploader.queue.length > 0) { From 9bcd81670355c600a89eb1e6dd72ba5f7a39e52e Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Tue, 23 Apr 2024 11:39:29 +0200 Subject: [PATCH 2/7] 114599: Added e2e test to test the newly added loading component after creating com/col --- cypress/e2e/collection-create.cy.ts | 13 +++++++++++++ cypress/e2e/community-create.cy.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 cypress/e2e/collection-create.cy.ts create mode 100644 cypress/e2e/community-create.cy.ts diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts new file mode 100644 index 0000000000..bd0aa7c64e --- /dev/null +++ b/cypress/e2e/collection-create.cy.ts @@ -0,0 +1,13 @@ +beforeEach(() => { + cy.visit('/collections/create'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); +}); + +it('should show loading component while saving', () => { + const title = 'Test Collection Title'; + cy.get('#title').type(title); + + cy.get('button[type="submit"]').click(); + + cy.get('ds-themed-loading').should('be.visible'); +}); diff --git a/cypress/e2e/community-create.cy.ts b/cypress/e2e/community-create.cy.ts new file mode 100644 index 0000000000..e727a67be5 --- /dev/null +++ b/cypress/e2e/community-create.cy.ts @@ -0,0 +1,13 @@ +beforeEach(() => { + cy.visit('/communities/create'); + cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); +}); + +it('should show loading component while saving', () => { + const title = 'Test Community Title'; + cy.get('#title').type(title); + + cy.get('button[type="submit"]').click(); + + cy.get('ds-themed-loading').should('be.visible'); +}); From 0ac98c5230ded9366c4dd1a3e3997d1a8044f13d Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Tue, 23 Apr 2024 11:55:59 +0200 Subject: [PATCH 3/7] 114599: Small lint fixes --- .../create-collection-page.component.ts | 2 +- .../create-community-page/create-community-page.component.ts | 2 +- .../create-comcol-page/create-comcol-page.component.ts | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index 9483679469..989d77c15b 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -13,9 +13,9 @@ import { RequestService } from '../../core/data/request.service'; import { RouteService } from '../../core/services/route.service'; import { Collection } from '../../core/shared/collection.model'; import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; -import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Collection diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index 44580afd89..082f6c4f0b 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -15,10 +15,10 @@ import { RequestService } from '../../core/data/request.service'; import { RouteService } from '../../core/services/route.service'; import { Community } from '../../core/shared/community.model'; import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; -import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Community diff --git a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts index 6c475be0c4..d4c311bd1b 100644 --- a/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts +++ b/src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts @@ -4,7 +4,10 @@ import { } from '@angular/core'; import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; -import { BehaviorSubject, Observable } from 'rxjs'; +import { + BehaviorSubject, + Observable, +} from 'rxjs'; import { mergeMap, take, From fea2ff7b9c3f8740550f3f37b09723afa2b8aed9 Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Tue, 23 Apr 2024 11:19:13 +0200 Subject: [PATCH 4/7] 114599: Added loading animation after creating collection or community --- .../create-collection-page/create-collection-page.component.ts | 1 + .../create-community-page/create-community-page.component.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index 989d77c15b..bc25c3643a 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -16,6 +16,7 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Collection diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index 082f6c4f0b..6b4d6b1cbf 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -19,6 +19,7 @@ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.comp import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Community From 8ac2fe9dcfa1813c70b212e21ac5156c3d9a6720 Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Tue, 23 Apr 2024 11:55:59 +0200 Subject: [PATCH 5/7] 114599: Small lint fixes --- .../create-collection-page/create-collection-page.component.ts | 1 - .../create-community-page/create-community-page.component.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index bc25c3643a..989d77c15b 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -16,7 +16,6 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; -import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Collection diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index 6b4d6b1cbf..082f6c4f0b 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -19,7 +19,6 @@ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.comp import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; -import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; /** * Component that represents the page where a user can create a new Community From 6ff3a40929c58aaf01ac5e24eb9485dd2b17035b Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Thu, 2 May 2024 10:21:49 +0200 Subject: [PATCH 6/7] 114599: Adapted the changes after the rebase --- .../create-collection-page.component.html | 2 +- .../create-collection-page.component.ts | 5 ++++- .../create-community-page.component.html | 2 +- .../create-community-page/create-community-page.component.ts | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.html b/src/app/collection-page/create-collection-page/create-collection-page.component.html index 94f1536b88..0907290ac3 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.html +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.html @@ -11,5 +11,5 @@
- +
diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index 989d77c15b..8017cb0245 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -1,4 +1,4 @@ -import { AsyncPipe } from '@angular/common'; +import { AsyncPipe, NgIf } from '@angular/common'; import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { @@ -16,6 +16,7 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; +import { LoadingComponent } from '../../../themes/custom/app/shared/loading/loading.component'; /** * Component that represents the page where a user can create a new Collection @@ -29,6 +30,8 @@ import { CollectionFormComponent } from '../collection-form/collection-form.comp TranslateModule, AsyncPipe, ThemedLoadingComponent, + LoadingComponent, + NgIf, ], standalone: true, }) diff --git a/src/app/community-page/create-community-page/create-community-page.component.html b/src/app/community-page/create-community-page/create-community-page.component.html index be9127eb2a..4c634dab8e 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.html +++ b/src/app/community-page/create-community-page/create-community-page.component.html @@ -14,5 +14,5 @@
- +
diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index 082f6c4f0b..da24af1ea1 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -19,6 +19,7 @@ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.comp import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; +import { LoadingComponent } from '../../../themes/custom/app/shared/loading/loading.component'; /** * Component that represents the page where a user can create a new Community @@ -34,6 +35,7 @@ import { CommunityFormComponent } from '../community-form/community-form.compone NgIf, AsyncPipe, ThemedLoadingComponent, + LoadingComponent, ], standalone: true, }) From 20146bdcefd7f06d3bfc6583467585e7f37042b1 Mon Sep 17 00:00:00 2001 From: Kuno Vercammen Date: Thu, 2 May 2024 11:47:12 +0200 Subject: [PATCH 7/7] 114599: Updated the e2e tests so they succeed --- cypress/e2e/collection-create.cy.ts | 4 ++-- cypress/e2e/community-create.cy.ts | 2 +- .../create-collection-page.component.ts | 7 ++++--- .../create-community-page.component.ts | 2 -- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts index bd0aa7c64e..29f7dd5cac 100644 --- a/cypress/e2e/collection-create.cy.ts +++ b/cypress/e2e/collection-create.cy.ts @@ -1,5 +1,5 @@ beforeEach(() => { - cy.visit('/collections/create'); + cy.visit('/collections/create?parent='.concat(Cypress.env('DSPACE_TEST_COMMUNITY'))); cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD')); }); @@ -9,5 +9,5 @@ it('should show loading component while saving', () => { cy.get('button[type="submit"]').click(); - cy.get('ds-themed-loading').should('be.visible'); + cy.get('ds-loading').should('be.visible'); }); diff --git a/cypress/e2e/community-create.cy.ts b/cypress/e2e/community-create.cy.ts index e727a67be5..96bc003ba2 100644 --- a/cypress/e2e/community-create.cy.ts +++ b/cypress/e2e/community-create.cy.ts @@ -9,5 +9,5 @@ it('should show loading component while saving', () => { cy.get('button[type="submit"]').click(); - cy.get('ds-themed-loading').should('be.visible'); + cy.get('ds-loading').should('be.visible'); }); diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index 8017cb0245..a26bc9d6f8 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -1,4 +1,7 @@ -import { AsyncPipe, NgIf } from '@angular/common'; +import { + AsyncPipe, + NgIf, +} from '@angular/common'; import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { @@ -16,7 +19,6 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionFormComponent } from '../collection-form/collection-form.component'; -import { LoadingComponent } from '../../../themes/custom/app/shared/loading/loading.component'; /** * Component that represents the page where a user can create a new Collection @@ -30,7 +32,6 @@ import { LoadingComponent } from '../../../themes/custom/app/shared/loading/load TranslateModule, AsyncPipe, ThemedLoadingComponent, - LoadingComponent, NgIf, ], standalone: true, diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index da24af1ea1..082f6c4f0b 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -19,7 +19,6 @@ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.comp import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { CommunityFormComponent } from '../community-form/community-form.component'; -import { LoadingComponent } from '../../../themes/custom/app/shared/loading/loading.component'; /** * Component that represents the page where a user can create a new Community @@ -35,7 +34,6 @@ import { LoadingComponent } from '../../../themes/custom/app/shared/loading/load NgIf, AsyncPipe, ThemedLoadingComponent, - LoadingComponent, ], standalone: true, })