Skip to content

Commit 585295f

Browse files
committed
add warnet dashboard
1 parent 2d258cb commit 585295f

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
@@ -254,11 +254,11 @@ def run_detached_process(command):
254254

255255

256256
def _port_start_internal(name, namespace):
257+
click.echo("Starting port-forwarding to warnet dashboard")
257258
command = f"kubectl port-forward -n {namespace} service/{name} 2019:80"
258259
run_detached_process(command)
259-
click.echo(
260-
"Port forwarding on port 2019 started in the background. To access landing page visit localhost:2019."
261-
)
260+
click.echo("Port forwarding on port 2019 started in the background.")
261+
click.echo("\nTo access the warnet dashboard visit localhost:2019 or run:\n warnet dashboard")
262262

263263

264264
def _port_stop_internal(name, namespace):

src/warnet/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .admin import admin
1818
from .bitcoin import bitcoin
1919
from .control import down, run, stop
20+
from .dashboard import dashboard
2021
from .deploy import deploy as deploy_command
2122
from .graph import graph
2223
from .image import image
@@ -33,6 +34,7 @@ def cli():
3334

3435

3536
cli.add_command(bitcoin)
37+
cli.add_command(dashboard)
3638
cli.add_command(deploy_command)
3739
cli.add_command(graph)
3840
cli.add_command(image)

0 commit comments

Comments
 (0)