Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

[#641] Add EditPlanNameModal for editing name and description of completed plans #663

Merged
merged 3 commits into from
Oct 4, 2018

Conversation

mturley
Copy link
Contributor

@mturley mturley commented Sep 24, 2018

Closes #641.
Depends on ManageIQ/manageiq#17989.

fwqwyj1f9e

});
};

render() {
Copy link

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
Copy link

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
Copy link

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 {
Copy link

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`:
Copy link

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.


class EditPlanNameModal extends React.Component {
onSubmit = () => {
const {
Copy link

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>
Copy link

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 => {
Copy link

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">
Copy link

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.

@miq-bot
Copy link
Member

miq-bot commented Sep 26, 2018

This pull request is not mergeable. Please rebase and repush.

@mturley mturley changed the title Add EditPlanNameModal for editing name and description of completed plans [#641] Add EditPlanNameModal for editing name and description of completed plans Sep 26, 2018

class EditPlanNameModal extends React.Component {
onSubmit = () => {
const {
Copy link

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.

@miq-bot
Copy link
Member

miq-bot commented Sep 27, 2018

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
0 files checked, 0 offenses detected
Everything looks fine. 🍰

@AparnaKarve
Copy link
Contributor

@mturley would it be possible to display the "Plan Name already exists" alert at top of the modal?

@mturley
Copy link
Contributor Author

mturley commented Oct 3, 2018

@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?

@vconzola
Copy link

vconzola commented Oct 4, 2018

@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.

@vconzola
Copy link

vconzola commented Oct 4, 2018

@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() {
Copy link

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`:
Copy link

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.

@mturley
Copy link
Contributor Author

mturley commented Oct 4, 2018

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.")

screenshot 2018-10-04 14 28 44

@mturley mturley force-pushed the 641-edit-plan-name branch from 12d229d to 1a24622 Compare October 4, 2018 18:33
});
};

render() {
Copy link

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.' };
Copy link
Contributor

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.')

@AparnaKarve
Copy link
Contributor

@mturley Can you make that one little gettext change above?
Everything else looks good!

@mturley mturley force-pushed the 641-edit-plan-name branch from 1a24622 to 1b79249 Compare October 4, 2018 21:07
@mturley
Copy link
Contributor Author

mturley commented Oct 4, 2018

Whoops, thanks @AparnaKarve! Done.

Copy link
Contributor

@AparnaKarve AparnaKarve left a 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!!

@AparnaKarve AparnaKarve merged commit 424c024 into ManageIQ:master Oct 4, 2018
@mturley mturley deleted the 641-edit-plan-name branch October 4, 2018 21:19
simaishi pushed a commit that referenced this pull request Oct 5, 2018
[#641] Add EditPlanNameModal for editing name and description of completed plans

(cherry picked from commit 424c024)
@simaishi
Copy link
Contributor

simaishi commented Oct 5, 2018

Hammer backport details:

$ git log -1
commit d7ade0ec3ed0f7c5ca0a8af5e74bdf9897a2ac97
Author: Aparna Karve <[email protected]>
Date:   Thu Oct 4 14:13:23 2018 -0700

    Merge pull request #663 from mturley/641-edit-plan-name
    
    [#641] Add EditPlanNameModal for editing name and description of completed plans
    
    (cherry picked from commit 424c024e395dd76e0d891b7a6694e184bde3367c)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants