console: prevent react-ace to use a service worker

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6778
GitOrigin-RevId: 0a00b924bcc7b9dc0c7b465dc4d05a67549fd329
This commit is contained in:
Nicolas Inchauspe 2022-11-18 17:38:28 +01:00 committed by hasura-bot
parent 619cc552f0
commit 4df205197a
27 changed files with 37 additions and 2 deletions

View File

@ -21,6 +21,7 @@ const Editor: React.FC<EditorProps> = ({ mode, editorRef, ...props }) => {
tabSize={2}
setOptions={{
showLineNumbers: true,
useWorker: false,
}}
{...props}
/>

View File

@ -67,6 +67,7 @@ const JsonEditor: React.FC<JsonEditorProps> = ({
height={height || '200px'}
width={width || '100%'}
showPrintMargin={false}
setOptions={{ useWorker: false }}
/>
</>
);

View File

@ -86,6 +86,7 @@ const TemplateEditor: React.FC<TemplateEditorProps> = ({
setOptions={{
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
useWorker: false,
}}
/>
</>

View File

@ -204,6 +204,7 @@ const PayloadOptionsTransforms: React.FC<PayloadOptionsTransformsProps> = ({
style={{ background: '#e2e8f0' }}
setOptions={{
highlightGutterLine: false,
useWorker: false,
}}
readOnly
/>

View File

@ -103,6 +103,7 @@ const JsonInput = props => {
exec: handleEditorExec,
},
]}
setOptions={{ useWorker: false }}
/>
);
};

View File

@ -118,6 +118,7 @@ const TextInput = props => {
exec: handleEditorExec,
},
]}
setOptions={{ useWorker: false }}
/>
);
};

View File

@ -61,6 +61,7 @@ const CodeTabs = ({
value: content.trim(),
readOnly: true,
mode: getLanguageModeFromExtension(getFileExtensionFromFilename(name)),
setOptions: { useWorker: false },
};
return (
<Tab eventKey={name} title={name} key={name}>

View File

@ -38,6 +38,7 @@ const DerivedFrom = ({ shouldDerive, parentMutation, toggleDerivation }) => {
width={'600px'}
height={'200px'}
readOnly
setOptions={{ useWorker: false }}
/>
</div>
);

View File

@ -41,6 +41,7 @@ const GlobalTypes: React.FC<InjectedProps> = ({ allTypes }) => {
style={{ background: '#e2e8f0' }}
setOptions={{
highlightGutterLine: false,
useWorker: false,
}}
readOnly
/>

View File

@ -102,6 +102,7 @@ const GraphQLEditor: React.FC<GraphQLEditorProps> = ({
width={width || '600px'}
showPrintMargin={false}
readOnly={readOnlyMode}
setOptions={{ useWorker: false }}
/>
</div>
</Analytics>

View File

@ -111,6 +111,7 @@ const DetailsComponent: React.FC<DetailsComponentProps> = ({
width="100%"
mode="graphqlschema"
readOnly
setOptions={{ useWorker: false }}
/>
</div>
<div className="h-full w-1/2 pl-xl">

View File

@ -119,6 +119,7 @@ const ListComponent: React.FC<Props> = ({
height="300px"
mode="graphqlschema"
readOnly
setOptions={{ useWorker: false }}
/>
</CollapsibleToggle>
</div>

View File

@ -92,6 +92,7 @@ export const getNotificationDetails = (
minLines={1}
maxLines={25}
width="100%"
setOptions={{ useWorker: false }}
/>
{children}
</div>

View File

@ -45,6 +45,7 @@ export const ConstraintExpandedContent = ({
fontSize={15}
width="100%"
showPrintMargin={false}
setOptions={{ useWorker: false }}
/>
</div>
</div>

View File

@ -321,6 +321,7 @@ const RawSQL = ({
onChange={handleSQLChange}
// prevents unwanted frequent event triggers
debounceChangePeriod={200}
setOptions={{ useWorker: false }}
/>
</div>
);

View File

@ -97,7 +97,7 @@ export const TemplateGalleryModalBody: React.VFC<{
width="100%"
showGutter={false}
showPrintMargin={false}
setOptions={{ showLineNumbers: false }}
setOptions={{ showLineNumbers: false, useWorker: false }}
maxLines={150}
/>
</div>

View File

@ -204,6 +204,7 @@ const ComputedFieldsEditor: React.FC<ComputedFieldsEditorProps> = ({
maxLines={100}
width="100%"
showPrintMargin={false}
setOptions={{ useWorker: false }}
/>
</div>
);

View File

@ -111,6 +111,7 @@ const TriggerEditorList = ({ tableSchema, dispatch }) => {
width="100%"
showPrintMargin={false}
className="mt-xs"
setOptions={{ useWorker: false }}
/>
{commentText && (
<div className="text-gray-500 mt-sm">{commentText}</div>

View File

@ -65,6 +65,7 @@ const JSONEditor: React.FC<JSONEditorProps> = ({
showPrintMargin={false}
value={value}
annotations={annotations}
setOptions={{ useWorker: false }}
/>
);
};

View File

@ -80,6 +80,7 @@ const Add: React.FC<Props> = ({ dispatch }) => {
value={payload}
onChange={setState.payload}
height="200px"
setOptions={{ useWorker: false }}
/>
</FormSection>
<CollapsibleToggle

View File

@ -98,6 +98,7 @@ const Form: React.FC<Props> = props => {
value={payload}
onChange={setState.payload}
height="200px"
setOptions={{ useWorker: false }}
/>
</FormSection>
<CollapsibleToggle

View File

@ -27,6 +27,7 @@ const InvocationLogDetails = ({ requestPayload, responsePayload }: Props) => {
width="100%"
showPrintMargin={false}
showGutter={false}
setOptions={{ useWorker: false }}
/>
</div>
</Tab>
@ -43,6 +44,7 @@ const InvocationLogDetails = ({ requestPayload, responsePayload }: Props) => {
width="100%"
showPrintMargin={false}
showGutter={false}
setOptions={{ useWorker: false }}
/>
</div>
</Tab>

View File

@ -78,6 +78,7 @@ const RedeliverEvent: React.FC<Props> = ({
showPrintMargin={false}
showGutter={false}
style={{ backgroundColor: '#fdf9ed', marginTop: '10px' }}
setOptions={{ useWorker: false }}
/>
</div>
<div className="pl-xs w-1/2">
@ -102,6 +103,7 @@ const RedeliverEvent: React.FC<Props> = ({
backgroundColor: '#fdf9ed',
marginTop: '10px',
}}
setOptions={{ useWorker: false }}
/>
</div>
</div>

View File

@ -112,6 +112,7 @@ class InvokeManualTrigger extends React.PureComponent {
showPrintMargin={false}
showGutter={false}
style={{ backgroundColor: '#fdf9ed', marginTop: '10px' }}
setOptions={{ useWorker: false }}
/>
</div>
<div className={`pl-0 w-1/2`}>
@ -130,6 +131,7 @@ class InvokeManualTrigger extends React.PureComponent {
backgroundColor: '#fdf9ed',
marginTop: '10px',
}}
setOptions={{ useWorker: false }}
/>
</div>
</div>

View File

@ -175,6 +175,7 @@ export const RowPermissionsSection: React.FC<RowPermissionsProps> = ({
setValue(rowPermissionsCheckType, SelectedSection.Custom)
}
editorProps={{ $blockScrolling: true }}
setOptions={{ useWorker: false }}
/>
</div>
)}
@ -214,6 +215,7 @@ export const RowPermissionsSection: React.FC<RowPermissionsProps> = ({
setValue(rowPermissionsCheckType, SelectedSection.Custom)
}
editorProps={{ $blockScrolling: true }}
setOptions={{ useWorker: false }}
/>
</div>
)}

View File

@ -56,6 +56,7 @@ export const RowPermissionBuilder = ({
name={`${tableName}-json-editor`}
value={json}
editorProps={{ $blockScrolling: true }}
setOptions={{ useWorker: false }}
/>
</div>
<div className="p-6 rounded-lg bg-white border border-gray-200w-full">

View File

@ -6,6 +6,7 @@ import AceEditor, {
IAceEditorProps,
ICommandManager,
} from 'react-ace';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-github';
import 'ace-builds/src-noconflict/theme-eclipse';
import 'ace-builds/src-noconflict/ext-language_tools';
@ -70,7 +71,12 @@ export type CodeEditorFieldProps = FieldWrapperPassThroughProps & {
disabled?: boolean;
};
const DEFAULT_EDITOR_OPTIONS = { minLines: 5, maxLines: 8, showGutter: false };
const DEFAULT_EDITOR_OPTIONS = {
minLines: 5,
maxLines: 8,
showGutter: false,
useWorker: false,
};
export const CodeEditorField: React.FC<CodeEditorFieldProps> = ({
name,