Commit a1ebf63c authored by tizah's avatar tizah

removed old staticAnalysis from remix-project

parent d3cdaaf1
var csjs = require('csjs-inject')
var css = csjs`
.analysis {
display: flex;
flex-direction: column;
}
.result {
margin-top: 1%;
max-height: 300px;
word-break: break-word;
}
.buttons {
margin: 1rem 0;
}
.label {
display: flex;
align-items: center;
}
.label {
display: flex;
align-items: center;
user-select: none;
}
.block input[type='radio']:checked ~ .entries{
height: auto;
transition: .5s ease-in;
}
.entries{
height: 0;
overflow: hidden;
transition: .5s ease-out;
}
`
module.exports = css
...@@ -81,27 +81,30 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -81,27 +81,30 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}) })
const [warningState, setWarningState] = useState([]) const [warningState, setWarningState] = useState([])
useEffect(() => { const executeCompilation = () => {
if (autoRun) { const setCompilationResult = async (data, source, file) => {
const setCompilationResult = async (data, source, file) => { await setResult({ lastCompilationResult: data, lastCompilationSource: source, currentFile: file })
await setResult({ lastCompilationResult: data, lastCompilationSource: source, currentFile: file }) }
}
if (props.analysisModule) { if (props.analysisModule) {
props.analysisModule.on( props.analysisModule.on(
'solidity', 'solidity',
'compilationFinished', 'compilationFinished',
(file, source, languageVersion, data) => { (file, source, languageVersion, data) => {
if (languageVersion.indexOf('soljson') !== 0) return if (languageVersion.indexOf('soljson') !== 0) return
setCompilationResult(data, source, file) setCompilationResult(data, source, file)
if (categoryIndex.length > 0) { if (categoryIndex.length > 0) {
run(data, source, file) run(data, source, file)
}
} }
) }
} )
} }
}
useEffect(() => {
if (autoRun) {
executeCompilation()
}
return () => { } return () => { }
}, [autoRun, categoryIndex]) }, [autoRun, categoryIndex])
...@@ -270,6 +273,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -270,6 +273,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
label={item.description} label={item.description}
onClick={event => handleCheckSingle(event, item._index)} onClick={event => handleCheckSingle(event, item._index)}
checked={categoryIndex.includes(item._index.toString())} checked={categoryIndex.includes(item._index.toString())}
onChange={() => {}}
/> />
</div> </div>
) )
...@@ -297,7 +301,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -297,7 +301,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
expand={false} expand={false}
> >
<div> <div>
<RemixUiCheckbox onClick={() => handleCheckOrUncheckCategory(category)} id={categoryId} inputType="checkbox" label={`Select ${category[0].categoryDisplayName}`} name='checkCategoryEntry' checked={category.map(x => x._index.toString()).every(el => categoryIndex.includes(el))} /> <RemixUiCheckbox onClick={() => handleCheckOrUncheckCategory(category)} id={categoryId} inputType="checkbox" label={`Select ${category[0].categoryDisplayName}`} name='checkCategoryEntry' checked={category.map(x => x._index.toString()).every(el => categoryIndex.includes(el))} onChange={() => {}}/>
</div> </div>
<div className="w-100 d-block px-2 my-1 entries collapse multi-collapse" id={`heading${categoryId}`}> <div className="w-100 d-block px-2 my-1 entries collapse multi-collapse" id={`heading${categoryId}`}>
{category.map((item, i) => { {category.map((item, i) => {
...@@ -327,6 +331,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -327,6 +331,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}).flat().every(el => categoryIndex.includes(el))} }).flat().every(el => categoryIndex.includes(el))}
label="Select all" label="Select all"
onClick={() => handleCheckAllModules(groupedModules)} onClick={() => handleCheckAllModules(groupedModules)}
onChange={() => {}}
/> />
<RemixUiCheckbox <RemixUiCheckbox
id="autorunstaticanalysis" id="autorunstaticanalysis"
...@@ -334,6 +339,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -334,6 +339,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
onClick={handleAutoRun} onClick={handleAutoRun}
checked={autoRun} checked={autoRun}
label="Autorun" label="Autorun"
onChange={() => {}}
/> />
<Button buttonText="Run" onClick={() => run(result.lastCompilationResult, result.lastCompilationSource, result.currentFile)} disabled={runButtonState || categoryIndex.length === 0}/> <Button buttonText="Run" onClick={() => run(result.lastCompilationResult, result.lastCompilationSource, result.currentFile)} disabled={runButtonState || categoryIndex.length === 0}/>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment