From 28c5127e1f9a1c2a642f0c89ccaaf2500c108c4b Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Wed, 24 Nov 2021 17:29:16 +0100 Subject: [PATCH] [WIP] VM Details --- src/components/Grid/style.css | 4 +- src/components/VmDetails/BaseCard.js | 47 ++- src/components/VmDetails/CardEditButton.js | 14 +- .../DetailsCard/CloudInit/CloudInitForm.js | 35 +-- .../DetailsCard/CloudInit/SysprepForm.js | 63 ++-- .../VmDetails/cards/DetailsCard/FieldRow.js | 21 +- .../VmDetails/cards/DetailsCard/index.js | 45 +-- .../VmDetails/cards/DetailsCard/style.css | 4 + .../cards/DisksCard/DiskImageEditor.js | 276 ++++++++---------- .../VmDetails/cards/DisksCard/DiskListItem.js | 17 +- .../cards/DisksCard/DiskStateIcon.js | 39 +-- .../VmDetails/cards/DisksCard/index.js | 6 +- .../VmDetails/cards/NicsCard/NicEditor.js | 164 +++++------ .../cards/NicsCard/NicLinkStateIcon.js | 32 +- .../VmDetails/cards/NicsCard/NicListItem.js | 14 +- .../VmDetails/cards/NicsCard/index.js | 6 +- .../VmDetails/cards/OverviewCard/index.js | 44 +-- .../cards/SnapshotsCard/NewSnapshotModal.js | 94 +++--- .../cards/SnapshotsCard/SnapshotDetail.js | 271 +++++++---------- .../cards/SnapshotsCard/SnapshotItem.js | 56 ++-- .../VmDetails/cards/SnapshotsCard/index.js | 3 +- .../cards/UtilizationCard/CpuCharts.js | 30 +- .../cards/UtilizationCard/DiskCharts.js | 47 ++- .../cards/UtilizationCard/MemoryCharts.js | 47 ++- .../cards/UtilizationCard/NetworkingCharts.js | 30 +- .../cards/UtilizationCard/NoHistoricData.js | 4 +- .../cards/UtilizationCard/NoLiveData.js | 4 +- .../UtilizationCard/UtilizationCardData.js | 25 ++ .../VmDetails/cards/UtilizationCard/style.css | 35 +++ src/components/VmDetails/index.js | 11 +- src/components/VmDetails/style.css | 7 +- 31 files changed, 663 insertions(+), 832 deletions(-) create mode 100644 src/components/VmDetails/cards/UtilizationCard/UtilizationCardData.js diff --git a/src/components/Grid/style.css b/src/components/Grid/style.css index 37864c9fa7..ea1857cd30 100644 --- a/src/components/Grid/style.css +++ b/src/components/Grid/style.css @@ -17,8 +17,8 @@ position: relative; width: 100%; min-height: 1px; - padding-right: 20px; - padding-left: 20px; + padding-right: 10px; + padding-left: 10px; flex: 1 1 0; /* grow shrink basis */ max-width: 100%; diff --git a/src/components/VmDetails/BaseCard.js b/src/components/VmDetails/BaseCard.js index a4d9f3b0f2..95c4c34588 100644 --- a/src/components/VmDetails/BaseCard.js +++ b/src/components/VmDetails/BaseCard.js @@ -4,18 +4,16 @@ import { Badge, Button, Card, - CardHeading, + CardHeader, CardTitle, CardBody, CardFooter, - Icon, - noop, - excludeKeys, -} from 'patternfly-react' +} from '@patternfly/react-core' import style from './style.css' import CardEditButton from './CardEditButton' import { Tooltip } from '_/components/tooltips' +import { CheckIcon, TimesIcon } from '@patternfly/react-icons/dist/esm/icons' /** * Base VM details card. Support common layouts and view vs edit modes. @@ -76,7 +74,7 @@ class BaseCard extends React.Component { } renderChildren (childProps) { - const children = this.props.children || noop + const children = this.props.children || (() => {}) return typeof children === 'function' ? children(childProps) : React.isValidElement(children) @@ -87,7 +85,7 @@ class BaseCard extends React.Component { render () { const { title = undefined, - icon = undefined, + icon: TheIcon = undefined, itemCount = undefined, editMode = undefined, editable = true, @@ -101,13 +99,18 @@ class BaseCard extends React.Component { const editing = editMode === undefined ? this.state.edit : editMode const hasHeading = !!title const hasBadge = itemCount !== undefined - const hasIcon = icon && icon.type && icon.name const RenderChildren = this.renderChildren return ( - + {hasHeading && ( - + + + + {TheIcon && } + {title} + {hasBadge && {itemCount}} + - - {hasIcon && } - {title} - {hasBadge && {itemCount}} - - + )} @@ -143,10 +141,8 @@ class BaseCard extends React.Component { {editing && ( - - +