Skip to content

Commit

Permalink
feat: allow influencing the index page
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Apr 1, 2022
1 parent 1c86d36 commit 31a9329
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions doppelgaenger-websocket/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from healthcheck import TornadoHandler, HealthCheck
import time


health = HealthCheck()


Expand Down Expand Up @@ -70,15 +69,21 @@ async def watch(collection):

class HomeHandler(tornado.web.RequestHandler):
def get(self):
self.render("templates/index.html", simulator_url=os.getenv("SIMULATOR_URL", ""))
self.render("templates/index.html",
simulator_url=os.getenv("SIMULATOR_URL", ""),
title=os.getenv("INDEX__TITLE", "Dashboard"),
cols=os.getenv("INDEX__COLS", "row-cols-1 row-cols-md-2 row-cols-xl-4 g-4")
)


def sig_handler(sig, frame):
logger.warning('Caught signal: %s', sig)
tornado.ioloop.IOLoop.instance().add_callback(shutdown)


MAX_WAIT_SECONDS_BEFORE_SHUTDOWN = 3


def shutdown():
logger.info('Stopping http server')
server.stop()
Expand All @@ -95,6 +100,7 @@ def stop_loop():
else:
io_loop.stop()
logging.info('Shutdown')

stop_loop()


Expand Down
6 changes: 3 additions & 3 deletions doppelgaenger-websocket/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

<title>Dashboard example</title>
<title>{{ title }}</title>

<style>
.updated .card-header {
Expand All @@ -34,7 +34,7 @@
<body>

<header class="container">
<h1>Dashboard example</h1>
<h1>{{ title }}</h1>
</header>

<main class="container">
Expand All @@ -56,7 +56,7 @@ <h1>Dashboard example</h1>
</div>
</div>

<div class="row row-cols-1 row-cols-md-2 row-cols-xl-4 g-4" id="devices"></div>
<div class="row {{ cols }}" id="devices"></div>

</main>

Expand Down

0 comments on commit 31a9329

Please sign in to comment.