-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add data quality to kpi and status
- Loading branch information
Showing
15 changed files
with
187 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/react-components/src/components/data-quality/data-quality-text.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.data-quality-text { | ||
display: flex; | ||
} |
66 changes: 66 additions & 0 deletions
66
packages/react-components/src/components/data-quality/data-quality-text.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import { Quality } from '@aws-sdk/client-iotsitewise'; | ||
import Box from '@cloudscape-design/components/box'; | ||
import Icon from '@cloudscape-design/components/icon'; | ||
import { | ||
spaceScaledXxs, | ||
colorBackgroundStatusError, | ||
colorBackgroundStatusWarning, | ||
borderRadiusBadge, | ||
colorBorderStatusError, | ||
colorBorderStatusWarning, | ||
spaceScaledXs, | ||
} from '@cloudscape-design/design-tokens'; | ||
|
||
import './data-quality-text.css'; | ||
|
||
type DataQualityTextOptions = { | ||
quality?: Quality; | ||
}; | ||
|
||
export const DataQualityText = ({ quality }: DataQualityTextOptions) => { | ||
// Don't show any special UX for good quality points | ||
if (!quality || quality === 'GOOD') return null; | ||
|
||
let icon = null; | ||
let text = null; | ||
let styles: React.CSSProperties = { | ||
padding: `${spaceScaledXxs} ${spaceScaledXs}`, | ||
border: '1px solid', | ||
borderRadius: borderRadiusBadge, | ||
gap: spaceScaledXxs, | ||
}; | ||
|
||
switch (quality) { | ||
case 'BAD': | ||
icon = <Icon name='status-negative' variant='error' />; | ||
text = <Box color='text-status-error'>Bad Quality</Box>; | ||
styles = { | ||
...styles, | ||
borderColor: colorBorderStatusError, | ||
backgroundColor: colorBackgroundStatusError, | ||
}; | ||
break; | ||
case 'UNCERTAIN': | ||
icon = <Icon name='status-warning' variant='warning' />; | ||
text = <Box color='text-status-warning'>Uncertain Quality</Box>; | ||
styles = { | ||
...styles, | ||
borderColor: colorBorderStatusWarning, | ||
backgroundColor: colorBackgroundStatusWarning, | ||
}; | ||
break; | ||
} | ||
|
||
return ( | ||
<div | ||
data-testid='data-quality-text' | ||
className='data-quality data-quality-text' | ||
> | ||
<div className='data-quality-text' style={styles}> | ||
{icon} | ||
{text} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.