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

Add routed tabs to the Settings page to prepare for Conversion Hosts settings #851

Merged
merged 6 commits into from
Jan 24, 2019

Conversation

mturley
Copy link
Contributor

@mturley mturley commented Jan 17, 2019

Part of the Conversion Hosts UI feature BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1693339

The old contents of Settings.js are in GeneralSettings.js now, and the new Settings.js is just a breadcrumb bar and tab container. The diff is a bit noisy because of this code being moved around.

You can see the tabs in action by turning hideConversionHostSettings to false (https://github.com/ManageIQ/manageiq-v2v/pull/851/files#diff-6c1adc83a5ff4719fa9ef50664bcf357R12), this flag is included so that we can merge this without exposing the unfinished ConversionHostsSettings component to master should we need to make a release.

u8guynzqss

@@ -16,20 +16,20 @@ describe('Settings component', () => {
servers: servers.resources
});

it('renders the settings page', () => {
const component = shallow(<Settings {...getBaseProps()} />);
it('renders the general settings page', () => {
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.

fetchServersAction(fetchServersUrl);
fetchSettingsAction(fetchSettingsUrl);
}
const Settings = props => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Settings has 62 lines of code (exceeds 25 allowed). Consider refactoring.

};

render() {
const { isFetchingServers, isFetchingSettings, isSavingSettings, savedSettings, settingsForm } = this.props;
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 5 locations. Consider refactoring.

}
}

GeneralSettings.propTypes = {
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.

patchSettingsAction(servers, settingsForm.values);
};

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 37 lines of code (exceeds 25 allowed). Consider refactoring.

Copy link
Contributor

@michaelkro michaelkro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something is off with our patternfly-react versions.

I see console errors and the tabs won't render for me unless I explicitly import Tab and change all the Tabs.Tab to just Tab.

I tried deleting my node_modules and reinstalling all my packages.

Out of curiosity, what version of patternfly-react is in your package.json?

EDIT: Just realized that I can just look for myself in your branch 🤦‍♂️

render() {
const { isFetchingServers, isFetchingSettings, isSavingSettings, savedSettings, settingsForm } = this.props;
const generalSettings = (
<GeneralSettings
Copy link
Contributor

@michaelkro michaelkro Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it would make sense, architecturally, to create a container component for GeneralSettings instead of passing these props down from Settings.

Also ok with putting this off until the actual need arises, but just want to avoid another <Overview /> situation, lol.

Do we anticipate any of these props to be shared across tabs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I guess I wasn't sure if we would need to use the generalized /api/settings actions and state outside of that first tab. I think you're right, I'll connect each tab to redux separately.

Copy link
Contributor

@michaelkro michaelkro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go! Only one small question regarding the component structure of the Settings page.

@miq-bot
Copy link
Member

miq-bot commented Jan 24, 2019

Checked commits mturley/manageiq-v2v@c488a74~...b700cdd 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. 🍰

path: 'settings/conversion_hosts',
component: Settings,
menu_item_id: 'menu_item_settings'
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure... we don't need an entry here for settings/general because by default, entering the settings route opens the general tab?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelkro That's correct. There's no /settings/general route, /settings and /settings/conversion_hosts are the routes to each tab.

Copy link
Contributor

@michaelkro michaelkro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Nicely done 🎉

@michaelkro michaelkro merged commit 339f3bf into ManageIQ:master Jan 24, 2019
@mturley mturley deleted the settings-tabs branch January 24, 2019 20:35
@mturley mturley added v1.1 bz Issues filed by QE or having a BZ and removed bugzilla needed labels Feb 27, 2019
@mturley mturley added v1.2 and removed v1.1 labels Mar 25, 2019
@mturley
Copy link
Contributor Author

mturley commented Apr 1, 2019

We will need this to be backported for https://bugzilla.redhat.com/show_bug.cgi?id=1688951.

simaishi pushed a commit that referenced this pull request Apr 5, 2019
Add routed tabs to the Settings page to prepare for Conversion Hosts settings

(cherry picked from commit 339f3bf)

https://bugzilla.redhat.com/show_bug.cgi?id=1696423
@simaishi
Copy link
Contributor

simaishi commented Apr 5, 2019

Hammer backport details:

$ git log -1
commit 75686ef4ca01d74f2c7af03c4c5bd2ef7d5d2b3b
Author: Michael Ro <mikerodev@gmail.com>
Date:   Thu Jan 24 15:31:21 2019 -0500

    Merge pull request #851 from mturley/settings-tabs
    
    Add routed tabs to the Settings page to prepare for Conversion Hosts settings
    
    (cherry picked from commit 339f3bf847c95c693f45af5abc107a0369f912ca)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1696423

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

Successfully merging this pull request may close these issues.

4 participants