diff --git a/package.json b/package.json index ee7ad635..897ea5f5 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@hookform/resolvers": "^3.1.1", - "@mui/icons-material": "^5.14.3", - "@mui/lab": "^5.0.0-alpha.138", - "@mui/material": "^5.14.3", - "@mui/x-data-grid": "^6.10.2", + "@mui/icons-material": "^5.15.4", + "@mui/lab": "^5.0.0-alpha.160", + "@mui/material": "^5.15.4", + "@mui/x-data-grid": "^6.18.7", "@types/react-beautiful-dnd": "^13.1.4", "array-move": "^4.0.0", "axios": "^1.4.0", diff --git a/src/components/dashboard/content/list/DashboardFailureModesTableList.tsx b/src/components/dashboard/content/list/DashboardFailureModesTableList.tsx index f8b4b71a..cc496d15 100644 --- a/src/components/dashboard/content/list/DashboardFailureModesTableList.tsx +++ b/src/components/dashboard/content/list/DashboardFailureModesTableList.tsx @@ -56,7 +56,7 @@ const DashboardFailureModesTableList = () => { return ( - {tables.filter(m => !!m && !!m.iri).map((mode) => { + {tables.map((mode) => { const routePath = ROUTES.FMEA + extractFragment(mode.iri); return ( diff --git a/src/components/dashboard/content/list/DashboardFaultTreeList.tsx b/src/components/dashboard/content/list/DashboardFaultTreeList.tsx index 840d1a23..536e4744 100644 --- a/src/components/dashboard/content/list/DashboardFaultTreeList.tsx +++ b/src/components/dashboard/content/list/DashboardFaultTreeList.tsx @@ -52,7 +52,7 @@ const DashboardFaultTreeList = () => { return ( - {faultTrees.filter(f => !!f && !!f.iri).map((tree) => { + {faultTrees.map((tree) => { const routePath = ROUTES.FTA + extractFragment(tree.iri); return ( diff --git a/src/components/dashboard/content/list/DashboardSystemList.tsx b/src/components/dashboard/content/list/DashboardSystemList.tsx index caac6f29..05d86d39 100644 --- a/src/components/dashboard/content/list/DashboardSystemList.tsx +++ b/src/components/dashboard/content/list/DashboardSystemList.tsx @@ -52,7 +52,7 @@ const DashboardSystemList = () => { return ( - {systems.filter(s => !!s && !!s.iri).map((system) => { + {systems.map((system) => { const routePath = ROUTES.SYSTEM + extractFragment(system.iri); return ( diff --git a/src/components/dialog/faultEvent/FaultEventCreation.schema.tsx b/src/components/dialog/faultEvent/FaultEventCreation.schema.tsx index 533026ff..70604dcd 100644 --- a/src/components/dialog/faultEvent/FaultEventCreation.schema.tsx +++ b/src/components/dialog/faultEvent/FaultEventCreation.schema.tsx @@ -3,7 +3,7 @@ import {yupOptionalNumber} from "@utils/validationUtils"; import {EventType, GateType} from "@models/eventModel"; export const schema = Yup.object().shape({ - name: Yup.string() + "fault-event-name": Yup.string() .min(1, 'Must be at least 1 character long') .required('Event is mandatory'), description: Yup.string().default(''), diff --git a/src/components/dialog/faultEvent/FaultEventCreation.tsx b/src/components/dialog/faultEvent/FaultEventCreation.tsx index 73582d25..a1dd3dc6 100644 --- a/src/components/dialog/faultEvent/FaultEventCreation.tsx +++ b/src/components/dialog/faultEvent/FaultEventCreation.tsx @@ -28,7 +28,7 @@ const FaultEventCreation = ({useFormMethods, eventReusing}: Props) => { useEffect(() => { if (selectedEvent) { - setValue('name', selectedEvent.name) + setValue('fault-event-name', selectedEvent.name) setValue('description', selectedEvent.description) setValue('probability', selectedEvent.probability) setValue('eventType', selectedEvent.eventType) @@ -43,7 +43,7 @@ const FaultEventCreation = ({useFormMethods, eventReusing}: Props) => {
Event: {eventReusing && - + <> { defaultValue={null} /> Create new Event: - } + } - + Type - { Object.values(EventType).map(value => - {value}) + {value}) } } @@ -76,10 +76,11 @@ const FaultEventCreation = ({useFormMethods, eventReusing}: Props) => { {/*TODO: sort out default value UI bug*/} {/*TODO: sort out default value UI bug*/} @@ -106,14 +107,13 @@ const FaultEventCreation = ({useFormMethods, eventReusing}: Props) => { Gate Type { - //@ts-ignore - return { gateTypeValues().map(value => { const [enabled, optionValue] = value - return {value} + return {optionValue} }) } diff --git a/src/components/dialog/faultEvent/FaultEventDialog.tsx b/src/components/dialog/faultEvent/FaultEventDialog.tsx index bdccae0e..99bca8f6 100644 --- a/src/components/dialog/faultEvent/FaultEventDialog.tsx +++ b/src/components/dialog/faultEvent/FaultEventDialog.tsx @@ -12,13 +12,13 @@ import {schema} from "./FaultEventCreation.schema"; import {yupResolver} from "@hookform/resolvers/yup"; import {eventFromHookFormValues} from "@services/faultEventService"; import {FaultEventsReuseProvider} from "@hooks/useReusableFaultEvents"; -import {useEffect} from "react"; +import {FaultEvent} from "@models/eventModel"; interface Props { open: boolean, eventIri: string, treeUri: string, - onCreated: () => void, + onCreated: (element: FaultEvent) => void, onClose: () => void, } @@ -34,8 +34,8 @@ const FaultEventDialog = ({open, eventIri, treeUri, onCreated, onClose}: Props) faultEventService.addEvent(eventIri, requestEvent) .then(value => { - onClose() - onCreated() + onClose(); + onCreated(value); }) .catch(reason => showSnackbar(reason, SnackbarType.ERROR)) } diff --git a/src/components/editor/faultTree/Editor.tsx b/src/components/editor/faultTree/Editor.tsx index 30094df9..1488153a 100644 --- a/src/components/editor/faultTree/Editor.tsx +++ b/src/components/editor/faultTree/Editor.tsx @@ -119,6 +119,11 @@ const Editor = ({setAppBarName}: DashboardTitleProps) => { const [eventDialogOpen, setEventDialogOpen] = useState(false); + const handleEventCreate = (newEvent: FaultEvent) => { + setSidebarSelectedEvent(newEvent); + refreshTree(); + } + const handleEventUpdate = (eventToUpdate: FaultEvent) => { faultEventService.update(eventToUpdate) .then(value => refreshTree()) @@ -176,7 +181,7 @@ const Editor = ({setAppBarName}: DashboardTitleProps) => { handleEventCreate(newEvent)} onClose={() => setEventDialogOpen(false)}/> let defaultValues; if (data) { - console.log(data); defaultValues = { eventType: data.eventType, - name: data.name, + "fault-event-name": data.name, description: data.description, probability: data.probability + "", gateType: data.gateType, @@ -46,7 +45,6 @@ const FaultEventShapeToolPane = ({data, onEventUpdated, refreshTree}: Props) => }); updateFunction = async (values: any) => { - console.log(values); let dataClone = cloneDeep(data) const updatedFaultEvent = deepOmit(faultEventService.eventFromHookFormValues(values), '@type') diff --git a/src/components/editor/faultTree/menu/faultEvent/reorder/FaultEventChildrenReorderList.tsx b/src/components/editor/faultTree/menu/faultEvent/reorder/FaultEventChildrenReorderList.tsx index 3ce73ef0..7387eed5 100644 --- a/src/components/editor/faultTree/menu/faultEvent/reorder/FaultEventChildrenReorderList.tsx +++ b/src/components/editor/faultTree/menu/faultEvent/reorder/FaultEventChildrenReorderList.tsx @@ -37,8 +37,6 @@ const FaultEventChildrenReorderList = ({eventChildren, handleReorder}: Props) => const oldIndex = result.source.index; const newIndex = result.destination.index; - console.log(result); - setItems(items => { const newItems = arrayMoveImmutable(items, oldIndex, newIndex) handleChildrenReordered(newItems); diff --git a/src/components/editor/system/menu/failureMode/ComponentFailureModesList.tsx b/src/components/editor/system/menu/failureMode/ComponentFailureModesList.tsx index b996929d..cfadd69c 100644 --- a/src/components/editor/system/menu/failureMode/ComponentFailureModesList.tsx +++ b/src/components/editor/system/menu/failureMode/ComponentFailureModesList.tsx @@ -169,8 +169,7 @@ const ComponentFailureModesList = ({ component }) => { - { - return createTheme(adaptV4Theme({ +const createCustomMuiTheme = (options) => { + return createTheme({ ...options, - })); + }); } export default createCustomMuiTheme; \ No newline at end of file diff --git a/src/utils/JsonLdUtils.tsx b/src/utils/JsonLdUtils.tsx index ff46e302..80f96b54 100644 --- a/src/utils/JsonLdUtils.tsx +++ b/src/utils/JsonLdUtils.tsx @@ -39,6 +39,8 @@ export default class JsonLdUtils { ): Promise { if (Array.isArray(input) && input.length === 0) { return Promise.resolve([]); + } else if (Array.isArray(input["@graph"]) && input["@graph"].length === 0) { + return Promise.resolve([]); } return compact(input, context) .then((res) => JsonLdUtils.loadArrayFromCompactedGraph(res))