+ /* Last lease removed for this resource -> remove the resource from the list */
+ if($scope._leases_by_resource.hasOwnProperty(other.resource) && $scope._leases_by_resource[other.resource].length == 0){
+ /* remove resource from the list of selected resources */
+ data_resource = {
+ state: STATE_SET,
+ key : null,
+ op : STATE_SET_REMOVE,
+ value: other.resource
+ };
+
+ prev_state = manifold.query_store.get_record_state($scope.instance.options.query_uuid, data_resource.value, STATE_SET);
+ /* Remove Resource from local cache */
+ delete $scope._leases_by_resource[data_resource.value]
+ /* Send the message to the list of resources, depending on the previous state */
+ if(jQuery.inArray(prev_state,[STATE_SET_IN,STATE_SET_IN_SUCCESS,STATE_SET_IN_PENDING,STATE_SET_OUT_FAILURE])>-1){
+ manifold.raise_event($scope.instance.options.query_uuid, FIELD_STATE_CHANGED, data_resource);
+ //manifold.raise_event($scope.instance.options.query_uuid, STATUS_REMOVE_WARNING, data_resource);
+ }
+
+ }