Skip to content

Commit edc5d84

Browse files
committed
Add infrastructureascode.ch branding, update dependencies
1 parent eea9bbe commit edc5d84

File tree

8 files changed

+700
-464
lines changed

8 files changed

+700
-464
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
ARG PYTHON
2-
FROM python:3.8
2+
FROM python:3.10
33

44
WORKDIR /playground
55
RUN useradd -m iac
66

7-
ENV PATH="/root/.poetry/bin:$PATH" \
7+
ENV PATH="/root/.local/bin:$PATH" \
88
PYTHONDONTWRITEBYTECODE=1 \
99
PYTHONUNBUFFERED=1
1010

1111

1212
RUN apt-get update && apt-get install curl -y \
1313
&& rm -rf /var/lib/apt/lists/* \
14-
&& curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python \
14+
&& curl -sSL https://install.python-poetry.org | python3 \
1515
&& poetry config virtualenvs.create false
1616

1717
COPY --chown=iac:iac pyproject.toml .

demo.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

flask_app.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import io
22
import yaml
33
import json
4-
from flask import Flask, render_template, request, Response, url_for, jsonify
4+
from flask import Flask, render_template, request, jsonify
55
from textfsm import TextFSM
66

77
app = Flask(__name__, static_url_path="/static")
8-
app.config["JSON_SORT_KEYS"] = False
9-
10-
11-
config = {"name": "TextFSM", "data": "RAW", "rendered": "JSON"}
8+
app.json.sort_keys = False
9+
app.config.update(
10+
TITLE="TextFSM",
11+
SUBTITLE="Playground for TextFSM templates",
12+
GITHUB="https://github.com/infrastructureAsCode-ch/ttp101/",
13+
data_textarea="RAW",
14+
template_textarea="TextFSM",
15+
rendered_textarea="JSON",
16+
)
1217

1318

1419
@app.route("/")
1520
def index():
16-
return render_template("index.html", **config)
21+
return render_template("index.html")
1722

1823

1924
@app.route("/examples")

poetry.lock

Lines changed: 381 additions & 292 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
[tool.poetry]
22
name = "textFSM101"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = ""
55
authors = ["ubaumann <[email protected]>"]
66

77
[tool.poetry.dependencies]
8-
python = "^3.8"
9-
flask = "^2.0.1"
10-
pyaml = "^21.10.1"
11-
gunicorn = "^20.1.0"
12-
textfsm = "^1.1.2"
8+
python = "^3.10"
9+
flask = "^3"
10+
pyaml = "^23"
11+
gunicorn = "^21"
12+
textfsm = "^1.1.3"
1313

1414
[tool.poetry.dev-dependencies]
15-
black = "^21.12b0"
16-
pylama = "^8.3.7"
17-
rich = "^11.0.0"
15+
black = "^23"
16+
pylama = "^8"
17+
rich = "^13"
1818

1919
[build-system]
2020
requires = ["poetry>=0.12"]

static/background.jpg

596 KB
Loading

templates/form.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div class="container-fluid">
2+
<form id="templateForm" method="POST" action="rend">
3+
4+
<div class="row">
5+
<div class="col-lg-4">
6+
<div class="form-group">
7+
<label for="textData">Data <small>{{config.data_textarea}}</small></label>
8+
<textarea class="form-control show-spaces" id="textData" name="data" rows="20"></textarea>
9+
</div>
10+
</div>
11+
<div class="col-lg-4">
12+
<div class="form-group">
13+
<label for="textTemplate">Template <small>{{config.template_textarea}}</small></label>
14+
<textarea class="form-control show-spaces" id="textTemplate" name="template"
15+
rows="20"></textarea>
16+
</div>
17+
</div>
18+
<div class="col-lg-4">
19+
<div class="form-group">
20+
<label for="textRendered" disabled>Rendered <small>{{config.rendered_textarea}}</small></label>
21+
<textarea class="form-control show-spaces" id="textRendered" rows="20" disabled></textarea>
22+
</div>
23+
</div>
24+
</div>
25+
<div class="row">
26+
<div class="col-auto">
27+
<div>
28+
<button class="btn btn-primary" type="submit">
29+
Render Template
30+
</button>
31+
</div>
32+
</div>
33+
<div class="col-auto mr-auto ">
34+
<div class="dropdown">
35+
<button id="examples" class="btn btn-primary dropdown-toggle" type="button"
36+
data-toggle="dropdown">Examples
37+
<span class="caret"></span></button>
38+
<ul class="dropdown-menu">
39+
</ul>
40+
</div>
41+
</div>
42+
</div>
43+
</div>
44+
</form>
45+
</div>

0 commit comments

Comments
 (0)