|
|
@ -1,4 +1,5 @@ |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
|
|
|
|
import ReactDOM from 'react-dom' //eslint-disable-line
|
|
|
|
import CheckBox from './Checkbox/StaticAnalyserCheckedBox' // eslint-disable-line
|
|
|
|
import CheckBox from './Checkbox/StaticAnalyserCheckedBox' // eslint-disable-line
|
|
|
|
import Button from './Button/StaticAnalyserButton' // eslint-disable-line
|
|
|
|
import Button from './Button/StaticAnalyserButton' // eslint-disable-line
|
|
|
|
import remixLib from '@remix-project/remix-lib' |
|
|
|
import remixLib from '@remix-project/remix-lib' |
|
|
@ -18,7 +19,8 @@ export interface RemixUiStaticAnalyserProps { |
|
|
|
registry: any, |
|
|
|
registry: any, |
|
|
|
event: any, |
|
|
|
event: any, |
|
|
|
analysisModule: any |
|
|
|
analysisModule: any |
|
|
|
_deps: any |
|
|
|
_deps: any, |
|
|
|
|
|
|
|
emit: any |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
@ -63,7 +65,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
|
|
|
|
|
|
|
const warningContainer = React.useRef(null) |
|
|
|
const warningContainer = React.useRef(null) |
|
|
|
const [runButtonState, setRunButtonState] = useState(true) |
|
|
|
const [runButtonState, setRunButtonState] = useState(true) |
|
|
|
const [autoRun, setAutoRun] = useState(true) |
|
|
|
const [autoRun, setAutoRun] = useState(false) |
|
|
|
const [result, setResult] = useState({ |
|
|
|
const [result, setResult] = useState({ |
|
|
|
lastCompilationResult: null, |
|
|
|
lastCompilationResult: null, |
|
|
|
lastCompilationSource: null, |
|
|
|
lastCompilationSource: null, |
|
|
@ -96,7 +98,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setAutoRun(true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return () => { } |
|
|
|
return () => { } |
|
|
|
}, [autoRun]) |
|
|
|
}, [autoRun]) |
|
|
|
|
|
|
|
|
|
|
@ -105,6 +110,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
// await props.analysisModule.call('editor', 'discardHighlight')
|
|
|
|
// await props.analysisModule.call('editor', 'discardHighlight')
|
|
|
|
// await props.analysisModule.call('editor', 'highlight', location, fileName)
|
|
|
|
// await props.analysisModule.call('editor', 'highlight', location, fileName)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
console.log({ autoRun }, ' auto run in run function') |
|
|
|
setResult({ lastCompilationResult, lastCompilationSource, currentFile }) |
|
|
|
setResult({ lastCompilationResult, lastCompilationSource, currentFile }) |
|
|
|
if (lastCompilationResult && categoryIndex.length) { |
|
|
|
if (lastCompilationResult && categoryIndex.length) { |
|
|
|
setRunButtonState(false) |
|
|
|
setRunButtonState(false) |
|
|
@ -193,6 +199,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
const groupedCategory = groupBy(resultArray, 'warningModuleName') |
|
|
|
const groupedCategory = groupBy(resultArray, 'warningModuleName') |
|
|
|
setWarningState(groupedCategory) |
|
|
|
setWarningState(groupedCategory) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [warningCount]) |
|
|
|
props.event.trigger('staticAnaysisWarning', [warningCount]) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setRunButtonState(true) |
|
|
|
setRunButtonState(true) |
|
|
@ -203,14 +210,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// const correctRunBtnDisabled = () => {
|
|
|
|
|
|
|
|
// if (props.lastCompilationResult && selectedCategoryIndex.length !== 0) {
|
|
|
|
|
|
|
|
// setRunButtonState(false)
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// setRunButtonState(true)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleCheckAllModules = (groupedModules) => { |
|
|
|
const handleCheckAllModules = (groupedModules) => { |
|
|
|
const index = groupedModuleIndex(groupedModules) |
|
|
|
const index = groupedModuleIndex(groupedModules) |
|
|
|
if (index.every(el => categoryIndex.includes(el))) { |
|
|
|
if (index.every(el => categoryIndex.includes(el))) { |
|
|
|