Skip to content

Commit

Permalink
Add empty state display to pare status
Browse files Browse the repository at this point in the history
  • Loading branch information
emdoyle committed Aug 18, 2024
1 parent 0cdf7fc commit 59c7483
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/pare/cli/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from typing import Any

import requests
from rich import box
from rich.console import Console
from rich.panel import Panel
from rich.table import Table

from pare import settings
Expand All @@ -22,8 +24,20 @@ def show_status():


def display_status_table(status_data: list[dict[str, Any]]):
table = Table(title="Deployment Data")
console = Console()

if not status_data:
empty_message = Panel(
"[italic]No deployment data available.[/italic]\n\n[dim]Try deploying a service or check your connection.[/dim]",
title="Deployment Data",
expand=False,
border_style="white",
box=box.ROUNDED,
)
console.print(empty_message)
return

table = Table(title="Deployment Data")
table.add_column("Name", style="cyan", no_wrap=True)
table.add_column("Git Hash", style="magenta")
table.add_column("Created At", style="yellow")
Expand All @@ -37,5 +51,4 @@ def display_status_table(status_data: list[dict[str, Any]]):

table.add_row(name, git_hash, created_at)

console = Console()
console.print(table)

0 comments on commit 59c7483

Please sign in to comment.