From 23e60f28580a320435bbf01ebe570cad57f406bf Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 3 Jun 2024 21:31:00 +0530 Subject: [PATCH] show table for result --- .../src/lib/components/solScanTable.tsx | 44 ++++++++++++------- .../src/lib/components/universalDappUI.tsx | 14 +++--- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx b/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx index 81fec80473..83e16ce0fa 100644 --- a/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx @@ -6,21 +6,33 @@ interface SolScanTableProps { } export function SolScanTable(props: SolScanTableProps) { + const {scanDetails} = props - return ( - - - - - - - - - - - - - -
h1h2
r1r2
- ) + return ( + + + + + + + + + + + { + Array.from(scanDetails, (template) => { + return ( + + + + + + + ) + }) + } + + +
IDNAMESEVERITYDESCRIPTION
{template.template_details.issue_id}{template.template_details.issue_name}{template.template_details.issue_severity}{template.template_details.static_issue_description}
+ ) } diff --git a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx index 9fbf8f23eb..2d6fb253b7 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -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' @@ -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}` @@ -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) => { @@ -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[] = scanData.scan_report.multi_file_scan_details const modal: AppModal = { id: 'SolidityScanSuccess', title: , - message: `Scan successful`, + message: , okLabel: 'Close' } await props.plugin.call('notification', 'modal', modal)