diff --git a/src/sunstone/public/app/tabs/images-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/images-tab/form-panels/create-common.js index 101ac1fd2e..f03ca4c453 100644 --- a/src/sunstone/public/app/tabs/images-tab/form-panels/create-common.js +++ b/src/sunstone/public/app/tabs/images-tab/form-panels/create-common.js @@ -20,13 +20,14 @@ define(function(require) { */ var BaseFormPanel = require("utils/form-panels/form-panel"); - var Sunstone = require("sunstone"); - var OpenNebulaError = require("opennebula/error"); - var Notifier = require("utils/notifier"); - var Locale = require("utils/locale"); - var WizardFields = require("utils/wizard-fields"); - var TemplateTabsHTML = require("hbs!./create/tabs"); var CustomTagsTable = require("utils/custom-tags-table"); + var Locale = require("utils/locale"); + var Notifier = require("utils/notifier"); + var OpenNebulaError = require("opennebula/error"); + var Sunstone = require("sunstone"); + var TemplateTabsHTML = require("hbs!./create/tabs"); + var Tips = require("utils/tips"); + var WizardFields = require("utils/wizard-fields"); /* CONSTANTS @@ -209,7 +210,7 @@ define(function(require) { } }); Foundation.reflow(context, "tabs"); - Foundation.reflow(context, "tooltip"); + Tips.setup(context); } function _submitWizard(that, context) { diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js index 8283853034..c2ef26da04 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js @@ -22,6 +22,7 @@ define(function(require) { var Sunstone = require("sunstone"); var Locale = require("utils/locale"); var TemplateUtils = require("utils/template-utils"); + var Tips = require("utils/tips"); var WizardFields = require("utils/wizard-fields"); var OpenNebulaAction = require("opennebula/action"); var OpenNebulaTemplate = require("opennebula/template"); @@ -148,7 +149,7 @@ define(function(require) { }); Foundation.reflow(context, "tabs"); - Foundation.reflow(context, "tooltip"); + Tips.setup(context); } function _onShow(context) { diff --git a/src/sunstone/public/app/tabs/vms-tab/actions.js b/src/sunstone/public/app/tabs/vms-tab/actions.js index df9b46175a..e50362e9c6 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -142,7 +142,9 @@ define(function(require) { "VM.deploy" : { type: "custom", call: function() { - Sunstone.getDialog(DEPLOY_DIALOG_ID).show(); + Sunstone.getDialog(DEPLOY_DIALOG_ID) + .reset() + .show(); } }, "VM.silent_deploy_action" : { @@ -153,41 +155,41 @@ define(function(require) { "VM.migrate" : { type: "custom", call: function() { - var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); - dialog.reset(); - dialog.setLive(false); - dialog.setType(0); - dialog.show(); + Sunstone.getDialog(MIGRATE_DIALOG_ID) + .reset() + .setLive(false) + .setType(0) + .show(); } }, "VM.migrate_poff" : { type: "custom", call: function() { - var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); - dialog.reset(); - dialog.setLive(false); - dialog.setType(1); - dialog.show(); + Sunstone.getDialog(MIGRATE_DIALOG_ID) + .reset() + .setLive(false) + .setType(1) + .show(); } }, "VM.migrate_poff_hard" : { type: "custom", call: function() { - var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); - dialog.reset(); - dialog.setLive(false); - dialog.setType(2); - dialog.show(); + Sunstone.getDialog(MIGRATE_DIALOG_ID) + .reset() + .setLive(false) + .setType(2) + .show(); } }, "VM.migrate_live" : { type: "custom", call: function() { - var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); - dialog.reset(); - dialog.setLive(true); - dialog.setType(0); - dialog.show(); + Sunstone.getDialog(MIGRATE_DIALOG_ID) + .reset() + .setLive(true) + .setType(0) + .show(); } }, "VM.save_rdp" : { @@ -388,8 +390,9 @@ define(function(require) { "VM.save_as_template" : { type: "single", call: function() { - var dialog = Sunstone.getDialog(SAVE_AS_TEMPLATE_DIALOG_ID); - dialog.show(); + Sunstone.getDialog(SAVE_AS_TEMPLATE_DIALOG_ID) + .reset() + .show(); }, error: function(req, resp) { Notifier.onError(req, resp); diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js b/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js index c12727d76b..37acc03997 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js @@ -110,6 +110,7 @@ define(function(require) { context.off("click", "#resize_capacity"); context.on("click", "#resize_capacity", function() { var dialog = Sunstone.getDialog(RESIZE_DIALOG_ID); + dialog.reset(); dialog.setElement(that.element); dialog.show(); dialogContext = dialog.dialogElement; diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/network.js b/src/sunstone/public/app/tabs/vms-tab/panels/network.js index 82230d8236..765d645622 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/network.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/network.js @@ -522,6 +522,7 @@ define(function(require) { context.off("click", "#attach_nic"); context.on("click", "#attach_nic", function() { var dialog = Sunstone.getDialog(ATTACH_NIC_DIALOG_ID); + dialog.reset(); dialog.setElement(that.element); dialog.setNicsNames(nics_names); dialog.show(); diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js b/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js index d65004af32..af69828b80 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/snapshots.js @@ -162,6 +162,7 @@ define(function(require) { context.off('click', '#take_snapshot'); context.on('click', '#take_snapshot', function() { var dialog = Sunstone.getDialog(SNAPSHOT_DIALOG_ID); + dialog.reset(); dialog.setElement(that.element); dialog.show(); return false; @@ -173,6 +174,7 @@ define(function(require) { context.on('click', '.snapshot_revert', function() { var dialog = Sunstone.getDialog(REVERT_DIALOG_ID); that.element.snapshot_id = $(this).parents('tr').attr('snapshot_id'); + dialog.reset(); dialog.setElement(that.element); dialog.show(); return false; diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js index 1833e9cef9..4bb64cedb5 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js @@ -479,6 +479,7 @@ define(function(require) { $('.hypervisor.only_kvm').hide(); $('.hypervisor.only_vcenter').show(); } + dialog.reset(); dialog.show(); return false; }); diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index 844eb74253..f05a5b6a71 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -131,7 +131,7 @@ define(function(require) { } } }) - $(".describeCharter").on("mouseleave").on("mouseleave", function(e){ + $(".describeCharter").off("mouseleave").on("mouseleave", function(e){ $(this).find("."+classInfo).remove(); }); } diff --git a/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js b/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js index c5a7182129..a591a73b03 100644 --- a/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vrouters-tab/panels/info.js @@ -126,6 +126,7 @@ define(function(require) { context.off('click', '.attach_nic'); context.on('click', '.attach_nic', function() { var dialog = Sunstone.getDialog(ATTACH_NIC_DIALOG_ID); + dialog.reset(); dialog.setElement(that.element); dialog.show(); return false; diff --git a/src/sunstone/public/app/utils/dialogs/dialog.js b/src/sunstone/public/app/utils/dialogs/dialog.js index 5fad753c70..a127b1666f 100644 --- a/src/sunstone/public/app/utils/dialogs/dialog.js +++ b/src/sunstone/public/app/utils/dialogs/dialog.js @@ -76,6 +76,7 @@ define(function(require) { } function _reset() { + $('.reveal-overlay').remove(); this.dialogElement.remove(); this.dialogElement = this.insert(); return false; diff --git a/src/sunstone/public/app/utils/graphs.js b/src/sunstone/public/app/utils/graphs.js index b0d00913b4..153df27d5b 100644 --- a/src/sunstone/public/app/utils/graphs.js +++ b/src/sunstone/public/app/utils/graphs.js @@ -24,7 +24,15 @@ define(function(require) { require('flot.resize'); // TODO Check if necessary require('flot.tooltip'); require('flot.time'); + var Humanize = require('utils/humanize'); + + /* + VARIABLES + */ + + var currentGraph = undefined; + /* CONSTRUCTOR */ @@ -120,7 +128,10 @@ define(function(require) { //options.xaxis.zoomRange = false; options.yaxis.panRange = false; if (series.length > 0) { - $.plot(info.div_graph, series, options); + currentGraph && currentGraph.shutdown(); + info.div_graph.removeData('plot').empty(); + + currentGraph = $.plot(info.div_graph, series, options); }; } diff --git a/src/sunstone/public/app/utils/tips.js b/src/sunstone/public/app/utils/tips.js index 3d4381eb11..616db6f00e 100644 --- a/src/sunstone/public/app/utils/tips.js +++ b/src/sunstone/public/app/utils/tips.js @@ -23,6 +23,8 @@ define(function(require) { context = $(document); } + $('.tooltip').remove(); + //For each tip in this context $('.tip', context).each(function() { var obj = $(this); diff --git a/src/sunstone/public/app/utils/websocket.js b/src/sunstone/public/app/utils/websocket.js index b814270a8e..2c9f1a4c1a 100644 --- a/src/sunstone/public/app/utils/websocket.js +++ b/src/sunstone/public/app/utils/websocket.js @@ -100,9 +100,10 @@ define(function (require) { var response = {}; response[object] = event_data.HOOK_MESSAGE[object]; + var request = { "request": { - "data": [response.ID], + "data": [response[object].ID], "method": "show", "resource": object }