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

Add Data Consumption Card to Object Service Dashboard #1976

Merged

Conversation

afreen23
Copy link
Contributor

@afreen23 afreen23 commented Jul 10, 2019

newdc
dc2

@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 Jul 10, 2019
@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 10, 2019
@openshift-ci-robot
Copy link
Contributor

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 /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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 10, 2019
@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from 752b71c to b1b8f7f Compare July 16, 2019 04:19
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2019
@afreen23 afreen23 changed the title [WIP] Add Data Consumption Card to Object Service Dashboard Add Data Consumption Card to Object Service Dashboard Jul 16, 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 Jul 16, 2019
@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from b1b8f7f to 01844de Compare July 16, 2019 04:22
@afreen23
Copy link
Contributor Author

@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';
Copy link
Contributor

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?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

Copy link
Contributor

@rawagner rawagner left a 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

@@ -0,0 +1,116 @@
import * as React from 'react';
import { Dropdown, DropdownToggle, DropdownItem, DropdownPosition } from '@patternfly/react-core';
Copy link
Contributor

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

Copy link
Contributor Author

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!
dropdoe


/* Chart Data Handlers */

export const iopsChartData = (data, key) => {
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

frontend/packages/noobaa-storage-plugin/src/queries.ts Outdated Show resolved Hide resolved
frontend/packages/noobaa-storage-plugin/src/utils.ts Outdated Show resolved Hide resolved
_.get(result, `metric.${metric}`, null);

export const getValue = (result: PrometheusResult): number =>
Number(_.get(result, 'value[1]', null));
Copy link
Contributor

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

Copy link
Contributor Author

@afreen23 afreen23 Jul 18, 2019

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 ?

Copy link
Contributor Author

@afreen23 afreen23 Jul 18, 2019

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it!

@lizsurette
Copy link

Im not sure about those colors in graphs, these are not used anywhere in console AFAIK @lizsurette

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:
https://www.patternfly.org/v4/documentation/react/charts/chartbar/

We do have a page calling out all individual chart colors if needed, but I think using a theme in this case works well:
https://www.patternfly.org/v4/design-guidelines/styles/chart-colors

@mceledonia @yuvalgalanti incase you guys have anything additional to add here :)

@afreen23
Copy link
Contributor Author

afreen23 commented Jul 18, 2019

Card header is bigger that others.

similar reasons: @rawagner
https://github.com/openshift/console/pull/2040/files#r304337872

@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from 01844de to 25f6c58 Compare July 18, 2019 21:58
@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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 18, 2019
@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from 25f6c58 to dacc1dd Compare July 18, 2019 23:13
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 18, 2019
@openshift-ci-robot
Copy link
Contributor

@afreen23: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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.

@cloudbehl
Copy link
Contributor

/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 Jul 19, 2019
@afreen23
Copy link
Contributor Author

/test e2e-aws-console

);
const valueP = humanizeBinaryBytesWithoutB(
data[1].reduce((total: number, physical: BarChartData) => total + physical.y, 0),
);
Copy link
Contributor

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.

Copy link
Contributor Author

@afreen23 afreen23 Jul 19, 2019

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

@afreen23
Copy link
Contributor Author

/test e2e-aws-console
/test e2e-aws-console-olm

@afreen23
Copy link
Contributor Author

/test e2e-aws-console

@cloudbehl
Copy link
Contributor

/approve

@rawagner can you have a look at this once.

@afreen23
Copy link
Contributor Author

/test e2e-aws-console-olm
/test e2e-aws-console
/test e2e-aws

@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from dacc1dd to c98c3c8 Compare July 19, 2019 12:57
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2019
@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from 433337c to 1a0be82 Compare July 19, 2019 14:40
@rawagner
Copy link
Contributor

/lgtm

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

/retest

@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from 1a0be82 to ecb9fcd Compare July 19, 2019 17:07
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2019
@afreen23 afreen23 force-pushed the noobaa_data-consumption-card branch from ecb9fcd to e2b169c Compare July 19, 2019 18:14
@cloudbehl
Copy link
Contributor

/approve
/lgtm

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

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

@afreen23
Copy link
Contributor Author

/test e2e-aws-console

@afreen23
Copy link
Contributor Author

/test e2e-aws

@openshift-bot
Copy link
Contributor

/retest

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

1 similar comment
@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 8d6207c into openshift:master Jul 20, 2019
@spadgett spadgett added this to the v4.2 milestone Jul 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.