Skip to content

Commit 51fbac4

Browse files
committed
add database creation time to slide-in panel
1 parent 30053cd commit 51fbac4

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/components/NodeInfoPanel.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ interface NodeInfoPanelProps {
1616
nodeData: NodeObject | null;
1717
}
1818

19-
// helper function to covert the database size format
19+
// helper functions
20+
21+
// covert the database size format
2022
const formatSize = (bytes?: number): string =>{
2123
if (bytes === undefined) return "N/A";
2224
if (bytes >= 1_073_741_824) {
@@ -29,11 +31,25 @@ const formatSize = (bytes?: number): string =>{
2931
return `${bytes} Bytes`;
3032
}
3133
};
32-
3334
// 1 Kilobyte (KB) = 1,024 Bytes
3435
// 1 Megabyte (MB) = 1,024 KB = 1,048,576 Bytes (1024*1024)
3536
// 1 Gigabyte (GB) = 1,024 MB = 1,073,741,824 Bytes (1024*1024*1024)
3637

38+
// convert the date format
39+
const dateCoverter = (date?: string): string => {
40+
if (date === undefined) return "N/A";
41+
const newDate = new Date(Number(date) * 1000);
42+
const result = new Intl.DateTimeFormat("en-US", {
43+
year: "numeric",
44+
month: "numeric",
45+
day: "numeric",
46+
hour: "numeric",
47+
minute: "numeric",
48+
second: "numeric"
49+
}).format(newDate);
50+
return result;
51+
}
52+
3753
const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({ open, onClose, nodeData }) => {
3854
const navigate = useNavigate();
3955
const dispatch = useAppDispatch();
@@ -125,7 +141,7 @@ const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({ open, onClose, nodeData }
125141
</Grid>
126142
<Grid item xs={12}>
127143
<Typography>Database Creation Time</Typography>
128-
<Typography></Typography>
144+
<Typography>{dateCoverter(dbInfo.instance_start_time)}</Typography>
129145
</Grid>
130146
<Grid item xs={12}>
131147
<Typography>Searchable Database Size</Typography>

0 commit comments

Comments
 (0)