fix: remove all MUI dependencies causing plugin load failure
Replace all @mui/material and @mui/icons-material imports with standard HTML elements and inline styles. This fixes the browser error: "TypeError: undefined is not an object (evaluating 'q.createSvgIcon')" The Headlamp plugin environment doesn't provide the full MUI library, so plugins must use only Headlamp CommonComponents or standard HTML. Changes: - AppBarScoreBadge: Replace Chip and ShieldIcon with button and emoji - DashboardView: Replace Button and RefreshIcon with button and emoji - ExemptionManager: Replace all MUI form components with HTML equivalents - PolarisSettings: Replace Button with HTML button All tests passing (50/50), TypeScript compilation clean, build successful. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { Chip } from '@mui/material';
|
||||
import { Shield as ShieldIcon } from '@mui/icons-material';
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { usePolarisDataContext } from '../api/PolarisDataContext';
|
||||
@@ -21,10 +19,10 @@ export default function AppBarScoreBadge() {
|
||||
const score = computeScore(counts);
|
||||
|
||||
// Color based on score
|
||||
const getColor = (score: number): 'success' | 'warning' | 'error' => {
|
||||
if (score >= 80) return 'success';
|
||||
if (score >= 50) return 'warning';
|
||||
return 'error';
|
||||
const getColor = (score: number): string => {
|
||||
if (score >= 80) return '#4caf50'; // green
|
||||
if (score >= 50) return '#ff9800'; // orange
|
||||
return '#f44336'; // red
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
@@ -32,13 +30,26 @@ export default function AppBarScoreBadge() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Chip
|
||||
icon={<ShieldIcon />}
|
||||
label={`Polaris: ${score}%`}
|
||||
color={getColor(score)}
|
||||
size="small"
|
||||
<button
|
||||
onClick={handleClick}
|
||||
style={{ cursor: 'pointer', marginRight: '8px' }}
|
||||
/>
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
marginRight: '8px',
|
||||
padding: '4px 12px',
|
||||
borderRadius: '16px',
|
||||
border: 'none',
|
||||
backgroundColor: getColor(score),
|
||||
color: 'white',
|
||||
fontSize: '13px',
|
||||
fontWeight: 500,
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: '4px',
|
||||
}}
|
||||
aria-label={`Polaris cluster score: ${score}%`}
|
||||
>
|
||||
<span>🛡️</span>
|
||||
<span>Polaris: {score}%</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user