Skip to content

Commit

Permalink
more updates for status box
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Reynolds committed Apr 29, 2024
1 parent ceb8486 commit 02d37f1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 31 deletions.
49 changes: 38 additions & 11 deletions labapp/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
from ce import get_ce_info, get_ce_state

app = Flask(__name__)
app.config['udf'] = os.getenv('UDF', None)
info = None
if app.config['udf']:
info = get_ce_info()
app.config['ce_info'] = info
app.config['ce_info'] = None
app.config['UDF'] = None
if os.getenv('UDF', None):
app.config['ce_info'] = get_ce_info()
app.config['UDF'] = True
app.config['base_url'] = "mcn-lab.f5demos.com"
app.config['CACHE_TYPE'] = 'SimpleCache'
cache = Cache(app)
Expand Down Expand Up @@ -57,7 +57,11 @@ def return_err(err):
def index():
"""index page"""
html = render_md("markdown/overview.md")
return render_template('overview.html', content=html)
return render_template('standard.html',
title="MCN Practical: Overview",
content=html,
udf=app.config['UDF']
)

@app.route('/setup', methods=['GET', 'POST'])
def setup():
Expand All @@ -80,13 +84,21 @@ def setup():
flash("Ephemeral NS cleared.", "info")
return response
html = render_md("markdown/setup.md")
return render_template('setup.html', content=html)
return render_template('setup.html',
title="MCN Practical: Setup",
content=html,
udf=app.config['UDF']
)

@app.route('/arch')
def arch():
"""arch page"""
html = render_md("markdown/arch.md")
return render_template('standard.html', content=html, title="MCN Practical: Architecture")
return render_template('standard.html',
title="MCN Practical: Architecture",
content=html,
udf=app.config['UDF']
)

@app.route('/_ce_state')
@cache.cached(timeout=30)
Expand All @@ -106,21 +118,36 @@ def lb():
"""lb page"""
ns = eph_ns()
html = render_md("markdown/lb.md")
return render_template('exercise_standard.html', title="MCN Practical: LB", content=html, ns=ns)
return render_template('exercise_standard.html',
title="MCN Practical: LB",
content=html,
ns=ns,
udf=app.config['UDF']
)

@app.route('/path')
def path():
"""path page"""
ns = eph_ns()
html = render_md("markdown/path.md")
return render_template('exercise_standard.html', title="MCN Practical: Path Routing", content=html, ns=ns)
return render_template('exercise_standard.html',
title="MCN Practical: Path Routing",
content=html,
ns=ns,
udf=app.config['UDF']
)

@app.route('/header')
def header():
"""header page"""
ns = eph_ns()
html = render_md("markdown/header.md")
return render_template('exercise_standard.html', title="MCN Practical: Headers", content=html, ns=ns)
return render_template('exercise_standard.html',
title="MCN Practical: Headers",
content=html,
ns=ns,
udf=app.config['UDF']
)

@app.route('/_lb1')
def lb_aws():
Expand Down
18 changes: 8 additions & 10 deletions labapp/app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}F5XC MCN Practical Lab{% endblock %}</title>
<title>{% block title %}{{ title }}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">

Expand Down Expand Up @@ -128,17 +128,15 @@
</div>
</li>
</ul>
</div>


{% if cluster-info %}
<div class="status-box bg-light p-2">
<p>Status: <strong>Active</strong></p>
</div>
{% endif %}



{% if udf %}
<div class="status-box bg-light p-2">
<p>Status: <strong>Active</strong></p>
</div>
{% endif %}


</div>

<!-- Main Content -->
Expand Down
9 changes: 0 additions & 9 deletions labapp/app/templates/overview.html

This file was deleted.

2 changes: 1 addition & 1 deletion labapp/app/templates/setup.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}

{% block title %}MCN Practical: Setup{% endblock %}
{% block title %}{{ title }}{% endblock %}

{% block content %}
<div class="markdown-body">
Expand Down

0 comments on commit 02d37f1

Please sign in to comment.