zapp_start.jinja2 4.56 KB
Newer Older
Daniele Venzano's avatar
Daniele Venzano committed
1
{% extends "base_user.jinja2" %}
2 3 4

{% block title %}ZApp Shop{% endblock %}

5
{% block custom_head %}
6
    <script src="{{ static_url("jquery.validate.min.js") }}" type="application/javascript"></script>
7
{% endblock %}
8

9
{% block content %}
10

11
    <div class="zapp-description">
Daniele Venzano's avatar
Daniele Venzano committed
12
        <img src="{{ reverse_url("zappshop_logo", zapp.id + '-' + zapp.manifest_index|string) }}" alt="logo">
13 14
        {{ zapp.readable_description|safe }}
    </div>
15

16
    <h3 class="zapp-startup">ZApp details</h3>
17 18 19
    <p>This ZApp is composed by the following services:</p>
    <ul>
    {% for service in zapp.zoe_description.services %}
20 21 22
        <li>{{ service["total_count"] }} {{ service["name"] }} ({{ service["essential_count"] }} essential{{ 's' if service["essential_count"] > 1 }})        <ul>
            <li>Suggested memory allocation: {% if service["resources"]["memory"]["min"] != None %}
                <script>format_bytes({{ service["resources"]["memory"]["min"] }}, 2) </script>
23 24
                        {% else %}
                No limit
25 26
                        {% endif %}</li>
            <li>Suggested CPU core allocation limit: {{ service["resources"]["cores"]["min"] if service["resources"]["cores"]["min"] != None else "No limit" }}</li>
27
        </ul></li>
28
        <li>Image: <code>{{ service["image"] }}</code></li>
29 30 31
    {% endfor %}
    </ul>

32 33 34 35 36 37 38 39
    <p>The following persistent volumes will be available:</p>
    <ul>
    <li><code>/mnt/workspace</code>: User workspace (RW)</li>
    {% for volume in additional_volumes %}
        <li><code>/mnt/{{ volume[1] }}</code> (RO)</li>
    {% endfor %}
    </ul>

40 41 42 43
    <h4>Start-up parameters:</h4>
    <form action="{{ reverse_url("zappshop_start", "") }}{{ zapp.id }}-{{ zapp.manifest_index }}" method="post" id="zapp_start_form">
    <input type="hidden" name="zapp-id" value="{{ zapp.id }}-{{ zapp.manifest_index }}">
    <label>Execution name:&nbsp;<input type="text" name="exec_name" value="{{ zapp.zoe_description.name }}" maxlength="16" size="18" required/></label><br/>
44 45 46
    {% if resources_are_customizable %}
        {% for param in zapp.parameters %}
            <label>{{ param.readable_name }}
47
            {% if param.type == "number" and "memory" in param.kind %}
48
                (GiB) <input name="{{ param.name }}-{{ param.kind }}" value="{{ param.default }}" required size="5" title="{{ param.description }}" type="{{ param.type }}" min="{{ param.min }}" max="{{ param.max }}" step="{{ param.step }}"/>
49
            {% elif param.type == "number" %}
50
                <input name="{{ param.name }}-{{ param.kind }}" value="{{ param.default }}" required size="5" title="{{ param.description }}" type="{{ param.type }}" min="{{ param.min }}" max="{{ param.max }}" step="{{ param.step }}"/>
51
            {% else %}
52
                <input name="{{ param.name }}-{{ param.kind }}" value="{{ param.default if param.default != None }}" required title="{{ param.description }}" size="128" type="{{ param.type }}" />
53
            {% endif %}
54 55
            </label><br/>
        {% endfor %}
56
        {% for service in zapp.zoe_description.services %}
57 58 59 60 61 62 63
            <div class="resource-form">
            <h5>{{ service.name }}</h5>
            <label>Memory allocation (GiB)
                <input name="{{ service.name }}-resource_memory_min" value="{{ service["resources"]["memory"]["min"] / (1024 ** 3) }}" required title="Memory soft limit, service can use more memory if there is no contention" type="number" min="0.5" max="{{ max_memory_limit }}" step="0.5"/></label>
            <label>Minimum core allocation:
                <input name="{{ service.name }}-resource_cores_min" value="{{ service["resources"]["cores"]["min"] }}" required title="No less than this amount of cores will be allocated to this service" type="number" min="0.1" max="{{ max_core_limit }}" step="0.1"/></label>
            </div>
64 65
        {%  endfor %}
    {% endif %}
66 67 68 69 70
        <hr>
        {%  if user.role.can_access_api %}
            <label class="label-inline"><input type="checkbox" onchange="set_submit_text(this)" name="download_json"> Download JSON with these parameters for command-line execution</label>
            <br><br>
        {% endif %}
71
        <button id="submit" type="submit">Start</button>
72
        <button type="reset">Reset</button>
73 74 75
    </form>

    <script>
76
        $("#zapp_start_form").validate();
77 78 79 80 81 82 83 84

        function set_submit_text(elem) {
            if (elem.checked) {
                $("#submit").text("Download JSON");
            } else {
                $("#submit").text("Start");
            }
        }
85
    </script>
86 87 88

    <p><a href="{{ reverse_url("zappshop") }}">Back to the ZApp shop</a></p>

89
{% endblock %}