New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mgr/dashboard: Refactoring of DeletionModalComponent
#24005
mgr/dashboard: Refactoring of DeletionModalComponent
#24005
Conversation
35dc030
to
6992c40
Compare
6992c40
to
26dac35
Compare
jenkins retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to prettify your code to get all tests to pass.
Besides that good job 👍
modalRef: this.modalRef | ||
this.modalRef = this.modalService.show(DeletionModalComponent, { | ||
initialState: { | ||
metaType: 'Role', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actionDescription
is missing here which results in a broken modal and that the following error is thrown in console No action description defined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find
26dac35
to
05fd3d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring 👍
05fd3d5
to
00aa518
Compare
Due to recently merged changes I had to adapt the code. We'll now have two variables for describing what is being confirmed: One variable describes the action ( I'll be using this new capability of the The questions that came up are:
|
00aa518
to
f6dd8ad
Compare
PR has been updated, please review again.
What about introducing a customizable |
@votdev We already have a |
@p-na IMHO it's fine to rename it if it will be used differently in a not so distant future. The rest looks good to me 👍 |
@@ -52,7 +49,6 @@ | |||
|
|||
<ng-template #deletionHeading> | |||
<ng-container i18n> | |||
Delete | |||
{{ actionDescription | titlecase }} {{ itemDescription | titlecase }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use the titlecase pipe for itemDescription
, otherwise RBD snapshot
will be transformed to Rbd Snapshot
.
- Simpler variable names: Examples: - `actionDescription` and `itemDescription` instead of `metaType` - `bodyTemplate` instead of `description` - `validationPattern` instead of `pattern` Some of these variable names have been generalized to ease the unification/generalization of dialog components: - `submitAction` instead of `deletionMethod` - Removed unique `setUp` method. Benefits: - Creation of the component is done as intended by the developers of the `ngx-boostrap` package and as expected by developers which use the package. The `setUp` method does not have to be called anymore on the `DeletionModalComponent` exclusively but instead the component is instantiated as all other modals. Property assignment on the instantiated object isn't handled by the `setUp` method anymore but by the `modalService`. - With the removal of the `setUp` method, some tests could be removed as well. - No need to pass the reference of the created modal to the modal manually. Preserved: - The provided check within the `setUp` method, which checked if the component had been correctly instantiated, has been moved to the `ngOnInit` method of the component. Signed-off-by: Patrick Nawracay <pnawracay@suse.com>
Signed-off-by: Patrick Nawracay <pnawracay@suse.com>
f6dd8ad
to
f95f231
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Simpler variable names:
Examples:
actionDescription
instead ofmetaType
bodyTemplate
instead ofdescription
validationPattern
instead ofpattern
Some of these variable names have been generalized to ease the
unification/generalization of dialog components:
submitAction
instead ofdeletionMethod
Removed unique
setUp
method.Benefits:
Creation of the component is done as intended by the developers of
the
ngx-boostrap
package and as expected by developers which usethe package. The
setUp
method does not have to be called anymoreon the
DeletionModalComponent
exclusively but instead thecomponent is instantiated as all other modals. Property assignment
on the instantiated object isn't handled by the
setUp
methodanymore but by the
modalService
.With the removal of the
setUp
method, some tests could beremoved as well.
No need to pass the reference of the created modal to the modal
manually.
Preserved:
setUp
method, which checked if thecomponent had been correctly instantiated, has been moved to the
ngOnInit
method of the component.Signed-off-by: Patrick Nawracay pnawracay@suse.com