|
165 | 165 |
|
166 | 166 | const all_metrics = <<.ALLMETRICS>> |
167 | 167 | const [current_metrics, setCurrent_metrics] = React.useState(JSON.parse(JSON.stringify(all_metrics))); |
| 168 | + const [hasHighlightedMetrics, setHasHighlightedMetrics] = React.useState(false); |
168 | 169 | const description = <<.DESCRIPTION>> |
169 | 170 | const metadata = <<.METADATA>> |
170 | 171 | const system_info = <<.SYSTEMINFO>> |
| 172 | + |
| 173 | + // Check for highlighted metrics whenever current_metrics changes |
| 174 | + React.useEffect(() => { |
| 175 | + // Look for any metrics that exceed their thresholds |
| 176 | + const hasHighlighted = current_metrics.some(row => row[5] === "Yes"); |
| 177 | + setHasHighlightedMetrics(hasHighlighted); |
| 178 | + }, [current_metrics]); |
171 | 179 | // Define consistent colors for TMA categories with child variations |
172 | 180 | const tmaColors = { |
173 | 181 | // Blue family for Frontend |
|
704 | 712 | </TableHead> |
705 | 713 | <TableBody> |
706 | 714 | {current_metrics.map((row) => { |
707 | | - // Check if this metric has exceed its threshold |
| 715 | + // Check if this metric has exceeded its threshold |
708 | 716 | const exceedsThreshold = row[5] == "Yes"; |
709 | 717 | return ( |
710 | 718 | <TableRow |
|
823 | 831 | </TableBody> |
824 | 832 | </Table> |
825 | 833 | </TableContainer> |
826 | | - <Box sx={{ marginTop: "16px" }}> |
827 | | - <Alert |
828 | | - severity="warning" |
829 | | - sx={{ |
830 | | - marginBottom: "24px", |
831 | | - backgroundColor: 'rgba(255, 255, 0, 0.2)', |
832 | | - '& .MuiAlert-icon': { |
833 | | - color: 'rgba(0, 0, 0, 0.7)' |
834 | | - }, |
835 | | - '& .MuiAlert-message': { |
836 | | - color: 'rgba(0, 0, 0, 0.7)' |
837 | | - } |
838 | | - }} |
839 | | - > |
840 | | - Metrics with a mean value exceeding their threshold formula are highlighted in yellow, indicating potential performance issues or anomalies that may require further investigation. Hover over the warning icon next to the mean value for more information. |
841 | | - </Alert> |
842 | | - </Box> |
| 834 | + {hasHighlightedMetrics && ( |
| 835 | + <Box sx={{ marginTop: "16px" }}> |
| 836 | + <Alert |
| 837 | + severity="warning" |
| 838 | + sx={{ |
| 839 | + marginBottom: "24px", |
| 840 | + backgroundColor: 'rgba(255, 255, 0, 0.2)', |
| 841 | + '& .MuiAlert-icon': { |
| 842 | + color: 'rgba(0, 0, 0, 0.7)' |
| 843 | + }, |
| 844 | + '& .MuiAlert-message': { |
| 845 | + color: 'rgba(0, 0, 0, 0.7)' |
| 846 | + } |
| 847 | + }} |
| 848 | + > |
| 849 | + Metrics with a mean value exceeding their threshold formula are highlighted in yellow, indicating potential performance issues or anomalies that may require further investigation. Hover over the warning icon next to the mean value for more information. |
| 850 | + </Alert> |
| 851 | + </Box> |
| 852 | + )} |
843 | 853 | </TabPanel> |
844 | 854 | <TabPanel |
845 | 855 | value={systemTabs} |
|
0 commit comments