Skip to content

Commit

Permalink
Merge pull request #120 from Alonza0314/refactor/edit-button
Browse files Browse the repository at this point in the history
refactor & feat /edit button
  • Loading branch information
ianchen0119 authored Nov 14, 2024
2 parents 2253502 + 05352db commit a2a6321
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
10 changes: 10 additions & 0 deletions frontend/src/pages/ProfileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ function ProfileList(props: Props) {
navigation("/profile/" + profile);
};

const handleEdit = (profile: string) => {
navigation("/profile/create/" + profile);
};

const filteredData = data.filter((profile) =>
profile.toLowerCase().includes(searchTerm.toLowerCase()),
);
Expand Down Expand Up @@ -156,6 +160,7 @@ function ProfileList(props: Props) {
<TableCell>Name</TableCell>
<TableCell>Delete</TableCell>
<TableCell>View</TableCell>
<TableCell>Edit</TableCell>
</TableRow>
</TableHead>
<TableBody>
Expand All @@ -176,6 +181,11 @@ function ProfileList(props: Props) {
VIEW
</Button>
</TableCell>
<TableCell>
<Button color="primary" variant="contained" onClick={() => handleEdit(row.toString())}>
EDIT
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
Expand Down
20 changes: 13 additions & 7 deletions frontend/src/pages/ProfileRead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ export default function ProfileRead() {

return (
<Dashboard title="Profile" refreshAction={() => {}}>
<Grid
item
xs={12}
sx={{
display: 'flex',
justifyContent: 'flex-end'
}}
>
<Button color="primary" variant="contained" onClick={handleEdit} sx={{ m: 1 }}>
EDIT
</Button>
</Grid>
<br />
<Card variant="outlined">
<Table>
<TableBody>
Expand Down Expand Up @@ -236,13 +249,6 @@ export default function ProfileRead() {
</Card>
</div>
))}

<br />
<Grid item xs={12}>
<Button color="primary" variant="contained" onClick={handleEdit} sx={{ m: 1 }}>
EDIT
</Button>
</Grid>
</Dashboard>
);
}
10 changes: 10 additions & 0 deletions frontend/src/pages/SubscriberList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ function SubscriberList(props: Props) {
navigation("/subscriber/" + subscriber.ueId + "/" + subscriber.plmnID);
};

const handleEdit = (subscriber: Subscriber) => {
navigation("/subscriber/create/" + subscriber.ueId + "/" + subscriber.plmnID);
};

const filteredData = data.filter((subscriber) =>
subscriber.ueId?.toLowerCase().includes(searchTerm.toLowerCase()) ||
subscriber.plmnID?.toLowerCase().includes(searchTerm.toLowerCase())
Expand Down Expand Up @@ -162,6 +166,7 @@ function SubscriberList(props: Props) {
<TableCell>UE ID</TableCell>
<TableCell>Delete</TableCell>
<TableCell>View</TableCell>
<TableCell>Edit</TableCell>
</TableRow>
</TableHead>
<TableBody>
Expand All @@ -183,6 +188,11 @@ function SubscriberList(props: Props) {
VIEW
</Button>
</TableCell>
<TableCell>
<Button color="primary" variant="contained" onClick={() => handleEdit(row)}>
EDIT
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
Expand Down
19 changes: 13 additions & 6 deletions frontend/src/pages/SubscriberRead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ export default function SubscriberRead() {

return (
<Dashboard title="Subscription" refreshAction={() => {}}>
<Grid
item
xs={12}
sx={{
display: 'flex',
justifyContent: 'flex-end'
}}
>
<Button color="primary" variant="contained" onClick={handleEdit} sx={{ m: 1 }}>
EDIT
</Button>
</Grid>
<br />
<Card variant="outlined">
<Table>
<TableBody>
Expand Down Expand Up @@ -343,12 +356,6 @@ export default function SubscriberRead() {
</Card>
</div>
))}
<br />
<Grid item xs={12}>
<Button color="primary" variant="contained" onClick={handleEdit} sx={{ m: 1 }}>
EDIT
</Button>
</Grid>
</Dashboard>
);
}

0 comments on commit a2a6321

Please sign in to comment.