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

Vm overview boot order summary #3560

Merged

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Nov 25, 2019

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. component/kubevirt Related to kubevirt-plugin labels Nov 25, 2019
@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

@suomiy @mareklibra please review

@yaacov yaacov changed the title Vm overview boot order summary [WIP] Vm overview boot order summary Nov 25, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 25, 2019
@yaacov yaacov mentioned this pull request Nov 25, 2019
7 tasks
@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

/retest

@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

@Ranelim @matthewcarleton please review.

@Ranelim
Copy link

Ranelim commented Nov 25, 2019

On empty state, boot order will mention that no drive was selected, therefore the VM will attempt boot from all the available disks (only disks), by order of appearance on YAML.
This state can occur when a user creates a VM from YAML without providing any priority weight for any drive to boot from.

When there are one or more drives selected on the boot order, the VM will attempt to boot only from the specified (priorities) drives and will disregard the rest of the disks.

https://github.com/openshift/openshift-origin-design/blob/master/web-console/knikubevirt/vm-details/vm-boot-order/vm-boot-order.md

import { ValueEnum } from '../../value-enum';

export class DiskType extends ValueEnum<string> {
static readonly DISK = new DiskType('disk');
static readonly CDROM = new DiskType('cdrom');
static readonly FLOPPY = new DiskType('floppy');
static readonly LUN = new DiskType('lun');
static readonly typeLabels = {
Copy link
Member

Choose a reason for hiding this comment

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

this could get confused with the enum: please see #3436 (review)

Copy link
Member Author

Choose a reason for hiding this comment

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

moved the dictionary away from the consts and renamed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

also added a constractor option :-)

@matthewcarleton
Copy link
Contributor

+1 to what @Ranelim is saying. Also, should we clarify here with "Show default boot disks"?

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from cc5545b to b9f2091 Compare November 25, 2019 16:06
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 25, 2019
@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

@Ranelim @matthewcarleton updated the screenshots, please re-review

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from b9f2091 to 49c5597 Compare November 25, 2019 16:36
@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

/test e2e-gcp-console

@matthewcarleton
Copy link
Contributor

LGTM @Ranelim WDYT?

@yaacov
Copy link
Member Author

yaacov commented Nov 25, 2019

/test e2e-gcp-console

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from 49c5597 to bf6f0fb Compare November 26, 2019 10:07
@yaacov
Copy link
Member Author

yaacov commented Nov 26, 2019

/test analyze
/test e2e-gcp-console

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from bf6f0fb to 6a6e92c Compare November 26, 2019 12:24
@@ -11,3 +12,8 @@ export type VMMultiStatus = {
importerPodsStatuses?: any[];
progress?: number;
};

export type BootableDeviceType = {
Copy link
Member

Choose a reason for hiding this comment

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

nit: missing typeLabel

Copy link
Member Author

Choose a reason for hiding this comment

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

nice ! added

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from be4cb24 to 4157754 Compare November 26, 2019 16:19
@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from 4157754 to 8c6b136 Compare November 26, 2019 16:20
@yaacov
Copy link
Member Author

yaacov commented Nov 26, 2019

@suomiy @mareklibra rebased, please review.

@yaacov yaacov changed the title [WIP] Vm overview boot order summary Vm overview boot order summary Nov 26, 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 Nov 26, 2019
};

// Note(Yaacov): className='text-secondary' is a hack to fix TextVariants being overriden.
const EmptyState: React.FC = () => (
Copy link
Member

Choose a reason for hiding this comment

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

can't we make a real component out of this?

margin-top: 0;
}

.kubevirt-boot-order-suammary__empty-text {
Copy link
Member

Choose a reason for hiding this comment

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

typo: suammary

@@ -79,18 +79,14 @@ export const VMTemplateDetailsList: React.FC<VMTemplateResourceListProps> = ({
canUpdateTemplate,
}) => {
const id = getBasicID(template);
const sortedBootableDevices = getBootableDevicesInOrder(template);
const devices = getDevices(asVM(template));
Copy link
Member

Choose a reason for hiding this comment

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

getDevices already expects VmLikeEntity

Copy link
Member Author

Choose a reason for hiding this comment

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

🌔 🌃 🕙

.filter((nic) => nic.bootOrder)
.map((nic) => ({ type: DEVICE_TYPE_INTERFACE, value: nic }));
export const getDevices = (vm: VMLikeEntityKind): BootableDeviceType[] => {
const disks = getDisks(asVM(vm)).map((disk) => ({
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 call asVM just once?

Copy link
Member Author

Choose a reason for hiding this comment

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

done ❗

value: disk,
}));
const nics = getInterfaces(asVM(vm)).map((nic) => ({
type: DEVICE_TYPE_INTERFACE,
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 convert these into plain string enum?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure 👍

@yaacov
Copy link
Member Author

yaacov commented Nov 26, 2019

/test e2e-gcp-console

@yaacov
Copy link
Member Author

yaacov commented Nov 26, 2019

/test e2e-gcp-console

isExpanded={isExpanded}
className="kubevirt-boot-order-summary__expandable"
>
<List>
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an ordered list but I see that the list component doesn't come with the option. It would be great if we could contribute that back to PatternFly, but in the meantime what's the easiest way to ensure this is numbered? I think it makes a big difference, WDYT @Ranelim (this would apply to the expanded list as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a commit that use ordered list:
matt · Details · OKD

p.s.
@matthewcarleton Will open a PR / Discussion in patternfly's github and cc you.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

@Ranelim Ranelim Nov 27, 2019

Choose a reason for hiding this comment

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

LGTM @Ranelim WDYT?

Not sure I follow what images I need to update where. The Boot-order PR and the images u added to your PR seem aligned.
But the only difference is how the CD-ROM string appears. Adding @matthewcarleton to confirm this. The design display:
Drive [1]: [container] (CD-COM)
And not:
CD-drive-[1] (CD-ROM)
This is fetched from the CD-COM creation.
The “Drive [#]” is the field title, and the rest is the field name itself.

I like the numbering order implemented. Better than bullets

Copy link
Contributor

Choose a reason for hiding this comment

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

ya good catch @Ranelim I didn't notice that. I agree we want to keep the proper format for CD-ROMs here.

Copy link
Member

Choose a reason for hiding this comment

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

I think the lack of consistency here is quite unfortunate.

Also it can be quite difficult to understand this constellation:

  1. Drive 2
  2. Drive 1

I think the names would be a better solution here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@matthewcarleton @Ranelim this PR is continuing in: #3436 please open/continue this discussion there.

#3436 also handle the modal that use the same device labeler, so will also benefit from this discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @yaacov see here

@yaacov yaacov force-pushed the vm-overview-boot-order-summary branch from 2c8629f to 0f3c4a9 Compare November 26, 2019 21:54

import './boot-order-summary.scss';

export const BootOrderSummaryEmptyState = ({ devices }: BootOrderSummaryEmptyStateProps) => {
Copy link
Member

Choose a reason for hiding this comment

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

I think we are trying to use BootOrderSummaryEmptyState: React.FC<BootOrderSummaryEmptyStateProps> convention in all of our code


const options = devices.filter((device) => !device.value.bootOrder);

const onToggle = () => {
Copy link
Member

Choose a reason for hiding this comment

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

can you memoize this with useCallback ?

import { BootOrderSummaryEmptyState } from './boot-order-summary-empty-state';

// NOTE(yaacov): using <ol> because '@patternfly/react-core' <List> currently miss isOrder parameter.
export const BootOrderSummary = ({ devices }: BootOrderSummaryProps) => {
Copy link
Member

Choose a reason for hiding this comment

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

+ here

>
<ol>
{options.map((option) => (
<ListItem key={deviceKey(option)}>{deviceLabel(option)}</ListItem>
Copy link
Member

Choose a reason for hiding this comment

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

I would rather use <li> for consistency until the List component is fixed

) : (
<ol>
{sources.map((source) => (
<ListItem key={deviceKey(source)}>{deviceLabel(source)}</ListItem>
Copy link
Member

Choose a reason for hiding this comment

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

+ here

@atiratree
Copy link
Member

/approve - without counting the cdrom issue

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 27, 2019
@yaacov
Copy link
Member Author

yaacov commented Nov 27, 2019

/lgtm

@openshift-ci-robot
Copy link
Contributor

@yaacov: you cannot LGTM your own PR.

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.

@glekner
Copy link
Contributor

glekner commented Nov 27, 2019

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glekner, suomiy, yaacov

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-merge-robot openshift-merge-robot merged commit cade0d7 into openshift:master Nov 27, 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. component/kubevirt Related to kubevirt-plugin lgtm Indicates that a PR is ready to be merged. 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.

None yet

7 participants