3177: look for checked persistent selections on submit.
[arvados.git] / apps / workbench / app / assets / javascripts / select_modal.js
index ba106d111046309b83453210301ec2dfde736676..596cb702294bf79796a8b80b6be21fea9e48ea86 100644 (file)
@@ -40,10 +40,20 @@ $(document).on('click', '.selectable', function() {
     var action_data_from_params = $(this).data('action-data-from-params');
     var selection_param = action_data.selection_param;
     $modal.find('.modal-error').removeClass('hide').hide();
-    $modal.find('.selectable.active[data-object-uuid]').each(function() {
+
+    $checked_selections = $modal.find('.persistent-selection:checked');
+    if ($checked_selections) {
+      $checked_selections.each(function() {
+          data.push({name: selection_param, value: $(this).attr('value')});
+      });
+    }
+
+    if (data.length == 0) {   // no checked persistent selection
+      $modal.find('.selectable.active[data-object-uuid]').each(function() {
         var val = $(this).attr('data-object-uuid');
         data.push({name: selection_param, value: val});
-    });
+      });
+    }
     $.each($.extend({}, action_data, action_data_from_params),
            function(key, value) {
                if (value instanceof Array && key[-1] != ']') {