X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fquerytable%2Fstatic%2Fjs%2Fquerytable.js;h=7ddf300d75e3fe8e0e839b7c9ef1e925c00e4f90;hb=261afa50a6fade31685a23b104ab919bebaf25ef;hp=623a1e1daa63346482960f6caa785ddde44bd176;hpb=3067eb36b836e5695ffd829960134bdadba61530;p=unfold.git diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js index 623a1e1d..7ddf300d 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querytable/static/js/querytable.js @@ -12,7 +12,8 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; var QUERYTABLE_MAP = { - 'Testbed': 'network_hrn', + 'Facility': 'facility_name', + 'Testbed': 'testbed_name', 'Resource name': 'hostname', 'Type': 'type', }; @@ -97,7 +98,7 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; sPaginationType: 'bootstrap', // Handle the null values & the error : Datatables warning Requested unknown parameter // http://datatables.net/forums/discussion/5331/datatables-warning-...-requested-unknown-parameter/p2 - aoColumnDefs: [{sDefaultContent: '',aTargets: [ '_all' ]}], + aoColumnDefs: [{sDefaultContent: '', aTargets: [ '_all' ]}], // WARNING: this one causes tables in a 'tabs' that are not exposed at the time this is run to show up empty // sScrollX: '100%', /* Horizontal scrolling */ bProcessing: true, /* Loading */ @@ -450,10 +451,12 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; on_field_state_changed: function(data) { - var state = manifold.query_store.get_record_state(this.options.query_uuid, data.value, data.status); - switch(data.status) { + // XXX We could get this from data.value + // var state = manifold.query_store.get_record_state(this.options.query_uuid, data.value, data.state); + + switch(data.state) { case STATE_SET: - switch(state) { + switch(data.op) { case STATE_SET_IN: case STATE_SET_IN_SUCCESS: case STATE_SET_OUT_FAILURE: @@ -467,18 +470,18 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_RESET); break; case STATE_SET_IN_PENDING: - this.set_checkbox_from_data(data.value, true); + this.set_checkbox_from_data(data.key, true); this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_ADDED); break; case STATE_SET_OUT_PENDING: - this.set_checkbox_from_data(data.value, false); + this.set_checkbox_from_data(data.key, false); this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_REMOVED); break; } break; case STATE_WARNINGS: - this.change_status(data.value, state); + this.change_status(data.key, data.value); break; } }, @@ -551,14 +554,18 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; _check_click: function(e) { - e.stopPropagation(); - + var data; var self = e.data; - var id=this.id; - // this.id = key of object to be added... what about multiple keys ? - if (debug) messages.debug("querytable._check_click key="+this.canonical_key+"->"+id+" checked="+this.checked); - manifold.raise_event(self.options.query_uuid, this.checked?SET_ADD:SET_REMOVED, id); + e.stopPropagation(); + + data = { + state: STATE_SET, + key : null, + op : this.checked ? STATE_SET_ADD : STATE_SET_REMOVE, + value: this.id + } + manifold.raise_event(self.options.query_uuid, FIELD_STATE_CHANGED, data); //return false; // prevent checkbox to be checked, waiting response from manifold plugin api },