feat: change default icon for unknown entities
Signed-off-by: David Weber <david.weber@w3tec.ch>
This commit is contained in:
committed by
Fredrik Adelöw
parent
ab1682e85d
commit
916da47e8a
@@ -27,11 +27,11 @@ import {
|
||||
Paper,
|
||||
} from '@material-ui/core';
|
||||
import { humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
||||
import WorkIcon from '@material-ui/icons/Work';
|
||||
import ExpandLessIcon from '@material-ui/icons/ExpandLess';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import { MarkdownContent } from '@backstage/core-components';
|
||||
import { ValidationOutputOk } from '../../types';
|
||||
import SvgIcon from '@material-ui/core/SvgIcon';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
validationOk: {
|
||||
@@ -60,9 +60,9 @@ export const EntityResult = ({
|
||||
const app = useApp();
|
||||
const [expanded, setExpanded] = useState(isFirstError);
|
||||
|
||||
const Icon =
|
||||
app.getSystemIcon(`kind:${item.entity.kind.toLocaleLowerCase('en-US')}`) ??
|
||||
WorkIcon;
|
||||
const Icon = app.getSystemIcon(
|
||||
`kind:${item.entity.kind.toLocaleLowerCase('en-US')}`,
|
||||
) as typeof SvgIcon;
|
||||
|
||||
const fetchErrorMessages = (response: ValidateEntityResponse) => {
|
||||
if (!response.valid) {
|
||||
@@ -75,13 +75,15 @@ export const EntityResult = ({
|
||||
<>
|
||||
<ListItem key={humanizeEntityRef(item.entity)}>
|
||||
<ListItemIcon>
|
||||
<Icon
|
||||
className={
|
||||
item.response.valid
|
||||
? classes.validationOk
|
||||
: classes.validationNotOk
|
||||
}
|
||||
/>
|
||||
{Icon && (
|
||||
<Icon
|
||||
className={
|
||||
item.response.valid
|
||||
? classes.validationOk
|
||||
: classes.validationNotOk
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={humanizeEntityRef(item.entity)}
|
||||
|
||||
Reference in New Issue
Block a user