Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Add a component for creating baremetal hosts #292

Merged
merged 1 commit into from
Apr 1, 2019

Conversation

honza
Copy link
Contributor

@honza honza commented Mar 26, 2019

@coveralls
Copy link

coveralls commented Mar 26, 2019

Pull Request Test Coverage Report for Build 1185

  • 6 of 17 (35.29%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 87.714%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/CreateBaremetalHostDialog/CreateBaremetalHostDialog.js 4 15 26.67%
Totals Coverage Status
Change from base Build 1157: -0.2%
Covered Lines: 2986
Relevant Lines: 3264

💛 - Coveralls

@@ -504,3 +512,10 @@ const getDefaultInterface = (vm, template) => {
const defaultInterfaceName = getTemplateAnnotations(template, ANNOTATION_DEFAULT_NETWORK);
return getDevice(vm, 'interfaces', defaultInterfaceName);
};

export const createBaremetalHost = async (k8sCreate, data) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use object deconstruction here

Copy link
Contributor

Choose a reason for hiding this comment

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

Please create a new file for this. It is crowded here already. I suggest k8s/requests/host/.. or something similar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

},
};

export class CreateBaremetalHost extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think adding a Dialog to the name would make it more clear what to expect from this component

const namespace = this.props.selectedNamespace.metadata.name;
const secretName = `${data.name.value}-secret`;

const secret = {
Copy link
Contributor

Choose a reason for hiding this comment

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

please can you move creation of these objects to createBaremetalHost function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

</Modal.Header>
<Modal.Body>
<Col sm={12}>
<p style={{ marginTop: '20px' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

please no inline styles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

isSubmitting: true,
}));
const data = this.state.form.value;
const namespace = this.props.selectedNamespace.metadata.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use getName from selectors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😍

@honza honza force-pushed the create-baremetal-host branch from 4c0463d to f760d7e Compare March 27, 2019 00:42
@honza
Copy link
Contributor Author

honza commented Mar 27, 2019

Great points, thanks

const namespace = getName(selectedNamespace);
const secretName = `${formData.name.value}-secret`;

const secret = {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to split creation of each object into a function (e.g. getSecret) for better readability

@honza honza force-pushed the create-baremetal-host branch from f760d7e to b76484e Compare March 27, 2019 18:02
@honza honza force-pushed the create-baremetal-host branch 2 times, most recently from 01ea7f4 to d3f6e95 Compare April 1, 2019 11:19
@honza honza force-pushed the create-baremetal-host branch from d3f6e95 to 410ce70 Compare April 1, 2019 14:39
@honza honza force-pushed the create-baremetal-host branch from 410ce70 to 6394b39 Compare April 1, 2019 14:51
@rawagner rawagner merged commit 4c7b8c2 into kubevirt:master Apr 1, 2019
@knowncitizen
Copy link

Nice

@honza honza deleted the create-baremetal-host branch April 1, 2019 14:56
cloudbehl pushed a commit to gnehapk/web-ui-components that referenced this pull request Apr 1, 2019
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.

7 participants