On Thu, Jun 05, 2008 at 03:31:09PM -0400, Scott Seago
wrote:> this patch needs to be applied on top of my earlier patch of the day
> >From 854fa46c2a90d60d09003d7185c745e660cb9dbd Mon Sep 17 00:00:00 2001
> From: Scott Seago <sseago at redhat.com>
> Date: Thu, 5 Jun 2008 15:25:39 -0400
> Subject: [PATCH] clear selected detail pane if deleting/moving it elsewhere
>
>
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
> wui/src/app/views/hardware/move.rhtml | 3 +++
> wui/src/app/views/hardware/show_hosts.rhtml | 4 ++++
> wui/src/app/views/hardware/show_storage.rhtml | 6 ++++++
> wui/src/app/views/hardware/show_vms.rhtml | 3 +++
> wui/src/app/views/host/show.rhtml | 1 +
> wui/src/app/views/resources/quick_summary.rhtml | 1 +
> wui/src/app/views/resources/show_vms.rhtml | 3 +++
> wui/src/app/views/storage/show.rhtml | 3 ++-
> wui/src/app/views/vm/show.rhtml | 3 ++-
> wui/src/public/javascripts/ovirt.js | 13 ++++++++-----
> 10 files changed, 33 insertions(+), 7 deletions(-)
>
> diff --git a/wui/src/app/views/hardware/move.rhtml
b/wui/src/app/views/hardware/move.rhtml
> index f5824c6..e146d6e 100644
> --- a/wui/src/app/views/hardware/move.rhtml
> +++ b/wui/src/app/views/hardware/move.rhtml
> @@ -29,6 +29,9 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (get_selected_<%= @resource_type
%>().indexOf($('#<%= @resource_type %>_selection_id').html())
!= -1){
> + empty_summary('<%= @resource_type %>_selection',
'<%= @resource_type == 'hosts' ? 'Host' : 'Storage
Pool' %>')
> + }
> }, 'json');
> }
> $('#move_to_new_pool').click(function(){
> diff --git a/wui/src/app/views/hardware/show_hosts.rhtml
b/wui/src/app/views/hardware/show_hosts.rhtml
> index 375905e..0aa38f9 100644
> --- a/wui/src/app/views/hardware/show_hosts.rhtml
> +++ b/wui/src/app/views/hardware/show_hosts.rhtml
> @@ -33,6 +33,10 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (hosts.indexOf($('#hosts_selection_id').html()) != -1){
> + empty_summary('hosts_selection', 'Host')
> + }
> +
> }, 'json');
> }
> }
> diff --git a/wui/src/app/views/hardware/show_storage.rhtml
b/wui/src/app/views/hardware/show_storage.rhtml
> index 73808ab..ca1de62 100644
> --- a/wui/src/app/views/hardware/show_storage.rhtml
> +++ b/wui/src/app/views/hardware/show_storage.rhtml
> @@ -35,6 +35,9 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (storage.indexOf($('#storage_selection_id').html()) != -1){
> + empty_summary('storage_selection', 'Storage Pool')
> + }
> }, 'json');
> }
> }
> @@ -49,6 +52,9 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (storage.indexOf($('#storage_selection_id').html()) != -1){
> + empty_summary('storage_selection', 'Storage Pool')
> + }
> }, 'json');
> }
> }
> diff --git a/wui/src/app/views/hardware/show_vms.rhtml
b/wui/src/app/views/hardware/show_vms.rhtml
> index dc70f1b..0225ad8 100644
> --- a/wui/src/app/views/hardware/show_vms.rhtml
> +++ b/wui/src/app/views/hardware/show_vms.rhtml
> @@ -20,6 +20,9 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (vm_pools.indexOf($('#vmpool_selection_id').html()) != -1){
> + empty_summary('vmpool_selection', 'Virtual Machine
Pool')
> + }
> }, 'json');
> }
> }
> diff --git a/wui/src/app/views/host/show.rhtml
b/wui/src/app/views/host/show.rhtml
> index 23d940a..901685b 100644
> --- a/wui/src/app/views/host/show.rhtml
> +++ b/wui/src/app/views/host/show.rhtml
> @@ -33,6 +33,7 @@
> }
> </script>
>
> + <div id="hosts_selection_id"
style="display:none"><%= @host.id %></div>
> <div class="selection_key">
> UUID:<br/>
> CPUs:<br/>
> diff --git a/wui/src/app/views/resources/quick_summary.rhtml
b/wui/src/app/views/resources/quick_summary.rhtml
> index c05dfd5..972c439 100644
> --- a/wui/src/app/views/resources/quick_summary.rhtml
> +++ b/wui/src/app/views/resources/quick_summary.rhtml
> @@ -39,6 +39,7 @@
> }
> </script>
>
> + <div id="vmpool_selection_id"
style="display:none"><%= @vm_resource_pool.id %></div>
> <% resources = @vm_resource_pool.full_resources %>
> <div class="selection_key">
> <br/>
> diff --git a/wui/src/app/views/resources/show_vms.rhtml
b/wui/src/app/views/resources/show_vms.rhtml
> index beacddf..abd4e52 100644
> --- a/wui/src/app/views/resources/show_vms.rhtml
> +++ b/wui/src/app/views/resources/show_vms.rhtml
> @@ -34,6 +34,9 @@
> if (data.alert) {
> alert(data.alert);
> }
> + if (vms.indexOf($('#vms_selection_id').html()) != -1){
> + empty_summary('vms_selection', 'Virtual Machine')
> + }
> }, 'json');
> }
> }
> diff --git a/wui/src/app/views/storage/show.rhtml
b/wui/src/app/views/storage/show.rhtml
> index fadf5d6..c64c4d7 100644
> --- a/wui/src/app/views/storage/show.rhtml
> +++ b/wui/src/app/views/storage/show.rhtml
> @@ -16,6 +16,7 @@
> <%- end -%>
> <%- end -%>
>
> + <div id="storage_selection_id"
style="display:none"><%= @storage_pool.id %></div>
> <div class="selection_key">
> IP address: </br>
> <% if @storage_pool[:type] == "IscsiStoragePool"
%>
> @@ -92,11 +93,11 @@
> if(confirm("Are you sure?")){
> $.post('<%= url_for :controller => "storage",
:action => "destroy", :id => @storage_pool %>',
> function(data,status){
> - storage_detail_empty()
> $("#storage_grid").flexReload()
> if (data.alert) {
> alert(data.alert);
> }
> + empty_summary('storage_selection', 'Storage
Pool')
> }, 'json');
> }
> }
> diff --git a/wui/src/app/views/vm/show.rhtml
b/wui/src/app/views/vm/show.rhtml
> index 7598944..9cb12a1 100644
> --- a/wui/src/app/views/vm/show.rhtml
> +++ b/wui/src/app/views/vm/show.rhtml
> @@ -43,11 +43,11 @@
> $.post('<%= url_for :controller => "vm", :action
=> "destroy", :id => @vm %>',
> {x: 1},
> function(data,status){
> - //storage_detail_empty()
> $("#vms_grid").flexReload()
> if (data.alert) {
> alert(data.alert);
> }
> + empty_summary('vms_selection', 'Virtual Machine')
> }, 'json');
> }
> }
> @@ -68,6 +68,7 @@
> }
> </script>
>
> + <div id="vms_selection_id"
style="display:none"><%= @vm.id %></div>
> <div class="selection_key">
> Uuid:<br/>
> Num vcpus allocated:<br/>
> diff --git a/wui/src/public/javascripts/ovirt.js
b/wui/src/public/javascripts/ovirt.js
> index 44d9154..8c94887 100644
> --- a/wui/src/public/javascripts/ovirt.js
> +++ b/wui/src/public/javascripts/ovirt.js
> @@ -103,6 +103,10 @@ function afterHwPool(response, status){
> if (response.resource_type) {
> $('#' + response.resource_type +
'_grid').flexReload()
> }
> +
> + if ((response.resource_type == 'hosts' ?
get_selected_hosts() :
get_selected_storage()).indexOf($('#'+response.resource_type+'_selection_id').html())
!= -1){
> + empty_summary(response.resource_type +'_selection',
(response.resource_type == 'hosts' ? 'Host' : 'Storage
Pool'))
> + }
> // do we have HW pools grid?
> //$("#vmpools_grid").flexReload()
> }
> @@ -161,12 +165,11 @@ function refresh_summary(element_id, url, obj_id){
> $('#'+element_id+'').load(url, { id: obj_id})
> }
> function refresh_summary_static(element_id, content){
> - $('#'+element_id+'').innerHTML = content
> + $('#'+element_id+'').html(content)
> }
> -
> -function storage_detail_empty(){
> - refresh_summary_static('storage_selection', '<div
class="selection_left"> \
> - <div>Select a storage volume.</div> \
> +function empty_summary(element_id, label){
> + refresh_summary_static(element_id, '<div
class="selection_left"> \
> + <div>Select a '+label+' above.</div> \
> </div>')
> }
>
> --
> 1.5.4.1
>
ACK
I have committed this.
--Hugh