Commit d002f963 authored by aniket-engg's avatar aniket-engg Committed by Aniket

toggele analysis checkbox

parent 76d86764
......@@ -64,6 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const warningContainer = React.useRef(null)
const [warningState, setWarningState] = useState({})
const [allWarnings, setAllWarnings] = useState({})
const [state, dispatch] = useReducer(analysisReducer, initialState)
useEffect(() => {
......@@ -72,6 +73,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
useEffect(() => {
setWarningState({})
setAllWarnings({})
if (autoRun) {
if (state.data !== null) {
run(state.data, state.source, state.file)
......@@ -126,14 +128,17 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
}
const groupedCategory = groupBy(resultArray, groupByKey)
setAllWarnings(groupedCategory)
setWarningState(groupedCategory)
}
const showWarningsByModule = (showOnlyModule: string) => {
if(showOnlyModule && warningState[showOnlyModule]) {
if(allWarnings[showOnlyModule]) {
const newWarningState = {}
newWarningState[showOnlyModule] = warningState[showOnlyModule]
setWarningState({[showOnlyModule]: warningState[showOnlyModule]})
newWarningState[showOnlyModule] = allWarnings[showOnlyModule]
setWarningState({[showOnlyModule]: allWarnings[showOnlyModule]})
} else if (showOnlyModule === 'all') {
setWarningState(allWarnings)
}
}
......@@ -312,6 +317,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const handleShowSlitherResultEnabled = () => {
if (slitherResultEnabled) {
setSlitherResultEnabled(false)
showWarningsByModule('all')
} else {
setSlitherResultEnabled(true)
showWarningsByModule('Slither Analysis')
......
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