filter out unknown mappers (#1559)
This commit is contained in:
parent
119fac0916
commit
bb46594d84
1 changed files with 24 additions and 16 deletions
|
@ -56,22 +56,30 @@ export const MapperList = ({
|
||||||
setAddMapperDialogOpen(!addMapperDialogOpen);
|
setAddMapperDialogOpen(!addMapperDialogOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
const loader = async () =>
|
const loader = async () => {
|
||||||
Promise.resolve(
|
if (!mapperList) {
|
||||||
(mapperList || [])
|
return [];
|
||||||
.map((mapper) => {
|
}
|
||||||
const mapperType = mapperTypes.filter(
|
|
||||||
(type) => type.id === mapper.protocolMapper
|
const list = mapperList.reduce<Row[]>((rows, mapper) => {
|
||||||
)[0];
|
const mapperType = mapperTypes.find(
|
||||||
return {
|
({ id }) => id === mapper.protocolMapper
|
||||||
...mapper,
|
);
|
||||||
category: mapperType.category,
|
|
||||||
type: mapperType.name,
|
if (!mapperType) {
|
||||||
priority: mapperType.priority,
|
return rows;
|
||||||
} as Row;
|
}
|
||||||
})
|
|
||||||
.sort((a, b) => a.priority - b.priority)
|
return rows.concat({
|
||||||
);
|
...mapper,
|
||||||
|
category: mapperType.category,
|
||||||
|
type: mapperType.name,
|
||||||
|
priority: mapperType.priority,
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return list.sort((a, b) => a.priority - b.priority);
|
||||||
|
};
|
||||||
|
|
||||||
const MapperLink = ({ id, name }: Row) => (
|
const MapperLink = ({ id, name }: Row) => (
|
||||||
<Link to={detailLink(id!)}>{name}</Link>
|
<Link to={detailLink(id!)}>{name}</Link>
|
||||||
|
|
Loading…
Reference in a new issue