File tree Expand file tree Collapse file tree
collection-page/create-collection-page
shared/comcol/comcol-forms/create-comcol-page Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ beforeEach ( ( ) => {
2+ cy . visit ( '/collections/create?parent=' . concat ( Cypress . env ( 'DSPACE_TEST_COMMUNITY' ) ) ) ;
3+ cy . loginViaForm ( Cypress . env ( 'DSPACE_TEST_ADMIN_USER' ) , Cypress . env ( 'DSPACE_TEST_ADMIN_PASSWORD' ) ) ;
4+ } ) ;
5+
6+ it ( 'should show loading component while saving' , ( ) => {
7+ const title = 'Test Collection Title' ;
8+ cy . get ( '#title' ) . type ( title ) ;
9+
10+ cy . get ( 'button[type="submit"]' ) . click ( ) ;
11+
12+ cy . get ( 'ds-loading' ) . should ( 'be.visible' ) ;
13+ } ) ;
Original file line number Diff line number Diff line change 1+ beforeEach ( ( ) => {
2+ cy . visit ( '/communities/create' ) ;
3+ cy . loginViaForm ( Cypress . env ( 'DSPACE_TEST_ADMIN_USER' ) , Cypress . env ( 'DSPACE_TEST_ADMIN_PASSWORD' ) ) ;
4+ } ) ;
5+
6+ it ( 'should show loading component while saving' , ( ) => {
7+ const title = 'Test Community Title' ;
8+ cy . get ( '#title' ) . type ( title ) ;
9+
10+ cy . get ( 'button[type="submit"]' ) . click ( ) ;
11+
12+ cy . get ( 'ds-loading' ) . should ( 'be.visible' ) ;
13+ } ) ;
Original file line number Diff line number Diff line change 1- < div class ="container ">
2- < div class ="row ">
3- < div class ="col-12 pb-4 ">
4- < h2 id ="sub-header " class =" border-bottom pb-2 " > {{'collection.create.sub-head' | translate:{ parent: dsoNameService.getName((parentRD$| async)?.payload) } }} </ h2 >
5- </ div >
1+ < div class ="container " *ngIf =" (isLoading$ | async) === false " >
2+ < div class ="row ">
3+ < div class ="col-12 pb-4 ">
4+ < h2 id ="sub-header "
5+ class =" border-bottom pb-2 " > {{ 'collection.create.sub-head' | translate:{ parent: dsoNameService.getName((parentRD$| async)?.payload) } }} </ h2 >
66 </ div >
7- < ds-collection-form (submitForm) ="onSubmit($event) "
8- (back) ="navigateToHome() "
9- (finish) ="navigateToNewPage() "> </ ds-collection-form >
7+ </ div >
8+ < ds-collection-form (submitForm) ="onSubmit($event) "
9+ (back) ="navigateToHome() "
10+ (finish) ="navigateToNewPage() "> </ ds-collection-form >
11+ </ div >
12+
13+ < div class ="container ">
14+ < ds-loading *ngIf ="isLoading$ | async "> </ ds-loading >
1015</ div >
Original file line number Diff line number Diff line change 1- import { AsyncPipe } from '@angular/common' ;
1+ import {
2+ AsyncPipe ,
3+ NgIf ,
4+ } from '@angular/common' ;
25import { Component } from '@angular/core' ;
36import { Router } from '@angular/router' ;
47import {
@@ -13,6 +16,7 @@ import { RequestService } from '../../core/data/request.service';
1316import { RouteService } from '../../core/services/route.service' ;
1417import { Collection } from '../../core/shared/collection.model' ;
1518import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component' ;
19+ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component' ;
1620import { NotificationsService } from '../../shared/notifications/notifications.service' ;
1721import { CollectionFormComponent } from '../collection-form/collection-form.component' ;
1822
@@ -27,6 +31,8 @@ import { CollectionFormComponent } from '../collection-form/collection-form.comp
2731 CollectionFormComponent ,
2832 TranslateModule ,
2933 AsyncPipe ,
34+ ThemedLoadingComponent ,
35+ NgIf ,
3036 ] ,
3137 standalone : true ,
3238} )
Original file line number Diff line number Diff line change 1- < div class ="container ">
1+ < div class ="container " *ngIf =" (isLoading$ | async) === false " >
22 < div class ="row ">
33 < div class ="col-12 pb-4 ">
44 < ng-container *ngVar ="(parentRD$ | async)?.payload as parent ">
55 < h2 *ngIf ="!parent " id ="header " class ="border-bottom pb-2 "> {{ 'community.create.head' | translate }}</ h2 >
6- < h2 *ngIf ="parent " id ="sub-header " class ="border-bottom pb-2 "> {{ 'community.create.sub-head' | translate:{ parent: dsoNameService.getName(parent) } }}</ h2 >
6+ < h2 *ngIf ="parent " id ="sub-header "
7+ class ="border-bottom pb-2 "> {{ 'community.create.sub-head' | translate:{ parent: dsoNameService.getName(parent) } }}</ h2 >
78 </ ng-container >
89 </ div >
910 </ div >
1011 < ds-community-form (submitForm) ="onSubmit($event) "
1112 (back) ="navigateToHome() "
1213 (finish) ="navigateToNewPage() "> </ ds-community-form >
1314</ div >
15+
16+ < div class ="container ">
17+ < ds-loading *ngIf ="isLoading$ | async "> </ ds-loading >
18+ </ div >
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { RequestService } from '../../core/data/request.service';
1515import { RouteService } from '../../core/services/route.service' ;
1616import { Community } from '../../core/shared/community.model' ;
1717import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component' ;
18+ import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component' ;
1819import { NotificationsService } from '../../shared/notifications/notifications.service' ;
1920import { VarDirective } from '../../shared/utils/var.directive' ;
2021import { CommunityFormComponent } from '../community-form/community-form.component' ;
@@ -32,6 +33,7 @@ import { CommunityFormComponent } from '../community-form/community-form.compone
3233 VarDirective ,
3334 NgIf ,
3435 AsyncPipe ,
36+ ThemedLoadingComponent ,
3537 ] ,
3638 standalone : true ,
3739} )
Original file line number Diff line number Diff line change @@ -4,7 +4,10 @@ import {
44} from '@angular/core' ;
55import { Router } from '@angular/router' ;
66import { TranslateService } from '@ngx-translate/core' ;
7- import { Observable } from 'rxjs' ;
7+ import {
8+ BehaviorSubject ,
9+ Observable ,
10+ } from 'rxjs' ;
811import {
912 mergeMap ,
1013 take ,
@@ -62,6 +65,11 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
6265 */
6366 protected type : ResourceType ;
6467
68+ /**
69+ * The
70+ */
71+ isLoading$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
72+
6573 public constructor (
6674 protected dsoDataService : ComColDataService < TDomain > ,
6775 public dsoNameService : DSONameService ,
@@ -89,6 +97,7 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
8997 * @param event The event returned by the community/collection form. Contains the new dso and logo uploader
9098 */
9199 onSubmit ( event ) {
100+ this . isLoading$ . next ( true ) ;
92101 const dso = event . dso ;
93102 const uploader = event . uploader ;
94103
@@ -101,6 +110,7 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
101110 ) ;
102111 } ) )
103112 . subscribe ( ( dsoRD : TDomain ) => {
113+ this . isLoading$ . next ( false ) ;
104114 if ( isNotUndefined ( dsoRD ) ) {
105115 this . newUUID = dsoRD . uuid ;
106116 if ( uploader . queue . length > 0 ) {
You can’t perform that action at this time.
0 commit comments