Skip to content

Commit 5756224

Browse files
committed
feat(admin): Change member status with expiration
* Changing status also includes the expiration options and no longer need multiple steps
1 parent 6c55321 commit 5756224

25 files changed

+262
-266
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ testem.log
4141
.DS_Store
4242
Thumbs.db
4343

44+
# Cache
45+
/.eslintcache
46+
4447
# The instance specific configuration should not be part of the repository
4548
apps/admin-gui/src/assets/config/instanceConfig.json
4649
apps/admin-gui/src/assets/config/instanceFavicon.ico

apps/admin-gui/src/app/shared/components/dialogs/create-sponsored-member-dialog/create-sponsored-member-dialog.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ <h5 class="mt-2">
139139
</app-choose-sponsor>
140140

141141
<h6 class="mt-4">{{'DIALOGS.CREATE_SPONSORED_MEMBER.EXPIRATION' | translate}}</h6>
142-
<perun-web-apps-expiration-select (datePicker)="setExpiration($event)" class="mt-2">
142+
<perun-web-apps-expiration-select
143+
[minDate]="minDate"
144+
(datePicker)="setExpiration($event)"
145+
class="mt-2">
143146
</perun-web-apps-expiration-select>
144147
</div>
145148
</mat-step>

apps/admin-gui/src/app/shared/components/dialogs/create-sponsored-member-dialog/create-sponsored-member-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export class CreateSponsoredMemberDialogComponent implements OnInit {
5959
submitAllowed = false;
6060
groupsToAssign: Subject<void> = new Subject<void>();
6161

62+
minDate = new Date();
63+
6264
private namespaceRules: NamespaceRules[] = [];
6365
private parsedRules: Map<string, { login: string; password: string }> = new Map<
6466
string,

apps/admin-gui/src/app/shared/components/dialogs/generate-sponsored-members-dialog/generate-sponsored-members-dialog.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ <h5 class="mb-4">
111111
<h5 class="mb-4">{{'DIALOGS.GENERATE_SPONSORED_MEMBERS.EXPIRATION' | translate}}</h5>
112112
<perun-web-apps-expiration-select
113113
(datePicker)="setExpiration($event)"
114+
[minDate]="minDate"
114115
[expiration]="expiration">
115116
</perun-web-apps-expiration-select>
116117
</div>

apps/admin-gui/src/app/shared/components/dialogs/generate-sponsored-members-dialog/generate-sponsored-members-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export class GenerateSponsoredMembersDialogComponent implements OnInit {
7171
languages = ['en'];
7272
currentLanguage = 'en';
7373

74+
minDate = new Date();
75+
7476
namespaceRules: NamespaceRules[] = [];
7577
private resultData: MemberData[] = [];
7678

apps/admin-gui/src/app/shared/components/dialogs/sponsor-existing-member-dialog/sponsor-existing-member-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h1 mat-dialog-title>{{'DIALOGS.SPONSOR_EXISTING_MEMBER.TITLE' | translate}}</h1
5555
<div>
5656
<br />
5757
<h6>{{'DIALOGS.SPONSOR_EXISTING_MEMBER.EXPIRATION' | translate}}</h6>
58-
<perun-web-apps-expiration-select (datePicker)="setExpiration($event)">
58+
<perun-web-apps-expiration-select [minDate]="minDate" (datePicker)="setExpiration($event)">
5959
</perun-web-apps-expiration-select>
6060
</div>
6161
</div>

apps/admin-gui/src/app/shared/components/dialogs/sponsor-existing-member-dialog/sponsor-existing-member-dialog.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class SponsorExistingMemberDialogComponent implements OnInit {
3838
serviceMemberId: number;
3939
selectedSponsor: User = null;
4040
sponsorType = 'self';
41+
minDate = new Date();
4142

4243
constructor(
4344
private dialogRef: MatDialogRef<SponsorExistingMemberDialogComponent>,

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,18 +1570,17 @@
15701570
},
15711571
"CHANGE_STATUS": {
15721572
"TITLE": "Change status",
1573-
"CURRENT_STATUS": "Current status: ",
1573+
"CURRENT_STATUS": "Current status",
15741574
"VALID_DESCRIPTION": "Member is properly configured and has access to all provided resources.",
1575-
"INVALID_DESCRIPTION": "Member has configuration error and DOESN'T have access to provided resources. You can check what is wrong by changing the member's status to ACTIVE. If possible, the procedure will configure all necessary settings by itself.",
1575+
"INVALID_DESCRIPTION": "Member has configuration error and DOES NOT have access to provided resources. You can check what is wrong by changing the member's status to ACTIVE. If possible, the procedure will configure all necessary settings by itself.",
15761576
"EXPIRED_DESCRIPTION": "Member didn't extend membership and might NOT have access to all services.",
1577-
"DISABLED_DESCRIPTION": "Member was manually disabled and DON'T have access to provided resources.",
1578-
"NEW_STATUS": "New status: ",
1579-
"SELECT_STATUS": "Select status",
1580-
"CHANGE_VALID_TO_INVALID": "Changing status to INVALID will <b>prevent the member from accessing all services.</b>\n\nINVALID members might not have the correct configuration (required by services) and have to be validated before accessing them.",
1577+
"DISABLED_DESCRIPTION": "Member was manually disabled and DOES NOT have access to provided resources.",
1578+
"NEW_STATUS": "New status",
1579+
"CHANGE_VALID_TO_INVALID": "Changing status to INCOMPLETE will <b>prevent the member from accessing all services.</b>\n\nINCOMPLETE members might not have the correct configuration (required by services) and have to be validated before accessing them.",
15811580
"CHANGE_VALID_TO_EXPIRED": "Changing status to EXPIRED <b>might prevent the member from accessing some of the services (based on provided service's rules).</b>\n\nEXPIRED status means, that member didn't extend his membership in the organization, but it's still possible for him to do so.",
15821581
"CHANGE_VALID_TO_DISABLED": "Changing status to DISABLED will <b>prevent the member from accessing all of the services. </b>\n\nDISABLED status means that the member is archived and is not allowed to any services.",
15831582
"CHANGE_NO_VALID_TO_VALID": "Changing status to ACTIVE <b>will trigger attribute validation</b>. \n\n<b>If successful</b>, the member will have access to all services. \n\n<b>If not</b>, see the displayed error message and do a manual configuration of invalid attributes.",
1584-
"CHANGE_NO_VALID_TO_INVALID": "INVALID status means there is a configuration error, which prevents the member from accessing provided services.",
1583+
"CHANGE_NO_VALID_TO_INVALID": "INCOMPLETE status means there is a configuration error, which prevents the member from accessing provided services.",
15851584
"CHANGE_NO_VALID_TO_EXPIRED": "EXPIRED status means, that member didn't extend his membership in the organization, but it's still possible for him to do so.",
15861585
"CHANGE_NO_VALID_TO_DISABLED": "DISABLED status means that the member is archived and is not allowed to any services. Member can't enable/extend membership by himself.",
15871586
"SUCCESS": "Member status was changed",

libs/perun/components/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export * from './lib/user-ext-sources-list/user-ext-sources-list.component';
1111
export * from './lib/password-reset/password-reset.component';
1212
export * from './lib/groups-list/groups-list.component';
1313
export * from './lib/groups-tree/groups-tree.component';
14-
export * from './lib/expiration-select/expiration-select.component';
1514
export * from './lib/perun-footer/perun-footer.component';
1615
export * from './lib/create-group-form/create-group-form.component';
1716
export * from './lib/app-form-item-search-select/app-form-item-search-select.component';

libs/perun/components/src/lib/expiration-select/expiration-select.component.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

libs/perun/components/src/lib/member-overview-groups/member-overview-groups.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,13 @@ export class MemberOverviewGroupsComponent implements OnChanges {
100100
});
101101
}
102102

103-
changeExpiration(statusChanged = false): void {
103+
changeExpiration(): void {
104104
const config = getDefaultDialogConfig();
105105
config.width = '400px';
106106
config.data = {
107107
memberId: this.member.id,
108108
groupId: this.selectedGroup.id,
109109
expirationAttr: this.expirationAtt,
110-
status: this.selectedMember.groupStatus,
111-
statusChanged: statusChanged,
112110
backButton: this.openedInDialog,
113111
};
114112

@@ -117,8 +115,6 @@ export class MemberOverviewGroupsComponent implements OnChanges {
117115
if (result.success) {
118116
this.groupIsSelected(this.selectedGroup);
119117
this.dialog.closeAll();
120-
} else if (statusChanged) {
121-
this.statusChanged.emit(statusChanged);
122118
}
123119
});
124120
}
@@ -130,14 +126,17 @@ export class MemberOverviewGroupsComponent implements OnChanges {
130126
member: this.selectedMember,
131127
voId: this.voId,
132128
groupId: this.selectedGroup.id,
129+
expirationAttr: this.expirationAtt,
133130
backButton: this.openedInDialog,
134131
};
135132

136133
const dialogRef = this.dialog.open(ChangeMemberStatusDialogComponent, config);
137134
dialogRef.afterClosed().subscribe((member: RichMember) => {
138135
if (member) {
139136
this.selectedMember = member;
140-
this.changeExpiration(true);
137+
this.groupIsSelected(this.selectedGroup);
138+
this.dialog.closeAll();
139+
this.statusChanged.emit(true);
141140
}
142141
});
143142
}

libs/perun/components/src/lib/member-overview-membership/member-overview-membership.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h1 *ngIf="openedInDialog" mat-dialog-title>
4242
</i>
4343
<button
4444
*ngIf="authResolver.isThisVoAdmin(voId) && !(member | memberStatusDisabled)"
45-
(click)="changeVoExpiration(false)"
45+
(click)="changeVoExpiration()"
4646
mat-icon-button>
4747
<mat-icon>edit</mat-icon>
4848
</button>

libs/perun/components/src/lib/member-overview-membership/member-overview-membership.component.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,31 @@ export class MemberOverviewMembershipComponent implements OnChanges {
4949
changeStatus(): void {
5050
const config = getDefaultDialogConfig();
5151
config.width = '600px';
52-
config.data = { member: this.member, voId: this.voId, backButton: this.openedInDialog };
53-
const oldStatus = this.member.status;
52+
config.data = {
53+
member: this.member,
54+
voId: this.voId,
55+
backButton: this.openedInDialog,
56+
expirationAttr: this.voExpirationAtt,
57+
};
5458

5559
const dialogRef = this.dialog.open(ChangeMemberStatusDialogComponent, config);
5660
dialogRef.afterClosed().subscribe((member: RichMember) => {
5761
if (member) {
5862
this.member = member;
59-
if (
60-
(oldStatus === 'VALID' &&
61-
(member.status === 'EXPIRED' || member.status === 'DISABLED')) ||
62-
member.status === 'VALID'
63-
) {
64-
this.changeVoExpiration(true);
65-
} else {
66-
this.dialog.closeAll();
67-
}
63+
this.dialog.closeAll();
64+
this.refreshVoExpiration();
6865
}
6966
});
7067
}
7168

72-
changeVoExpiration(statusChanged: boolean): void {
69+
changeVoExpiration(): void {
7370
const config = getDefaultDialogConfig();
7471
config.width = '400px';
7572
config.data = {
7673
voId: this.voId,
7774
memberId: this.member.id,
7875
expirationAttr: this.voExpirationAtt,
7976
status: this.member.status,
80-
statusChanged: statusChanged,
8177
backButton: this.openedInDialog,
8278
};
8379

@@ -89,8 +85,6 @@ export class MemberOverviewMembershipComponent implements OnChanges {
8985
}
9086
this.refreshVoExpiration();
9187
this.dialog.closeAll();
92-
} else if (statusChanged) {
93-
this.statusChanged.emit(statusChanged);
9488
}
9589
});
9690
}

libs/perun/components/src/lib/perun-components.module.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ import { ResourceSearchSelectComponent } from './resource-search-select/resource
6464
import { MemberSearchSelectComponent } from './member-search-select/member-search-select.component';
6565
import { FacilitySearchSelectComponent } from './facility-search-select/facility-search-select.component';
6666
import { UserSearchSelectComponent } from './user-search-select/user-search-select.component';
67-
import { ExpirationSelectComponent } from './expiration-select/expiration-select.component';
6867
import { ScrollingModule } from '@angular/cdk/scrolling';
6968
import { RecentlyViewedIconComponent } from './recently-viewed-icon/recently-viewed-icon.component';
7069
import { FacilitiesListComponent } from './facilities-list/facilities-list.component';
@@ -102,13 +101,9 @@ import { MailingListsComponent } from './settings-mailing-lists/mailing-lists.co
102101
import { DataQuotasComponent } from './settings-data-quotas/data-quotas.component';
103102
import { LoaderDirective } from '@perun-web-apps/perun/directives';
104103
import { SettingsSSHKeysComponent } from './settings-ssh-keys/settings-ssh-keys.component';
105-
import { AddSshDialogComponent } from '@perun-web-apps/perun/dialogs';
106-
import { RemoveStringValueDialogComponent } from '@perun-web-apps/perun/dialogs';
107-
import { ShowSshDialogComponent } from '@perun-web-apps/perun/dialogs';
108104
import { RoleSearchSelectComponent } from './role-search-select/role-search-select.component';
109105
import { PerunHeaderComponent } from './perun-header/perun-header.component';
110106
import { MatBadgeModule } from '@angular/material/badge';
111-
import { ShowNotificationHistoryDialogComponent } from '@perun-web-apps/perun/dialogs';
112107
import { QueryParamsHandlingDirective } from '@perun-web-apps/perun/directives';
113108
import { BanSpecificationComponent } from './ban-specification/ban-specification.component';
114109
import { BanOnEntityListComponent } from './ban-on-entity-list/ban-on-entity-list.component';
@@ -117,6 +112,10 @@ import { ChangeMemberStatusOrExpirationDialogComponent } from './change-member-s
117112
import { MemberOverviewGroupsComponent } from './member-overview-groups/member-overview-groups.component';
118113
import { DeselectButtonComponent } from './deselect-button/deselect-button.component';
119114
import { AuditLogSearchSelectComponent } from './audit-log-search-select/audit-log-search-select.component';
115+
import { AddSshDialogComponent } from '@perun-web-apps/perun/dialogs';
116+
import { RemoveStringValueDialogComponent } from '@perun-web-apps/perun/dialogs';
117+
import { ShowSshDialogComponent } from '@perun-web-apps/perun/dialogs';
118+
import { ShowNotificationHistoryDialogComponent } from '@perun-web-apps/perun/dialogs';
120119
import { ApplicationStateSelectorComponent } from './application-state-selector/application-state-selector.component';
121120
import { AuthorizedGroupsCellComponent } from './authorized-groups-cell/authorized-groups-cell.component';
122121

@@ -220,7 +219,6 @@ export const APP_DATE_FORMATS: MatDateFormats = {
220219
MemberSearchSelectComponent,
221220
FacilitySearchSelectComponent,
222221
UserSearchSelectComponent,
223-
ExpirationSelectComponent,
224222
RecentlyViewedIconComponent,
225223
FacilitiesListComponent,
226224
EntitySearchSelectComponent,
@@ -254,12 +252,8 @@ export const APP_DATE_FORMATS: MatDateFormats = {
254252
MailingListsComponent,
255253
DataQuotasComponent,
256254
SettingsSSHKeysComponent,
257-
AddSshDialogComponent,
258-
RemoveStringValueDialogComponent,
259-
ShowSshDialogComponent,
260255
RoleSearchSelectComponent,
261256
PerunHeaderComponent,
262-
ShowNotificationHistoryDialogComponent,
263257
QueryParamsHandlingDirective,
264258
BanSpecificationComponent,
265259
BanOnEntityListComponent,
@@ -270,6 +264,10 @@ export const APP_DATE_FORMATS: MatDateFormats = {
270264
AuditLogSearchSelectComponent,
271265
ApplicationStateSelectorComponent,
272266
AuthorizedGroupsCellComponent,
267+
AddSshDialogComponent,
268+
RemoveStringValueDialogComponent,
269+
ShowSshDialogComponent,
270+
ShowNotificationHistoryDialogComponent,
273271
],
274272
exports: [
275273
VosListComponent,
@@ -301,7 +299,6 @@ export const APP_DATE_FORMATS: MatDateFormats = {
301299
MemberSearchSelectComponent,
302300
FacilitySearchSelectComponent,
303301
UserSearchSelectComponent,
304-
ExpirationSelectComponent,
305302
RecentlyViewedIconComponent,
306303
FacilitiesListComponent,
307304
EntitySearchSelectComponent,
@@ -330,12 +327,8 @@ export const APP_DATE_FORMATS: MatDateFormats = {
330327
MailingListsComponent,
331328
DataQuotasComponent,
332329
SettingsSSHKeysComponent,
333-
AddSshDialogComponent,
334-
RemoveStringValueDialogComponent,
335-
ShowSshDialogComponent,
336330
RoleSearchSelectComponent,
337331
PerunHeaderComponent,
338-
ShowNotificationHistoryDialogComponent,
339332
QueryParamsHandlingDirective,
340333
BanSpecificationComponent,
341334
BanOnEntityListComponent,
@@ -347,6 +340,10 @@ export const APP_DATE_FORMATS: MatDateFormats = {
347340
ApplicationStateSelectorComponent,
348341
LoaderDirective,
349342
AuthorizedGroupsCellComponent,
343+
AddSshDialogComponent,
344+
RemoveStringValueDialogComponent,
345+
ShowSshDialogComponent,
346+
ShowNotificationHistoryDialogComponent,
350347
],
351348
providers: [
352349
{ provide: DateAdapter, useClass: AppDateAdapter },

libs/perun/dialogs/src/lib/change-group-expiration-dialog/change-group-expiration-dialog.component.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import {
88
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
99
import { TranslateService } from '@ngx-translate/core';
1010
import { NotificatorService } from '@perun-web-apps/perun/services';
11-
import { formatDate } from '@angular/common';
1211
import { Urns } from '@perun-web-apps/perun/urns';
1312

1413
export interface ChangeGroupExpirationDialogData {
1514
groupId: number;
1615
memberId: number;
1716
expirationAttr: Attribute;
1817
status: string;
19-
statusChanged?: boolean;
2018
backButton?: boolean;
2119
}
2220

@@ -74,15 +72,6 @@ export class ChangeGroupExpirationDialogComponent implements OnInit {
7472
this.currentExpiration = (this.expirationAttr?.value as string) ?? 'never';
7573
this.newExpiration = this.currentExpiration;
7674

77-
if (this.data.statusChanged) {
78-
if (this.data.status !== 'VALID') {
79-
this.newExpiration = formatDate(currentDate, 'yyyy-MM-dd', 'en');
80-
this.maxDate = currentDate;
81-
} else {
82-
this.newExpiration = 'never';
83-
}
84-
}
85-
8675
if (this.data.status === 'VALID') {
8776
this.attributesManagerService
8877
.getGroupAttributeByName(this.data.groupId, Urns.GROUP_DEF_EXPIRATION_RULES)

0 commit comments

Comments
 (0)