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

Kubevirt VmDetails #1682

Merged
merged 3 commits into from
Jun 20, 2019
Merged

Kubevirt VmDetails #1682

merged 3 commits into from
Jun 20, 2019

Conversation

mareklibra
Copy link
Contributor

@mareklibra mareklibra commented Jun 7, 2019

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 7, 2019
@openshift-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@openshift-ci-robot openshift-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 7, 2019
@@ -0,0 +1,4 @@
/* Styles of all active plugins */
Copy link
Contributor Author

@mareklibra mareklibra Jun 7, 2019

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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 ^^.

Copy link
Contributor

@vojtechszocs vojtechszocs Jun 14, 2019

Choose a reason for hiding this comment

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

So we'll have to add scss there ^^.

This is addressed by #1721 (commit).

@mareklibra
Copy link
Contributor Author

To achieve full encapsulation of plugins, styles should be extendable as well.
We can handle that on plugin's package.json level with modification to webpack.
@vojtechszocs , wdyt?

If such an extension point is considered as waste of effort, we can go with the simple solution proposed here:

  • if a plugin needs custom styling, there will be single entry src/style.scss in its root
  • frontend/packages/_plugin-style.scss is manually maintained to register all styling of active plugins

So to (de)activate a plugin, one-line modification of frontend/packages/_plugin-style.scss and console-app/package.json is required

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 10, 2019
@mareklibra mareklibra changed the title WIP: Kubevirt.vm details Kubevirt VmDetails Jun 10, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 10, 2019
@mareklibra
Copy link
Contributor Author

@spadgett , can I ask you for review here, please?

@@ -0,0 +1,155 @@
import * as React from 'react';
Copy link
Member

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

Copy link
Contributor

@vojtechszocs vojtechszocs Jun 14, 2019

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 = '---';
Copy link
Member

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

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor

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 }),
Copy link
Member

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

Copy link
Contributor Author

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) =>
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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).

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

@spadgett spadgett left a 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 = '---';
Copy link
Member

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?

@spadgett
Copy link
Member

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.

  • It doesn't use the standard ResourceSummary component on every other detail page
  • It uses more columns than every other details page
  • Empty values should be a single - with text-muted style
  • The Edit buttons should be a menu item in an actions dropdown

What does the floating (?) icon do?

@lizsurette
Copy link

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.

@mareklibra Here is our updated design based on feedback from @beanh66 and the OpenShift design team...
1-0-0

You can track the larger design PR if needed, too.

FYI @matthewcarleton

@spadgett
Copy link
Member

Thanks @lizsurette. Looks good!

Note that ResourceSummary forces a certain layout of the first few fields for consistency across pages. So the order of the items in the left column might change slightly. (Namespace is always directly under name for instance.)

@lizsurette
Copy link

Note that ResourceSummary forces a certain layout of the first few fields for consistency across pages. So the order of the items in the left column might change slightly. (Namespace is always directly under name for instance.)

That makes sense to me @spadgett. FYI @matthewcarleton

@matthewcarleton
Copy link
Contributor

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

@mareklibra
Copy link
Contributor Author

@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.
I will adapt this PR accordingly. Anyway, I suggest to implement new features (like the charts) still in follow-ups.

@jelkosz, FYI., this will take a little bit more time then originally expected.

@jelkosz
Copy link

jelkosz commented Jun 14, 2019

I will adapt this PR accordingly. Anyway, I suggest to implement new features (like the charts) still in follow-ups.

this makes sense to me! Redesign to look like the rest of the pages but without adding new features is a good approach.

FYI., this will take a little bit more time then originally expected.

:(

@vojtechszocs
Copy link
Contributor

To achieve full encapsulation of plugins, styles should be extendable as well.
We can handle that on plugin's package.json level with modification to webpack.
@vojtechszocs , wdyt?

If such an extension point is considered as waste of effort, we can go with the simple solution proposed here:

  • if a plugin needs custom styling, there will be single entry src/style.scss in its root
  • frontend/packages/_plugin-style.scss is manually maintained to register all styling of active plugins

So to (de)activate a plugin, one-line modification of frontend/packages/_plugin-style.scss and console-app/package.json is required

Again, sorry for responding late. Based on discussion with @christianvogt I think the best approach at the moment is to import the necessary stylesheets within the plugin's entry module.

Enabling a plugin shouldn't involve more steps beyond updating console-app's dependencies.

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.

@spadgett spadgett added this to the v4.2 milestone Jun 14, 2019
];

const breadcrumbsFor = (obj) =>
breadcrumbsForOwnerRefs(obj).concat({
Copy link
Member

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

Copy link
Contributor Author

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 = {
Copy link
Member

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

Suggested change
export type VmiSpec = {
export type VMISpec = {

Here and below

Copy link
Contributor Author

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}
Copy link
Member

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?

Copy link
Contributor Author

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)} />
Copy link
Member

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) => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const VmDetailsConnected = (props: VmDetailsProps) => {
const VMDetailsConnected: React.FC<VMDetailsProps> = (props) => {

Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

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

Consider

Suggested change
const { vm } = props;
const { vm, ...rest } = props;

and using {...rest} below

Copy link
Contributor Author

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;
Copy link
Member

@spadgett spadgett Jun 14, 2019

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;
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved by rebase

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2019
@jtomasek
Copy link

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 19, 2019
@yaacov yaacov mentioned this pull request Jun 19, 2019
1 task
@atiratree
Copy link
Member

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.

@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot
Copy link
Contributor

@suomiy: changing LGTM is restricted to assignees, and only openshift/console repo collaborators may be assigned issues.

In response to this:

/lgtm

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.

@jtomasek
Copy link

/assign

@jtomasek
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2019
@jelkosz
Copy link

jelkosz commented Jun 19, 2019

/assign

@openshift-ci-robot
Copy link
Contributor

@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.
For more information please see the contributor guide

In response to this:

/assign

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.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 19, 2019
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 19, 2019
@mareklibra
Copy link
Contributor Author

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.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 20, 2019
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit fdf6b17 into openshift:master Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.