From 7426a25d89f0a5c02abfcc22e2f8eb9458a66966 Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Fri, 3 Apr 2015 12:10:14 +0200 Subject: [PATCH] Add resource from the scheduler not only leases --- plugins/querytable/static/js/querytable.js | 4 ++-- plugins/scheduler2/static/js/scheduler2.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js index 01c72b66..c1b19235 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querytable/static/js/querytable.js @@ -533,11 +533,11 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_RESET); break; case STATE_SET_IN_PENDING: - this.set_checkbox_from_data(data.key, true); + this.set_checkbox_from_data(data.value, true); this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_ADDED); break; case STATE_SET_OUT_PENDING: - this.set_checkbox_from_data(data.key, false); + this.set_checkbox_from_data(data.value, false); this.set_bgcolor(data.value, QUERYTABLE_BGCOLOR_REMOVED); break; } diff --git a/plugins/scheduler2/static/js/scheduler2.js b/plugins/scheduler2/static/js/scheduler2.js index a13856a9..939a2e23 100755 --- a/plugins/scheduler2/static/js/scheduler2.js +++ b/plugins/scheduler2/static/js/scheduler2.js @@ -197,10 +197,21 @@ var SCHEDULER_COLWIDTH = 50; value: new_lease } manifold.raise_event($scope.instance.options.query_lease_uuid, FIELD_STATE_CHANGED, data); + /* Add to local cache also, unless we listen to events from outside */ - if (!(resource_urn in $scope._leases_by_resource)) + if (!(resource_urn in $scope._leases_by_resource)){ $scope._leases_by_resource[resource_urn] = []; + /* Add the resource of the selected timeslot to the pending list */ + data_resource = { + state: STATE_SET, + key : null, + op : STATE_SET_ADD, + value: resource_urn + }; + manifold.raise_event($scope.instance.options.query_uuid, FIELD_STATE_CHANGED, data_resource); + } $scope._leases_by_resource[resource_urn].push(new_lease); + } $scope._remove_lease = function(other) -- 2.43.0