From 2d43f598b8f4ffa3392632c25265794ea7110933 Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Tue, 21 Oct 2025 22:07:46 +0530 Subject: [PATCH] mgr/dashboard: Carbonize the Change Password Form Fixes https://tracker.ceph.com/issues/73193 - using carbon based stylings, typography and components - used grid layout for form arrangement - breadcrumb is slightly off, which needs to be fixed by applying grid layout to the app shell Signed-off-by: Afreen Misbah --- .../user-password-form.component.html | 196 ++++++++---------- .../user-password-form.component.scss | 6 - .../user-password-form.component.ts | 14 +- .../src/styles/ceph-custom/_forms.scss | 28 ++- 4 files changed, 126 insertions(+), 118 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.html index e09907aeb85..438aee155a8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.html @@ -1,115 +1,93 @@ -
-
-
-
{{ action | titlecase }} {{ resource | upperFirst }}
- -
- -
- -
-
- - -
- This field is required. - The old and new passwords must be different. -
-
- - -
- -
-
- - -
-
-
-
-
- This field is required. - The old and new passwords must be different. - - {{ passwordValuation }} - -
-
- - -
- -
-
- - -
- This field is required. - Password confirmation doesn't match the new password. -
-
+ +
+
+
+

{{ action | titlecase }} {{ resource | upperFirst }}

+
- - - -
+
+ + + + {{INVALID_TEXTS['required']}} + {{INVALID_TEXTS['notmatch']}} + + + + {{INVALID_TEXTS['required']}} + {{INVALID_TEXTS['notmatch']}} + {{INVALID_TEXTS['passwordPolicy']}} + + + + {{INVALID_TEXTS['required']}} + {{INVALID_TEXTS['match']}} + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.scss index b507fceb03f..e69de29bb2d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.scss @@ -1,6 +0,0 @@ -@use './src/styles/vendor/variables' as vv; - -#oldpassword.is-valid { - background-image: unset; - border-color: vv.$gray-400; -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts index dffb927ac16..bb2c47a2718 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-password-form/user-password-form.component.ts @@ -28,6 +28,12 @@ export class UserPasswordFormComponent { passwordStrengthLevelClass: string; passwordValuation: string; icons = Icons; + INVALID_TEXTS = { + required: 'This field is required', + notmatch: 'The old and new passwords must be different', + match: "Password confirmation doesn't match the new password.", + passwordPolicy: '' + }; constructor( public actionLabels: ActionLabelsI18n, @@ -76,11 +82,17 @@ export class UserPasswordFormComponent { CdValidators.passwordPolicy( this.userService, () => this.authStorageService.getUsername(), - (_valid: boolean, credits: number, valuation: string) => { + (_valid: boolean, credits, valuation: string) => { + /* `passwordStrengthLevelClass` and `passwordValuation` is used in LoginPasswordFormComponent + * These values are not needed in this component after carbonization. + * @TODO: Need to remove once the LoginPasswordFormComponent is carbonized. + */ this.passwordStrengthLevelClass = this.passwordPolicyService.mapCreditsToCssClass( credits ); this.passwordValuation = _.defaultTo(valuation, ''); + + this.INVALID_TEXTS['passwordPolicy'] = _.defaultTo(valuation, ''); } ) ] diff --git a/src/pybind/mgr/dashboard/frontend/src/styles/ceph-custom/_forms.scss b/src/pybind/mgr/dashboard/frontend/src/styles/ceph-custom/_forms.scss index ce6e8e68439..7d209ca2b9c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/ceph-custom/_forms.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/ceph-custom/_forms.scss @@ -111,12 +111,36 @@ Carbon Overrides /****************************************** Form Controls ******************************************/ + +// Ref: https://carbondesignsystem.com/components/form/style/#recommended-for-default-forms/ + +form { + // Overriding to remove extra space which is getting added when cdsGrid is used. + // If we use grid in app shell, then we dont need to set this. + // @TODO: Add grid layout for the app shell + .cds--grid { + padding-inline: 0; + } +} + +.form-heading { + h3 { + @include type.type-style('heading-03'); + } + + display: block; + margin-bottom: var(--cds-spacing-08); +} + .form-item { @extend .cds--form-item; display: block; - margin-bottom: 32px; - margin-top: 32px; + margin-bottom: var(--cds-spacing-07); +} + +.form-button { + margin-top: var(--cds-spacing-09); } .form-item-append { -- 2.39.5