Skip to content

Commit

Permalink
add PerFlowTableView as a React Component
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn committed Oct 25, 2023
1 parent faa670c commit 7ab8eb2
Showing 1 changed file with 41 additions and 31 deletions.
72 changes: 41 additions & 31 deletions frontend/src/pages/ChargingRecordList.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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) => (
<TableRow key={i}>
<TableCell>{}</TableCell>
<TableCell>{FlowChargingRecord.Filter}</TableCell>
<TableCell>{FlowChargingRecord.QuotaLeft}</TableCell>
<TableCell>{FlowChargingRecord.DataTotalVolume}</TableCell>
<TableCell>{FlowChargingRecord.DataVolumeUplink}</TableCell>
<TableCell>{FlowChargingRecord.DataVolumeDownlink}</TableCell>
</TableRow>
)) : <></>
}
</>
)

const tableView = (
<Table>
<TableHead>
Expand All @@ -64,39 +84,29 @@ export default function ChargingRecordList() {
</TableHead>
<TableBody>
{cr.map((row, index) => (
<TableRow key={index}>
<TableCell>
{row.Supi}
<Button
onClick={() => onExpand()}
>
{expand === true ? <ExpandMoreIcon viewBox="0 0 24 24"/> : <ExpandLessIcon viewBox="0 0 24 24"/>}
</Button>
</TableCell>
<TableCell>{row.CmState}</TableCell>
<TableCell>{row.Quota}</TableCell>
<TableCell>{row.DataTotalVolume}</TableCell>
<TableCell>{row.DataVolumeUplink}</TableCell>
<TableCell>{row.DataVolumeDownlink}</TableCell>
</TableRow>
))}
{expand === true ? cr.map((row, index) => (
row.flowInfos?.map((flowChargingRecord, i) => (
<TableRow key={i}>
<TableCell>{}</TableCell>
<TableCell>{flowChargingRecord.Filter}</TableCell>
<TableCell>{flowChargingRecord.QuotaLeft}</TableCell>
<TableCell>{flowChargingRecord.DataTotalVolume}</TableCell>
<TableCell>{flowChargingRecord.DataVolumeUplink}</TableCell>
<TableCell>{flowChargingRecord.DataVolumeDownlink}</TableCell>
<>
<TableRow key={index}>
<TableCell>
{row.Supi}
<Button
onClick={() => onExpand()}
>
{expand === true ? <ExpandMoreIcon viewBox="0 0 24 24"/> : <ExpandLessIcon viewBox="0 0 24 24"/>}
</Button>
</TableCell>
<TableCell>{row.CmState}</TableCell>
<TableCell>{row.Quota}</TableCell>
<TableCell>{row.DataTotalVolume}</TableCell>
<TableCell>{row.DataVolumeUplink}</TableCell>
<TableCell>{row.DataVolumeDownlink}</TableCell>
</TableRow>
))
)):
<></>
}
<PerFlowTableView FlowCharingRecords={row.flowInfos} />
</>
))}
</TableBody>
</Table>
)

return (
<Dashboard title="UE CHARGING RECORD">
<Grid container spacing={2}>
Expand Down

0 comments on commit 7ab8eb2

Please sign in to comment.