-
Notifications
You must be signed in to change notification settings - Fork 30
Add a component for creating baremetal hosts #292
Conversation
Pull Request Test Coverage Report for Build 1185
💛 - Coveralls |
src/k8s/request.js
Outdated
@@ -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) => { |
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.
you can use object deconstruction here
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.
Please create a new file for this. It is crowded here already. I suggest k8s/requests/host/..
or something similar
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.
Done
}, | ||
}; | ||
|
||
export class CreateBaremetalHost extends React.Component { |
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.
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 = { |
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.
please can you move creation of these objects to createBaremetalHost
function?
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.
Done
</Modal.Header> | ||
<Modal.Body> | ||
<Col sm={12}> | ||
<p style={{ marginTop: '20px' }}> |
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.
please no inline styles
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.
Done
isSubmitting: true, | ||
})); | ||
const data = this.state.form.value; | ||
const namespace = this.props.selectedNamespace.metadata.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.
you can use getName
from selectors
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.
😍
4c0463d
to
f760d7e
Compare
Great points, thanks |
src/components/CreateBaremetalHostDialog/CreateBaremetalHostDialog.js
Outdated
Show resolved
Hide resolved
src/k8s/requests/hosts/index.js
Outdated
const namespace = getName(selectedNamespace); | ||
const secretName = `${formData.name.value}-secret`; | ||
|
||
const secret = { |
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.
would be nice to split creation of each object into a function (e.g. getSecret
) for better readability
src/components/CreateBaremetalHostDialog/CreateBaremetalHostDialog.js
Outdated
Show resolved
Hide resolved
src/components/CreateBaremetalHostDialog/CreateBaremetalHostDialog.js
Outdated
Show resolved
Hide resolved
f760d7e
to
b76484e
Compare
src/components/CreateBaremetalHostDialog/CreateBaremetalHostDialog.js
Outdated
Show resolved
Hide resolved
01ea7f4
to
d3f6e95
Compare
d3f6e95
to
410ce70
Compare
410ce70
to
6394b39
Compare
Nice |
cc @knowncitizen @jtomasek @flofuchs