Skip to content

Commit fb98861

Browse files
author
Kuno Vercammen
committed
114599: Added loading animation after creating collection or community
1 parent 0e61cfd commit fb98861

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
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-themed-loading *ngIf="isLoading$ | async"></ds-themed-loading>
1015
</div>

src/app/collection-page/create-collection-page/create-collection-page.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Collection } from '../../core/shared/collection.model';
1515
import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component';
1616
import { NotificationsService } from '../../shared/notifications/notifications.service';
1717
import { CollectionFormComponent } from '../collection-form/collection-form.component';
18+
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
1819

1920
/**
2021
* 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
2728
CollectionFormComponent,
2829
TranslateModule,
2930
AsyncPipe,
31+
ThemedLoadingComponent,
3032
],
3133
standalone: true,
3234
})
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
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-themed-loading *ngIf="isLoading$ | async"></ds-themed-loading>
18+
</div>

src/app/community-page/create-community-page/create-community-page.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea
1818
import { NotificationsService } from '../../shared/notifications/notifications.service';
1919
import { VarDirective } from '../../shared/utils/var.directive';
2020
import { CommunityFormComponent } from '../community-form/community-form.component';
21+
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
2122

2223
/**
2324
* 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
3233
VarDirective,
3334
NgIf,
3435
AsyncPipe,
36+
ThemedLoadingComponent,
3537
],
3638
standalone: true,
3739
})

src/app/shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from '@angular/core';
55
import { Router } from '@angular/router';
66
import { TranslateService } from '@ngx-translate/core';
7-
import { Observable } from 'rxjs';
7+
import { BehaviorSubject, Observable } from 'rxjs';
88
import {
99
mergeMap,
1010
take,
@@ -62,6 +62,11 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
6262
*/
6363
protected type: ResourceType;
6464

65+
/**
66+
* The
67+
*/
68+
isLoading$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
69+
6570
public constructor(
6671
protected dsoDataService: ComColDataService<TDomain>,
6772
public dsoNameService: DSONameService,
@@ -89,6 +94,7 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
8994
* @param event The event returned by the community/collection form. Contains the new dso and logo uploader
9095
*/
9196
onSubmit(event) {
97+
this.isLoading$.next(true);
9298
const dso = event.dso;
9399
const uploader = event.uploader;
94100

@@ -101,6 +107,7 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
101107
);
102108
}))
103109
.subscribe((dsoRD: TDomain) => {
110+
this.isLoading$.next(false);
104111
if (isNotUndefined(dsoRD)) {
105112
this.newUUID = dsoRD.uuid;
106113
if (uploader.queue.length > 0) {

0 commit comments

Comments
 (0)