Skip to content

Commit

Permalink
Add displaying of disk names
Browse files Browse the repository at this point in the history
  • Loading branch information
romasku committed Feb 11, 2021
1 parent 4c26e91 commit 733167f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
11 changes: 10 additions & 1 deletion neuro-cli/src/neuro_cli/formatters/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def __init__(

def _disk_to_table_row(self, disk: Disk) -> Sequence[str]:
storage_str = utils.format_size(disk.storage)
line = [disk.id, storage_str, self._uri_formatter(disk.uri), disk.status.value]
line = [
disk.id,
disk.name,
storage_str,
self._uri_formatter(disk.uri),
disk.status.value,
]
if self._long_format:
line += [
format_datetime(disk.created_at),
Expand All @@ -53,6 +59,7 @@ def __call__(self, disks: Sequence[Disk]) -> RenderableType:
# make sure that the first column is fully expanded
width = len("disk-06bed296-8b27-4aa8-9e2a-f3c47b41c807")
table.add_column("Id", style="bold", width=width)
table.add_column("Name")
table.add_column("Storage")
table.add_column("Uri")
table.add_column("Status")
Expand Down Expand Up @@ -80,6 +87,8 @@ def __call__(self, disk: Disk) -> RenderableType:
table.add_row("Id", disk.id)
table.add_row("Storage", utils.format_size(disk.storage))
table.add_row("Uri", self._uri_formatter(disk.uri))
if disk.name:
table.add_row("Name", disk.name)
table.add_row("Status", disk.status.value)
table.add_row("Created at", format_datetime(disk.created_at))
table.add_row("Last used", format_datetime(disk.last_usage))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Id Storage Uri Status Created at Last used Life span
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
disk-1 50.0G disk://cluster/user/disk-1 Pending Mar 04 2017 Mar 08 2017
disk-2 50.0M disk://cluster/user/disk-2 Ready Apr 04 2017 2d3h4m5s
disk-3 50.0K disk://cluster/user/disk-3 Ready May 04 2017
disk-4 50B disk://cluster/user/disk-4 Broken Jun 04 2017
Id Name Storage Uri Status Created at Last used Life span
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
disk-1 50.0G disk://cluster/user/disk-1 Pending Mar 04 2017 Mar 08 2017
disk-2 50.0M disk://cluster/user/disk-2 Ready Apr 04 2017 2d3h4m5s
disk-3 50.0K disk://cluster/user/disk-3 Ready May 04 2017
disk-4 50B disk://cluster/user/disk-4 Broken Jun 04 2017
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Id Storage Uri Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
disk-1 50.0G disk://cluster/user/disk-1 Pending
disk-2 50.0M disk://cluster/user/disk-2 Ready
disk-3 50.0K disk://cluster/user/disk-3 Ready
disk-4 50B disk://cluster/user/disk-4 Broken
Id Name Storage Uri Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
disk-1 50.0G disk://cluster/user/disk-1 Pending
disk-2 50.0M disk://cluster/user/disk-2 Ready
disk-3 50.0K disk://cluster/user/disk-3 Ready
disk-4 50B disk://cluster/user/disk-4 Broken

0 comments on commit 733167f

Please sign in to comment.