summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/base.html
blob: ceb49bdd1959b66a6c9d1e4a97f94683c859528a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
    {% block head %}
    <title>{% block title %}{% endblock %} - OpenGnsys</title>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="{{ url_for('static', filename='AdminLTE/plugins/fontawesome-free/css/all.min.css') }}">
    <!-- Theme style -->
    <link rel="stylesheet" href="{{ url_for('static', filename='AdminLTE/dist/css/adminlte.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/soleta.css') }}" />
    {% endblock %}
</head>
<body>
    <div class="main d-flex flex-column align-items-stretch h-100">
        <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
            <a class="navbar-brand" href="#">OpenGnsys</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    {% if current_user.is_authenticated %}
                    <li class="nav-item {% block nav_dashboard%}{% endblock %}">
                        <a class="nav-link" href="{{ url_for('index') }}">{{ _('Dashboard') }}<span class="sr-only">(current)</span></a>
                    </li>
		    <li class="nav-item {% block nav_scopes%}{% endblock %}">
                        <a class="nav-link" href="{{ url_for('scopes') }}">{{ _('Scopes') }}</a>
                    </li>
                    <li class="nav-item {% block nav_commands%}{% endblock %}">
                        <a class="nav-link" href="{{ url_for('commands') }}">{{ _('Commands') }}</a>
                    </li>
                    <li class="nav-item {% block nav_images%}{% endblock %}">
                        <a class="nav-link" href="{{ url_for('images') }}">{{ _('Images') }}</a>
                    </li>
                    {% endif %}
                </ul>

                <ul class="nav navbar-nav navbar-right">
                    {% if current_user.is_authenticated %}

                    <li class="nav-item">
                        <a class="btn btn-danger" href="{{ url_for('logout') }}">{{ _('Logout') }}</a>
                    </li>

                    {% else %}

                    <li class="nav-item">
                        <a class="btn btn-primary" href="{{ url_for('login') }}">{{ _('Login') }}</a>
                    </li>

                    {% endif %}
                </ul>
            </div>
        </nav>
        <div class="container-fluid flex-grow-1">
            {% block container %}
            <div class="row h-100">
                    {# The sidebar is not visible on index and login #}
                    {% if request.endpoint not in ["index", "login"] %}
                        <div id="sidebar" class="bg-light col-md-3 col-lg-2">
                            {% block sidebar %}{% endblock %}
                        </div>
                    {% else %}
                    {% endif %}
                    <div id="content" class="col">
                        <div id="commands" class="py-2">{% block commands %}{% endblock %}</div>
                        <div class="container">
                            {% block content %}{% endblock %}
                        </div>
                    </div>
            </div>
            {% endblock %}
        </div>

        {% block footer %}
        <footer class="footer navbar-inverse bg-dark flex-shrink-0" role="contentinfo">
            <div class="text-center text-secondary mt-1 p-3">
                Powered by
                <a class="text-light" href="https://opengnsys.soleta.eu/">Soleta Networks</a>
            </div>
        </footer>
        {% endblock %}
    </div>

    <!-- jQuery -->
    <script src="{{ url_for('static', filename='AdminLTE/plugins/jquery/jquery.min.js') }}"></script>
    <!-- Bootstrap 4 -->
    <script src="{{ url_for('static', filename='AdminLTE/plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
    <!-- AdminLTE App -->
    <script src="{{ url_for('static', filename='AdminLTE/dist/js/adminlte.min.js') }}"></script>
    <!-- ChartJS -->
    <script src="{{ url_for('static', filename='AdminLTE/plugins/chart.js/Chart.min.js') }}"></script>

    <script src="{{ url_for('static', filename='js/ogcp.js') }}"></script>

    <script>
        // error messages
        {% for category, message in get_flashed_messages(with_categories=True) %}
            let bgclass = 'bg-success';
            {% if category == 'info' %}
                bgclass = 'bg-info';
            {% elif category == 'error' %}
                bgclass = 'bg-danger';
            {% else %}
                bgclass = 'bg-warning';
            {% endif %}
            $(document).Toasts('create', {
                class: bgclass,
                position: 'topLeft',
                autohide: true,
                delay: 5000,
                title: '{{ message }}',
            })
        {% endfor %}
    </script>

    {% block extrabody %}{% endblock %}
</body>
</html>