base.html 7.05 KB
Newer Older
Dudás Ádám committed
1 2
<!DOCTYPE html>
{% load i18n %}
Bence Dányi committed
3
{% load l10n %}
4
{% load staticfiles %}
Dudás Ádám committed
5 6 7 8
{% get_current_language as lang %}
<html lang="{{lang}}">
<head>
    <title>{% block title %}IK Cloud{% endblock %}</title>
9
    <link href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;subset=latin,latin-ext" rel="stylesheet" type="text/css" />
10
    <link rel="icon" type="image/png" href="{% static "favicon.png" %}" />
11 12
    {% if DEBUG %}<link rel="stylesheet/less" href="{% static "style/style.less" %}" />{% else %}
    <link href="{% static "style/style.css" %}" rel="stylesheet" type="text/css" />{% endif %}
13
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
14
    <script src="{% static "script/jquery.min.js" %}"></script>
Őry Máté committed
15
    <script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>
Bence Dányi committed
16
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
17
    <script type="text/javascript">
18
        {% if DEBUG %}window.localStorage.removeItem('https://cloud.ik.bme.hu/static/style/style.less:timestamp');{% endif %}
19
        var current_user={{user.id}};
Bence Dányi committed
20
        google.load('visualization', '1.0', {'packages':['corechart']});
21
    </script>
22
    {% if DEBUG %}<script src="{% static "script/less.min.js" %}"></script>{% endif %}
23
    <script src="{% static "script/knockout.min.js" %}"></script>
24 25 26 27 28 29
    {% if DEBUG %}<script type="text/javascript" src="{% static "script/util.js" %}"></script>
    {% else %}<script type="text/javascript" src="{% static "script/util.min.js" %}"></script>
    {% endif %}
    {% if DEBUG %}<script type="text/javascript" src="{% static "script/cloud.js" %}"></script>
    {% else %}<script type="text/javascript" src="{% static "script/cloud.min.js" %}"></script>
    {% endif %}
Dudás Ádám committed
30 31
    {{ form.media }}
    {% block js %}{% endblock %}
Őry Máté committed
32
    <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0" />
Dudás Ádám committed
33 34 35 36
</head>
<body>
    <div id="header">
        {% block login %}
Dányi Bence committed
37 38
        <div id="loginblock"><p>
            {% if user.is_authenticated %}
39
            {% trans "Logged in:" %} {{ user.username }}.
40
            <a href="{% url logout %}">{% trans "Logout" %}</a>.
Dányi Bence committed
41
            {% if user.is_staff %}
42
            <a href="{% url admin:index %}">{% trans "Admin" %}</a>.
Dányi Bence committed
43 44
            {% endif %}
            {% else %}
45
            <a href="{% url login %}">{% trans "Login" %}</a>.
Dányi Bence committed
46
            {% endif %}
47
            {% if user.is_authenticated %}
Dányi Bence committed
48
            {% if lang == 'hu' %}
49
            <a href="{% url school.views.language "en" %}">In English</a>.
Dányi Bence committed
50
            {% else %}
51
            <a href="{% url school.views.language "hu" %}">Magyarul</a>.
Dányi Bence committed
52
            {% endif %}
53
            {% endif %}
Dányi Bence committed
54 55
            </p>
        </div>
Dudás Ádám committed
56 57
        {% endblock %}
        {% block header %}
Dányi Bence committed
58
        {% block header_title %}
59
        <h1><a href="{% url one.views.index %}">IK Cloud</a></h1>
Dányi Bence committed
60
        {% endblock %}
Dudás Ádám committed
61 62 63
        {% endblock %}
    </div>
    {% block messages %}
Dányi Bence committed
64 65 66 67 68 69 70
    {% if messages %}
    <ul class="messagelist">
    {% for message in messages %}
        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
    {% endfor %}
    </ul>
    {% endif %}
Dudás Ádám committed
71 72 73
    {% endblock messages %}
    <div id="content">
        {% block content %}{% endblock %}
Dányi Bence committed
74
        <div class="clear"></div>
Dudás Ádám committed
75
    </div>
76
    <footer>
Bence Dányi committed
77 78
        <div>
            <div style="float: left" id="chart_cpu_div"></div>
Bence Dányi committed
79 80 81
            <a href="/sites/legal/">{% trans "Legal notice" %}</a> |
            <a href="/sites/policy/">{% trans "Policy" %}</a> |
            <a href="/sites/help/">{% trans "Help" %}</a> |
Őry Máté committed
82 83 84
            <a href="/sites/support/">{% trans "Support" %}</a> |
            <a href="/sites/changelog/#{{release}}" title="{% trans "Change log" %}">{{release}}</a>

Bence Dányi committed
85 86
            <div style="float: right" id="chart_mem_div"></div>
        </div>
Bence Dányi committed
87 88 89 90 91 92 93
        {% if cloud_stat %}
            <script type="text/javascript">
                google.setOnLoadCallback(drawChart);
                function drawChart() {
                    var data_cpu = new google.visualization.DataTable();
                    data_cpu.addColumn('string', 'Topping');
                    data_cpu.addColumn('number', 'Used');
Bence Dányi committed
94 95
                    data_cpu.addColumn('number', 'Allocated');
                    data_cpu.addColumn('number', 'Free');
Bence Dányi committed
96
                    data_cpu.addRows([
Bence Dányi committed
97 98 99 100
                        ['CPU',
                        {{cloud_stat.CPU.USED_CPU}},
                        {{cloud_stat.CPU.ALLOC_CPU}},
                        {{cloud_stat.CPU.FREE_CPU}},]
Bence Dányi committed
101 102
                    ]);
                    var cpu_options = {
Bence Dányi committed
103 104 105 106 107
                        'width':400,
                        'height':20,
                        isStacked: true,
                        enableInteractivity: false,
                        colors: ['red', 'orange', 'blue']
Bence Dányi committed
108 109 110 111
                    };
                    var data_mem = new google.visualization.DataTable();
                    data_mem.addColumn('string', 'Topping');
                    data_mem.addColumn('number', 'Used');
Bence Dányi committed
112 113
                    data_mem.addColumn('number', 'Allocated');
                    data_mem.addColumn('number', 'Free');
Bence Dányi committed
114
                    data_mem.addRows([
Bence Dányi committed
115 116
                        ['RAM',
                        {{cloud_stat.MEM.USED_MEM|unlocalize}},
Bence Dányi committed
117
                        {{cloud_stat.MEM.ALLOC_MEM|unlocalize}},
Bence Dányi committed
118
                        {{cloud_stat.MEM.FREE_MEM|unlocalize}},]
Bence Dányi committed
119 120
                    ]);
                    var mem_options = {
Bence Dányi committed
121 122 123 124
                        'width':400,
                        'height':20,
                        isStacked: true,
                        enableInteractivity: false,
125 126 127 128 129 130 131 132
                        colors: ['red', 'orange', 'blue'],
                        hAxis : {
                            viewWindowMode: 'explicit',
                            viewWindow: {
                                min: 0,
                                max: {{cloud_stat.MEM.USED_MEM|unlocalize}}+{{cloud_stat.MEM.ALLOC_MEM|unlocalize}}+{{cloud_stat.MEM.FREE_MEM|unlocalize}}
                            }
                        },
Bence Dányi committed
133 134 135 136 137 138 139 140
                    };
                    var chart = new google.visualization.BarChart(document.getElementById('chart_cpu_div'));
                    chart.draw(data_cpu, cpu_options);
                    var chart = new google.visualization.BarChart(document.getElementById('chart_mem_div'));
                    chart.draw(data_mem, mem_options);
                }
            </script>
        {% endif %}
141
    </footer>
Bence Dnyi committed
142 143
    <div id="modal" style="display: none">
        <div id="shadow"></div>
Bence Dányi committed
144
        <div id="modal-container"></div>
Bence Dnyi committed
145
    </div>
146 147 148 149 150 151 152 153 154 155
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-39125666-1']);
        _gaq.push(['_trackPageview']);
        (function() {
         var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
         ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
         var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
         })();
    </script>
Dudás Ádám committed
156 157
</body>
</html>