|
|
@ -1,14 +1,11 @@ |
|
|
|
import React from 'react' |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
import { ErrorRendererOptions } from '../../staticanalyser' |
|
|
|
import { ErrorRendererOptions } from '../../staticanalyser' |
|
|
|
|
|
|
|
|
|
|
|
type BasicTitleProps = { |
|
|
|
type BasicTitleProps = { |
|
|
|
warningStateEntries: any |
|
|
|
warningStateEntries: any |
|
|
|
|
|
|
|
ssaWarnings: any[] |
|
|
|
hideWarnings?: boolean |
|
|
|
hideWarnings?: boolean |
|
|
|
showLibsWarnings?: boolean |
|
|
|
showLibsWarnings?: boolean |
|
|
|
ssaWarnings: any[] |
|
|
|
|
|
|
|
ssaWarningsNoLibs: any[] |
|
|
|
|
|
|
|
ssaWarningsTotal: number |
|
|
|
|
|
|
|
ssaWarningsNoLibsTotal: number |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type warningResultOption = { |
|
|
|
type warningResultOption = { |
|
|
@ -35,29 +32,22 @@ export function calculateWarningStateEntries(entries: [string, any][]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function BasicTitle(props: BasicTitleProps) { |
|
|
|
export function BasicTitle(props: BasicTitleProps) { |
|
|
|
|
|
|
|
const [filteredTotal, setFilteredTotal] = useState(0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
setFilteredTotal(props.ssaWarnings.filter(x => !x.options.isLibrary && x.hasWarning).length) |
|
|
|
|
|
|
|
}, [props, props.ssaWarnings.filter(x => !x.options.isLibrary && x.hasWarning).length]) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<span id="ssaRemixtab"> |
|
|
|
<span id="ssaRemixtab">Remix{props.ssaWarnings.length > 0 ? !props.hideWarnings ? !props.showLibsWarnings ? <span data-id="RemixStaticAnalysisErrorCount" className={`badge ${props.ssaWarnings.filter(x => x.hasWarning).length > 0 ? 'badge-warning' : props.ssaWarnings.filter(x => x.options.type === 'errors').length > 0 ? 'badge-danger' : 'badge-info'} badge-pill mx-1 ml-1 text-center`}> |
|
|
|
Remix |
|
|
|
{filteredTotal} |
|
|
|
{props.ssaWarnings.length > 0 ? ( |
|
|
|
</span>: ( |
|
|
|
props.hideWarnings === false ? ( |
|
|
|
<i className="badge badge-warning badge-pill mx-1 ml-1 text-center"> |
|
|
|
props.showLibsWarnings === false ? ( |
|
|
|
{ |
|
|
|
<span |
|
|
|
props.ssaWarnings.length |
|
|
|
data-id="RemixStaticAnalysisErrorCount" |
|
|
|
} |
|
|
|
className={`badge ${props.ssaWarningsNoLibsTotal > 0 ? "badge-warning" |
|
|
|
</i> |
|
|
|
: props.ssaWarnings.filter(x => x.options.type === 'error').length > 0 ? "badge-danger" |
|
|
|
) : null : null} |
|
|
|
: "badge-info" |
|
|
|
|
|
|
|
} badge-pill ml-1 px-1 text-center`}
|
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{props.ssaWarnings.filter(x => !x.options.isLibrary).length} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<span data-id="RemixStaticAnalysisErrorCount" className="badge badge-warning rounded-circle ml-1 text-center"> |
|
|
|
|
|
|
|
{props.ssaWarningsTotal} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) : null |
|
|
|
|
|
|
|
) : null} |
|
|
|
|
|
|
|
</span> |
|
|
|
</span> |
|
|
|
); |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|