X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fqueryupdater%2Fstatic%2Fjs%2Fqueryupdater.js;h=f1d6b322416d22dabb1a6a41bb886a8ae2d1803b;hb=7464fb5c0d4d4857963b52b944b27df41e4ec1f6;hp=8c68037fc895db05207af98fd3422bc41712235b;hpb=10f5e0a7e25604e93f85727ce35acea95e162679;p=unfold.git
diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js
index 8c68037f..f1d6b322 100644
--- a/plugins/queryupdater/static/js/queryupdater.js
+++ b/plugins/queryupdater/static/js/queryupdater.js
@@ -26,7 +26,11 @@
// Record state through the query cycle
- var QueryUpdater = Plugin.extend({
+ var QueryUpdaterPlugin = Plugin.extend({
+
+ /**************************************************************************
+ * CONSTRUCTOR
+ **************************************************************************/
init: function(options, element) {
this.classname="queryupdater";
@@ -38,32 +42,12 @@
this.selected_resources = Array();
this.table = this.elmt('table').dataTable({
-// the original querytable layout was
-// sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t<'row'<'col-xs-5'i><'col-xs-7'p>>",
-// however the bottom line with 'showing blabla...' and the navigation widget are not really helpful
sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t>",
-// so this does not matter anymore now that the pagination area is turned off
-// sPaginationType: 'bootstrap',
- bAutoWidth: true,
-// bJQueryUI : true,
-// bRetrieve : true,
-// sScrollX : '100%', // Horizontal scrolling
-// bSortClasses : false, // Disable style for the sorted column
-// aaSorting : [[ 0, 'asc' ]], // Default sorting on URN
-// fnDrawCallback: function() { // Reassociate close click every time the table is redrawn
-// /* Prevent to loop on click while redrawing table */
-// $('.ResourceSelectedClose').unbind('click');
-// /* Handle clicks on close span */
-// /* Reassociate close click every time the table is redrawn */
-// $('.ResourceSelectedClose').bind('click', self, self._close_click);
-// }
- });
+ bAutoWidth: true,
+ });
- // XXX This should not be done at init...
- this.elmt('update').click(this, this.do_checksla);
- this.elmt('refresh').click(this, this.do_refresh);
- this.elmt('reset').click(this, this.do_reset);
- this.elmt('clear_annotations').click(this, this.do_clear_annotations);
+ this.elmt('update').click(this, this.do_ok);
+ this.elmt('refresh').click(this, this.do_cancel);
this.listen_query(options.query_uuid);
},
@@ -75,244 +59,118 @@
do_checksla: function(e) {
var username = e.data.options.username;
var urn = data.value;
- var arrayselectedresources = data.selected_resources;
+ var arraySelectedResources = data.selected_resources;
- var accepted_sla = Array();
+ var accepted_sla = [];
var count = 0;
- // XXX check that the query is not disabled
-
- console.log("DATA VALUE: " + data.value);
-
- //
SLA description
- //
Testbed guarantees 0.99 Uptime rate for 0.99 rate of the VirtualWall resources during the sliver lifetime
- //
SLA description
- //
Testbed guarantees 0.99 Uptime rate for 0.99 rate of the WiLab2 resources during the sliver lifetime
- var promt = $('#modal-body');
+ var self = e.data;
+ // var testbedsWithSLA = ["iminds", "fuseco", "netmode"];
+ var testbedsWithSLA;
- // id="myModalLabel"
- var flagVW = false;
- var flagWi = false;
+ var sliverPattern = /IDN\+(.+)\+(node|channel)\+/;
+ var list = [];
- promt.append('
SLA description
');
+ var promt = $('#sla-table-body');
- var wilabForm = "";
- wilabForm += "
";
- for(var iter = 0; iter < arrayselectedresources.length; iter++){
- var list = '
Testbed guarantees 0.99 Uptime rate for 0.99 rate of the VirtualWall resources during the sliver lifetime
';
-
- var wallForm = "";
- wallForm += "
";
- for(var iter = 0; iter < arrayselectedresources.length; iter++){
- var list = '
'+arrayselectedresources[iter].toLowerCase()+'
';
-
- if (arrayselectedresources[iter].toLowerCase().indexOf("wall2") >= 0){
-
- accepted_sla.push({"wall2":false});
- wallForm += list;
- flagVW = true;
-
+ $.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 = $('
');
+ element.append(
+ $('
').append(list[i]),
+ $('
').append('99% of Uptime for 99% of resources'),
+ $('