Commit 2cc1f678 by tarokkk

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

parents 696d4d85 048906e2
var toggleDetails;
$(function() {
toggleDetails = cloud.throttle(function() {
if($(this).parent('.entry').hasClass('opened')) {
if ($(this).parent('.entry').hasClass('opened')) {
$(this).parent('.entry').removeClass('opened');
$(this).next('.details').slideUp(700);
} else {
......@@ -9,7 +9,7 @@ $(function() {
$(this).next('.details').slideDown(700);
}
})
$('a').click(function(e){
$('a').click(function(e) {
e.stopPropagation();
});
$('.delete-template').click(function(e) {
......@@ -32,19 +32,19 @@ $(function() {
});
});
});
$('#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(){
$('#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() {
$.ajax({
type: 'POST',
url: '/ajax/key/reset/',
success: function(){
success: function() {
window.location.reload();
}
})
});
});
$('.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) {
e.preventDefault();
e.stopPropagation();
......@@ -141,7 +141,7 @@ $(function() {
})
$('#modal').show();
});
$('.template-unshare').click(function(e){
$('.template-unshare').click(function(e) {
e.stopPropagation();
});
$('#old-upload').click(function(e) {
......@@ -154,7 +154,7 @@ $(function() {
$(this).css('backgroundColor', function(w) {
return 'hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 50%, 0.2)';
}($(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)';
}($(this)[0].style.width));
});
......@@ -183,20 +183,21 @@ $(function() {
$('#new-group-members').change(updateSummary);
});
$('.hidden-password').click(function() {
if($(this).attr('type') == 'password'){
if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text');
$(this).addClass('shown');
} else if(this.selectionStart-this.selectionEnd == 0) {
} else if (this.selectionStart - this.selectionEnd == 0) {
$(this).attr('type', 'password');
$(this).removeClass('shown');
}
});
$('.shares li').click(function(e){
e.preventDefault(); e.stopPropagation();
e=$(this);
if(!e.hasClass('description')){
if(e.next().is(':hidden')){
$('.shares li').click(function(e) {
e.preventDefault();
e.stopPropagation();
e = $(this);
if (!e.hasClass('description')) {
if (e.next().is(':hidden')) {
e.next().slideDown(700);
} else {
e.next().slideUp(700);
......@@ -205,12 +206,13 @@ $(function() {
e.slideUp(700);
}
});
$('.shares .edit').click(function(e){
e.preventDefault(); e.stopPropagation();
$('.shares .edit').click(function(e) {
e.preventDefault();
e.stopPropagation();
$.ajax({
type: 'GET',
url: '/ajax/shareEdit/'+$(this).data('id')+'/',
success: function(data){
url: '/ajax/shareEdit/' + $(this).data('id') + '/',
success: function(data) {
$('#modal').show();
$('#modal-container').html(data);
}
......@@ -225,7 +227,7 @@ $(function() {
$.get('/vm/credentials/' + id, function(data) {
$('#modal-container').html(data);
$('#modal-container .hidden-password').click(function() {
if($(this).attr('type') == 'password'){
if ($(this).attr('type') == 'password') {
$(this).attr('type', 'text');
$(this).addClass('shown');
} else {
......@@ -311,7 +313,7 @@ $(function() {
type: 'POST',
url: '/vm/' + state + '/' + id + '/',
success: function(data, b, c) {
if(state == "resume") {
if (state == "resume") {
window.location.href = '/vm/show/' + id + "/";
} else {
window.location.reload();
......@@ -370,9 +372,9 @@ $(function() {
function hide_group(id) {
var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
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];
if(hide == id) return false;
if (hide == id) return false;
}
hidden_groups_for_user.push(id);
hidden_groups[current_user] = hidden_groups_for_user;
......@@ -383,7 +385,7 @@ $(function() {
function hide_groups() {
var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
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];
$('#group-' + hide).hide();
}
......@@ -398,9 +400,57 @@ $(function() {
function hidden_group_count() {
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();
}
......@@ -408,7 +458,7 @@ $(function() {
e.preventDefault();
e.stopPropagation();
hide_group($(this).data('id'));
if($('#show-hidden-groups').is(':hidden')) {
if ($('#show-hidden-groups').is(':hidden')) {
$('#show-hidden-groups').slideDown(700);
}
return false;
......@@ -419,7 +469,7 @@ $(function() {
show_hidden_groups();
$('#show-hidden-groups').slideUp(700);
$('#groups > li').each(function() {
if($(this).is(':hidden')) {
if ($(this).is(':hidden')) {
$(this).slideDown(700);
}
})
......@@ -454,46 +504,38 @@ $(function() {
});
$('#new-owner-form input').keyup(function() {
var timer;
return function(e){
var val=$(this).val().split(' ')[0];
return function(e) {
var val = $(this).val().split(' ')[0];
clearTimeout(timer);
timer=setTimeout(function(){
if(val.length<1) return;
timer = setTimeout(function() {
if (val.length < 1) return;
$.ajax({
type: 'POST',
data: 'q='+val,
data: 'q=' + val,
url: '/ajax/group/autocomplete/',
dataType: 'json',
success: function(data){
success: function(data) {
console.log(data);
$('#new-owner-autocomplete')[0].innerHTML='<ul>';
var el=$('#new-owner-autocomplete')[0];
for(var i in data){
var d=data[i];
el.innerHTML+='<li>'
+d.name+': '
+d.neptun
+' <input type="button" value="'+gettext('Add owner')+'" data-neptun="'+d.neptun+'" />'
+'<div class="clear"></div></li>';
$('#new-owner-autocomplete')[0].innerHTML = '<ul>';
var el = $('#new-owner-autocomplete')[0];
for (var i in data) {
var d = data[i];
el.innerHTML += '<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){
el.innerHTML+='<li>'
+gettext('Unknown')+': '
+val
+' <input type="button" value="'+gettext('Add owner')+'" data-neptun="'+val+'" />'
+'<div class="clear"></div></li>';
if (data.length == 0) {
el.innerHTML += '<li>' + gettext('Unknown') + ': ' + val + ' <input type="button" value="' + gettext('Add owner') + '" data-neptun="' + val + '" />' + '<div class="clear"></div></li>';
}
el.innerHTML+='</ul>';
$(el).find('input').each(function(){
var self=this;
$(this).click(function(e){
el.innerHTML += '</ul>';
$(el).find('input').each(function() {
var self = this;
$(this).click(function(e) {
e.stopPropagation();
$.ajax({
type: 'POST',
data: 'neptun='+$(self).data('neptun'),
url: '/ajax/group/'+$('#new-owner').data('gid')+'/addOwner/',
data: 'neptun=' + $(self).data('neptun'),
url: '/ajax/group/' + $('#new-owner').data('gid') + '/addOwner/',
dataType: 'json',
success: function(data){
success: function(data) {
window.location.reload();
}
})
......@@ -501,7 +543,7 @@ $(function() {
})
}
});
},1000);
}, 1000);
e.stopPropagation();
}
}());
......
......@@ -645,13 +645,22 @@ table {
margin:20px;
display: none;
}
&:hover .boxhelp-box {
.help:hover .boxhelp-box {
display: block;
}
.help {
img {
cursor: default;
}
}
.icon {
display: block;
float: right;
}
img {
margin: 3px;
cursor: pointer;
}
}
#new-owner-autocomplete {
......
......@@ -9,21 +9,26 @@
{% endblock title %}
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
<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 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 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 class="icon">
<img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="files" id="toggle-box-files"/>
</div>
</div>
{% endblock %}
......
......@@ -10,15 +10,20 @@
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
<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="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 class="icon">
<img src="" alt="toggle" title="{% trans "Show/hide box" %}" class="toggle-box" data-id="templates" id="toggle-box-templates"/>
</div>
</div>
{% endblock %}
......
......@@ -10,15 +10,20 @@
{% block boxhelp %}
<div class="boxhelp">
<div class="icon">
<img src="{% static "icons/information-frame.png" %}" alt="{% trans "Help" %}" />
<div class="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 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 class="icon">
<img src="" alt="{% trans "Show/hide box" %}" class="toggle-box" data-id="vms" id="toggle-box-vms"/>
</div>
</div>
{% endblock %}
......
......@@ -3,6 +3,26 @@
{% load l10n %}
{% 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 %}
{% trans "My Groups" %}
{% endblock title %}
......
......@@ -3,6 +3,26 @@
{% load l10n %}
{% 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 %}
{% trans "Members of" %}: {{group.name}}
{% 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