-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract flowRule/upSecurity/chargingConfig as additional co…
…mponent, which used by profileRead and subscriberRead
- Loading branch information
1 parent
fc72c1f
commit 458309a
Showing
5 changed files
with
210 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from "react"; | ||
import { | ||
Box, | ||
Grid, | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableRow, | ||
} from "@mui/material"; | ||
import { ChargingData } from "../../api/api"; | ||
|
||
const ChargingCfg = ({ | ||
chargingData, | ||
}: { | ||
chargingData: ChargingData; | ||
}) => { | ||
const isOnlineCharging = chargingData.chargingMethod === "Online"; | ||
|
||
return ( | ||
<Box sx={{ m: 2 }}> | ||
<Grid container spacing={2}> | ||
<Grid item xs={12}> | ||
<h4>Charging Config</h4> | ||
</Grid> | ||
</Grid> | ||
<Table> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Charging Method</TableCell> | ||
<TableCell>{chargingData.chargingMethod}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
{isOnlineCharging && ( | ||
<TableBody> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}> Quota </TableCell> | ||
<TableCell>{chargingData.quota}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
)} | ||
<TableBody> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}> Unit Cost </TableCell> | ||
<TableCell>{chargingData.unitCost}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default ChargingCfg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React from "react"; | ||
import { | ||
Box, | ||
Card, | ||
Table, | ||
TableBody, | ||
TableRow, | ||
TableCell, | ||
} from "@mui/material"; | ||
import { QosFlows, Nssai } from "../../api/api"; | ||
|
||
const FlowRule = ({ | ||
dnn, | ||
flow, | ||
data, | ||
chargingConfig, | ||
qosFlow, | ||
}: { | ||
dnn: string; | ||
flow: any; | ||
data: any; | ||
chargingConfig: (dnn: string, snssai: Nssai, filter: string | undefined) => JSX.Element | undefined; | ||
qosFlow: (sstSd: string, dnn: string, qosRef: number | undefined) => QosFlows | undefined; | ||
}) => { | ||
const flowKey = toHex(flow.sst) + flow.sd; | ||
|
||
return ( | ||
<div key={flow.snssai}> | ||
<Box sx={{ m: 2 }}> | ||
<h4>Flow Rules</h4> | ||
<Card variant="outlined"> | ||
<Table> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>IP Filter</TableCell> | ||
<TableCell>{flow.filter}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Precedence</TableCell> | ||
<TableCell>{flow.precedence}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>5QI</TableCell> | ||
<TableCell>{qosFlow(flowKey, dnn, flow.qosRef)?.["5qi"]}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Uplink GBR</TableCell> | ||
<TableCell>{qosFlow(flowKey, dnn, flow.qosRef!)?.gbrUL}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Downlink GBR</TableCell> | ||
<TableCell>{qosFlow(flowKey, dnn, flow.qosRef!)?.gbrDL}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Uplink MBR</TableCell> | ||
<TableCell>{qosFlow(flowKey, dnn, flow.qosRef!)?.mbrUL}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Downlink MBR</TableCell> | ||
<TableCell>{qosFlow(flowKey, dnn, flow.qosRef!)?.mbrDL}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Charging Characteristics</TableCell> | ||
<TableCell>{chargingConfig(dnn, flow.snssai, flow.filter)}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</Card> | ||
</Box> | ||
</div> | ||
); | ||
}; | ||
|
||
const toHex = (v: number | undefined): string => { | ||
return ("00" + v?.toString(16).toUpperCase()).substr(-2); | ||
}; | ||
|
||
export default FlowRule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from "react"; | ||
import { | ||
Box, | ||
Card, | ||
Table, | ||
TableBody, | ||
TableRow, | ||
TableCell, | ||
} from "@mui/material"; | ||
import { DnnConfiguration } from "../../api/api"; | ||
|
||
const UpSecurity = ({ | ||
dnn, | ||
}: { | ||
dnn: DnnConfiguration; | ||
}) => { | ||
if (dnn.upSecurity === undefined) { | ||
return <div></div>; | ||
} | ||
|
||
const security = dnn.upSecurity; | ||
return ( | ||
<div key={security.upIntegr}> | ||
<Box sx={{ m: 2 }}> | ||
<h4>UP Security</h4> | ||
<Card variant="outlined"> | ||
<Table> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Integrity of UP Security</TableCell> | ||
<TableCell>{security.upIntegr}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell style={{ width: "40%" }}>Confidentiality of UP Security</TableCell> | ||
<TableCell>{security.upConfid}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</Card> | ||
</Box> | ||
</div> | ||
); | ||
}; | ||
|
||
export default UpSecurity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.