setSearch(null)}>
{/* ref-able single child for ClickAwayListener */}
-
+
@@ -174,6 +176,7 @@ const PowerInput = (props: PowerInputProps) => {
prop !== 'disabled'})<{ disabled?: boolean }>`
border: 1px solid #eee;
min-height: 52px;
width: 100%;
@@ -17,6 +17,11 @@ export const FakeInput = styled('div')`
border-color: rgba(0, 0, 0, 0.23);
position: relative;
+ ${({ disabled, theme }) => !!disabled && `
+ color: ${theme.palette.action.disabled},
+ border-color: ${theme.palette.action.disabled},
+ `}
+
&:hover {
border-color: ${({ theme }) => theme.palette.text.primary};
}
diff --git a/packages/web/src/components/TestSubstep/index.tsx b/packages/web/src/components/TestSubstep/index.tsx
index 64f99dc8..4673120a 100644
--- a/packages/web/src/components/TestSubstep/index.tsx
+++ b/packages/web/src/components/TestSubstep/index.tsx
@@ -6,6 +6,7 @@ import ListItem from '@mui/material/ListItem';
import Alert from '@mui/material/Alert';
import LoadingButton from '@mui/lab/LoadingButton';
+import { EditorContext } from 'contexts/Editor';
import JSONViewer from 'components/JSONViewer';
import { EXECUTE_FLOW } from 'graphql/mutations/execute-flow';
import FlowSubstepTitle from 'components/FlowSubstepTitle';
@@ -31,6 +32,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
step,
} = props;
+ const editorContext = React.useContext(EditorContext);
const [executeFlow, { data, error, loading }] = useMutation(EXECUTE_FLOW, { context: { autoSnackbar: false }});
const response = data?.executeFlow?.data;
@@ -74,6 +76,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
onClick={handleSubmit}
sx={{ mt: 2 }}
loading={loading}
+ disabled={editorContext.readOnly}
color="primary"
>
Test & Continue
diff --git a/packages/web/src/contexts/Editor.tsx b/packages/web/src/contexts/Editor.tsx
new file mode 100644
index 00000000..02968957
--- /dev/null
+++ b/packages/web/src/contexts/Editor.tsx
@@ -0,0 +1,23 @@
+import * as React from 'react';
+
+interface IEditorContext {
+ readOnly: boolean;
+}
+
+export const EditorContext = React.createContext({ readOnly: false });
+
+type EditorProviderProps = {
+ children: React.ReactNode;
+ value: IEditorContext;
+}
+
+export const EditorProvider = (props: EditorProviderProps): React.ReactElement => {
+ const { children, value } = props;
+ return (
+
+ {children}
+
+ );
+};
diff --git a/packages/web/src/locales/en.json b/packages/web/src/locales/en.json
index dea54604..6e7ed750 100644
--- a/packages/web/src/locales/en.json
+++ b/packages/web/src/locales/en.json
@@ -40,6 +40,9 @@
"createFlow.creating": "Creating a flow...",
"flow.active": "ON",
"flow.inactive": "OFF",
+ "flowEditor.publish": "PUBLISH",
+ "flowEditor.unpublish": "UNPUBLISH",
+ "flowEditor.publishFlowCannotBeUpdated": "To edit this flow, you must first unpublish it.",
"flow.createdAt": "created {datetime}",
"flow.updatedAt": "updated {datetime}",
"flow.view": "View",