From 7eb51d65d09432f5f82b4e6d2889f82cb28c1f52 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 11 Nov 2011 10:28:58 -0800 Subject: [PATCH] Add base install wizard scripts --- ui/index-test.html | 2 ++ ui/index.jsp | 2 ++ ui/scripts-test/installWizard.js | 12 ++++++++ ui/scripts/ui-custom/installWizard.js | 43 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 ui/scripts-test/installWizard.js create mode 100644 ui/scripts/ui-custom/installWizard.js diff --git a/ui/index-test.html b/ui/index-test.html index 15778a16d02..1d949ddb096 100644 --- a/ui/index-test.html +++ b/ui/index-test.html @@ -1391,6 +1391,8 @@ + + diff --git a/ui/index.jsp b/ui/index.jsp index 71609e20a52..3faefea0c6f 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1399,6 +1399,8 @@ + + diff --git a/ui/scripts-test/installWizard.js b/ui/scripts-test/installWizard.js new file mode 100644 index 00000000000..6612c2ca2fd --- /dev/null +++ b/ui/scripts-test/installWizard.js @@ -0,0 +1,12 @@ +(function($, cloudStack, testData) { + cloudStack.installWizard = { + // Check if install wizard should be invoked + check: function(args) { + setTimeout(function() { + args.response.success({ + doInstall: false + }); + }, 100); + } + }; +}(jQuery, cloudStack, testData)); \ No newline at end of file diff --git a/ui/scripts/ui-custom/installWizard.js b/ui/scripts/ui-custom/installWizard.js new file mode 100644 index 00000000000..51acf183a07 --- /dev/null +++ b/ui/scripts/ui-custom/installWizard.js @@ -0,0 +1,43 @@ +(function($, cloudStack, testData) { + cloudStack.uiCustom.installWizard = function(args) { + var context = args.context; + var $installWizard = $('
').addClass('install-wizard'); + var $container = args.$container; + + var elems = { + nextButton: function() { + return $('
').addClass('button next').html('Next'); + } + }; + + // Layout/behavior for each step in wizard + var steps = { + // Welcome screen + welcome: function(args) { + return $.merge( + $('

').html('Welcome screen'), + $('

').html('Welcome text goes here.'), + $('

').addClass('button next').html('Next'), + elems.nextButton().click(args.nextStep) + ); + }, + + addZone: function(args) { + var $zoneWizard = $('#template').find('.multi-wizard.zone-wizard').clone(); + + return $.merge( + $zoneWizard.find('.steps .setup-zone'), + elems.nextButton().click(function() { + args.nextStep({ + data: { + zone: cloudStack.serializeForm + } + }); + }) + ); + } + }; + + $installWizard.append(steps.addZone).appendTo($container); + }; +}(jQuery, cloudStack, testData)); \ No newline at end of file