Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit bbe60d3

Browse files
authored
Add a warning icon to the tabs (#178)
1 parent 3b8e07e commit bbe60d3

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

badge_server/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ def one_badge_image():
278278
if badge_name is None:
279279
badge_name = package_name
280280

281+
badge_name = _sanitize_badge_name(badge_name)
282+
281283
force_run_check = flask.request.args.get('force_run_check')
282284
# Remove the last '/' from the url root
283285
url_prefix = flask.request.url_root[:-1]
@@ -304,6 +306,7 @@ def one_badge_image():
304306

305307
details_link = url_prefix + flask.url_for('one_badge_target',
306308
package=package_name)
309+
307310
response = flask.make_response(
308311
pybadges.badge(
309312
left_text=badge_name,
@@ -380,7 +383,7 @@ def run_check():
380383
else py3_description
381384
version_and_res['py3']['details'] = py3_details
382385

383-
# Write the result to memory store
386+
# Write the result to Cloud Datastore
384387
CACHE.set(
385388
'{}_self_comp_badge'.format(package_name), version_and_res)
386389

@@ -470,7 +473,7 @@ def run_check():
470473
res['details'] = details
471474
res['deprecated_deps'] = deprecated_deps
472475

473-
# Write the result to memory store
476+
# Write the result to Cloud Datastore
474477
CACHE.set(
475478
'{}_dependency_badge'.format(package_name), res)
476479

@@ -571,7 +574,7 @@ def run_check():
571574
py_version]['details'][package] = details
572575
result = version_and_res
573576

574-
# Write the result to memory store
577+
# Write the result to Cloud Datastore
575578
CACHE.set(
576579
'{}_google_comp_badge'.format(package_name), result)
577580

badge_server/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
compatibility_lib==0.0.10
1+
compatibility_lib==0.0.11
22
Flask==1.0.2
33
google-cloud-bigquery==1.3.0
44
google-cloud-datastore==1.7.0

badge_server/templates/google-compatibility.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,18 @@ <h4>Google Compatibility Check Results</h4>
4848

4949
<ul class="nav nav-tabs" id="myTab" role="tablist">
5050
<li class="nav-item">
51-
<a class="nav-link active" id="py2-tab" data-toggle="tab" href="#py2" role="tab" aria-controls="py2" aria-selected="true">Python 2</a>
51+
<a class="nav-link active" id="py2-tab" data-toggle="tab" href="#py2" role="tab" aria-controls="py2" aria-selected="true">Python 2
52+
{% if result.py2.status == "CHECK_WARNING" %}
53+
<span class="badge badge-warning">Warning</span>
54+
{% endif %}
55+
</a>
5256
</li>
5357
<li class="nav-item">
54-
<a class="nav-link" id="py3-tab" data-toggle="tab" href="#py3" role="tab" aria-controls="py3" aria-selected="false">Python 3</a>
58+
<a class="nav-link" id="py3-tab" data-toggle="tab" href="#py3" role="tab" aria-controls="py3" aria-selected="false">Python 3
59+
{% if result.py3.status == "CHECK_WARNING" %}
60+
<span class="badge badge-warning">Warning</span>
61+
{% endif %}
62+
</a>
5563
</li>
5664
</ul>
5765
<div class="tab-content pl-3 p-1" id="myTabContent">

badge_server/templates/one-badge.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,18 @@ <h4>Google Compatibility Check Results</h4>
168168

169169
<ul class="nav nav-tabs" id="myTab" role="tablist">
170170
<li class="nav-item">
171-
<a class="nav-link active" id="py2-tab" data-toggle="tab" href="#py2" role="tab" aria-controls="py2" aria-selected="true">Python 2</a>
171+
<a class="nav-link active" id="py2-tab" data-toggle="tab" href="#py2" role="tab" aria-controls="py2" aria-selected="true">Python 2
172+
{% if google_compat_res.py2.status == "CHECK_WARNING" %}
173+
<span class="badge badge-warning">Warning</span>
174+
{% endif %}
175+
</a>
172176
</li>
173177
<li class="nav-item">
174-
<a class="nav-link" id="py3-tab" data-toggle="tab" href="#py3" role="tab" aria-controls="py3" aria-selected="false">Python 3</a>
178+
<a class="nav-link" id="py3-tab" data-toggle="tab" href="#py3" role="tab" aria-controls="py3" aria-selected="false">Python 3
179+
{% if google_compat_res.py3.status == "CHECK_WARNING" %}
180+
<span class="badge badge-warning">Warning</span>
181+
{% endif %}
182+
</a>
175183
</li>
176184
</ul>
177185
<div class="tab-content pl-3 p-1" id="myTabContent">

0 commit comments

Comments
 (0)