[Ovirt-devel] [PATCH] Fixing a loading issue with the Start On form
Simon COURTOIS
scourtois at linagora.com
Tue Sep 21 15:20:26 UTC 2010
Signed-off-by: Simon COURTOIS <scourtois at linagora.com>
---
src/app/views/vm/start.rhtml | 76 +++++++++++++++++++++--------------------
1 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/src/app/views/vm/start.rhtml b/src/app/views/vm/start.rhtml
index bed1d2d..f80cf70 100644
--- a/src/app/views/vm/start.rhtml
+++ b/src/app/views/vm/start.rhtml
@@ -4,6 +4,45 @@
<%- content_for :description do -%>
Please choose a Host to start the Virtual Machine. Leave the selection blank to allow oVirt to choose the most appropriate starting host.
<%- end -%>
+
+<script type="text/javascript">
+ $(function() {
+
+ $('#start_vm_form').ajaxForm({
+ dataType: 'json',
+ success: afterVm
+ });
+
+ });
+
+ function start_vm_select(selected_rows) {
+ var selected_ids = new Array();
+ for (i=0; i<selected_rows.length; i++) {
+ load_widget_select(selected_rows[i]);
+ selected_ids[i] = selected_rows[i].id;
+ }
+ if (selected_ids.length == 1) {
+ $('#selected_starting_host')
+ .load('<%= url_for :controller => "host", :action => "quick_summary" %>',
+ { id: parseInt(selected_ids[0].substring(3)) });
+ $('#vm_action_data').val(selected_ids[0].substring(3));
+ }
+ }
+
+ function start_vm_deselect(selected_rows) {
+ var selected_ids = new Array()
+ for (i=0; i<selected_rows.length; i++) {
+ load_widget_deselect(selected_rows[i]);
+ selected_ids[i] = selected_rows[i].id;
+ }
+ refresh_summary_static('selected_starting_host',
+ '<div class="selection_left"> \
+ <div>No starting host selected.</div> \
+ </div>');
+ $('#vm_action_data').val('');
+ }
+</script>
+
<div class="panel_header"></div>
<form method="POST" id="start_vm_form" action="<%= url_for :action => 'vm_action' %>">
@@ -38,40 +77,3 @@
</div>
<%= popup_footer("$('#start_vm_form').submit()", "Start Virtual Machine") %>
</form>
-<script type="text/javascript">
- $(function() {
-
- $('#start_vm_form').ajaxForm({
- dataType: 'json',
- success: afterVm
- });
-
- });
-
- function start_vm_select(selected_rows) {
- var selected_ids = new Array();
- for (i=0; i<selected_rows.length; i++) {
- load_widget_select(selected_rows[i]);
- selected_ids[i] = selected_rows[i].id;
- }
- if (selected_ids.length == 1) {
- $('#selected_starting_host')
- .load('<%= url_for :controller => "host", :action => "quick_summary" %>',
- { id: parseInt(selected_ids[0].substring(3)) });
- $('#vm_action_data').val(selected_ids[0].substring(3));
- }
- }
-
- function start_vm_deselect(selected_rows) {
- var selected_ids = new Array()
- for (i=0; i<selected_rows.length; i++) {
- load_widget_deselect(selected_rows[i]);
- selected_ids[i] = selected_rows[i].id;
- }
- refresh_summary_static('selected_starting_host',
- '<div class="selection_left"> \
- <div>No starting host selected.</div> \
- </div>');
- $('#vm_action_data').val('');
- }
-</script>
--
1.7.2.3
More information about the ovirt-devel
mailing list