diff --git a/cypress/e2e/collection-create.cy.ts b/cypress/e2e/collection-create.cy.ts new file mode 100644 index 0000000000..29f7dd5cac --- /dev/null +++ b/cypress/e2e/collection-create.cy.ts @@ -0,0 +1,13 @@ +beforeEach(() => { + 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')); +}); + +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-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..96bc003ba2 --- /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-loading').should('be.visible'); +}); 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..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 @@ -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..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 } from '@angular/common'; +import { + AsyncPipe, + NgIf, +} from '@angular/common'; import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { @@ -13,6 +16,7 @@ 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'; @@ -27,6 +31,8 @@ import { CollectionFormComponent } from '../collection-form/collection-form.comp CollectionFormComponent, TranslateModule, AsyncPipe, + ThemedLoadingComponent, + 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 57039040c2..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 @@ -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..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,6 +15,7 @@ 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'; @@ -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..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 { Observable } from 'rxjs'; +import { + BehaviorSubject, + Observable, +} from 'rxjs'; import { mergeMap, take, @@ -62,6 +65,11 @@ export class CreateComColPageComponent i */ protected type: ResourceType; + /** + * The + */ + isLoading$: BehaviorSubject = new BehaviorSubject(false); + public constructor( protected dsoDataService: ComColDataService, public dsoNameService: DSONameService, @@ -89,6 +97,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 +110,7 @@ export class CreateComColPageComponent i ); })) .subscribe((dsoRD: TDomain) => { + this.isLoading$.next(false); if (isNotUndefined(dsoRD)) { this.newUUID = dsoRD.uuid; if (uploader.queue.length > 0) {