X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fstatic%2Fjs%2Fmyslice.js;fp=portal%2Fstatic%2Fjs%2Fmyslice.js;h=fa115bec90cb2143e14f616a2da7652d55c54a3b;hb=c79b3c894ec8a08686ae4978e5375c15ec6f2cbf;hp=2caa4b8ffdc620af20251629b1f2a583186212fa;hpb=a0149650c8519c69236da8b58720eb94393c8307;p=myslice.git diff --git a/portal/static/js/myslice.js b/portal/static/js/myslice.js index 2caa4b8f..fa115bec 100644 --- a/portal/static/js/myslice.js +++ b/portal/static/js/myslice.js @@ -138,38 +138,39 @@ var myslice = { }, apply: function() { - $('div#loading').show(); - this.pending = []; - this.save(); - // setTimeout(function(){ - // $('div#loading').hide(); - // window.location.href = '/resources/' + this.slice + '?message=true'; - // },6000); + + //$('div#loading').show(); + //this.pending = []; + //this.save(); + //setTimeout(function(){ + //$('div#loading').hide(); + //window.location.href = '/resources/' + this.slice + '?message=true'; + //},6000); - $.post("/rest/slice/", { 'fields': ['resource','slice_hrn'], 'filters': { 'slice_hrn' : this.slice } }, function(data) { - console.log(data); - resources = []; - reserved = []; - update = []; - if ('resource' in data[0]) { - $.each(data[0].resource, function(idx, r) { - resources.push(r.urn); - }); - } - //myslice.pending - console.log(myslice.pending); - console.log(resources); - $.each(resources.concat(myslice.pending), function(idx, v) { - update.push({ 'resource': v }); - }); - console.log(update); - $.post("/update/slice/", { 'filters': { 'slice_hrn' : 'ple.upmc.myslicedemo' }, 'params' : update }, function(data) { - console.log(data); - }); - }); - //console.log(this.slice); + $.post("/rest/slice/", { 'fields': ['resource','slice_hrn'], 'filters': { 'slice_hrn' : this.slice } }, function(data) { + console.log(data); + resources = []; + reserved = []; + update = []; + if ('resource' in data[0]) { + $.each(data[0].resource, function(idx, r) { + resources.push(r.urn); + }); + } + //myslice.pending + console.log(myslice.pending); + console.log(resources); + $.each(resources.concat(myslice.pending), function(idx, v) { + update.push( v ); + }); + console.log(update); + $.post("/update/slice/", { 'filters': { 'slice_hrn' : myslice.slice }, 'params' : update }, function(data) { + console.log(data); + }); + }); + console.log(this.slice); } };