Skip to content

Commit 44910d0

Browse files
michalberkybodnara
authored andcommitted
fix(admin): fix application form page spinners
* Divided the 'loading' variable into two separate variables handling the loading of header and table individually.
1 parent f4e3b3b commit 44910d0

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

apps/admin-gui/src/app/vos/pages/group-detail-page/group-settings/group-settings-application-form/group-settings-application-form.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<h1 class="page-subtitle">
22
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.TITLE' | translate}}
33
</h1>
4-
<mat-spinner *ngIf="loading" class="ms-auto me-auto"> </mat-spinner>
4+
<mat-spinner *ngIf="loadingHeader" class="ms-auto me-auto"> </mat-spinner>
55
<div *ngIf="!noApplicationForm">
6-
<div *ngIf="!loading" class="d-flex w-75">
6+
<div *ngIf="!loadingHeader" class="d-flex w-75">
77
<div>
88
<div class="fw-bold">
99
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.MODULE_NAMES' | translate}}:
@@ -105,7 +105,7 @@ <h1 class="page-subtitle">
105105
</ng-template>
106106
<div class="position-relative">
107107
<app-application-form-list
108-
*perunWebAppsLoader="loading; indicator: spinner"
108+
*perunWebAppsLoader="loadingTable; indicator: spinner"
109109
(applicationFormItemsChange)="changeItems()"
110110
[applicationForm]="applicationForm"
111111
[applicationFormItems]="applicationFormItems"
@@ -115,7 +115,7 @@ <h1 class="page-subtitle">
115115
</app-application-form-list>
116116
</div>
117117
</div>
118-
<div *ngIf="!loading && noApplicationForm">
118+
<div *ngIf="!loadingTable && noApplicationForm">
119119
<perun-web-apps-alert
120120
alert_type="warn"
121121
>{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.NO_APPLICATION_FORM' | translate}}</perun-web-apps-alert

apps/admin-gui/src/app/vos/pages/group-detail-page/group-settings/group-settings-application-form/group-settings-application-form.component.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
3434
@HostBinding('class.router-component') true;
3535
@ViewChild('autoRegToggle')
3636
autoRegToggle: MatSlideToggle;
37-
loading = false;
37+
loadingHeader = false;
38+
loadingTable = false;
3839
applicationForm: ApplicationForm;
3940
applicationFormItems: ApplicationFormItem[] = [];
4041
noApplicationForm = false;
@@ -62,7 +63,8 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
6263
) {}
6364

6465
ngOnInit(): void {
65-
this.loading = true;
66+
this.loadingHeader = true;
67+
this.loadingTable = true;
6668
this.group = this.entityStorageService.getEntity();
6769
this.setAuth();
6870
// FIXME this might not work in case of some race condition (other request finishes sooner)
@@ -80,16 +82,21 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
8082
)
8183
.subscribe((attr) => {
8284
this.autoRegistrationEnabled = !!attr.value;
83-
this.loading = false;
85+
this.loadingHeader = false;
86+
this.loadingTable = false;
8487
});
8588
},
86-
() => (this.loading = false)
89+
() => {
90+
this.loadingHeader = false;
91+
this.loadingTable = false;
92+
}
8793
);
8894
},
8995
(error: RPCError) => {
9096
if (error.name === 'FormNotExistsException') {
9197
this.noApplicationForm = true;
92-
this.loading = false;
98+
this.loadingHeader = false;
99+
this.loadingTable = false;
93100
} else {
94101
this.notificator.showRPCError(error);
95102
}
@@ -195,16 +202,16 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
195202
}
196203

197204
updateFormItems(): void {
198-
this.loading = true;
205+
this.loadingTable = true;
199206
this.refreshApplicationForm = true;
200207
this.registrarManager.getFormItemsForGroup(this.group.id).subscribe({
201208
next: (formItems) => {
202209
this.applicationFormItems = formItems;
203210
this.itemsChanged = false;
204211
this.refreshApplicationForm = false;
205-
this.loading = false;
212+
this.loadingTable = false;
206213
},
207-
error: () => (this.loading = false),
214+
error: () => (this.loadingTable = false),
208215
});
209216
}
210217

apps/admin-gui/src/app/vos/pages/vo-detail-page/vo-settings/vo-settings-application-form/vo-settings-application-form.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<h1 class="page-subtitle">
22
{{'VO_DETAIL.SETTINGS.APPLICATION_FORM.TITLE' | translate}}
33
</h1>
4-
<mat-spinner *ngIf="loading" class="ms-auto me-auto"> </mat-spinner>
4+
<mat-spinner *ngIf="loadingHeader" class="ms-auto me-auto"> </mat-spinner>
55
<div>
6-
<div *ngIf="!loading" class="d-flex w-75">
6+
<div *ngIf="!loadingHeader" class="d-flex w-75">
77
<div>
88
<div class="fw-bold">
99
{{'VO_DETAIL.SETTINGS.APPLICATION_FORM.MODULE_NAMES' | translate}}:
@@ -93,7 +93,7 @@ <h1 class="page-subtitle">
9393
</ng-template>
9494
<div class="position-relative">
9595
<app-application-form-list
96-
*perunWebAppsLoader="loading; indicator: spinner"
96+
*perunWebAppsLoader="loadingTable; indicator: spinner"
9797
(applicationFormItemsChange)="changeItems()"
9898
[applicationForm]="applicationForm"
9999
[applicationFormItems]="applicationFormItems"

apps/admin-gui/src/app/vos/pages/vo-detail-page/vo-settings/vo-settings-application-form/vo-settings-application-form.component.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
2828
export class VoSettingsApplicationFormComponent implements OnInit {
2929
static id = 'VoSettingsApplicationFormComponent';
3030
@HostBinding('class.router-component') true;
31-
loading = false;
31+
loadingHeader = false;
32+
loadingTable = false;
3233
applicationForm: ApplicationForm;
3334
applicationFormItems: ApplicationFormItem[] = [];
3435
itemsChanged = false;
@@ -53,14 +54,16 @@ export class VoSettingsApplicationFormComponent implements OnInit {
5354
) {}
5455

5556
ngOnInit(): void {
56-
this.loading = true;
57+
this.loadingHeader = true;
58+
this.loadingTable = true;
5759
this.vo = this.entityStorageService.getEntity();
5860
this.setAuthRights();
5961
this.registrarManager.getVoApplicationForm(this.vo.id).subscribe((form) => {
6062
this.applicationForm = form;
6163
this.registrarManager.getFormItemsForVo(this.vo.id).subscribe((formItems) => {
6264
this.applicationFormItems = formItems;
63-
this.loading = false;
65+
this.loadingHeader = false;
66+
this.loadingTable = false;
6467
});
6568
});
6669
}
@@ -142,14 +145,14 @@ export class VoSettingsApplicationFormComponent implements OnInit {
142145
}
143146

144147
updateFormItems(): void {
145-
this.loading = true;
148+
this.loadingTable = true;
146149
this.refreshApplicationForm = true;
147150
this.registrarManager.getFormItemsForVo(this.vo.id).subscribe((formItems) => {
148151
this.applicationFormItems = formItems;
149152
this.itemsChanged = false;
150153
this.setAuthRights();
151154
this.refreshApplicationForm = false;
152-
this.loading = false;
155+
this.loadingTable = false;
153156
});
154157
}
155158

@@ -158,7 +161,7 @@ export class VoSettingsApplicationFormComponent implements OnInit {
158161
}
159162

160163
save(): void {
161-
this.loading = true;
164+
this.loadingTable = true;
162165
let i = 0;
163166
for (const item of this.applicationFormItems) {
164167
item.ordnum = i;
@@ -178,7 +181,7 @@ export class VoSettingsApplicationFormComponent implements OnInit {
178181
});
179182
this.updateFormItems();
180183
},
181-
error: () => (this.loading = false),
184+
error: () => (this.loadingTable = false),
182185
});
183186
}
184187

0 commit comments

Comments
 (0)