Skip to content

Commit

Permalink
show table for result
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket-Engg committed Jun 3, 2024
1 parent 749ceca commit b9d0c62
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 24 deletions.
44 changes: 28 additions & 16 deletions libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,33 @@ interface SolScanTableProps {
}

export function SolScanTable(props: SolScanTableProps) {
const {scanDetails} = props

return (
<table className="table h6 table-sm">
<thead>
<tr>
<td scope="col">h1</td>
<td scope="col">h2</td>
</tr>
</thead>
<tbody>
<tr>
<td scope="col">r1</td>
<td scope="col">r2</td>
</tr>
</tbody>
</table>
)
return (
<table className="table h6 table-sm">
<thead>
<tr>
<td scope="col">ID</td>
<td scope="col">NAME</td>
<td scope="col">SEVERITY</td>
<td scope="col">DESCRIPTION</td>
</tr>
</thead>
<tbody>
{
Array.from(scanDetails, (template) => {
return (
<tr>
<td scope="col">{template.template_details.issue_id}</td>
<td scope="col">{template.template_details.issue_name}</td>
<td scope="col">{template.template_details.issue_severity}</td>
<td scope="col">{template.template_details.static_issue_description}</td>
</tr>
)
})
}

</tbody>
</table>
)
}
14 changes: 6 additions & 8 deletions libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as ethJSUtil from '@ethereumjs/util'
import axios from 'axios'
import { AppModal } from '@remix-ui/app'
import { ContractGUI } from './contractGUI'
import { SolScanTable } from './solScanTable'
import { TreeView, TreeViewItem } from '@remix-ui/tree-view'
import { BN } from 'bn.js'
import { CustomTooltip, is0XPrefixed, isHexadecimal, isNumeric, shortenAddress } from '@remix-ui/helper'
Expand Down Expand Up @@ -220,7 +221,7 @@ export function UniversalDappUI(props: UdappProps) {
}

const handleScanContinue = async () => {
await props.plugin.call('notification', 'toast', 'Running scan...')
await props.plugin.call('notification', 'toast', 'Processing data to scan...')
const workspace = await props.plugin.call('filePanel', 'getCurrentWorkspace')
const fileName = props.instance.filePath || `${workspace.name}/${props.instance.contractData.contract.file}`
const filePath = `.workspaces/${fileName}`
Expand All @@ -233,8 +234,8 @@ export function UniversalDappUI(props: UdappProps) {

ws.addEventListener('error', console.error);

ws.addEventListener('open', (event) => {
console.log('Connected to the server.')
ws.addEventListener('open', async (event) => {
await props.plugin.call('notification', 'toast', 'Initiating scan...')
})

ws.addEventListener('message', async (event) => {
Expand Down Expand Up @@ -273,15 +274,12 @@ export function UniversalDappUI(props: UdappProps) {
const url = data.payload.scan_details.link

const {data: scanData} = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url })
console.log('scanData--->', scanData)
const scanDetails = scanData.scan_report.multi_file_scan_details
console.log('scanDetails--->', scanDetails)

const scanDetails: Record<string, any>[] = scanData.scan_report.multi_file_scan_details

const modal: AppModal = {
id: 'SolidityScanSuccess',
title: <FormattedMessage id="udapp.solScan.successModalTitle" />,
message: `Scan successful`,
message: <SolScanTable scanDetails={scanDetails} />,
okLabel: 'Close'
}
await props.plugin.call('notification', 'modal', modal)
Expand Down

0 comments on commit b9d0c62

Please sign in to comment.