-
Notifications
You must be signed in to change notification settings - Fork 30
Create VmDetails component #135
Create VmDetails component #135
Conversation
</dd> | ||
|
||
<dt>Operating System</dt> | ||
<dd>{get(vm, 'metadata.annotations["os.template.cnv.io"]', DASHES)}</dd> |
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.
can you extract this to https://github.com/kubevirt/web-ui-components/blob/master/src/utils/selectors.js ? Same for Workload Profile and Templates.
I also moved the OS/Flavor/Workload from annotations to labels just today. So its under vm/metadata.labels not vm/metadata.annotations
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.
Can you please also show the OS icon? In common templates it is defined as iconClass
which points to standard openshift icons defined here.
Pleas note this icon might not be defined in the template so you can not rely on it 100%, but in all standard templates it should be there.
@@ -0,0 +1,5 @@ | |||
// TODO Add valid tests |
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.
Agree :-)
0a5caf1
to
3d3d990
Compare
Pull Request Test Coverage Report for Build 387
💛 - Coveralls |
Pull Request Test Coverage Report for Build 534
💛 - Coveralls |
I haven't been able to fully test all the changes due to my environment malfunctioning, but I wanted to push it to give you guys a chance to run it for yourself if you'd like. I still have a few more changes coming in addition to the tests. It builds fine for me, but there is a test failure that seems to be unrelated as it also occurs on master. |
3d3d990
to
97312bb
Compare
97312bb
to
e235245
Compare
e235245
to
18f01bc
Compare
This commit makes changes based on review feedback, including the following items: - Use VmStatus instead of StateColumn - Extract selectors - Use cloudInitData function - Remove dashes when no description is provided - Add CPU and Memory to Flavor field - Organize mocks for the VmDetails fixture
18f01bc
to
657b8e3
Compare
25e3491
to
87c23c4
Compare
1fa2e21
to
9f50f67
Compare
9f50f67
to
c748bd8
Compare
export const getLabelValue = (vm, label) => { | ||
let value; | ||
if (has(vm, 'metadata.labels')) { | ||
forEach(Object.keys(vm.metadata.labels), key => { |
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.
maybe using an array find function would be more readable here
const ipAddresses = getVmIpAddresses(vmi); | ||
|
||
return ( | ||
<Fragment> |
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 don't really see a reason for using Fragment here
|
||
const DASHES = '---'; | ||
|
||
export const getVmIpAddresses = vmi => { |
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.
maybe it would be better to move this function into selectors? + also the tests
export const getVmIpAddresses = vmi => { | ||
let ipAddresses = []; | ||
if (has(vmi, 'status.interfaces')) { | ||
ipAddresses = vmi.status.interfaces.map(iface => iface.ipAddress); |
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 would prefer this as a ternary condition, but there is no real need for this change.
const memory = getMemory(vm); | ||
let resourceStr = ''; | ||
resourceStr += cpu ? `${cpu} CPU` : ''; | ||
resourceStr += memory ? `, ${memory} Memory` : ''; |
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.
this will build a string starting with ,
if there is no cpu by any chance
<div className="co-m-pane__body"> | ||
<h1 className="co-m-pane__heading">Virtual Machine Overview</h1> | ||
<div> | ||
<div className="row"> |
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.
We could use pf-react (bootstrap) Row
and Col
components here. I personally do not mind this approach but we are already using Col
in this project, so I guess it would be better to be consistent.
</dl> | ||
</div> | ||
|
||
{/* Details columns */} |
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 guess it would be more useful to use ids like this for the columns and the descriptiveness would be kept.
<dd>{launcherPod ? launcherPod.spec.hostname : DASHES}</dd> | ||
|
||
<dt>Namespace</dt> | ||
<dd>{NamespaceResourceLink}</dd> |
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.
this component sharing is really ugly, but I guess we don't have a choice here.
}, | ||
}; | ||
|
||
export default { |
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.
We could expose more fixtures (with more colorful set of data) to the cosmos. cloudInitTestVm would be nice
This PR creates a VmDetails component for the VM details overview page.