From 595cd11a8aa77c9ad7cfeb9b43eb9125dc45b461 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 12 Mar 2014 19:04:59 +0100 Subject: [PATCH] feature #2746: Fix datastore show info --- .../public/js/plugins/datastores-tab.js | 64 +++++++------------ 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 7d417d9fa1..d96e065baf 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -313,7 +313,12 @@ var datastore_actions = { "Datastore.show" : { type: "single", call: OpenNebula.Datastore.show, - callback: updateDatastoreElement, + callback: function(request, response) { + updateDatastoreElement(request, response); + if (Sunstone.rightInfoVisible($("#datastores-tab"))) { + updateDatastoreInfo(request, response); + } + }, error: onError }, @@ -353,8 +358,7 @@ var datastore_actions = { type: "single", call: OpenNebula.Datastore.update, callback: function(request) { - notifyMessage("Template updated correctly"); - Sunstone.runAction('Datastore.showinfo',request.request.data[0][0]); + Sunstone.runAction('Datastore.show',request.request.data[0][0]); }, error: onError }, @@ -363,7 +367,7 @@ var datastore_actions = { type: "single", call: OpenNebula.Datastore.update, callback: function() { - notifyMessage(tr("Datastore updated correctly")); + Sunstone.runAction('Datastore.show',request.request.data[0][0]); }, error: onError }, @@ -388,30 +392,29 @@ var datastore_actions = { type: "multiple", call: OpenNebula.Datastore.chown, callback: function (req) { - Sunstone.runAction("Datastore.show",req.request.data[0][0][0]); + Sunstone.runAction("Datastore.show",req.request.data[0][0]); }, elements: datastoreElements, - error: onError, - notify: true + error: onError }, "Datastore.chgrp" : { type: "multiple", call: OpenNebula.Datastore.chgrp, callback: function (req) { - // Sunstone.runAction("Datastore.show",req.request.data[0][0][0]); - setInterval(Sunstone.runAction("Datastore.show",req.request.data[0][0][0]),1000); + Sunstone.runAction("Datastore.show",req.request.data[0][0]); }, elements: datastoreElements, - error: onError, - notify: true + error: onError }, "Datastore.chmod" : { type: "single", call: OpenNebula.Datastore.chmod, - error: onError, - notify: true + callback: function (req) { + Sunstone.runAction("Datastore.show",req.request.data[0]); + }, + error: onError }, "Datastore.addtocluster" : { @@ -438,28 +441,18 @@ var datastore_actions = { { Sunstone.runAction("Cluster.adddatastore",cluster,ds); } - Sunstone.runAction("Datastore.show",ds); - Sunstone.runAction("Datastore.showinfo",ds); }, - elements: datastoreElements, - notify:true - }, - - "Datastore.help" : { - type: "custom", - call: function() { - hideDialog(); - $('div#datastores_tab div.legend_div').slideToggle(); - } + callback: function (req) { + Sunstone.runAction("Datastore.show",req.request.data[0][0]); + }, + elements: datastoreElements }, "Datastore.rename" : { type: "single", call: OpenNebula.Datastore.rename, callback: function(request) { - notifyMessage(tr("Datastore renamed correctly")); - Sunstone.runAction('Datastore.showinfo',request.request.data[0][0]); - Sunstone.runAction('Datastore.list'); + Sunstone.runAction('Datastore.show',request.request.data[0][0]); }, error: onError, notify: true @@ -533,7 +526,7 @@ var datastores_tab = { '+tr("Owner")+'\ '+tr("Group")+'\ '+tr("Name")+'\ - '+tr("Capacity")+'\ + '+tr("Capacity")+'\ '+tr("Cluster")+'\ '+tr("Basepath")+'\ '+tr("TM MAD")+'\ @@ -709,18 +702,9 @@ function updateDatastoreInfo(request,ds){ '+info.BASE_PATH+'\ \ \ - '+tr("Capacity")+'\\ \ - ' + tr("Total") + '\ - '+(is_system_ssh ? '-' : humanize_size_from_mb(info.TOTAL_MB))+'\ - \ - \ - ' + tr("Used") + '\ - '+(is_system_ssh ? '-' : humanize_size_from_mb(info.USED_MB))+'\ - \ - \ - ' + tr("Free") + '\ - '+(is_system_ssh ? '-' : humanize_size_from_mb(info.FREE_MB))+'\ + '+tr("Capacity")+'\ + ' + generate_datastore_capacity_bar(info, info.TYPE) + '\ \ \ ' + tr("Limit") + '\