From b8b8ac260e65992bf1ce4e6f40e1879824727eca Mon Sep 17 00:00:00 2001 From: Shiva Ahir Date: Wed, 9 Oct 2024 22:50:18 -0400 Subject: [PATCH 1/2] Enabling toggle to turn on/off ACPU power --- src/components/Tables/ACPUTable.js | 60 ++++++++++++++++++------------ src/components/style/ACPUTable.css | 52 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 23 deletions(-) diff --git a/src/components/Tables/ACPUTable.js b/src/components/Tables/ACPUTable.js index ae840e06..604d003f 100644 --- a/src/components/Tables/ACPUTable.js +++ b/src/components/Tables/ACPUTable.js @@ -33,6 +33,11 @@ function ACPUTable({ device, update, notify }) { const [disable, setDisable] = React.useState(true); const loadActivity = GetOptions('A45_Load'); + // Toggle handler to enable/disable ACPU fields + const handleToggle = () => { + setDisable(!disable); + }; + function fetchPort(port, link) { server.GET(server.peripheralPath(device, `${link}/${port.href}`), (data) => { const ep = parseInt(port.href.slice(-1), 10); @@ -46,7 +51,6 @@ function ACPUTable({ device, update, notify }) { function fetchAcpuData(link) { if (link !== '') { server.GET(server.peripheralPath(device, link), (data) => { - // resolve cycling if (data.name !== acpuData.name || data.frequency !== acpuData.frequency || data.load !== acpuData.load) { @@ -75,7 +79,7 @@ function ACPUTable({ device, update, notify }) { function fetchData() { server.GET(server.api.fetch(server.Elem.peripherals, device), (data) => { const acpu = getPeripherals(data, 'acpu'); - setDisable(acpu.length === 0); + setDisable(true); if (acpu.length > 0) { const link = acpu[0].href; setHref(link); @@ -124,7 +128,6 @@ function ACPUTable({ device, update, notify }) { } const deleteRow = (index) => { - // no delete method for acpu. this is just clear name of the endpoint which mean disable const val = endpoints[index].data; val.name = ''; server.PATCH(server.peripheralPath(device, `${href}/ep/${endpoints[index].ep}`), val, () => fetchAcpuData(href)); @@ -147,9 +150,20 @@ function ACPUTable({ device, update, notify }) { const powerHeader = ['Power', '%']; const title = 'ACPU'; + return (
+ + {/* Toggle Switch for ACPU */} +
+ + +
+
handleChange('load', value)} items={loadActivity} disabled={disable} />
+ setModalOpen(true)}> - { - endpoints.map((row, index) => ( - (row.data !== undefined && row.data.name !== '') - && ( - - - { setEditIndex(index); setModalOpen(true); }} - onDeleteClick={() => deleteRow(index)} - /> - {row.data.name} - - - - - - - ) - )) - } + {endpoints.map((row, index) => ( + (row.data !== undefined && row.data.name !== '') + && ( + + + { setEditIndex(index); setModalOpen(true); }} + onDeleteClick={() => deleteRow(index)} + /> + {row.data.name} + + + + + + + ) + ))} + {modalOpen && ( Date: Wed, 9 Oct 2024 22:57:41 -0400 Subject: [PATCH 2/2] fixing python coverage error --- .github/workflows/rpe_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpe_test.yml b/.github/workflows/rpe_test.yml index 5e4d0b7d..d33e2dbb 100644 --- a/.github/workflows/rpe_test.yml +++ b/.github/workflows/rpe_test.yml @@ -242,7 +242,7 @@ jobs: - name: Install dependencies run: | - pip install -r requirements.txt + python3 -m pip install -r requirements.txt npm install - name: Run pytest with Codecov