diff --git a/frontend/src/pages/ChargingRecordList.tsx b/frontend/src/pages/ChargingRecordList.tsx index e8f9290b..60d928bd 100644 --- a/frontend/src/pages/ChargingRecordList.tsx +++ b/frontend/src/pages/ChargingRecordList.tsx @@ -1,6 +1,6 @@ import React, { Component, useState, useEffect } from "react"; import axios from "../axios"; -import { ChargingRecord } from "../api/api"; +import { ChargingRecord, flowChargingRecord } from "../api/api"; import Dashboard from "../Dashboard"; import { @@ -49,7 +49,27 @@ export default function ChargingRecordList() { setExpand(true) } } - + + interface Props { + FlowCharingRecords: flowChargingRecord[] | undefined + } + /* eslint-disable react/prop-types */ + const PerFlowTableView = ({ FlowCharingRecords }: Props): React.ReactElement => ( + <> + {expand === true ? FlowCharingRecords!.map((FlowChargingRecord, i) => ( + + {} + {FlowChargingRecord.Filter} + {FlowChargingRecord.QuotaLeft} + {FlowChargingRecord.DataTotalVolume} + {FlowChargingRecord.DataVolumeUplink} + {FlowChargingRecord.DataVolumeDownlink} + + )) : <> + } + + ) + const tableView = ( @@ -64,39 +84,29 @@ export default function ChargingRecordList() { {cr.map((row, index) => ( - - - {row.Supi} - - - {row.CmState} - {row.Quota} - {row.DataTotalVolume} - {row.DataVolumeUplink} - {row.DataVolumeDownlink} - - ))} - {expand === true ? cr.map((row, index) => ( - row.flowInfos?.map((flowChargingRecord, i) => ( - - {} - {flowChargingRecord.Filter} - {flowChargingRecord.QuotaLeft} - {flowChargingRecord.DataTotalVolume} - {flowChargingRecord.DataVolumeUplink} - {flowChargingRecord.DataVolumeDownlink} + <> + + + {row.Supi} + + + {row.CmState} + {row.Quota} + {row.DataTotalVolume} + {row.DataVolumeUplink} + {row.DataVolumeDownlink} - )) - )): - <> - } + + + ))}
) + return (