Revision abf90954

b/api/handlers.py
76 76
    @paginator
77 77
    def read_all(self, request, detail=False):
78 78
        virtual_servers = VirtualMachine.objects.all()
79
        #get all VM's for now, FIX it to take the user's VMs only yet
79
        #get all VM's for now, FIX it to take the user's VMs only
80 80

  
81 81
        if not detail:
82 82
            virtual_servers = VirtualMachine.objects.filter(owner=User.objects.all()[0])
b/settings.py.dist
124 124
#needed for django. this is the class that implements the User system. We use this to allow users to add stuff for themselves (about, image etc)
125 125
#http://docs.djangoproject.com/en/dev/topics/auth/#auth-profiles
126 126

  
127
TIMEOUT = 10*1000
128
#after this time passes and the client gets no response, it raises an alert that there are network problems
127 129

  
b/ui/templates/machines.html
202 202
</div>
203 203

  
204 204
<script>
205

  
205 206
// hardcoded image types
206 207
var image_tags = {
207 208
                1: 'archlinux',
......
234 235
        type: "GET",
235 236
        //async: false,
236 237
        dataType: "json",
237
        error: function(data) {
238
        timeout: {{timeout}},
239
        error: function(data, strError) {
238 240
                    $("#spinner").hide();
239
                    alert('{% trans "Cannot connect to the backend! Please inform the admins" %}');
240
                              },
241
                    if (strError == 'timeout'){
242
                        alert('{% trans "timeout error. Check your network connection" %}');
243
                        return false;
244
                                              }
245
                    else{
246
                        alert('{% trans "Cannot connect to the backend! Please inform the admins" %}');
247
                        return false;
248
                        }
249
                          },
241 250
        success: function(data) {
242 251
            if ($(".running a.name").length + $(".terminated a.name").length == 0) {
243 252
            
......
312 321
        type: "GET",
313 322
        //async: false,
314 323
        dataType: "json",
324
        timeout: {{timeout}},
325
        error: function(data, strError) {
326
                    if (strError == 'timeout'){
327
                        alert('{% trans "timeout error. Check your network connection" %}');
328
                        return false;
329
                                              }                    
330
                          },
315 331
        success: function(data) {
316 332
            if ($("ul#standard-images li").toArray().length + $("ul#custom-images li").toArray().length == 0) {
317 333
                $.each(data.images, function(i,image){
b/ui/views.py
1 1
import os
2
from django.conf import settings
2 3
from django.utils.translation import gettext_lazy as _
3 4
from django.template import Context, loader
4 5
from django.http import HttpResponse
5 6
from django.utils.translation import get_language
6 7

  
8
TIMEOUT = settings.TIMEOUT
7 9

  
8 10
def template(name, context):
9 11
    template_path = os.path.join(os.path.dirname(__file__), "templates/")  
......
16 18
    return template('home', context)
17 19

  
18 20
def machines(request):
19
    context = {}
21
    context = {'timeout': TIMEOUT}
20 22
    return template('machines', context)
21 23
   
22 24
def machines_list(request):

Also available in: Unified diff