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

Add Alerts Card #329

Merged
merged 1 commit into from
Apr 10, 2019
Merged

Add Alerts Card #329

merged 1 commit into from
Apr 10, 2019

Conversation

rawagner
Copy link
Contributor

@rawagner rawagner commented Apr 9, 2019

alerts

According to design we should have a dropdown which would allow filtering alerts by severity. Severity is defined by labels and label values can be anything so its up to alert creator to set the key and value. For this reason Im not adding dropdown yet. I try to recognize critical alerts by looking for label severity: critical. All others are evaluated as warning severity

@coveralls
Copy link

coveralls commented Apr 9, 2019

Pull Request Test Coverage Report for Build 1356

  • 21 of 25 (84.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 87.265%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/Dashboard/Alert/AlertItem.js 6 7 85.71%
src/components/ClusterOverview/Alerts/Alerts.js 10 13 76.92%
Totals Coverage Status
Change from base Build 1342: -0.06%
Covered Lines: 3237
Relevant Lines: 3555

💛 - Coveralls

import { AlertsBody } from '../../Dashboard/Alert/AlertsBody';
import { filterAlerts } from './utils';

export const Alerts = ({ alertsResponse }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we return null from this component instead?

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

export const AlertItem = ({ alert }) => (
<Row className="kubevirt-alert__item">
<Col lg={1} md={1} sm={1} xs={1}>
{getSeverityIcon(get(alert, 'labels.severity'))}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make selectors for alerts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added alerts selectors to prometheus folder


export const AlertItem = ({ alert }) => (
<Row className="kubevirt-alert__item">
<Col lg={1} md={1} sm={1} xs={1}>
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we rather use css with a margin here?

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

<GridItem span={6}>
<ComplianceConnected />
<GridItem span={12}>
<div className="kubevirt-cluster-overview__health-combined">
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't using another Grid + GridItem's be simpler here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right :) using Grid and GridItem now


export const AlertsBody = ({ alerts }) => (
<div className="kubevirt-alert__alerts-body">
{alerts.map((alert, index) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

can we render the alerts as children (AlertItem) for better reusability?

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

};

Alerts.propTypes = {
alertsResponse: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rather send an empty array from web-ui ? This would make things a bit cleaner here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not sure, even though there is no Not Available state yet I think that in the future we will want to notify user that AlertManager is not available/accessible and object as alertsResponse will serve its purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@atiratree
Copy link
Contributor

Can you please also add alerts to ClusteOverview fixture?

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2019
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2019
@rawagner
Copy link
Contributor Author

Can you please also add alerts to ClusteOverview fixture?

added

};

Alerts.propTypes = {
alertsResponse: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
Copy link
Contributor

Choose a reason for hiding this comment

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

ok

const alerts = filterAlerts(alertsResponse);

return alerts.length > 0 ? (
<DashboardCard className="kubevirt-alerts__card">
Copy link
Contributor

Choose a reason for hiding this comment

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

the top border probably shouldn't go to Alerts card

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im passing className to Alerts from ClusterOverview now

@atiratree atiratree merged commit 30312e2 into kubevirt:master Apr 10, 2019
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.

4 participants