Skip to content

Commit 4879b03

Browse files
committed
add warnet dashboard
1 parent 31c08e1 commit 4879b03

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/warnet/dashboard.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import click
2+
3+
4+
@click.command()
5+
def dashboard():
6+
"""Open the Warnet dashboard in default browser"""
7+
import webbrowser
8+
9+
url = "http://localhost:2019"
10+
webbrowser.open(url)
11+
click.echo("warnet dashboard opened in default browser")

src/warnet/deploy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ def run_detached_process(command):
282282

283283

284284
def _port_start_internal(name, namespace):
285+
click.echo("Starting port-forwarding to warnet dashboard")
285286
command = f"kubectl port-forward -n {namespace} service/{name} 2019:80"
286287
run_detached_process(command)
287-
click.echo(
288-
"Port forwarding on port 2019 started in the background. To access landing page visit localhost:2019."
289-
)
288+
click.echo("Port forwarding on port 2019 started in the background.")
289+
click.echo("\nTo access the warnet dashboard visit localhost:2019 or run:\n warnet dashboard")
290290

291291

292292
def _port_stop_internal(name, namespace):

src/warnet/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .admin import admin
44
from .bitcoin import bitcoin
55
from .control import down, logs, run, snapshot, stop
6+
from .dashboard import dashboard
67
from .deploy import deploy
78
from .graph import create, graph
89
from .image import image
@@ -21,6 +22,7 @@ def cli():
2122
cli.add_command(bitcoin)
2223
cli.add_command(deploy)
2324
cli.add_command(down)
25+
cli.add_command(dashboard)
2426
cli.add_command(graph)
2527
cli.add_command(image)
2628
cli.add_command(init)

0 commit comments

Comments
 (0)