Skip to content

Conversation

@dlabaj
Copy link
Collaborator

@dlabaj dlabaj commented Oct 10, 2024

Closes issue #222 by converting the battery component to the new severity compoent.

@patternfly-build
Copy link

patternfly-build commented Oct 10, 2024

@dlabaj
Copy link
Collaborator Author

dlabaj commented Oct 10, 2024

@andrew-ronaldson Can you review the styling. I'm not sure it's correct. I put an extra small space between the icon and the label. Thanks.

@dlabaj dlabaj requested a review from InsaneZein October 10, 2024 08:45
@dlabaj dlabaj linked an issue Oct 10, 2024 that may be closed by this pull request
2 tasks
Copy link
Collaborator

@fhlavac fhlavac left a comment

Choose a reason for hiding this comment

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

We should probably focus more on cypress tests than RTL ones, can you please add them?

I tried to put some draft together:


import React from 'react';
import Severity, { SeverityType } from '../../packages/module/dist/dynamic/Severity';

const severities = [
  { type: SeverityType.critical, label: 'Critical severity', ouiaId: 'Severity-critical' },
  { type: SeverityType.important, label: 'Important severity', ouiaId: 'Severity-important' },
  { type: SeverityType.moderate, label: 'Moderate severity', ouiaId: 'Severity-moderate' },
  { type: SeverityType.minor, label: 'Minor severity', ouiaId: 'Severity-minor' },
  { type: SeverityType.none, label: 'No severity', ouiaId: 'Severity-none' },
  { type: SeverityType.undefined, label: 'Undefined severity', ouiaId: 'Severity-undefined' }
];

describe('Severity', () => {
  severities.map(({ type, label, ouiaId }) => {
    it(`renders Severity with ${type} severity`, () => {
      cy.mount(<Severity severity={type} label={label} ouiaId={ouiaId} />);
      cy.get(`[data-ouia-component-id="${ouiaId}"]`).should('exist');
      cy.get(`[data-ouia-component-id="${ouiaId}"]`).should('have.attr', 'title', label);
      cy.get('span').contains(label);
    });
  });
});

@andrew-ronaldson
Copy link

There is a docs change here to update the table to severity info insteead of battery levels.Screenshot 2024-10-11 at 9 25 02 AM

This link shows the classes for each severity color token. Some are showing up as the default icon color

@kaylachumley
Copy link

@dlabaj Everything is looking pretty good. Just a few things, if you could please update the color tokens to match their respective severity level.

undefined severity = --pf-t--global--icon--color--severity--undefined--default
none severity = --pf-t--global--icon--color--severity--none--default
minor severity = --pf-t--global--icon--color--severity--minor--default
moderate severity = --pf-t--global--icon--color--severity--moderate--default
important severity = --pf-t--global--icon--color--severity--important--default
critical severity = --pf-t--global--icon--color--severity--critical--default

Screenshot 2024-10-11 at 3 37 34 PM

The introduction description body text still says battery, that'll need swapped to say severity as well. Example: "The severity component generates a severity, which corresponds to a level low, medium, high or critical. Each level corresponds with a severity level and respective color:"

The body text below will also need update to this:" To specify the severity of the severity risk level, you can pass a predefined enum or text value into the severity property that corresponds to the appropriate severity level"

Copy link

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! looks grand!

@dlabaj dlabaj force-pushed the severityUpdate branch 2 times, most recently from 9180af9 to fcf5dd9 Compare October 14, 2024 19:51
fix: Updated to migrate Battery component to Severity component.
<React.Fragment>
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
<FlexItem>
{/* eslint-disable-next-line react/no-unknown-property */}
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this needed?

Copy link
Collaborator

@fhlavac fhlavac left a comment

Choose a reason for hiding this comment

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

Looks great!

@dlabaj dlabaj merged commit 62ce18c into patternfly:main Oct 15, 2024
6 checks passed
@dlabaj dlabaj deleted the severityUpdate branch October 19, 2024 01:06
fhlavac pushed a commit to fhlavac/react-component-groups that referenced this pull request Oct 24, 2024
fix: Updated to migrate Battery component to Severity component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Severity to include new severity icons

6 participants