Skip to content

Commit 05b4a03

Browse files
committed
fix(admin): allow to change approval style for embedded group applications
* Now it is possible to set approval style also for embedded group applications on a subgroup level. * Toogle was replaced by info text. Previously it was possible to change autoRegistration on an organization level from app detail, but now we don't want to allow this feature due to subgroup level of autoRegistration. * Also some little refactor was done for this page.
1 parent 8daf271 commit 05b4a03

File tree

3 files changed

+19
-66
lines changed

3 files changed

+19
-66
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: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ <h1 class="page-subtitle">
33
</h1>
44
<mat-spinner *ngIf="loading" class="ms-auto me-auto"> </mat-spinner>
55
<div *ngIf="!noApplicationForm">
6-
<div *ngIf="!loading" class="d-flex w-50">
7-
<div [ngClass]="autoRegistrationEnabled ? 'w-75' : 'w-50'">
6+
<div *ngIf="!loading" class="d-flex w-75">
7+
<div>
88
<div class="fw-bold">
99
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.MODULE_NAME' | translate}}:
1010
{{applicationForm.moduleClassName}}
@@ -15,40 +15,31 @@ <h1 class="page-subtitle">
1515
>{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.APPLICATION_TYPE' | translate}}</span
1616
>:
1717

18-
<mat-icon class="align-bottom" matTooltip="Initial">arrow_right_alt</mat-icon>
18+
<mat-icon class="align-middle" matTooltip="Initial">arrow_right_alt</mat-icon>
1919
{{applicationForm.automaticApproval ?
2020
('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.AUTOMATIC'| translate) : ('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.MANUAL'| translate)}}
2121
,
22-
<mat-icon class="align-bottom" matTooltip="Extension">restore</mat-icon>
23-
{{applicationForm.automaticApprovalExtension ?
22+
<span [ngClass]="autoRegistrationEnabled ? '' : 'me-2'">
23+
<mat-icon class="align-middle" matTooltip="Extension">restore</mat-icon>
24+
{{applicationForm.automaticApprovalExtension ?
2425
('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.AUTOMATIC'| translate) : ('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.MANUAL'| translate)}}
26+
</span>
2527

26-
<span *ngIf="autoRegistrationEnabled">
28+
<span *ngIf="autoRegistrationEnabled" class="me-2">
2729
,
28-
<mat-icon class="align-bottom" matTooltip="Embedded">nat</mat-icon>
30+
<mat-icon class="align-middle" matTooltip="Embedded">nat</mat-icon>
2931
{{applicationForm.automaticApprovalEmbedded ?
3032
('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.AUTOMATIC'| translate) : ('GROUP_DETAIL.SETTINGS.APPLICATION_FORM.MANUAL'| translate)}}
3133
</span>
34+
<button *ngIf="editAuth" (click)="settings()" mat-stroked-button>
35+
<i class="material-icons">edit</i>
36+
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.SETTINGS_BUTTON' | translate}}
37+
</button>
3238
</div>
33-
<div *ngIf="voHasEmbeddedGroupApplication">
34-
<mat-slide-toggle
35-
(change)="updateAutoRegistration()"
36-
[disabled]="!changeAutoRegistration"
37-
[ngModel]="autoRegistrationEnabled"
38-
#autoRegToggle>
39-
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.ALLOW_EMBEDDED' | translate}}
40-
</mat-slide-toggle>
41-
</div>
42-
</div>
43-
<div class="w-25">
44-
<button
45-
*ngIf="editAuth"
46-
(click)="settings()"
47-
class="ms-auto action-button"
48-
mat-stroked-button>
49-
<i class="material-icons">edit</i>
50-
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.SETTINGS_BUTTON' | translate}}
51-
</button>
39+
<span *ngIf="autoRegistrationEnabled">
40+
<mat-icon class="align-bottom">info</mat-icon>
41+
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.ALLOW_EMBEDDED' | translate}}
42+
</span>
5243
</div>
5344
</div>
5445

@@ -80,7 +71,7 @@ <h1 class="page-subtitle">
8071
{{'VO_DETAIL.SETTINGS.APPLICATION_FORM.SAVE_BUTTON' | translate}}
8172
</button>
8273

83-
<button (click)="copy()" *ngIf="editAuth" class="me-2 action-button" mat-stroked-button>
74+
<button (click)="copy()" *ngIf="editAuth" class="me-2" mat-stroked-button>
8475
<i class="material-icons">file_copy</i>
8576
{{'GROUP_DETAIL.SETTINGS.APPLICATION_FORM.COPY_GROUP_BUTTON' | translate}}
8677
</button>

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

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
4242
group: Group;
4343
editAuth = false;
4444
createEmptyForm = false;
45-
voHasEmbeddedGroupApplication = false;
4645
autoRegistrationEnabled: boolean;
47-
changeAutoRegistration: boolean;
4846
refreshApplicationForm = false;
4947
// to recognize new items in other items' dependencies
5048
private idCounter = -1;
@@ -81,7 +79,6 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
8179
'urn:perun:group:attribute-def:virt:autoRegistrationEnabled'
8280
)
8381
.subscribe((attr) => {
84-
this.voHasEmbeddedGroupApplication = attr.value !== null;
8582
this.autoRegistrationEnabled = !!attr.value;
8683
this.loading = false;
8784
});
@@ -109,10 +106,6 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
109106
'createApplicationFormInGroup_Group_policy',
110107
[this.group]
111108
);
112-
this.changeAutoRegistration = this.guiAuthResolver.isAuthorized(
113-
'addGroupsToAutoRegistration_List<Group>_policy',
114-
[this.group]
115-
);
116109
}
117110

118111
add(): void {
@@ -255,35 +248,4 @@ export class GroupSettingsApplicationFormComponent implements OnInit {
255248
this.applicationFormItems = [];
256249
this.itemsChanged = true;
257250
}
258-
259-
updateAutoRegistration(): void {
260-
this.autoRegToggle.setDisabledState(true);
261-
if (this.autoRegistrationEnabled) {
262-
this.registrarManager.deleteGroupsFromAutoRegistration([this.group.id]).subscribe(
263-
() => {
264-
this.autoRegistrationEnabled = !this.autoRegistrationEnabled;
265-
this.translate
266-
.get('VO_DETAIL.SETTINGS.APPLICATION_FORM.CHANGE_SETTINGS_SUCCESS')
267-
.subscribe((successMessage: string) => {
268-
this.notificator.showSuccess(successMessage);
269-
});
270-
this.autoRegToggle.setDisabledState(false);
271-
},
272-
() => this.autoRegToggle.setDisabledState(false)
273-
);
274-
} else {
275-
this.registrarManager.addGroupsToAutoRegistration([this.group.id]).subscribe(
276-
() => {
277-
this.autoRegistrationEnabled = !this.autoRegistrationEnabled;
278-
this.translate
279-
.get('VO_DETAIL.SETTINGS.APPLICATION_FORM.CHANGE_SETTINGS_SUCCESS')
280-
.subscribe((successMessage: string) => {
281-
this.notificator.showSuccess(successMessage);
282-
});
283-
this.autoRegToggle.setDisabledState(false);
284-
},
285-
() => this.autoRegToggle.setDisabledState(false)
286-
);
287-
}
288-
}
289251
}

apps/admin-gui/src/assets/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@
734734
"CLEAR": "Clear form",
735735
"CLEAR_TOOLTIP": "Removes all form items",
736736
"CHANGE_SETTINGS_SUCCESS": "Application form settings successfully changed.",
737-
"ALLOW_EMBEDDED": "Allowed for embedded applications"
737+
"ALLOW_EMBEDDED": "This group is allowed for embedded applications"
738738
},
739739
"NOTIFICATIONS": {
740740
"TITLE": "Email notifications",

0 commit comments

Comments
 (0)