-
Notifications
You must be signed in to change notification settings - Fork 42
[#641] Add EditPlanNameModal for editing name and description of completed plans #663
Conversation
}); | ||
}; | ||
|
||
render() { |
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.
Function render
has 71 lines of code (exceeds 25 allowed). Consider refactoring.
|
||
const formBody = ( | ||
<Form horizontal> | ||
<Field |
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.
Identical blocks of code found in 3 locations. Consider refactoring.
}) | ||
]} | ||
/> | ||
<Field |
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.
Identical blocks of code found in 3 locations. Consider refactoring.
}; | ||
|
||
render() { | ||
const { |
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.
Similar blocks of code found in 11 locations. Consider refactoring.
.set('savingPlan', false) | ||
.set('savingPlanRejected', false) | ||
.set('savingPlanError', null); | ||
case `${V2V_POST_EDIT_PLAN_TITLE}_REJECTED`: |
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.
Similar blocks of code found in 6 locations. Consider refactoring.
7021d00
to
de03401
Compare
|
||
class EditPlanNameModal extends React.Component { | ||
onSubmit = () => { | ||
const { |
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.
Similar blocks of code found in 4 locations. Consider refactoring.
|
||
return ( | ||
<Modal show={editPlanNameModalVisible} onHide={hideEditPlanNameModalAction}> | ||
<Modal.Header> |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
|
||
export { fetchTransformationPlansAction } from '../../OverviewActions'; | ||
|
||
export const showAlertAction = (alertText, alertType = 'error') => dispatch => { |
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.
Similar blocks of code found in 3 locations. Consider refactoring.
</Modal.Header> | ||
<Modal.Body> | ||
{!savingPlan ? formBody : spinner} | ||
<div className="modal-alert"> |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
This pull request is not mergeable. Please rebase and repush. |
e4b8b8c
to
573db0d
Compare
|
||
class EditPlanNameModal extends React.Component { | ||
onSubmit = () => { | ||
const { |
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.
Similar blocks of code found in 6 locations. Consider refactoring.
Checked commits mturley/manageiq-v2v@7d3ec5a~...573db0d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@mturley would it be possible to display the "Plan Name already exists" alert at top of the modal? |
@AparnaKarve I could, but I didn't want to have to add a bunch of whitespace above the name field or have the contents move around vertically when the alert is shown. In the Plan Wizard we have the wizard steps as a natural margin to lay this alert over, but displaying it at the top as-is would cover up the name field. @vconzola, I'm curious about your thoughts on this. Should we leave the alert at the bottom of the modal, or add sufficient margin above the name field so it can appear at the top? |
@mturley @AparnaKarve I'm not sure we need the inline message at all. I think the text below the input text box is probably sufficient if you added "plan name already exists" after "Enter a unique name". But let me check with some other designers. Also, drop the "Please" at the beginning. We're not supposed to use "please" in our UIs. |
@mturley OK, here's the deal. Inline notification is only needed for server side validation of form information. In our case, we're validating as information is entered into the field so a field error message only is appropriate. So you can do what I said above: "Plan name already exists. Enter a unique name." |
}); | ||
}; | ||
|
||
render() { |
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.
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
.set('savingPlan', false) | ||
.set('savingPlanRejected', false) | ||
.set('savingPlanError', null); | ||
case `${V2V_POST_EDIT_PLAN_NAME}_REJECTED`: |
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.
Similar blocks of code found in 6 locations. Consider refactoring.
This one should now be all set. The "Please" was already in place for the two wizards, and I was reusing the validation helper from the plan wizard where it was defined, so I went ahead and updated the text for the mapping wizard too. ("Plan name already exists. Enter a unique name." and "Mapping name already exists. Enter a unique name.") |
12d229d
to
1a24622
Compare
}); | ||
}; | ||
|
||
render() { |
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.
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring.
props.showAlertAction(sprintf(__('Name %s already exists'), newPlanName)); | ||
const error = { name: 'Please enter a unique name' }; | ||
if (props.showAlertAction) props.showAlertAction(sprintf(__('Name %s already exists'), newPlanName)); | ||
const error = { name: 'Plan name already exists. Enter a unique name.' }; |
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.
__('Plan name already exists. Enter a unique name.')
@mturley Can you make that one little gettext change above? |
1a24622
to
1b79249
Compare
Whoops, thanks @AparnaKarve! Done. |
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.
Thanks @mturley - this looks great!!
Hammer backport details:
|
Closes #641.
Depends on ManageIQ/manageiq#17989.