-
Notifications
You must be signed in to change notification settings - Fork 616
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
Kubevirt VmDetails #1682
Kubevirt VmDetails #1682
Conversation
Hi @mareklibra. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
frontend/packages/_plugin-style.scss
Outdated
@@ -0,0 +1,4 @@ | |||
/* Styles of all active plugins */ |
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.
Simple, but working.
See additional comments for more details.
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 I ask for comments here, please? @spadgett , @vojtechszocs
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 can be removed in favor of importing style from plugin.ts
.
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.
@mareklibra Sorry for responding late.
Plugin-specific styles can be loaded as a side effect of loading the plugin's entry module, e.g. in kubevirt-plugin/src/plugin.ts
:
import './style.scss';
I see you've already updated the PR to do that, so 👍 on that.
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.
@mareklibra Please note, once #1708 is merged and you enable the kubevirt-plugin
& run tests (yarn test
), we'll need to ensure Jest properly mocks scss
files. Right now, the relevant module mapper config is:
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
So we'll have to add scss
there ^^.
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.
To achieve full encapsulation of plugins, styles should be extendable as well. If such an extension point is considered as waste of effort, we can go with the simple solution proposed here:
So to (de)activate a plugin, one-line modification of |
@spadgett , can I ask you for review here, please? |
@@ -0,0 +1,155 @@ | |||
import * as React from 'react'; |
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 we move this to ./vm/
folder? - to distinguish between vm and vm template files in the future
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.
👍 public/components/*
seem to use the plural for directories, so I'd suggest using components/vms
and components/vm-templates
here for better organization.
@@ -0,0 +1 @@ | |||
export const DASHES = '---'; |
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 should probably go to console-shared
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 use a single dash, -
, throughout console. Is there a reason it's ---
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.
IIRC, this was requested during UX review some time ago.
But I agree, it makes sense to unify and potentially change later everywhere.
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.
One more change: the DASHES
are imported from kubevirt-web-ui-components
now, so triple dash ---
is still used per former UXD review. This way it will be consistent across Virtual Machines pages and can be unified with OpenShift when moving kubevirt-web-ui-components
under console
. Or if it is a blocker, I can fix there and fire new release. @spadgett , are you ok with that, please?
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.
Sorry, I disagree. We should change it everywhere in console or not at all. It sounds like we reviewed one page and didn't consider any of the existing pages that already have a dash. IMO, the right thing to do is fix kubevrit-web-ui-components so that it's consistent with existing console pages.
We're adding kubevirt as a plugin is so that it feels like an integrated part of console. This might seem like a little thing, but it undercuts that goal. The kubevirt pages should look and behave like other console pages.
For the record, I prefer a single dash -
. But I'm most concerned about keeping consistency.
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't we simply use the shared package here?
// packages/console-shared/src/constants/index.ts
export const DASH = '-';
const { name, namespace } = vm.metadata; | ||
|
||
const resources = [ | ||
getResource(VirtualMachineInstanceModel, { name, namespace, isList: false }), |
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 probably move this method here rather sooner than later, because it is used in many places.
- note: it builds requested resource object with reasonable defaults
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.
And it appeared that it can be even farther enhanced. As discussed before, it will be moved along the rest of kubevirt-web-ui-components
.
@@ -0,0 +1,4 @@ | |||
import * as _ from 'lodash-es'; | |||
|
|||
export const getLoadedResource = (props, kind) => |
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 kind of functionality should be probably included in the firehose.
Many components do not care about the loaded prop. They just need the data or undefined/null if the data is not available yet.
- note: previously implemented by WithResources.
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.
Components can choose to handle !loaded
the same as no data, but that should be up to the component. It's a worse API not to have an explicit loaded
prop. In most cases, you should handle it as well as handle errors.
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 am not suggesting to make any regression to the API. It is enough Just to enhance it, possibly by adding some flags to the resource (or the whole firehose).
Many components need just the raw data and this would make it easier for them to have less logic or a need to specify getLoadedResource for each resource (like this PR).
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.
In most cases, components should explicitly handle loaded
. Changing the API to make it easy to ignore seems like a bad change.
I also think getLoadedResource
is a not a useful helper because it assumes the property of the data. The prop is not always the kind. It would be better to remove it from the PR.
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.
Recently I try to avoid WithResources
in favour of just Firehose
. There will be probably a small change to Firehose
needed when migrating later features, but it's not a recent concern.
The purpose of this getLoadedResource
function is to provide simple mapping to meet contract with existing component. So far, similar logic was handled via WithResources
which took care of error handling and potentially passed empty data to the component or tentatively rendered a loader component.
I can improve components in kubevirt-web-ui-components
to deal with the Firehose
state machine explicitly. But it's extra complexity as I can't break the "safe-path" for potentially releasing web-ui even in 4.2 timeframe.
I will try, but definitely I'll definitely need to create new release of web-ui-components
for that.
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.
When looking into the code once again, I think it's better to enhance Firehose
(see #1711) and we can move checks to children components consistently with the rest of console
. Please have a look at recent changes in this PR.
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.
@mareklibra Can you add a screenshot?
@@ -0,0 +1 @@ | |||
export const DASHES = '---'; |
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 use a single dash, -
, throughout console. Is there a reason it's ---
here?
This page does not look or behave like other console pages. This goes against the goal of making kubevirt feel like an integrated, first-class part of console.
What does the floating (?) icon do? |
@mareklibra Here is our updated design based on feedback from @beanh66 and the OpenShift design team... You can track the larger design PR if needed, too. FYI @matthewcarleton |
Thanks @lizsurette. Looks good! Note that |
That makes sense to me @spadgett. FYI @matthewcarleton |
I've suggested on the updated design PR that we include designs around the inline edit rather than just omitting the bulk for clarity. @spadgett @lizsurette |
@lizsurette , @spadgett , thanks for the review. Recent design conforms web-ui. Original plan was to move our fork to upstream as it is with just minor necessary modifications. Improvements were supposed to be done in follow-ups to not delay the effort more then necessary while targeting full feature parity for 4.2. I agree that the pages should look and behave consistently and especially changes on upstream side should be reflected here. @jelkosz, FYI., this will take a little bit more time then originally expected. |
this makes sense to me! Redesign to look like the rest of the pages but without adding new features is a good approach.
:( |
Again, sorry for responding late. Based on discussion with @christianvogt I think the best approach at the moment is to Enabling a plugin shouldn't involve more steps beyond updating Ideally, plugin entry modules should be side-effect-free and only export the list of extensions, because they are loaded early and therefore impact the initial chunk size. We can revisit this in future and have a better separation. |
]; | ||
|
||
const breadcrumbsFor = (obj) => | ||
breadcrumbsForOwnerRefs(obj).concat({ |
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.
note: this is changing in #1725
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.
Rebased on top of that and updated accordingly
import { K8sResourceKind, ObjectMetadata } from '@console/internal/module/k8s'; | ||
|
||
// https://kubevirt.io/api-reference/master/definitions.html#_v1_virtualmachineinstancespec | ||
export type VmiSpec = { |
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.
Per console naming conventions, acronyms should be caps like
export type VmiSpec = { | |
export type VMISpec = { |
Here and below
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, changed on multiple places
kind={PodModel.kind} | ||
name={getName(pod)} | ||
namespace={getNamespace(pod)} | ||
uid={pod.metadata.uid} |
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 see a uid
prop used by ResourceLink
?
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
const { vm } = props; | ||
|
||
const namespaceResourceLink = () => ( | ||
<ResourceLink kind={NamespaceModel.kind} name={getNamespace(vm)} title={getNamespace(vm)} /> |
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.
title
shouldn't be necessary (unless it's a hover to show the full value when truncated)
DASHES | ||
); | ||
|
||
const VmDetailsConnected = (props: VmDetailsProps) => { |
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.
const VmDetailsConnected = (props: VmDetailsProps) => { | |
const VMDetailsConnected: React.FC<VMDetailsProps> = (props) => { |
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'm confused: this is VMDetailsConnected
, but I don't see a call to connect()
. We should give this a different name if it's not referring to redux connect
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
); | ||
|
||
const VmDetailsConnected = (props: VmDetailsProps) => { | ||
const { vm } = props; |
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.
Consider
const { vm } = props; | |
const { vm, ...rest } = props; |
and using {...rest}
below
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
isList: false, | ||
props: 'vmi', | ||
}); | ||
vmiRes.ignoreIfMissing = true; |
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.
optional
Add this to the declaration. No reason this needs to be on a separate line.
let stuff = k8s.get(reduxID); | ||
if (stuff) { | ||
stuff = stuff.toJS(); | ||
stuff.ignoreIfMissing = props.ignoreIfMissing; |
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 should be removed since #1711 merged
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.
resolved by rebase
/ok-to-test |
Redesigned to fit into openshift design. All review comments have been addressed + any other potential comments can be addressed in followups. Merging in order to unblock other PRs. |
/lgtm |
@suomiy: changing LGTM is restricted to assignees, and only openshift/console repo collaborators may be assigned issues. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
/lgtm |
/assign |
@jelkosz: GitHub didn't allow me to assign the following users: jelkosz. Note that only openshift members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Last force-push was done by mistake while rebasing other PRs stacked on top of this. Should be ok now. I'm sorry for confusion. |
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jtomasek, mareklibra, spadgett, suomiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
Introduces Details Page for Virtual Machines.
Depends on:
optional
prop for watches on individual resources #1711Resource > Resource Details
breadcrumb to resource det… #1725