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

kubernetes: virtual machines - add Vm Detail page #9466

Closed
wants to merge 5 commits into from

Conversation

atiratree
Copy link
Contributor

@atiratree atiratree commented Jun 21, 2018

First stage of #8948

  • adds Vm Detail page and navigation between vms and vm
  • this PR still uses old terminology (vm/ovm), but it will be changed in the next stages

I also created DetailPage component for easier creation of pages like this (will be used at least for Vm/Vm Instance). Not sure if I should split the component to another PR?

Todo:

  • polish ui
  • fix tests (mainly ids)
  • add tests - basic use case + navigation

@atiratree
Copy link
Contributor Author

Screenshots:

Navigation
  • Click on vm in vms list

screenshot from 2018-06-21 16-21-58

Vm Detail

screenshot from 2018-06-21 15-52-46

404 page

not-exists

@atiratree
Copy link
Contributor Author

atiratree commented Jun 21, 2018

Few notes about the design:

screenshot-localhost-9090-2018 06 21-16-30-17

  1. I am showing the icon of vm (will be probably the same for vm/vm instance) and "namespace:name". Not sure if I should put the namespace somewhere else
  2. This is the link to go back to the vm list. It is consistent with kubernetes plugin. We could also show a path there
  3. There will be Vm / Vm Instance depending on the type here (old terminology is Offline Vm / Vm)
  4. I also put state there. Please let me know if I should put it somewhere else.

@garrett @andreasn @beanh66

@atiratree
Copy link
Contributor Author

+ the vm details are accessible at /kubernetes#/vms/$VM_UID

@atiratree atiratree force-pushed the vm-detail branch 2 times, most recently from 375f208 to edf4a30 Compare June 21, 2018 15:10
@atiratree
Copy link
Contributor Author

atiratree commented Jun 21, 2018

+ there are two React 16 TODOs in lib/cockpit-components-detail-page.jsx - #9263

@atiratree atiratree force-pushed the vm-detail branch 10 times, most recently from a599129 to b925116 Compare June 21, 2018 16:21
@mykaul
Copy link

mykaul commented Jun 21, 2018

VM, not Vm.
VMs, not Vms.

I'm also unsure about the title 'Vm' instead of just 'Details' ?

@beanh66
Copy link

beanh66 commented Jun 21, 2018

@suomiy For #2 in your list, can we show that as breadcrumbs instead?

@atiratree
Copy link
Contributor Author

VM, not Vm.
VMs, not Vms.

thanks

I'm also unsure about the title 'Vm' instead of just 'Details' ?

Could be 'Details' but we have to indicate the difference between 'VM' and 'VM Instance' somehow, because they will have similar pages.

For #2 in your list, can we show that as breadcrumbs instead?

I can add breadcrumbs. But all of the other pages in Kubernetes plugin are done this way. I am not sure if I should keep it for consistency simpler like this.

There is also another problem:

  • breadcrumbs for VM Instances > Vm Instance will not have VM Instances page because it will redirect directly into the vms.
  • but it will have it's own path /kubernetes#/vminstances/$VM_INSTANCE_UID

@andreasn
Copy link
Contributor

I can add breadcrumbs. But all of the other pages in Kubernetes plugin are done this way. I am not sure if I should keep it for consistency simpler like this.

I agree with this. It's important to keep consistency across pages. We can revisit the current pattern later if it performs badly in usability tests, and if so, we can change all the navigation across all pages in the kubernetes plugin to work like that. But for now, I would prefer if the current behaviour is kept.

@beanh66
Copy link

beanh66 commented Jun 25, 2018

@suomiy @andreasn Got it, thanks for the explanation! That makes sense to me, keeping consistent behavior in the product. 👍

@atiratree
Copy link
Contributor Author

fixed Vm -> 'VM'

<div>
<DetailPage>
{header}
<DetailPageRow title={cockpit.format(_("Vm with uid $0 does not exist."), vmUid)} idPrefix={'vm-not-found'} />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: uid should be in CAPITAL

Copy link
Contributor

Choose a reason for hiding this comment

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

fine for a follow-up

@@ -66,7 +66,7 @@ const prepareDiskData = (disk, vm, pvs, idPrefix) => {
if (pv) {
bus = _("iSCSI");
onNavigate = () => cockpit.jump(`/kubernetes#/volumes/${pv.metadata.name}`);
} else if (disk.disk.bus) {
} else if (disk.disk && disk.disk) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this what was intended?

* @param {kubeMethods} kubeMethods
* @param {KubeRequest} KubeRequest
*/
function init($scope, $routeParams, kubeLoader, kubeSelect, kubeMethods, KubeRequest) {
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 we can share can between these two entry points even 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.

What do you suggest? Unifying the id of the root element and passing the component to render? I do not see other improvements otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

After offline discussion, this is nothing critical. I'm fine with this approach.

@mareklibra
Copy link
Contributor

Important to note: this should work for kubevirt >= 0.6.0
Oncoming 0.7.0 (so far just pre-release alpha.3 is out) will change terminology in k8s objects, means code introduced by this PR will need to be adjusted.

I've tested this PR against kubevirt 0.6.0.

Might be my misunderstanding, but
oc get offlinevirtualmachine.kubevirt.io shows 2 OVMs but they are not listed within /kubernetes#/vms view . Just VM Instances are listed there.

I'm not quite sure if recent 2 entrypoints are good solution. If the user navigates between list and detail, redux store is reinitialized so loosing its state. There's so far no issue with that but I can imagine use-cases where this might be serious issue.

@atiratree
Copy link
Contributor Author

  • changed navigation from "/kubernetes#/vms/$VM_UID" to "/kubernetes#/vms/$VM_NAMESPACE/$VM_NAME" to match other kubernetes pages' behaviour. Also it behaves better when restarting vm (vm can have different UID) . - using old terminology

  • added tests

@mareklibra please can you rereview?

@atiratree atiratree force-pushed the vm-detail branch 4 times, most recently from 20da1ed to d76ee4e Compare July 17, 2018 15:25
@atiratree
Copy link
Contributor Author

It seems I am not able to re-trigger the tests with bots/tests-trigger. Tests are triggered successfully when I push the changes.

./bots/tests-trigger 9466

verify/ubuntu-1604: triggering on pull request 9466
statuses/d76ee4e842ff4ca840f07c6c88273c5d68ded607
{"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/statuses/#create-a-status"}
Traceback (most recent call last):
  File "./bots/tests-trigger", line 74, in <module>
    sys.exit(main())
  File "./bots/tests-trigger", line 71, in main
    return trigger_pull(api, opts)
  File "./bots/tests-trigger", line 55, in trigger_pull
    api.post("statuses/" + revision, changes)
  File "/home/ansy/Projects/IdeaProjects/cockpit/bots/task/github.py", line 201, in post
    raise RuntimeError("GitHub API problem: {0}".format(response['reason'] or status))
RuntimeError: GitHub API problem: Not Found

Does somebody have a clue what might be a problem?

@atiratree
Copy link
Contributor Author

i also have refreshed token in ~/.config/github-token

@martinpitt @stefwalter

@martinpitt
Copy link
Member

@suomiy : You are in the contributors team, so I'm afraid I don't have an immediate idea what's wrong.

@mareklibra
Copy link
Contributor

This should work against kubevirt 0.6.0 - so let's aim at merging this and change later once #9638 lands with >=0.7.1

@mareklibra
Copy link
Contributor

One syntax issue found: rest of Cockpit uses semicolons. I'm wondering why linter is not enforcing this. I suggest fix eslint rules along code in a follow-up.

@atiratree
Copy link
Contributor Author

@mareklibra fixed

@atiratree atiratree force-pushed the vm-detail branch 3 times, most recently from 1f7f44b to 6136f49 Compare July 26, 2018 15:48
- used primarily for the detail pages of listings
- add navigation between vms and vm
- refactor initialization / redux store
- add status to VmOverviewTabKubevirt when in VmDetail
- refactor ids in VmMetricsTab
@martinpitt
Copy link
Member

testKubevirtVmInstance fails, setting needswork. (Let's please not introduce even more flakes, the kubevirt tests are already bad enough for landing PRs.)

@atiratree
Copy link
Contributor Author

testKubevirtVmInstance fails, setting needswork. (Let's please not introduce even more flakes, the kubevirt tests are already bad enough for landing PRs.)

@martinpitt this is actually the same flake as in testKubevirtMachinesList because the detail should show the same UI as the list, thus it is reusing the same code and we get the same flake. I can look at the tests and see if I can fix the flakes, but I am not sure if I will be successful, because the tests usually pass on my machine.

@martinpitt
Copy link
Member

@suomiy : OK; let's retry the tests instead, the new test should at least be able to succeed.

For reproducing, try to run the tests with -j4 or so, to slow them down :-)

@atiratree
Copy link
Contributor Author

I tried that (100% usage CPU and 90% RAM) but still no luck. Also got few of these: bcbcarl/react-c3js#22 ,which I hope are not a cause of some of these failures.

Current test runs seems to have passed fine for testKubevirtVmInstance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants