this.iter_records(query_uuid, function(record_key, record) {
var is_reserved, is_pending, in_set, is_unconfigured;
+
+ /* By default, a record is visible unless a filter says the opposite */
var visible = true;
var record_state = manifold.query_store.get_record_state(query_uuid, record_key, STATE_SET);
if (op == '=' || op == '==') {
if ( col_value != value || col_value==null || col_value=="" || col_value=="n/a")
visible = false;
+
}else if (op == 'included') {
+ /* By default, the filter returns false unless the record
+ * field match at least one value of the included statement
+ */
+ visible = false;
$.each(value, function(i,x) {
if(x == col_value){
visible = true;
return false; // ~ break
- }else{
- visible = false;
}
});
}else if (op == '!=') {
manifold.raise_event($scope.instance.options.query_uuid, FILTER_REMOVED, filter);
}
- if ((num_selected != 0) && (num_selected != num)) {
+ if (num_selected != num) {
filter = ['network_hrn', 'included', selected];
manifold.raise_event($scope.instance.options.query_uuid, FILTER_ADDED, filter);
}
this.set_networks();
},
-/*
- var self = this;
- console.log('query network DONE');
- $("[id^='testbeds-filter_']").on('click',function(e) {
- $(this).toggleClass("active");
-
- // avoid multiple calls when an event is raised to manifold.js
- e.stopPropagation();
-
- value = this.dataset['platform'];
- // handle the hrn that include . in their name (has to be in sync with the data from SFA)
- //value = value.replace(/\./g,"\\.");
- key = "network_hrn";
- op = "included";
- return $(this).hasClass('active') ? self._addFilter(key, op, value) : self._removeFilter(key, op, value);
- });
-
- },*/
-
/* INTERNAL FUNCTIONS */
set_networks: function()
return angular.element('[ng-controller=TestbedsCtrl]').scope()
},
+/*
_addFilter: function(key, op, value)
{
values = Array();
// Update the filter with the new list of values, ex: [ple,nitos,wilab]
manifold.raise_event(this.options.query_uuid, FILTER_ADDED, [key, op, values]);
},
+
_removeFilter: function(key, op, value)
{
console.log("remove "+value);
manifold.raise_event(this.options.query_uuid, FILTER_ADDED, [key, op, values]);
}
}
-
+*/
});
/* Plugin registration */