pull/5370/head
aniket-engg 8 months ago committed by Aniket
parent f360a6290e
commit 3dd82e1a10
  1. 53
      libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx
  2. 12
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx

@ -1,53 +0,0 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
import parse from 'html-react-parser'
const _paq = (window._paq = window._paq || [])
interface SolScanTableProps {
scanDetails: Record<string, any>[],
fileName: string
}
export function SolScanTable(props: SolScanTableProps) {
const { scanDetails, fileName } = props
return (
<>
<p>Scanning successful! <b>{scanDetails.length} warnings </b> found for file: <b>{fileName}</b></p>
<p>See the warning details below. For more details,&nbsp;
<a href="https://solidityscan.com/signup"
target='_blank'
onClick={() => _paq.push(['trackEvent', 'udapp', 'solidityScan', 'goToSolidityScan'])}>
go to SolidityScan.
</a>
</p>
<table className="table table-bordered table-hover">
<thead>
<tr>
<td scope="col" style={{ wordBreak: "keep-all" }}>NAME</td>
<td scope="col" style={{ wordBreak: "keep-all" }}>SEVERITY</td>
<td scope="col" style={{ wordBreak: "keep-all" }}>CONFIDENCE</td>
<td scope="col" style={{ wordBreak: "keep-all" }}>DESCRIPTION</td>
<td scope="col" style={{ wordBreak: "keep-all" }}>REMEDIATION</td>
</tr>
</thead>
<tbody>
{
Array.from(scanDetails, (template) => {
return (
<tr key={template.template_details.issue_id}>
<td scope="col">{template.template_details.issue_name}</td>
<td scope="col">{template.template_details.issue_severity}</td>
<td scope="col">{template.template_details.issue_confidence}</td>
<td scope="col">{parse(template.template_details.static_issue_description)}</td>
<td scope="col">{template.template_details.issue_remediation ? parse(template.template_details.issue_remediation) : 'Not Available' }</td>
</tr>
)
})
}
</tbody>
</table>
</>
)
}

@ -256,7 +256,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
const handleScanContinue = async () => {
const plugin = api as any
await plugin.call('notification', 'toast', 'Processing data to scan...')
_paq.push(['trackEvent', 'udapp', 'solidityScan', 'initiateScan'])
_paq.push(['trackEvent', 'solidityCompiler', 'solidityScan', 'initiateScan'])
const workspace = await plugin.call('filePanel', 'getCurrentWorkspace')
const fileName = `${workspace.name}/${props.compiledFileName}`
const filePath = `.workspaces/${fileName}`
@ -270,7 +270,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
ws.addEventListener('error', console.error);
ws.addEventListener('open', async (event) => {
await plugin.call('notification', 'toast', 'Fetching result in terminal ...')
await plugin.call('notification', 'toast', 'Fetching result in Remix terminal ...')
})
ws.addEventListener('message', async (event) => {
@ -293,7 +293,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
ws.send(JSON.stringify(reqToInitScan))
} else if (data.type === "scan_status" && data.payload.scan_status === "download_failed") {
// Message on failed scan
_paq.push(['trackEvent', 'udapp', 'solidityScan', 'scanFailed'])
_paq.push(['trackEvent', 'solidityCompiler', 'solidityScan', 'scanFailed'])
const modal: AppModal = {
id: 'SolidityScanError',
title: <FormattedMessage id="solidity.solScan.errModalTitle" />,
@ -303,7 +303,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
await plugin.call('notification', 'modal', modal)
} else if (data.type === "scan_status" && data.payload.scan_status === "scan_done") {
// Message on successful scan
_paq.push(['trackEvent', 'udapp', 'solidityScan', 'scanSuccess'])
_paq.push(['trackEvent', 'solidityCompiler', 'solidityScan', 'scanSuccess'])
const url = data.payload.scan_details.link
const { data: scanData } = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url })
@ -327,7 +327,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
}
const runSolidityScan = async () => {
_paq.push(['trackEvent', 'udapp', 'solidityScan', 'askPermissionToScan'])
_paq.push(['trackEvent', 'solidityCompiler', 'solidityScan', 'askPermissionToScan'])
const modal: AppModal = {
id: 'SolidityScanPermissionHandler',
title: <FormattedMessage id="solidity.solScan.modalTitle" />,
@ -335,7 +335,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
<span><FormattedMessage id="solidity.solScan.modalMessage" />
<a href={'https://solidityscan.com'}
target="_blank"
onClick={() => _paq.push(['trackEvent', 'udapp', 'solidityScan', 'learnMore'])}>
onClick={() => _paq.push(['trackEvent', 'solidityCompiler', 'solidityScan', 'learnMore'])}>
Learn more
</a>
</span>

Loading…
Cancel
Save