-
Notifications
You must be signed in to change notification settings - Fork 605
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
Add Data Consumption Card to Object Service Dashboard #1976
Add Data Consumption Card to Object Service Dashboard #1976
Conversation
afreen23
commented
Jul 10, 2019
•
edited
Loading
edited
Hi @afreen23. 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. |
752b71c
to
b1b8f7f
Compare
b1b8f7f
to
01844de
Compare
@mareklibra @cloudbehl @rawagner please review it! |
import { DataConsumptionDropdown } from './data-consumption-card-dropdown'; | ||
import { DataConsumptionQueries } from '../../queries'; | ||
import { getMetric, getValue } from '../../utils'; | ||
import './data-consumption-card.scss'; |
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.
Rest of the code has just single scss import per plugin/application which subsequently @import
specialized fragments.
I think we should stay consistent.
IMO, this per-component encapsulation fits better a library than an end-user application.
@spadgett , thoughts?
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.
@christianvogt @vojtechszocs opinion?
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.
My thought is that SCSS is no different than a js module. If a class is specific to a component and no other component, then why not import it at the component level where it belongs. This will also benefit from lazy loading. If we need to refactor / remove the component. Finding the a related CSS code is also easier. It ensures we are being explicit in the dependencies of that component.
We don't use utilities from the global scope. CSS should be no different. I'd even argue that utility classes should also be imported at the component level as well and let webpack chunk those utility classes into a common module at the root. This happens for modules like lodash which is used everywhere.
I'm 100% for co-locating CSS and trying to make as scoped as possible. If we could eventually do what PF4 does, even better.
The dev-console
follows this pattern.
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.
Some visual issues:
Card header is bigger that others.
Im not sure about those colors in graphs, these are not used anywhere in console AFAIK @lizsurette
...es/noobaa-storage-plugin/src/components/data-consumption-card/data-consumption-card-body.tsx
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,116 @@ | |||
import * as React from 'react'; | |||
import { Dropdown, DropdownToggle, DropdownItem, DropdownPosition } from '@patternfly/react-core'; |
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.
you should use Dropdown
from utils/dropdown.jsx
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.
@rwagner that dropdown dont have the functionality to disable dropdown items. Thats why I used PF4!
|
||
/* Chart Data Handlers */ | ||
|
||
export const iopsChartData = (data, key) => { |
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.
all these data parsing functions looks very similar to getRangeVectorStats
and getInstantVectorStats
from graphs/utils.ts
. You should reuse them
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.
thanx for telling this, but still for IOPS I need a modified function.
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.
actually it is not valid for my case, the data coming from prom for each dropdown selection is different. I tried to incorporate these but it did not work out.
@rawagner
...ckages/noobaa-storage-plugin/src/components/data-consumption-card/data-consumption-card.scss
Outdated
Show resolved
Hide resolved
...ackages/noobaa-storage-plugin/src/components/data-consumption-card/data-consumption-card.tsx
Outdated
Show resolved
Hide resolved
...ackages/noobaa-storage-plugin/src/components/data-consumption-card/data-consumption-card.tsx
Outdated
Show resolved
Hide resolved
...ackages/noobaa-storage-plugin/src/components/data-consumption-card/data-consumption-card.tsx
Outdated
Show resolved
Hide resolved
_.get(result, `metric.${metric}`, null); | ||
|
||
export const getValue = (result: PrometheusResult): number => | ||
Number(_.get(result, 'value[1]', null)); |
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.
Number(null) returns 0, I dont think this is safe
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 this case it is safe, anyways 0 values are not being plotted on chart.
I intentionally put that, rather than handling null
values. I cannot find better approach, if you could suggest something ?
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.
Oh I see! sorry its in utils, I will change it later with the enhancement Pr, because i need to check which components are using it. Please ignore for now.
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 fixed it!
Looks like we are using the new PatternFly 4 Charts with the purple theme in this case, so I think it's good to go! Here is a bit more on the new bar chart and the theme prop: We do have a page calling out all individual chart colors if needed, but I think using a theme in this case works well: @mceledonia @yuvalgalanti incase you guys have anything additional to add here :) |
similar reasons: @rawagner |
01844de
to
25f6c58
Compare
25f6c58
to
dacc1dd
Compare
...obaa-storage-plugin/src/components/object-data-reduction-card/object-data-reduction-card.tsx
Outdated
Show resolved
Hide resolved
@afreen23: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
/ok-to-test |
/test e2e-aws-console |
); | ||
const valueP = humanizeBinaryBytesWithoutB( | ||
data[1].reduce((total: number, physical: BarChartData) => total + physical.y, 0), | ||
); |
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.
Nit: Here also you can destruct the valueL and valueP as you did for others humanizeBinaryBytesWithoutB
return value.
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.
nope I cant because I am using it multiple times, there will be same variables issues @gnehapk
/test e2e-aws-console |
/test e2e-aws-console |
/approve @rawagner can you have a look at this once. |
/test e2e-aws-console-olm |
dacc1dd
to
c98c3c8
Compare
433337c
to
1a0be82
Compare
/lgtm |
/retest |
1a0be82
to
ecb9fcd
Compare
ecb9fcd
to
e2b169c
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afreen23, cloudbehl, rawagner 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 |
/test e2e-aws-console |
/test e2e-aws |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |