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 9f6e063727..f57cf89e02 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 @@ -25,6 +25,7 @@ define(function(require) { var OpenNebulaTemplate = require("opennebula/template"); var Sunstone = require("sunstone"); var TemplateUtils = require("utils/template-utils"); + var Tips = require("utils/tips"); var WizardFields = require("utils/wizard-fields"); /* @@ -149,7 +150,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 61eb98c892..9f795b5e7c 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -135,7 +135,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" : { @@ -146,41 +148,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" : { @@ -384,8 +386,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 a8198b68ba..e4e07fb019 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js @@ -107,6 +107,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 7fa439c1bd..5e06cb8654 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/network.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/network.js @@ -521,6 +521,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 e3bd6ae4b9..64d9c8d56b 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/storage.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/storage.js @@ -476,6 +476,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 18bab24f13..4ee5ed3ab6 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 @@ -138,7 +138,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 }