Skip to content

Commit

Permalink
Offline (static) frontend - fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ralgozino committed Oct 2, 2020
1 parent 085b063 commit f090789
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 18 deletions.
7 changes: 6 additions & 1 deletion .dockerignore
@@ -1 +1,6 @@
app/__pycache__
app/__pycache__
.git
.vscode
env
screenshots
manifests
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,4 +1,5 @@
env
.vscode
__pycache__
launch.json
launch.json
app/static/node_modules
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ You'll need OPA Gatekeeper running in your cluster and at least some constraint
In order to deploy Gatekeper Policy Manager to your cluster, apply the provided kustomization file running the following command:

```shell
$ kubectl apply -k .
kubectl apply -k .
```

By default, this will create a deployment and a service both with the name `gatekeper-policy-manager` in the `gatekeeper-system` namespace. We invite you to take a look into the `kustomization.yaml` file to do further configuration.
Expand Down
5 changes: 3 additions & 2 deletions app/app.py
Expand Up @@ -217,14 +217,15 @@ def get_constrainttemplates():
return render_template("message.html",
type="error",
title="Error",
message="We had a problem while asking the API for Gatekeeper objects",
message="We had a problem while asking the API for Gatekeeper Constraint Templates objects",
action="Is Gatekeeper deployed in the cluster?",
description=e
)
else:
return render_template("constrainttemplates.html",
constrainttemplates=constrainttemplates,
title="Constraint Templates"
title="Constraint Templates",
hide_sidebar=len(constrainttemplates["items"]) == 0
)


Expand Down
19 changes: 19 additions & 0 deletions app/static/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/static/user-tie.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions app/templates/base.html
Expand Up @@ -2,17 +2,18 @@
<html lang="en">
<head>
<title>Gatekeeper Policy Manager - {{ title }}</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.js"></script>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='user-tie.svg') }}"/>
<script src="{{ url_for('static', filename='node_modules/jquery/dist/jquery.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.css') }}">
<script src="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='prism.css') }}">
<script src={{ url_for('static', filename='prism.js') }}></script>
<style>
.footer.segment {
padding: 5em 0em;
margin-top: 10em !important;
}
</style>
<script src={{ url_for('static', filename='prism.js') }}></script>
</head>
<body style="background-color: #f0f0f0;">
<div class="ui top secondary pointing menu">
Expand Down
17 changes: 15 additions & 2 deletions app/templates/constrainttemplates.html
Expand Up @@ -7,9 +7,19 @@
{% endfor %}
{% endblock %}
{% block content %}
{% if constrainttemplates["items"]|length == 0 %}
<div class="ui segments">
<div class="ui secondary header segment">
<i class="ui info icon"></i> There are no Constraint Templates defined
</div>
<div class="ui blue segment">
We didn't find any Constraint Template CRDs defined in the cluster.
</div>
</div>
{% else %}
{% for constrainttemplate in constrainttemplates["items"] %}
<div class="ui segments" id="{{ constrainttemplate.spec.crd.spec.names.kind }}">
<div class="ui {% if constrainttemplate.status.created %} green {% endif %} secondary header segment">{{ constrainttemplate.spec.crd.spec.names.kind }} {% if constrainttemplate.status.created %} <span class="ui small horizontal label green">CREATED</span> {% endif %}</div>
<div class="ui {% if constrainttemplate.status and constrainttemplate.status.created %} green {% endif %} secondary header segment">{{ constrainttemplate.spec.crd.spec.names.kind }} {% if constrainttemplate.status and constrainttemplate.status.created %} <span class="ui small horizontal label green">CREATED</span>{% else %}<span class="ui small horizontal basic label red" title="Status field is not set, is Gatekeeper healthy?">UNKOWN STATE</span>{% endif %}</div>
{% for t in constrainttemplate.spec.targets %}
<div class="ui segment">
<h5 class="header">Target {{ t.target }}</h5>
Expand Down Expand Up @@ -74,6 +84,7 @@ <h5 class="header">Parameters schema</h5>
</div>
{% endif %}

{% if constrainttemplate.status %}
<div class="ui segment">
<h5>Status</h6>
<div class="ui horizontal list">
Expand All @@ -88,8 +99,10 @@ <h5>Status</h6>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}

</div>
{% endfor %}
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion app/templates/footer.html
@@ -1,6 +1,6 @@
<div class="ui inverted vertical footer segment">
<div class="ui container">
<h4 class="ui inverted header">Gatekeeper Policy Manager v0.2</h4>
<h4 class="ui inverted header">Gatekeeper Policy Manager v0.3</h4>
<p>A simple to use web-based Gatekeeper policies manager</p>
<p><i class="red heart icon"></i> Proud part of the <a href="https://kubernetesfury.com">Kubernetes Fury Distribution</a></p>
<p><i class="github icon"></i> <a href="https://github.com/sighupio/gatekeeper-policy-manager">Source Code</a></p>
Expand Down
7 changes: 4 additions & 3 deletions app/templates/index.html
Expand Up @@ -2,9 +2,10 @@
<html lang="en">
<head>
<title>Gatekeeper Policy Manager - {{ title }}</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.js"></script>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='user-tie.svg') }}"/>
<script src="{{ url_for('static', filename='node_modules/jquery/dist/jquery.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.css') }}">
<script src="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.js') }}"></script>
<style type="text/css">
body {
background-color: #1b1c1d;
Expand Down
7 changes: 4 additions & 3 deletions app/templates/message.html
Expand Up @@ -2,9 +2,10 @@
<html lang="en">
<head>
<title>Gatekeeper Policy Manager - {{ title }}</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.js"></script>
<link rel="icon" type="image/png" href="{{ url_for('static', filename='user-tie.svg') }}"/>
<script src="{{ url_for('static', filename='node_modules/jquery/dist/jquery.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.css') }}">
<script src="{{ url_for('static', filename='node_modules/fomantic-ui-css/semantic.min.js') }}"></script>
<style type="text/css">
body {
background-color: #1b1c1d;
Expand Down

0 comments on commit f090789

Please sign in to comment.