Skip to content
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

Domains: Cleanup Domain Management data components #1235

Merged
merged 2 commits into from
Dec 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions client/components/data/domain-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ const MyComponent = React.createClass( {
render() {
return (
<DomainManagementData
component={ MyChildComponent }
context={ context }
productsList={ productsList }
sites={ sites }>
{ MyChildComponent }
</DomainManagementData>
sites={ sites } />
);
}
} );
Expand All @@ -51,12 +50,14 @@ The component expects to receive all listed props:

* `context` - a request context
* `productsList` - a collection of all the products users can have on WordPress.com
* `selectedDomainName` - the domain name currently selected (optional)
* `sites` - a list of user sites

The child component should receive processed props defined during the render:

* `context` - a request context
* `products` - a collection of all the products users can have on WordPress.com
* `selectedDomainName` - the domain name currently selected (optional)
* `selectedSite` - the site currently selected

As well as:
Expand Down
4 changes: 1 addition & 3 deletions client/components/data/domain-management/dns/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ module.exports = React.createClass( {
stores={ stores }
getStateFromStores={ getStateFromStores }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }>
{ this.props.children }
</StoreConnection>
selectedSite={ this.props.sites.getSelectedSite() } />
);
}
} );
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const EmailForwardingData = React.createClass( {
stores={ [ EmailForwardingStore ] }
getStateFromStores={ getStateFromStores }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }>
{ this.props.children }
</StoreConnection>
selectedSite={ this.props.sites.getSelectedSite() } />
);
}
} );
Expand Down
4 changes: 1 addition & 3 deletions client/components/data/domain-management/email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const MyComponent = React.createClass( {
productsList={ productsList }
selectedDomainName={ selectedDomainName }
context={ context }
sites={ sites }
user={ user.get() } />
sites={ sites } />
);
}
} );
Expand All @@ -39,7 +38,6 @@ The component expects to receive all listed props:
* `productsList` - a collection of all the products users can have on WordPress.com
* `selectedDomainName` - the domain name currently selected
* `sites` - a list of user sites
* `user` - a current user object

The child component should receive processed props defined during the render:

Expand Down
15 changes: 7 additions & 8 deletions client/components/data/domain-management/email/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ var StoreConnection = require( 'components/data/store-connection' ),
GoogleAppsUsersStore = require( 'lib/domains/google-apps-users/store' ),
CartStore = require( 'lib/cart/store' ),
observe = require( 'lib/mixins/data-observe' ),
upgradesActions = require( 'lib/upgrades/actions' );
upgradesActions = require( 'lib/upgrades/actions' ),
userFactory = require( 'lib/user' );

const user = userFactory();

var stores = [
DomainsStore,
Expand All @@ -34,7 +37,7 @@ function getStateFromStores( props ) {
googleAppsUsers: GoogleAppsUsersStore.getByDomainName( props.selectedDomainName ),
selectedDomainName: props.selectedDomainName,
selectedSite: props.selectedSite,
user: props.user
user: user.get()
};
}

Expand All @@ -46,8 +49,7 @@ module.exports = React.createClass( {
context: React.PropTypes.object.isRequired,
productsList: React.PropTypes.object.isRequired,
selectedDomainName: React.PropTypes.string,
sites: React.PropTypes.object.isRequired,
user: React.PropTypes.object.isRequired
sites: React.PropTypes.object.isRequired
},

mixins: [ observe( 'productsList' ) ],
Expand Down Expand Up @@ -79,10 +81,7 @@ module.exports = React.createClass( {
products={ this.props.productsList.get() }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }
context={ this.props.context }
user={ this.props.user }>
{ this.props.children }
</StoreConnection>
context={ this.props.context } />
);
}
} );
8 changes: 5 additions & 3 deletions client/components/data/domain-management/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function getStateFromStores( props ) {
context: props.context,
domains: ( props.selectedSite ? DomainsStore.getBySite( props.selectedSite.ID ) : null ),
products: props.products,
selectedDomainName: props.selectedDomainName,
selectedSite: props.selectedSite
};
}
Expand All @@ -33,6 +34,7 @@ module.exports = React.createClass( {
propTypes: {
context: React.PropTypes.object.isRequired,
productsList: React.PropTypes.object.isRequired,
selectedDomainName: React.PropTypes.string,
sites: React.PropTypes.object.isRequired
},

Expand All @@ -57,13 +59,13 @@ module.exports = React.createClass( {
render: function() {
return (
<StoreConnection
component={ this.props.component }
stores={ stores }
getStateFromStores={ getStateFromStores }
products={ this.props.productsList.get() }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }
context={ this.props.context }>
{ this.props.children }
</StoreConnection>
context={ this.props.context } />
);
}
} );
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ const NameserversData = React.createClass( {
stores={ stores }
getStateFromStores={ getStateFromStores }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }>
{ this.props.children }
</StoreConnection>
selectedSite={ this.props.sites.getSelectedSite() } />
);
}
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export default React.createClass( {
stores={ stores }
getStateFromStores={ getStateFromStores }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }>
{ this.props.children }
</StoreConnection>
selectedSite={ this.props.sites.getSelectedSite() } />
);
}
} );
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ module.exports = React.createClass( {
stores={ stores }
getStateFromStores={ getStateFromStores }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }>
{ this.props.children }
</StoreConnection>
selectedSite={ this.props.sites.getSelectedSite() } />
);
}
} );
4 changes: 1 addition & 3 deletions client/components/data/domain-management/whois/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ module.exports = React.createClass( {
products={ this.props.productsList.get() }
selectedDomainName={ this.props.selectedDomainName }
selectedSite={ this.props.sites.getSelectedSite() }
context={ this.props.context }>
{ this.props.children }
</StoreConnection>
context={ this.props.context } />
);
}
} );
28 changes: 9 additions & 19 deletions client/my-sites/upgrades/domain-management/controller.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ProductsList from 'lib/products-list';
import SiteRedirectData from 'components/data/domain-management/site-redirect';
import SitesList from 'lib/sites-list';
import TransferData from 'components/data/domain-management/transfer';
import User from 'lib/user';
import WhoisData from 'components/data/domain-management/whois';
import titleActions from 'lib/screen-title/actions';

Expand Down Expand Up @@ -56,11 +55,10 @@ module.exports = {

renderPage(
<DomainManagementData
component={ DomainManagement.List }
context={ context }
productsList={ productsList }
sites={ sites }>
<DomainManagement.List />
</DomainManagementData>
sites={ sites } />
);
},

Expand All @@ -77,13 +75,11 @@ module.exports = {

renderPage(
<DomainManagementData
component={ DomainManagement.Edit }
context={ context }
productsList={ productsList }
sites={ sites }>
<DomainManagement.Edit
selectedSite={ sites.getSelectedSite() }
selectedDomainName={ context.params.domain } />
</DomainManagementData>
selectedDomainName={ context.params.domain }
sites={ sites } />
);
},

Expand Down Expand Up @@ -150,8 +146,6 @@ module.exports = {
},

domainManagementEmail( context ) {
const user = new User();

setTitle(
i18n.translate( 'Domain Management › Email' ),
context
Expand All @@ -168,8 +162,7 @@ module.exports = {
productsList={ productsList }
selectedDomainName={ context.params.domain }
context={ context }
sites={ sites }
user={ user.get() } />
sites={ sites } />
);
},

Expand Down Expand Up @@ -263,14 +256,11 @@ module.exports = {

renderPage(
<DomainManagementData
component={ DomainManagement.AddGoogleApps }
context={ context }
productsList={ productsList }
sites={ sites }>
<DomainManagement.AddGoogleApps
productsList={ productsList }
selectedSite={ sites.getSelectedSite() }
selectedDomainName={ context.params.domain } />
</DomainManagementData>
selectedDomainName={ context.params.domain }
sites={ sites } />
);
},

Expand Down