X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fqueryupdater%2Fstatic%2Fjs%2Fqueryupdater.js;fp=plugins%2Fqueryupdater%2Fstatic%2Fjs%2Fqueryupdater.js;h=f1d6b322416d22dabb1a6a41bb886a8ae2d1803b;hb=3aae671a1ca0cef870a268b88ddcde8d520d7621;hp=f3ba672d207d6c18eebfefcc22cf8dcdea5a9d33;hpb=d3828739b742f18881ce982179ea0f75b080ed71;p=myslice.git diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js index f3ba672d..f1d6b322 100644 --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@ -56,7 +56,109 @@ /***************************** GUI EVENTS *****************************/ - /************************** GUI MANIPULATION **************************/ + do_checksla: function(e) { + var username = e.data.options.username; + var urn = data.value; + var arraySelectedResources = data.selected_resources; + + var accepted_sla = []; + var count = 0; + var self = e.data; + // var testbedsWithSLA = ["iminds", "fuseco", "netmode"]; + var testbedsWithSLA; + + var sliverPattern = /IDN\+(.+)\+(node|channel)\+/; + var list = []; + + var promt = $('#sla-table-body'); + + $.get("/sla/testbeds/", function(data) { + testbedsWithSLA = data; + + console.log("Testbeds with SLA: " + testbedsWithSLA); + + $(arraySelectedResources).each(function () { + var sliverMatch = sliverPattern.exec(this); + var sliverId = sliverMatch[1]; + for (var i = 0; i < testbedsWithSLA.length; i++) { + if(this.indexOf(testbedsWithSLA[i].toLowerCase()) >= 0){ // If it has SLA + if (list.indexOf(sliverId) == -1) { // If it is not in the list + list.push(sliverId); + } + } + } + }); + + if (list.length > 0) { + for (var i = 0; i < list.length; i++) { + var element = $('