Commit 2cc1f678 by tarokkk

Merge branch 'master' of ssh://giccero.cloud.ik.bme.hu/cloud

parents 696d4d85 048906e2
var toggleDetails; var toggleDetails;
$(function() { $(function() {
toggleDetails = cloud.throttle(function() { toggleDetails = cloud.throttle(function() {
if($(this).parent('.entry').hasClass('opened')) { if ($(this).parent('.entry').hasClass('opened')) {
$(this).parent('.entry').removeClass('opened'); $(this).parent('.entry').removeClass('opened');
$(this).next('.details').slideUp(700); $(this).next('.details').slideUp(700);
} else { } else {
...@@ -9,7 +9,7 @@ $(function() { ...@@ -9,7 +9,7 @@ $(function() {
$(this).next('.details').slideDown(700); $(this).next('.details').slideDown(700);
} }
}) })
$('a').click(function(e){ $('a').click(function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
$('.delete-template').click(function(e) { $('.delete-template').click(function(e) {
...@@ -32,19 +32,19 @@ $(function() { ...@@ -32,19 +32,19 @@ $(function() {
}); });
}); });
}); });
$('#reset-key').click(function(e){ $('#reset-key').click(function(e) {
vm_confirm_popup(gettext('Are you sure about reseting store credentials?<br /> You will lose your access to your store account on your existing virtual machines!'), gettext('Reset'), function(){ vm_confirm_popup(gettext('Are you sure about reseting store credentials?<br /> You will lose your access to your store account on your existing virtual machines!'), gettext('Reset'), function() {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/ajax/key/reset/', url: '/ajax/key/reset/',
success: function(){ success: function() {
window.location.reload(); window.location.reload();
} }
}) })
}); });
}); });
$('.entry .summary').click(toggleDetails); $('.entry .summary').click(toggleDetails);
if(window.navigator.userAgent.indexOf('cloud-gui') < 0) { if (window.navigator.userAgent.indexOf('cloud-gui') < 0) {
$('.connect-vm').click(function(e) { $('.connect-vm').click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -141,7 +141,7 @@ $(function() { ...@@ -141,7 +141,7 @@ $(function() {
}) })
$('#modal').show(); $('#modal').show();
}); });
$('.template-unshare').click(function(e){ $('.template-unshare').click(function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
$('#old-upload').click(function(e) { $('#old-upload').click(function(e) {
...@@ -154,7 +154,7 @@ $(function() { ...@@ -154,7 +154,7 @@ $(function() {
$(this).css('backgroundColor', function(w) { $(this).css('backgroundColor', function(w) {
return 'hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 50%, 0.2)'; return 'hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 50%, 0.2)';
}($(this)[0].style.width)); }($(this)[0].style.width));
if(parseInt($(this).css('width')) > 0) $(this).css('borderRight', function(w) { if (parseInt($(this).css('width')) > 0) $(this).css('borderRight', function(w) {
return '1px solid hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 30%, 0.4)'; return '1px solid hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 30%, 0.4)';
}($(this)[0].style.width)); }($(this)[0].style.width));
}); });
...@@ -183,20 +183,21 @@ $(function() { ...@@ -183,20 +183,21 @@ $(function() {
$('#new-group-members').change(updateSummary); $('#new-group-members').change(updateSummary);
}); });
$('.hidden-password').click(function() { $('.hidden-password').click(function() {
if($(this).attr('type') == 'password'){ if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text'); $(this).attr('type', 'text');
$(this).addClass('shown'); $(this).addClass('shown');
} else if(this.selectionStart-this.selectionEnd == 0) { } else if (this.selectionStart - this.selectionEnd == 0) {
$(this).attr('type', 'password'); $(this).attr('type', 'password');
$(this).removeClass('shown'); $(this).removeClass('shown');
} }
}); });
$('.shares li').click(function(e){ $('.shares li').click(function(e) {
e.preventDefault(); e.stopPropagation(); e.preventDefault();
e=$(this); e.stopPropagation();
if(!e.hasClass('description')){ e = $(this);
if(e.next().is(':hidden')){ if (!e.hasClass('description')) {
if (e.next().is(':hidden')) {
e.next().slideDown(700); e.next().slideDown(700);
} else { } else {
e.next().slideUp(700); e.next().slideUp(700);
...@@ -205,12 +206,13 @@ $(function() { ...@@ -205,12 +206,13 @@ $(function() {
e.slideUp(700); e.slideUp(700);
} }
}); });
$('.shares .edit').click(function(e){ $('.shares .edit').click(function(e) {
e.preventDefault(); e.stopPropagation(); e.preventDefault();
e.stopPropagation();
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/ajax/shareEdit/'+$(this).data('id')+'/', url: '/ajax/shareEdit/' + $(this).data('id') + '/',
success: function(data){ success: function(data) {
$('#modal').show(); $('#modal').show();
$('#modal-container').html(data); $('#modal-container').html(data);
} }
...@@ -225,7 +227,7 @@ $(function() { ...@@ -225,7 +227,7 @@ $(function() {
$.get('/vm/credentials/' + id, function(data) { $.get('/vm/credentials/' + id, function(data) {
$('#modal-container').html(data); $('#modal-container').html(data);
$('#modal-container .hidden-password').click(function() { $('#modal-container .hidden-password').click(function() {
if($(this).attr('type') == 'password'){ if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text'); $(this).attr('type', 'text');
$(this).addClass('shown'); $(this).addClass('shown');
} else { } else {
...@@ -311,7 +313,7 @@ $(function() { ...@@ -311,7 +313,7 @@ $(function() {
type: 'POST', type: 'POST',
url: '/vm/' + state + '/' + id + '/', url: '/vm/' + state + '/' + id + '/',
success: function(data, b, c) { success: function(data, b, c) {
if(state == "resume") { if (state == "resume") {
window.location.href = '/vm/show/' + id + "/"; window.location.href = '/vm/show/' + id + "/";
} else { } else {
window.location.reload(); window.location.reload();
...@@ -370,9 +372,9 @@ $(function() { ...@@ -370,9 +372,9 @@ $(function() {
function hide_group(id) { function hide_group(id) {
var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {}; var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
var hidden_groups_for_user = hidden_groups[current_user] || []; var hidden_groups_for_user = hidden_groups[current_user] || [];
for(var i in hidden_groups_for_user) { for (var i in hidden_groups_for_user) {
var hide = hidden_groups_for_user[i]; var hide = hidden_groups_for_user[i];
if(hide == id) return false; if (hide == id) return false;
} }
hidden_groups_for_user.push(id); hidden_groups_for_user.push(id);
hidden_groups[current_user] = hidden_groups_for_user; hidden_groups[current_user] = hidden_groups_for_user;
...@@ -383,7 +385,7 @@ $(function() { ...@@ -383,7 +385,7 @@ $(function() {
function hide_groups() { function hide_groups() {
var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {}; var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
var hidden_groups_for_user = hidden_groups[current_user] || []; var hidden_groups_for_user = hidden_groups[current_user] || [];
for(var i in hidden_groups_for_user) { for (var i in hidden_groups_for_user) {
var hide = hidden_groups_for_user[i]; var hide = hidden_groups_for_user[i];
$('#group-' + hide).hide(); $('#group-' + hide).hide();
} }
...@@ -398,9 +400,57 @@ $(function() { ...@@ -398,9 +400,57 @@ $(function() {
function hidden_group_count() { function hidden_group_count() {
var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {}; var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
return(hidden_groups[current_user] || []).length; return (hidden_groups[current_user] || []).length;
} }
if(hidden_group_count() == 0) {
function toggle_box(id) {
var boxes = JSON.parse(window.localStorage.getItem('hidden_boxes')) || {};
var user_boxes = boxes[current_user] || [];
for (var i in user_boxes) {
var box = user_boxes[i];
if (box == id) {
user_boxes.splice(i, 1);
boxes[current_user] = user_boxes;
window.localStorage.setItem('hidden_boxes', JSON.stringify(boxes));
$('#toggle-box-'+id).attr('src', '/static/icons/eye-half.png');
$('#toggle-box-'+id).parent().parent().parent().next().slideDown(700);
return;
}
}
user_boxes.push(id);
boxes[current_user] = user_boxes;
$('#toggle-box-'+id).attr('src', '/static/icons/eye.png');
$('#toggle-box-'+id).parent().parent().parent().next().slideUp(700);
console.log($('#toggle-box-'+id).parent().parent().parent().next()[0])
window.localStorage.setItem('hidden_boxes', JSON.stringify(boxes));
}
function box_hidden(id) {
var boxes = JSON.parse(window.localStorage.getItem('hidden_boxes')) || {};
var user_boxes = boxes[current_user] || [];
for (var i in user_boxes) {
var box = user_boxes[i];
if (box == id) {
return true;
}
}
return false;
}
$('.toggle-box').each(function(){
var id=$(this).data('id');
$(this).click(function(){
toggle_box(id);
});
if(box_hidden(id)){
$(this).attr('src','/static/icons/eye.png');
$(this).parent().parent().parent().next().hide();
} else {
$(this).attr('src','/static/icons/eye-half.png');
}
})
if (hidden_group_count() == 0) {
$('#show-hidden-groups').hide(); $('#show-hidden-groups').hide();
} }
...@@ -408,7 +458,7 @@ $(function() { ...@@ -408,7 +458,7 @@ $(function() {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
hide_group($(this).data('id')); hide_group($(this).data('id'));
if($('#show-hidden-groups').is(':hidden')) { if ($('#show-hidden-groups').is(':hidden')) {
$('#show-hidden-groups').slideDown(700); $('#show-hidden-groups').slideDown(700);
} }
return false; return false;
...@@ -419,7 +469,7 @@ $(function() { ...@@ -419,7 +469,7 @@ $(function() {
show_hidden_groups(); show_hidden_groups();
$('#show-hidden-groups').slideUp(700); $('#show-hidden-groups').slideUp(700);
$('#groups > li').each(function() { $('#groups > li').each(function() {
if($(this).is(':hidden')) { if ($(this).is(':hidden')) {
$(this).slideDown(700); $(this).slideDown(700);
} }
}) })
...@@ -454,46 +504,38 @@ $(function() { ...@@ -454,46 +504,38 @@ $(function() {
}); });
$('#new-owner-form input').keyup(function() { $('#new-owner-form input').keyup(function() {
var timer; var timer;
return function(e){ return function(e) {
var val=$(this).val().split(' ')[0]; var val = $(this).val().split(' ')[0];
clearTimeout(timer); clearTimeout(timer);
timer=setTimeout(function(){ timer = setTimeout(function() {
if(val.length<1) return; if (val.length < 1) return;
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
data: 'q='+val, data: 'q=' + val,
url: '/ajax/group/autocomplete/', url: '/ajax/group/autocomplete/',
dataType: 'json', dataType: 'json',
success: function(data){ success: function(data) {
console.log(data); console.log(data);
$('#new-owner-autocomplete')[0].innerHTML='<ul>'; $('#new-owner-autocomplete')[0].innerHTML = '<ul>';
var el=$('#new-owner-autocomplete')[0]; var el = $('#new-owner-autocomplete')[0];
for(var i in data){ for (var i in data) {
var d=data[i]; var d = data[i];
el.innerHTML+='<li>' el.innerHTML += '<li>' + d.name + ': ' + d.neptun + ' <input type="button" value="' + gettext('Add owner') + '" data-neptun="' + d.neptun + '" />' + '<div class="clear"></div></li>';
+d.name+': '
+d.neptun
+' <input type="button" value="'+gettext('Add owner')+'" data-neptun="'+d.neptun+'" />'
+'<div class="clear"></div></li>';
} }
if(data.length == 0){ if (data.length == 0) {
el.innerHTML+='<li>' el.innerHTML += '<li>' + gettext('Unknown') + ': ' + val + ' <input type="button" value="' + gettext('Add owner') + '" data-neptun="' + val + '" />' + '<div class="clear"></div></li>';
+gettext('Unknown')+': '
+val
+' <input type="button" value="'+gettext('Add owner')+'" data-neptun="'+val+'" />'
+'<div class="clear"></div></li>';
} }
el.innerHTML+='</ul>'; el.innerHTML += '</ul>';
$(el).find('input').each(function(){ $(el).find('input').each(function() {
var self=this; var self = this;
$(this).click(function(e){ $(this).click(function(e) {
e.stopPropagation(); e.stopPropagation();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
data: 'neptun='+$(self).data('neptun'), data: 'neptun=' + $(self).data('neptun'),
url: '/ajax/group/'+$('#new-owner').data('gid')+'/addOwner/', url: '/ajax/group/' + $('#new-owner').data('gid') + '/addOwner/',
dataType: 'json', dataType: 'json',
success: function(data){ success: function(data) {
window.location.reload(); window.location.reload();
} }
}) })
...@@ -501,7 +543,7 @@ $(function() { ...@@ -501,7 +543,7 @@ $(function() {
}) })
} }
}); });
},1000); }, 1000);
e.stopPropagation(); e.stopPropagation();
} }
}()); }());
......
...@@ -645,13 +645,22 @@ table { ...@@ -645,13 +645,22 @@ table {
margin:20px; margin:20px;
display: none; display: none;
} }
&:hover .boxhelp-box { .help:hover .boxhelp-box {
display: block; display: block;
} }
.help {
img {
cursor: default;
}
}
.icon { .icon {
display: block; display: block;
float: right; float: right;
} }
img {
margin: 3px;
cursor: pointer;
}
} }
#new-owner-autocomplete { #new-owner-autocomplete {
......
...@@ -9,21 +9,26 @@ ...@@ -9,21 +9,26 @@
{% endblock title %} {% endblock title %}
{% block boxhelp %} {% block boxhelp %}
<div class="boxhelp"> <div class="boxhelp">
<div class="icon"> <div class="help">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" /> <div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is your global data store.{% endblocktrans %}</p>
<p>{% blocktrans %}You can access it from all your own virtual machines,
the lab client, this web interface, or through SFTP protocol.
{% endblocktrans %}</p>
<p>{% blocktrans %}This directory is mounted on Windows machines as Z:
drive, and on Linux ones as ~/sshfs.{% endblocktrans %}</p>
<p>{% blocktrans %}If you log in on lab machines (currently Ubuntu only),
you can see this folder also as ~/sshfs.{% endblocktrans %}</p>
<p>{% blocktrans with serv=storeserv %}You can also use an SFTP client (eg.
WinSCP) to access your files at {{serv}}. You will need to register a
public key bellow.{% endblocktrans %}</p>
</div>
</div> </div>
<div class="boxhelp-box"> <div class="icon">
<p>{% blocktrans %}This is your global data store.{% endblocktrans %}</p> <img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="files" id="toggle-box-files"/>
<p>{% blocktrans %}You can access it from all your own virtual machines,
the lab client, this web interface, or through SFTP protocol.
{% endblocktrans %}</p>
<p>{% blocktrans %}This directory is mounted on Windows machines as Z:
drive, and on Linux ones as ~/sshfs.{% endblocktrans %}</p>
<p>{% blocktrans %}If you log in on lab machines (currently Ubuntu only),
you can see this folder also as ~/sshfs.{% endblocktrans %}</p>
<p>{% blocktrans with serv=storeserv %}You can also use an SFTP client (eg.
WinSCP) to access your files at {{serv}}. You will need to register a
public key bellow.{% endblocktrans %}</p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
......
...@@ -10,15 +10,20 @@ ...@@ -10,15 +10,20 @@
{% block boxhelp %} {% block boxhelp %}
<div class="boxhelp"> <div class="boxhelp">
<div class="icon"> <div class="help">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" /> <div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p>
<p>{% blocktrans %}Templates are customized versions of the base images.{% endblocktrans %}</p>
<p>{% blocktrans %}You can install all the needed software on a master
machine, and it will be ready to run by your students in minutes.
{% endblocktrans %}</p>
</div>
</div> </div>
<div class="boxhelp-box"> <div class="icon">
<p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p> <img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="templates" id="toggle-box-templates"/>
<p>{% blocktrans %}Templates are customized versions of the base images.{% endblocktrans %}</p>
<p>{% blocktrans %}You can install all the needed software on a master
machine, and it will be ready to run by your students in minutes.
{% endblocktrans %}</p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
......
...@@ -10,15 +10,20 @@ ...@@ -10,15 +10,20 @@
{% block boxhelp %} {% block boxhelp %}
<div class="boxhelp"> <div class="boxhelp">
<div class="icon"> <div class="help">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" /> <div class="icon">
<img class="help" src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your running virtual machines.{% endblocktrans %}</p>
<p>{% blocktrans %}You can launch a new VM instance if it is shared by
a teacher for one of your groups.{% endblocktrans %}</p>
<p>{% blocktrans %}Please note, that users and shares both have a limit
of launchable instances.{% endblocktrans %}</p>
</div>
</div> </div>
<div class="boxhelp-box"> <div class="icon">
<p>{% blocktrans %}This is the list of your running virtual machines.{% endblocktrans %}</p> <img src="" alt="{% trans "Show/hide box" %}" class="toggle-box" data-id="vms" id="toggle-box-vms"/>
<p>{% blocktrans %}You can launch a new VM instance if it is shared by
a teacher for one of your groups.{% endblocktrans %}</p>
<p>{% blocktrans %}Please note, that users and shares both have a limit
of launchable instances.{% endblocktrans %}</p>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
......
...@@ -3,6 +3,26 @@ ...@@ -3,6 +3,26 @@
{% load l10n %} {% load l10n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% block boxhelp %}
<div class="boxhelp">
<div class="help">
<div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p>
<p>{% blocktrans %}Templates are customized versions of the base images.{% endblocktrans %}</p>
<p>{% blocktrans %}You can install all the needed software on a master
machine, and it will be ready to run by your students in minutes.
{% endblocktrans %}</p>
</div>
</div>
<div class="icon">
<img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="groups" id="toggle-box-groups"/>
</div>
</div>
{% endblock %}
{% block title %} {% block title %}
{% trans "My Groups" %} {% trans "My Groups" %}
{% endblock title %} {% endblock title %}
......
...@@ -3,6 +3,26 @@ ...@@ -3,6 +3,26 @@
{% load l10n %} {% load l10n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% block boxhelp %}
<div class="boxhelp">
<div class="help">
<div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
</div>
<div class="boxhelp-box">
<p>{% blocktrans %}This is the list of your own templates.{% endblocktrans %}</p>
<p>{% blocktrans %}Templates are customized versions of the base images.{% endblocktrans %}</p>
<p>{% blocktrans %}You can install all the needed software on a master
machine, and it will be ready to run by your students in minutes.
{% endblocktrans %}</p>
</div>
</div>
<div class="icon">
<img src="" alt="eye" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="members" id="toggle-box-members"/>
</div>
</div>
{% endblock %}
{% block title %} {% block title %}
{% trans "Members of" %}: {{group.name}} {% trans "Members of" %}: {{group.name}}
{% endblock title %} {% endblock title %}
......
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