Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add navbar to bokeh pages #1141

Merged
merged 4 commits into from Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions distributed/bokeh/scheduler.py
Expand Up @@ -53,6 +53,8 @@

template = jinja2.Template(template_source)

template_variables = {'pages': ['status', 'workers', 'tasks', 'system', 'counters']}


def update(source, data):
""" Update source with data
Expand Down Expand Up @@ -885,6 +887,8 @@ def systemmonitor_doc(scheduler, doc):
doc.add_root(column(table.root, sysmon.root,
sizing_mode='scale_width'))
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'system'


def stealing_doc(scheduler, doc):
Expand All @@ -905,6 +909,8 @@ def stealing_doc(scheduler, doc):
sizing_mode='scale_width'))

doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'stealing'


def events_doc(scheduler, doc):
Expand All @@ -915,6 +921,8 @@ def events_doc(scheduler, doc):
doc.title = "Dask Scheduler Events"
doc.add_root(column(events.root, sizing_mode='scale_width'))
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'events'


def workers_doc(scheduler, doc):
Expand All @@ -925,6 +933,8 @@ def workers_doc(scheduler, doc):
doc.title = "Dask Workers"
doc.add_root(table.root)
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'workers'


def tasks_doc(scheduler, doc):
Expand All @@ -936,6 +946,8 @@ def tasks_doc(scheduler, doc):
doc.title = "Dask Task Stream"
doc.add_root(ts.root)
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'tasks'


def status_doc(scheduler, doc):
Expand Down Expand Up @@ -970,6 +982,8 @@ def status_doc(scheduler, doc):
task_progress.root,
sizing_mode='scale_width'))
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'status'


class BokehScheduler(BokehServer):
Expand Down
75 changes: 41 additions & 34 deletions distributed/bokeh/template.html
Expand Up @@ -15,7 +15,7 @@
body {
min-height: 100%;
margin: 0 4%;
padding: 20px;
padding: 0px 20px;
border-left: 1px solid #F0F0F0;
border-right: 1px solid #F0F0F0;
background: #FFF;
Expand Down Expand Up @@ -44,30 +44,42 @@
content: ".";
font-size: 0;
}
.header {
width: 100;
clear: both;
overflow: hidden;
.navbar img {
height: 40px;
float: right;
margin-bottom: 0px;
padding: 0px 24px;
}
.header h1 {
font-family: 'Source Sans Pro', sans-serif;
font-size: 18px;
text-transform: uppercase;
color: #2e484c;
margin: 1em 0 0 0;
float: left;
.navbar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #EEE;
}
.header p {
font-family: 'Source Sans Pro', sans-serif;
font-size: 18px;
float: left;
max-width: 60%;

.navbar li {
float: left;
font-size: 18px;
transition: .3s background-color;
}
.header img {
height: 50px;
float: right;
margin-bottom: 20px;

.navbar li a {
display: block;
color: black;
text-align: center;
padding: 11px 16px;
text-decoration: none;
}

.navbar li:hover {
background-color: #eaaa6d;
}

.active {
background-color: rgba(234, 170, 109, 0.7);
}

a {
color: #1f5396;
text-decoration: none;
Expand All @@ -80,25 +92,20 @@
a:focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.bk-root .bk-toolbar-box .bk-toolbar-right {
} .bk-root .bk-toolbar-box .bk-toolbar-right {
top: 4px;
right: 4px;
}
</style>
</head>
<body>
<div class="header">
<img src="https://dask.readthedocs.io/en/latest/_images/dask_horizontal.svg">
<p>
Dask
&mdash;
<a href="https://dask.pydata.org/en/latest/">Algorithm Docs</a>
&mdash;
<a href="https://distributed.readthedocs.io/en/latest/">Scheduler Docs</a>
&mdash;
<a href="/">Diagnostic Pages</a>
</p>
<div class="navbar">
<ul>
<li><a href="http://dask.pydata.org/en/latest/" style="padding:0px 0px;"><img src="https://dask.readthedocs.io/en/latest/_images/dask_horizontal.svg"></a></li>
{% for page in pages %}
<li{% if page == active_page %} class="active"{% endif %}><a href="/{{ page }}">{{ page|title }}</a></li>
{% endfor %}
</ul>
</div>
<div class="dashboard">
{{ plot_div }}
Expand Down
9 changes: 9 additions & 0 deletions distributed/bokeh/worker.py
Expand Up @@ -32,6 +32,7 @@
template_source = f.read()

template = jinja2.Template(template_source)
template_variables = {'pages': ['main', 'system', 'crossfilter', 'counters']}


class StateTable(DashboardComponent):
Expand Down Expand Up @@ -554,6 +555,8 @@ def main_doc(worker, doc):
communicating_stream.root,
sizing_mode='scale_width'))
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'main'


def crossfilter_doc(worker, doc):
Expand All @@ -567,6 +570,8 @@ def crossfilter_doc(worker, doc):

doc.add_root(column(statetable.root, crossfilter.root))
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'crossfilter'


def systemmonitor_doc(worker, doc):
Expand All @@ -577,6 +582,8 @@ def systemmonitor_doc(worker, doc):

doc.add_root(sysmon.root)
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'system'


def counters_doc(server, doc):
Expand All @@ -587,6 +594,8 @@ def counters_doc(server, doc):

doc.add_root(counter.root)
doc.template = template
doc.template_variables.update(template_variables)
doc.template_variables['active_page'] = 'counters'


class BokehWorker(BokehServer):
Expand Down