Skip to content

Commit

Permalink
fix: users being able to step to the final step without submitting (#157
Browse files Browse the repository at this point in the history
)
  • Loading branch information
illfixit authored and kamilczaja committed Oct 24, 2024
1 parent 82757fd commit c96329b
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 68 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).

#### Patch

- Fixed user being able to skip to the final step without submitting in multiple components ([#121](https://github.com/sovity/authority-portal/issues/121))
- Fixed Keycloak notifications, OTP pages ([#146](https://github.com/sovity/authority-portal/issues/146)), ([#151](https://github.com/sovity/authority-portal/issues/151))
- Fixed provided connectors' statuses missing on the dashboard ([#138](https://github.com/sovity/authority-portal/issues/138))
- Fixed "Hosted By Name" column in Connector CSV report ([#149](https://github.com/sovity/authority-portal/issues/149))
Expand Down Expand Up @@ -297,9 +298,9 @@ Major release, containing a UI rework and several new features.
- Keycloak
- Replace [MDS theme](authority-portal-keycloak/mds-theme) with the new version
- Keycloak IAM needs to be upgraded to version 23.0.4
- Portal Backend
- Added environment variables
```yaml
# CaaS Portal API Client Auth
# will be provided by sovity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,6 @@ export const AUTHORITY_PORTAL_FAKE_BACKEND: FetchAPI = async (
return ok(IdResponseToJSON(result));
})

.url('registration')
.on('POST', () => {
const request = RegistrationRequestDtoFromJSON(body);
const result = registerOrganization(request);
return failed(409);
})

.url('registration')
.on('POST', () => {
const request = RegistrationRequestDtoFromJSON(body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ export const DEFAULT_CERTIFICATE_TAB_FORM_VALUE: CertificateTabFormValue =
export interface ProvideConnectorPageFormModel {
connectorTab: FormGroup<ConnectorTabFormModel>;
certificateTab: FormGroup<CertificateTabFormModel>;
canSwitchTabs: FormControl<boolean>;
}
export const DEFAULT_PROVIDE_CONNECTOR_PAGE_FORM_VALUE: ProvideConnectorPageFormValue =
{
connectorTab: DEFAULT_CONNECTOR_TAB_FORM_VALUE,
certificateTab: DEFAULT_CERTIFICATE_TAB_FORM_VALUE,
canSwitchTabs: true,
};
export type ProvideConnectorPageFormValue =
ɵFormGroupRawValue<ProvideConnectorPageFormModel>;
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class ProvideConnectorPageForm {
);

return this.formBuilder.nonNullable.group({
canSwitchTabs: [true, Validators.requiredTrue],
connectorTab,
certificateTab,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.connectorTab">
[completed]="state.state === 'success' || form.connectorTab.valid">
<form class="flex flex-col w-full justify-center">
<ng-template matStepLabel>Add Connector Details</ng-template>
<div
Expand Down Expand Up @@ -96,8 +95,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.certificateTab">
[completed]="state.state === 'success'">
<ng-template matStepLabel>Generate Certificate</ng-template>

<div class="flex justify-center items-center">
Expand All @@ -121,7 +119,9 @@
<button
class="btn-accent"
[disabledBtn]="
state.state === 'submitting' || !form.certificateTab.valid
state.state === 'submitting' ||
!form.connectorTab.valid ||
!form.certificateTab.valid
"
(click)="registerConnector()">
{{ createActionName }}
Expand All @@ -131,10 +131,7 @@
<!-- Generate Certificate Step-->

<!-- Final Step -->
<mat-step
color="accent"
[editable]="false"
[stepControl]="form.group.controls.canSwitchTabs">
<mat-step color="accent" [editable]="false">
<ng-template matStepLabel>Setup Connector</ng-template>

<app-connector-registering-success-message-page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ export class ProvideConnectorPageComponent implements OnInit, OnDestroy {
mdsId,
() => this.form.group.enable(),
() => this.form.group.disable(),
() => this.stepper.next(),
() => {
setTimeout(() => {
this.stepper.next();
}, 0);
},
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ export const DEFAULT_CERTIFICATE_TAB_FORM_VALUE: CertificateTabFormValue =
export interface RegisterCentralComponentPageFormModel {
componentTab: FormGroup<ComponentTabFormModel>;
certificateTab: FormGroup<CertificateTabFormModel>;
canSwitchTabs: FormControl<boolean>;
}

export const DEFAULT_REGISTER_CENTRAL_COMPONENT_PAGE_FORM_VALUE: RegisterCentralComponentPageFormValue =
{
componentTab: DEFAULT_COMPONENT_TAB_FORM_VALUE,
certificateTab: DEFAULT_CERTIFICATE_TAB_FORM_VALUE,
canSwitchTabs: true,
};
export type RegisterCentralComponentPageFormValue =
ɵFormGroupRawValue<RegisterCentralComponentPageFormModel>;
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export class RegisterCentralComponentPageForm {
);

return this.formBuilder.nonNullable.group({
canSwitchTabs: [true, Validators.requiredTrue],
componentTab,
certificateTab,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.componentTab">
[completed]="state.state === 'success' || form.componentTab.valid">
<form class="flex flex-col w-full justify-center">
<ng-template matStepLabel>Add Component Details</ng-template>
<div
Expand Down Expand Up @@ -71,8 +70,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.componentTab">
[completed]="state.state === 'success'">
<ng-template matStepLabel>Generate Certificate</ng-template>

<div class="flex justify-center items-center">
Expand All @@ -94,7 +92,9 @@
<button
class="btn-accent"
[disabledBtn]="
state.state === 'submitting' || !form.certificateTab.valid
state.state === 'submitting' ||
!form.componentTab.valid ||
!form.certificateTab.valid
"
(click)="registerComponent()">
{{ createActionName }}
Expand All @@ -104,10 +104,7 @@
<!-- Generate Certificate Step-->

<!-- Final Step -->
<mat-step
color="accent"
[editable]="false"
[stepControl]="form.group.controls.canSwitchTabs">
<mat-step color="accent" [editable]="false">
<ng-template matStepLabel>Setup Central Component</ng-template>
<div class="my-12 flex flex-col justify-center items-center text-center">
<h2 class="wizard-end-title">Finish setting up your component!</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export class RegisterCentralComponentPageComponent
request,
() => this.form.group.enable(),
() => this.form.group.disable(),
() => this.stepper.next(),
() => {
setTimeout(() => {
this.stepper.next();
}, 0);
},
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ export const DEFAULT_CERTIFICATE_TAB_FORM_VALUE: CertificateTabFormValue =
export interface RegisterConnectorPageFormModel {
connectorTab: FormGroup<ConnectorTabFormModel>;
certificateTab: FormGroup<CertificateTabFormModel>;
canSwitchTabs: FormControl<boolean>;
}

export const DEFAULT_REGISTER_CONNECTOR_PAGE_FORM_VALUE: RegisterConnectorPageFormValue =
{
connectorTab: DEFAULT_CONNECTOR_TAB_FORM_VALUE,
certificateTab: DEFAULT_CERTIFICATE_TAB_FORM_VALUE,
canSwitchTabs: true,
};
export type RegisterConnectorPageFormValue =
ɵFormGroupRawValue<RegisterConnectorPageFormModel>;
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class RegisterConnectorPageForm {
);

return this.formBuilder.nonNullable.group({
canSwitchTabs: [true, Validators.requiredTrue],
connectorTab,
certificateTab,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.connectorTab">
[completed]="state.state === 'success' || form.connectorTab.valid">
<form class="flex flex-col w-full justify-center">
<ng-template matStepLabel>Add Connector Details</ng-template>
<div
Expand Down Expand Up @@ -89,8 +88,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="form.certificateTab">
[completed]="state.state === 'success'">
<ng-template matStepLabel>Generate Certificate</ng-template>

<div class="flex justify-center items-center">
Expand All @@ -112,7 +110,9 @@
<button
class="btn-accent"
[disabledBtn]="
state.state === 'submitting' || !form.certificateTab.valid
state.state === 'submitting' ||
!form.connectorTab.valid ||
!form.certificateTab.valid
"
(click)="registerConnector()">
{{ createActionName }}
Expand All @@ -122,10 +122,7 @@
<!-- Generate Certificate Step-->

<!-- Final Step -->
<mat-step
color="accent"
[editable]="false"
[stepControl]="form.group.controls.canSwitchTabs">
<mat-step color="accent" [editable]="false">
<ng-template matStepLabel>Setup Connector</ng-template>

<app-connector-registering-success-message-page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export class RegisterConnectorPageComponent implements OnInit, OnDestroy {
},
() => this.form.group.enable(),
() => this.form.group.disable(),
() => this.stepper.next(),
() => {
setTimeout(() => {
this.stepper.next();
}, 0);
},
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="userForm">
[completed]="userForm.valid || state.state === 'success'">
<div class="flex flex-col px-1 md:px-8 w-full">
<ng-template matStepLabel>User Details</ng-template>
<app-user-create-form
Expand Down Expand Up @@ -49,8 +48,7 @@
color="accent"
editable="false"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="orgForm">
[completed]="state.state === 'success'">
<div class="flex flex-col px-1 md:px-8 w-full">
<ng-template matStepLabel>Organization Profile</ng-template>
<h3 class="wizard-step-title">Organization Profile</h3>
Expand All @@ -69,7 +67,7 @@ <h3 class="wizard-step-title">Organization Profile</h3>

<button
class="btn-accent"
[disabledBtn]="!parentFormGroup.valid || loading"
[disabledBtn]="!userForm.valid || !orgForm.valid || loading"
(click)="submit()">
Register
</button>
Expand All @@ -79,7 +77,7 @@ <h3 class="wizard-step-title">Organization Profile</h3>
<!-- Organization profile form -->

<!-- final step -->
<mat-step [editable]="false" [stepControl]="parentFormGroup">
<mat-step [editable]="false">
<ng-template matStepLabel>Email Verification</ng-template>
<div
class="my-12 flex flex-col justify-center items-center text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export class OrganizationCreatePageComponent implements OnInit, OnDestroy {
);

return this.formBuilder.nonNullable.group({
isEditable: [true, Validators.requiredTrue],
userTab,
organizationTab,
});
Expand Down Expand Up @@ -135,8 +134,9 @@ export class OrganizationCreatePageComponent implements OnInit, OnDestroy {
() => this.parentFormGroup.enable(),
() => this.parentFormGroup.disable(),
() => {
this.stepper.next();
this.parentFormGroup.controls.isEditable.setValue(false);
setTimeout(() => {
this.stepper.next();
}, 0);
},
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export type RegistrationOrganizationTabFormValue =
ɵFormGroupRawValue<RegistrationOrganizationTabFormModel>;

export interface RegistrationWizardFormModel {
isEditable: FormControl<boolean>;
userTab: FormGroup<RegistrationUserTabFormModel>;
organizationTab: FormGroup<RegistrationOrganizationTabFormModel>;
}
Expand All @@ -44,7 +43,6 @@ export type RegistrationWizardFormValue =

export const DEFAULT_REGISTRATION_WIZARD_FORM_VALUE: RegistrationWizardFormValue =
{
isEditable: true,
userTab: DEFAULT_USER_CREATE_FORM_MODEL,
organizationTab: {
...DEFAULT_ORGANIZATION_CREATE_FORM_MODEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
<mat-step
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="userForm">
[completed]="userForm.valid || state.state === 'success'">
<div class="flex flex-col px-1 md:px-8 w-full">
<ng-template matStepLabel>User Profile</ng-template>

Expand Down Expand Up @@ -67,8 +66,7 @@ <h2 class="wizard-step-title">User Profile</h2>
*ngIf="state.onboardingType === 'USER_ORGANIZATION_ONBOARDING'"
color="accent"
[editable]="state.state === 'editing' || state.state === 'error'"
[completed]="state.state === 'success'"
[stepControl]="orgProfileForm">
[completed]="state.state === 'success'">
<div class="flex flex-col px-1 md:px-8 w-full">
<ng-template matStepLabel>Organization Profile</ng-template>

Expand All @@ -88,7 +86,9 @@ <h2 class="wizard-step-title">Organization Profile</h2>
<button
class="btn-accent"
[disabledBtn]="
!parentFormGroup.valid || state.state === 'submitting'
!userForm.valid ||
!orgForm.valid ||
state.state === 'submitting'
"
(click)="submit()">
Submit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export class OrganizationOnboardPageComponent implements OnInit {
);

return this.formBuilder.nonNullable.group({
isEditable: [true, Validators.requiredTrue],
userTab,
organizationTab,
});
Expand All @@ -164,8 +163,9 @@ export class OrganizationOnboardPageComponent implements OnInit {
() => this.parentFormGroup.enable(),
() => this.parentFormGroup.disable(),
() => {
this.stepper.next();
this.parentFormGroup.controls.isEditable.setValue(false);
setTimeout(() => {
this.stepper.next();
}, 0);
},
),
);
Expand Down
Loading

0 comments on commit c96329b

Please sign in to comment.