From 48a672847fcc98fce625f37faf62f3b53bd8e32b Mon Sep 17 00:00:00 2001 From: Pierre Paul Lefebvre Date: Thu, 20 Aug 2015 15:07:32 -0400 Subject: [PATCH] Adds more checks for issue-52 --- jeto/models/vagrant.py | 1 - jeto/static/js/controllers/instances.js | 23 ++++++++++++++++++----- requirements.txt | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/jeto/models/vagrant.py b/jeto/models/vagrant.py index a096ce4..916d24f 100644 --- a/jeto/models/vagrant.py +++ b/jeto/models/vagrant.py @@ -141,7 +141,6 @@ def __str__(self): return self.__unicode__() def post(self): - print request.json return self @orm.reconstructor diff --git a/jeto/static/js/controllers/instances.js b/jeto/static/js/controllers/instances.js index 6df90fa..079fa33 100644 --- a/jeto/static/js/controllers/instances.js +++ b/jeto/static/js/controllers/instances.js @@ -95,8 +95,14 @@ function InstancesController($scope, Instances, Projects, Hosts, $http, $locatio instance.archive_url = $scope.instanceInfo.archive_url; instance.state = 'create'; instance.async = true; - instance.$save(function(data){ + instance.$save({}, function(data){ $location.path('/instances/' + data.instance.id); + }, function(error){ + $('.loading').hide(); + alert("Something failed ... try to refresh.\n" + +"if you think it's a bug please report it on github\n" + +"https://github.com/StudioQi/jeto/issues\n" + +"Error message :\n" + error.message); }); } }, @@ -137,10 +143,17 @@ function InstancesController($scope, Instances, Projects, Hosts, $http, $locatio instanceId = $scope.deleteId; $('.loading').show(); $http.delete('/api/instances/' + instanceId) - .success(function(infos) { - setTimeout($scope.updateInfos, 100); - $scope.deleteId = undefined; - }); + .success(function(){ + setTimeout($scope.updateInfos, 100); + $scope.deleteId = undefined; + }) + .error(function(error){ + $('.loading').hide(); + alert("Something failed ... try to refresh.\n" + +"if you think it's a bug please report it on github\n" + +"https://github.com/StudioQi/jeto/issues\n" + +"Error message :\n" + error.message); + }); } }, cancel: { diff --git a/requirements.txt b/requirements.txt index 0dafb99..0dc464d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ Babel==1.3 Flask==0.10.1 Flask-Babel==0.9 -Flask-RESTful==0.2.5 +Flask-RESTful==0.3.4 Flask-SQLAlchemy==1.0 Flask-Migrate==1.2.0 Flask-OAuth @@ -28,6 +28,6 @@ six==1.6.1 speaklater==1.3 wsgiref==0.1.2 redis==2.9.1 -rq==0.5.3 +rq==0.5.4 times==0.6.2 ansiconv==1.0.0