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

Render VmDetails with deleted template curreclty. #287

Merged

Conversation

yaacov
Copy link
Contributor

@yaacov yaacov commented Mar 24, 2019

Description
When we want to render VmDetails with missing VmTemplate we get a warning that we can not find the template. But It is OK to delete a template of an existing vm, the view should silently fall back to vm's current resources.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1685393

Screenshots

When template is missing, show warning triangle instead of an error:

Peek 2019-03-31 14-35

Replace drop-down with a label when only one flavor option is available:

Peek 2019-03-31 16-34

Add an optional template resource link method to vmDetails:

Peek 2019-04-01 11-43

Show labels for CPU and Memory in flavor form:

Peek 2019-04-01 14-46

@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch from 1c0bf32 to f243916 Compare March 24, 2019 18:04
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1088

  • 11 of 11 (100.0%) changed or added relevant lines in 2 files are covered.
  • 15 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.2%) to 86.957%

Files with Coverage Reduction New Missed Lines %
src/components/Details/VmDetails/VmDetails.js 4 84.5%
src/components/Details/VmTemplateDetails/VmTemplateDetails.js 4 75.9%
src/components/Details/Flavor/Flavor.js 7 76.0%
Totals Coverage Status
Change from base Build 875: -0.2%
Covered Lines: 2829
Relevant Lines: 3119

💛 - Coveralls

@coveralls
Copy link

coveralls commented Mar 24, 2019

Pull Request Test Coverage Report for Build 1193

  • 38 of 38 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 87.855%

Totals Coverage Status
Change from base Build 968: 0.1%
Covered Lines: 3010
Relevant Lines: 3285

💛 - Coveralls

@yaacov
Copy link
Contributor Author

yaacov commented Mar 25, 2019

wip until fixing coverage ...

@yaacov yaacov changed the title Render VmDetails with deleted template curreclty. [WIP]Render VmDetails with deleted template curreclty. Mar 25, 2019
if (this.state.editing && !this.isVmOff(vm, launcherPod, importerPods, migration)) {
this.setEditing(false);
}

// Check template, if template is missing, update view.
if (getVmTemplate(vm) != null && this.state.templateError === PENDING_STR) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This component will most likely be rerendered multiple times, but strictly speaking componentDidUpdate will not be called for initial render.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks ! will fix that.


// Check template, if template is missing, update view.
if (getVmTemplate(vm) != null && this.state.templateError === PENDING_STR) {
retrieveVmTemplate(k8sGet, vm)
Copy link
Contributor

Choose a reason for hiding this comment

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

retrieveVmTemplate is already called for the flavor. Please call this method only once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@@ -15,6 +15,8 @@ import { getId } from '../../../../selectors';

const testVmDetails = (vm, otherProps) => <VmDetails {...VmDetailsFixture[0].props} vm={vm} {...otherProps} />;

const flushAllPromises = () => new Promise(resolve => setImmediate(resolve));
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, thanks ❗ 👍

@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch from 88af55e to a9e0a26 Compare March 25, 2019 10:50
@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch 2 times, most recently from 71bde61 to 3748b64 Compare March 25, 2019 11:28
@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch 2 times, most recently from 7de0d06 to 96e3563 Compare March 25, 2019 11:58
@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch 3 times, most recently from b0942e7 to 93dd926 Compare March 25, 2019 12:13
@yaacov yaacov changed the title [WIP]Render VmDetails with deleted template curreclty. Render VmDetails with deleted template curreclty. Mar 25, 2019
@yaacov
Copy link
Contributor Author

yaacov commented Mar 25, 2019

@rawagner @suomiy please re-review.

I'v removed the part that indicate missing template in the vm details view, because it is not part of the BZ, and may be implemented better in a separate PR.

@rawagner
Copy link
Contributor

@yaacov I wonder if its okay to not show anything in UI if we cannot load the template ? We use the loaded template to get possible flavors when editing. Lets consider this flow:

  1. I will create VM from template with Small flavor
  2. I will delete the template (or somebody else)
  3. I will go to VM details - I can see that flavor is Small
  4. I will go to Edit mode - flavor dropdown now shows only Custom Flavor and I might get confused why is that so.

@matthewcarleton WDYT ?

@@ -145,7 +145,10 @@ export class VmTemplateDetails extends React.Component {
const { vmTemplate, dataVolumes, NamespaceResourceLink, LoadingComponent } = this.props;
const id = getId(vmTemplate);
const vm = selectVm(vmTemplate.objects);
const baseTemplateLabels = getVmTemplate(vmTemplate);
const getTemplateDisplayName = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant, can we replace the getVmTemplate method? So it can be also reused in vmDetails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's ok now 💮

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

can we add some margin to the custom label so it appears similar to the dropdown ?

.kubevirt-flavor__label {
   margin-bottom ...
}

@suomiy WDYT ?

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

@suomiy @matthewcarleton do we need some labels to the inputs in edit mode ?

Peek 2019-04-01 11-43

we curently have:

[ flavor drop down ]
[ number input     ]
[ number input     ]

should it have labels in edit mode, e.g.

[ flavor drop down        ]
Memory [ number input     ]
CPU    [ number input     ]

WDYT ?

b - Does <InlineEdit formFields has some props for that ?

@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch from 7c51b51 to 43c9da8 Compare April 1, 2019 10:56
@atiratree
Copy link
Contributor

.kubevirt-flavor__label {
  margin-bottom ...
}

@suomiy WDYT ?

yup, I would make the margin similar to the dropdown

[ flavor drop down ]
Memory [ number input ]
CPU [ number input ]

WDYT ?

b - Does <InlineEdit formFields has some props for that ?

+1, that is a good remark. I guess it has to be some regression with InlineFormFactory, because It already has a title. Can you look at it?

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

I guess it has to be some regression with InlineFormFactory, because It already has a title. Can you look at it?

Sure 👍

const id = getId(vmTemplate);
const vm = selectVm(vmTemplate.objects);
const baseTemplate = getVmTemplate(vmTemplate);
const baseTemplateLabels = getTemplateDisplayName(getVmTemplate(vmTemplate));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: variable name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry ... baseTemplateName ?

Copy link
Contributor

Choose a reason for hiding this comment

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

np, yup could be or baseTemplateDisplayName

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

show labels in inline form:

Peek 2019-04-01 14-46

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

@suomiy this is nearing the end 🎉 🎈 , should I squash, or leave separate commits for easier review ?

@yaacov yaacov changed the title [WIP] Render VmDetails with deleted template curreclty. Render VmDetails with deleted template curreclty. Apr 1, 2019
@matthewcarleton
Copy link
Contributor

@yaacov this looks great, thanks! One question, what happens when the available CPU/Memory is exceeded?

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

what happens when the available CPU/Memory is exceeded?

@matthewcarleton

TL;DR - I do not know.

IFAIK we do not have the quota/total values to validate the form ... @suomiy do you know something about this ?

p.s.
What I think happen when values are bad is that openshift will try to execute and fail after some tries ... @suomiy - do you know something about that ?

@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch from 1dfe303 to f252b77 Compare April 1, 2019 15:21
…ng icon on template label instead.

Ref: BZ1685393

1- Shaw warning triangle when template is missing.
2- Replace dropdown with div when only one option avaliable.
3- Add link to template resource.
4- Add deleted template test to vmTemplateDetails.
5- Show labels in the inline flavors edit form.
6- Add css to flavor label.
@yaacov yaacov force-pushed the render-vm-detail-with-deleted-template branch from f252b77 to 5d3a01c Compare April 1, 2019 15:39
@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

@suomiy @rawagner please review ... I think it's ready 🍻

@atiratree
Copy link
Contributor

what happens when the available CPU/Memory is exceeded?

@matthewcarleton

TL;DR - I do not know.

IFAIK we do not have the quota/total values to validate the form ... @suomiy do you know > something about this ?

p.s.
What I think happen when values are bad is that openshift will try to execute and fail after >some tries ... @suomiy - do you know something about that ?

Currently, we do not have a way to know the quota AFAIK. The request will go ok, just the VM will fail with an error the next time you try to start it.

@atiratree
Copy link
Contributor

@suomiy this is nearing the end tada balloon , should I squash, or leave separate commits for easier review ?

don't worry about that. It will be squashed on merge

@atiratree
Copy link
Contributor

.kubevirt-flavor__label {
margin-bottom ...
}

is this present in this PR?

@yaacov
Copy link
Contributor Author

yaacov commented Apr 1, 2019

.kubevirt-flavor__label {
margin-bottom ...
}

is this present in this PR?

Aaa... forgot to do git add 💯

@matthewcarleton
Copy link
Contributor

@suomiy ah ok. Ya it would be a nicer experience for sure to know what the limit is at the time. Would it be possible to explore adding that feature (in another PR :) )

@atiratree
Copy link
Contributor

Would it be possible to explore adding that feature (in another PR :) )

I think this should be explored on the backend. Doesn't seem like we can do much about it here in the UI.

@jelkosz Do you have some additional information on this issue?

@atiratree
Copy link
Contributor

looks good, merging

@atiratree atiratree merged commit c694293 into kubevirt:master Apr 2, 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.

6 participants