|
@@ -1,8 +1,9 @@
|
|
|
import * as React from 'react';
|
|
|
import * as Icons from '@tabler/icons';
|
|
|
-import {Button, Divider, Group, Image, SimpleGrid, Space, Text, Title, TextInput, Select, Stack, Paper, Alert, Center} from '@mantine/core';
|
|
|
+import {Button, Divider, Group, Image, SimpleGrid, Space, Text, Title, TextInput, Select, Stack, Paper, Alert, Center, MantineProvider} from '@mantine/core';
|
|
|
+import { modals, ModalsProvider } from '@mantine/modals';
|
|
|
|
|
|
-import { Graphviz } from 'graphviz-react';
|
|
|
+import {GraphvizComponent} from "../graphviz";
|
|
|
|
|
|
import {newOnion, undoButtonHelpText, VersionedModelState,} from '../versioned_model/single_model';
|
|
|
import {InfoHoverCard, InfoHoverCardOverlay} from "../info_hover_card";
|
|
@@ -412,12 +413,23 @@ export function getDemoLive() {
|
|
|
function onExecuteNonDeterministicStep(transitions: Transition[]) {
|
|
|
if (runtimeStuff.runtimeModelNode !== null) {
|
|
|
const deterministic = transitions.length <= 1;
|
|
|
+ if (!deterministic) {
|
|
|
+ modals.open({
|
|
|
+ title: (<b>Non-determinism!</b>),
|
|
|
+ children: (
|
|
|
+ <>
|
|
|
+ <Text>Multiple futures exist.</Text>
|
|
|
+ <Text>Use <b>Redo</b> or <b>History</b> to select your desired future.</Text>
|
|
|
+ <Button fullWidth onClick={modals.closeAll} mt="md">
|
|
|
+ OK
|
|
|
+ </Button>
|
|
|
+ </>
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ }
|
|
|
for (const transition of transitions) {
|
|
|
onExecuteStep(transition, deterministic /* only go to next version if only one future exists */);
|
|
|
}
|
|
|
- if (!deterministic) {
|
|
|
- alert("Non-determinism -> multiple futures exist.\nUse the Redo button or the History view to select your desired future.")
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -425,6 +437,8 @@ export function getDemoLive() {
|
|
|
srcName+'--('+label+')-->'+tgtName;
|
|
|
|
|
|
return <>
|
|
|
+ <MantineProvider>
|
|
|
+ <ModalsProvider>
|
|
|
<OnionContext.Provider value={{generateUUID, primitiveRegistry}}>
|
|
|
<SimpleGrid cols={2}>
|
|
|
<Stack>
|
|
@@ -518,7 +532,7 @@ export function getDemoLive() {
|
|
|
</>}>
|
|
|
<div style={{backgroundColor:"#eee"}}>{
|
|
|
runtimeStuff.states.length > 0 ?
|
|
|
- <Graphviz dot={runtimeStuff.dotGraph} options={{fit:false, width:null, height:null}} />
|
|
|
+ <GraphvizComponent dot={runtimeStuff.dotGraph} options={{fit:false, width:null, height:null}} />
|
|
|
: <Center position="center" style={{padding:20}}>
|
|
|
<Text>FSA will appear here.</Text>
|
|
|
</Center>
|
|
@@ -533,6 +547,8 @@ export function getDemoLive() {
|
|
|
</Stack>
|
|
|
</SimpleGrid>
|
|
|
</OnionContext.Provider>
|
|
|
+ </ModalsProvider>
|
|
|
+ </MantineProvider>
|
|
|
</>;
|
|
|
}
|
|
|
}
|