Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

ClusterOverview: refactor Utilization card and connect #307

Merged
merged 1 commit into from
Apr 5, 2019

Conversation

mareklibra
Copy link
Contributor

@mareklibra mareklibra commented Apr 4, 2019

Utilization card is refactored to split concern between
ClusterOverview and Dashboard components.

Connected to real data.

So far CPU only, other items will follow.

@coveralls
Copy link

coveralls commented Apr 4, 2019

Pull Request Test Coverage Report for Build 1248

  • 21 of 22 (95.45%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 87.392%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/ClusterOverview/Utilization/Utilization.js 4 5 80.0%
Totals Coverage Status
Change from base Build 1010: 0.1%
Covered Lines: 3082
Relevant Lines: 3375

💛 - Coveralls

@mareklibra
Copy link
Contributor Author

Loading state:

01_loading

02_data

@mareklibra mareklibra force-pushed the utilization.realData branch from 125f995 to da0e1d0 Compare April 4, 2019 11:42
@ohadlevy
Copy link
Contributor

ohadlevy commented Apr 4, 2019

just wondering, whats the timeout on fetching the data? (in case Prometheus is down for example), do we also show error to load the card?

@mareklibra
Copy link
Contributor Author

@ohadlevy , good point. It will be implemented within #276 consistently for all cards.


export const getUtilizationCpuStats = response => {
const values = get(response, 'data.result[0].values', []);
return values.map(timeValuePair => parseNumber(timeValuePair[1]));
Copy link
Contributor

@rawagner rawagner Apr 4, 2019

Choose a reason for hiding this comment

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

I think it would be better to return null if we have no values, instead of empty array - see my other comment about Not available state

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

{isLoading || `${actual} ${unit}`}
</Col>
<Col className="kubevirt-utilization__item-chart" lg={7} md={7} sm={7} xs={7}>
{isLoading ? <LoadingComponent /> : <SparklineChart id={id} data={chartData} axis={axis} unloadBeforeLoad />}
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add 'Not available' state ? when isLoading is false and data are null. We already have that in ClusterCapacity https://github.com/kubevirt/web-ui-components/blob/master/src/components/Dashboard/Capacity/CapacityItem.js#L24

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

return (
<div className="kubevirt-utilization__item">
<Row>
<Col lg={2} md={2} sm={2} xs={2}>
Copy link
Contributor

Choose a reason for hiding this comment

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

looking at https://docs.google.com/presentation/d/1kfzD1jyEAIejWFKoKSTJLCetwvmIriLI2UlFbyB-xbg/edit#slide=id.g54d7130601_45_38 - we need to improve behaviour of UtilizationItem when there is not enough space

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Can I deal with that in a separate PR?

There are basically two options

  • introduce sort of isNarrow property (preferred)
  • refactor the component structure and handle it via CSS (too complicated considering the case)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, lets fix this in followup

@mareklibra mareklibra force-pushed the utilization.realData branch from da0e1d0 to af7af59 Compare April 5, 2019 07:30
@mareklibra
Copy link
Contributor Author

If metric can not be accessed:

03_na

Utilization card is refactored to split concern between
ClusterOverview and Dashboard components.

Connected to real data.

So far CPU only, others will follow.
@mareklibra mareklibra force-pushed the utilization.realData branch from af7af59 to 8cf91c0 Compare April 5, 2019 07:33
@rawagner
Copy link
Contributor

rawagner commented Apr 5, 2019

@mareklibra just FYI I have asked Andy to provide us designs for Not Available/ Loading state #310 so once we will have those we may need to change this a bit, however Im happy with the current state

@rawagner rawagner merged commit c93164f into kubevirt:master Apr 5, 2019
mareklibra added a commit to mareklibra/kubevirt-web-ui-components that referenced this pull request Apr 5, 2019
Utilization card is refactored to split concern between
ClusterOverview and Dashboard components.

Connected to real data.

So far CPU only, others will follow.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants