Commit 00bb4f06 by Dányi Bence

webui: shared templates

parent 4d01cc66
...@@ -161,6 +161,13 @@ ...@@ -161,6 +161,13 @@
} }
} }
.shares {
margin-left: 40px;
li {
height: 30px;
position: relative;
}
}
@placeholderColor: #555; @placeholderColor: #555;
input::-webkit-input-placeholder{ input::-webkit-input-placeholder{
color: @placeholderColor; color: @placeholderColor;
......
...@@ -6,25 +6,41 @@ ...@@ -6,25 +6,41 @@
{% for t in mytemplates %} {% for t in mytemplates %}
<li class="wm" id="t{{t.id }}"> <li class="wm" id="t{{t.id }}">
<div class="summary {% if t.state == 'NEW' or t.state == 'SAVING'%}unfinished{% endif %}"> <div class="summary {% if t.state == 'NEW' or t.state == 'SAVING'%}unfinished{% endif %}">
<div class="name">{{t.name}} <div class="name">
{% if t.myshares %} {{t.name}}
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% endif %}
</div> </div>
<div class="status">{{t.state}}</div> <div class="status">{{t.state}}</div>
<div class="actions"> <div class="actions">
{% if t.state == 'READY' %}
<a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try" %}"> <a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try" %}">
<img src="/static/icons/control.png" alt="{% trans "Start" %}"/></a> <img src="/static/icons/control.png" alt="{% trans "Start" %}"/></a>
<a href="#" title="{% trans "Edit" %}"><img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" /></a> <a href="#" title="{% trans "Edit" %}"><img src="/static/icons/pencil.png" alt="{% trans "Edit" %}" /></a>
<a href="#" class="delete-template-button" data-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}"><img src="/static/icons/minus-circle.png" alt="{% trans "Remove" %}" /></a>
<a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}"><img src="/static/icons/user-share.png" alt="{% trans "Share" %}" /></a> <a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}"><img src="/static/icons/user-share.png" alt="{% trans "Share" %}" /></a>
{% endif %}
<a href="#" class="delete-template-button" data-id="{{ t.id }}" data-name="{{ t.name }}" title="{% trans "Remove" %}"><img src="/static/icons/minus-circle.png" alt="{% trans "Remove" %}" /></a>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
{% if t.myshares %}
<ul class="shares">
{% for i in t.myshares %}
<li>
<div class="quota">
<div class="used" style="width: {{ i.get_instance_pc }}%"></div>
</div>
<form action="/vm/unshare/{{i.id}}/" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
{% csrf_token %}
<input type="submit" value="unshare" style="float: right"/>
</form>
<div class="clear"></div>
</li>
{% endfor %}
</ul>
{% endif %}
</div> </div>
<div class="details"> <div class="details">
<ul> <ul>
...@@ -67,23 +83,34 @@ ...@@ -67,23 +83,34 @@
{% for t in publictemplates %} {% for t in publictemplates %}
<li class="wm" id="t{{t.id }}"> <li class="wm" id="t{{t.id }}">
<div class="summary public-template"> <div class="summary public-template">
<div class="name">{{t.name}} <div class="name">
{% if t.myshares %} {{t.name}}
<ul>
{% for i in t.myshares %}
<li>{{i.name}} -&gt; {{i.group}} ({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
<form style="display:inline" action="/vm/unshare/{{i.id}}/" method="post">{% csrf_token %}<input type="submit" value="unshare"/></form>
</li>
{% endfor %}
{% endif %}
</div> </div>
<div class="status">{{t.state}}</div> <div class="status">{{t.state}}</div>
<div class="actions"> <div class="actions">
{% if t.state == 'READY' %}
<a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try" %}"> <a href="#" class="try-template-button" data-id="{{t.id}}" title="{% trans "Try" %}">
<img src="/static/icons/control.png" alt="{% trans "Start" %}"/></a> <img src="/static/icons/control.png" alt="{% trans "Start" %}"/></a>
<a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}"><img src="/static/icons/user-share.png" alt="{% trans "Share" %}" /></a> <a href="#" class="template-share" data-id="{{t.id}}" data-gid="{{group.id}}" title="{% trans "Share" %}"><img src="/static/icons/user-share.png" alt="{% trans "Share" %}" /></a>
{% endif %}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
{% if t.myshares %}
<ul class="shares">
{% for i in t.myshares %}
<li>
<form action="/vm/unshare/{{i.id}}/" method="post">
<span title="{{i.name}}">{{i.name|truncatechars:20}}</span>
({{i.get_running}}/{{i.instance_limit}} = {{i.get_instance_pc}}%)
{% csrf_token %}
<input type="submit" value="unshare" style="float: right"/>
</form>
<div class="clear"></div>
</li>
{% endfor %}
</ul>
{% endif %}
</div> </div>
<div class="details"> <div class="details">
<ul> <ul>
......
...@@ -84,7 +84,8 @@ ...@@ -84,7 +84,8 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% include "box-templatelist.html" %} {% include "box-templatelist.html" %}
{% include "box-grouplist.html" %}
</div> </div>
{% include "box-filelist.html" %} {% include "box-filelist.html" %}
{% include "box-grouplist.html" %}
{% endblock %} {% endblock %}
...@@ -77,12 +77,12 @@ ...@@ -77,12 +77,12 @@
</ul> </ul>
<nav> <nav>
<input type="reset" class="prev" value="{% trans "Cancel" %}" /> <input type="reset" class="prev" value="{% trans "Cancel" %}" />
<input type="submit" value="{% trans "Share" %}" {% if not groups %} disabled=""{%endif%}/> <input type="submit" value="{% trans "Share" %}" {% if not groups %}{%endif%}/>
<div class="clear"></div> <div class="clear"></div>
</nav> </nav>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
{% if not group %} {% if not group %}
if (!$("select#share-group-select :selected").val()) if (!$("select#share-group-select :selected").val())
$('#new-share input[type=submit]').attr("disabled", "") $('#new-share input[type=submit]').attr("disabled", "")
else else
...@@ -94,7 +94,6 @@ ...@@ -94,7 +94,6 @@
$('#new-share input[type=submit]').removeAttr("disabled") $('#new-share input[type=submit]').removeAttr("disabled")
}) })
{% endif %} {% endif %}
$('#new-share nav .prev').click(function(){ $('#new-share nav .prev').click(function(){
$('#modal').hide(); $('#modal').hide();
}) })
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% block content %} {% block content %}
<div class="boxes"> <div class="boxes">
<div class="contentblock"> <!-- <div class="contentblock">
<h2>Summary</h2> <h2>Summary</h2>
</div> </div> -->
<div class="contentblock" id="group-members"> <div class="contentblock" id="group-members">
<h2>{% trans "Members" %}</h2> <h2>{% trans "Members" %}</h2>
<ul class="wm-list"> <ul class="wm-list">
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{% if not member.user %} {% if not member.user %}
{% trans "This user never logged in, no data available" %} {% trans "This user never logged in, no data available" %}
{% else %} {% else %}
{{member}} ({{member.code}}) {{member}} ({{member.code}}) <a href="mailto:{{member.user.email}}">E-mail</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
...@@ -52,18 +52,18 @@ ...@@ -52,18 +52,18 @@
</div> </div>
<div class="boxes"> <div class="boxes">
{% if noshare %} {% if noshare %}
<div id="new-wm-tooltip" style="position:absolute"> <div id="new-wm-tooltip" style="position:absolute">
<div id="new-wm-tooltip-container"> <div id="new-wm-tooltip-container">
<p> <p>
{% trans "This group has no shared templates." %} {% trans "This group has no shared templates." %}
</p> </p>
<p> <p>
{% trans "Share one, and the group members can start their own virtual machine." %} {% trans "Share one, and the group members can start their own virtual machine." %}
</p> </p>
<div id="new-wm-tooltip-tail"></div> <div id="new-wm-tooltip-tail"></div>
</div>
</div> </div>
{% endif %} </div>
{% include "box-templatelist.html" %} {% endif %}
{% include "box-templatelist.html" %}
</div> </div>
{% endblock %} {% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment