@@ -91,6 +91,22 @@ def visualize_peripherals(info_dict):
9191 tree .add ("No peripherals found" )
9292 return tree
9393
94+ def visualize_storage_devices (status ):
95+ tree = Tree ("Storage Devices" )
96+ storage_devices = status .get ("storage" , {}).get ("storage_devices" , [])
97+ if storage_devices :
98+ for storage_device in storage_devices :
99+ storage_devices_tree = tree .add (
100+ f"{ storage_device .get ('name' , 'Unknown' )} "
101+ )
102+ total = float (storage_device .get ("total_gb" , 0 ))
103+ used = float (storage_device .get ("used_gb" , 0 ))
104+ used_percent = (used / total * 100 ) if total > 0 else 0
105+ storage_devices_tree .add (f"ID: { storage_device .get ('storage_device_id' , 'Unknown' )} " )
106+ storage_devices_tree .add (f"Storage: { used_percent :.1f} % used ({ used :.1f} GB / { total :.1f} GB)" )
107+ else :
108+ tree .add ("No storage devices found" )
109+ return tree
94110
95111class DeviceInfoDisplay :
96112 """A class for displaying device information."""
@@ -135,15 +151,6 @@ def summary(self, device: Device):
135151 battery = status ["power" ].get ("battery_level_percent" , "N/A" )
136152 self .console .print (f"Battery: { battery } %" , highlight = False )
137153
138- if "storage" in status :
139- storage = status ["storage" ]
140- total = float (storage .get ("total_gb" , 0 ))
141- used = float (storage .get ("used_gb" , 0 ))
142- used_percent = (used / total * 100 ) if total > 0 else 0
143- self .console .print (
144- f"Storage: { used_percent :.1f} % used ({ used :.1f} GB / { total :.1f} GB)" ,
145- highlight = False ,
146- )
147-
154+ self .console .print (visualize_storage_devices (status ))
148155 self .console .print (visualize_peripherals (info_dict ))
149156 self .console .print (visualize_configuration (info_dict , status ))
0 commit comments