Blob Blame History Raw
From d0731ed0ccbcb24e2bc080dba6ba05a8eb0eecc4 Mon Sep 17 00:00:00 2001
From: Ondrej Mular <omular@redhat.com>
Date: Tue, 13 Sep 2016 09:02:22 +0200
Subject: [PATCH] web UI: reset selected group when displaying new resource
 dialog

---
 pcsd/public/js/pcsd.js   | 13 +++++++++++++
 pcsd/views/_resource.erb |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/pcsd/public/js/pcsd.js b/pcsd/public/js/pcsd.js
index 67a0bdb..371b76b 100644
--- a/pcsd/public/js/pcsd.js
+++ b/pcsd/public/js/pcsd.js
@@ -3046,3 +3046,16 @@ function manage_resource(resource_id) {
     }
   });
 }
+
+function show_add_resource_dialog() {
+  var new_resource_group_selector_id = $(
+    "#new_resource_agent .group-selector"
+  ).attr("id");
+  Ember.View.views[new_resource_group_selector_id].set(
+    "group_select_value", null
+  );
+  $('#new_resource_agent').dialog({
+    title: 'Add Resource',
+    modal:true, width: 'auto'
+  });
+}
diff --git a/pcsd/views/_resource.erb b/pcsd/views/_resource.erb
index ad2251c..86e5567 100644
--- a/pcsd/views/_resource.erb
+++ b/pcsd/views/_resource.erb
@@ -14,7 +14,7 @@
       Remove</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
   <div class="plus sprites"></div><div class="link">&nbsp;
     <% if @myView == "resource" %>
-      <a href="#" onclick="$('#new_resource_agent').dialog({title: 'Add Resource', modal:true, width: 'auto'});return false;">
+      <a href="#" onclick="show_add_resource_dialog();return false;">
     <% else %>
       <a href="#" onclick="$('#new_stonith_agent').dialog({title: 'Add Fence Device', modal:true, width: 'auto'});return false;">
     <% end %>
-- 
1.8.3.1