diff --git a/ui/index-test.html b/ui/index-test.html index 4c88dff32c2..a6e664d3dbc 100644 --- a/ui/index-test.html +++ b/ui/index-test.html @@ -1403,6 +1403,8 @@ + + diff --git a/ui/index.jsp b/ui/index.jsp index 2b4e6b30b57..648fe9caca8 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1411,6 +1411,8 @@ + + diff --git a/ui/scripts-test/cloudStack.js b/ui/scripts-test/cloudStack.js index 7567393800c..83317536e8b 100644 --- a/ui/scripts-test/cloudStack.js +++ b/ui/scripts-test/cloudStack.js @@ -28,11 +28,11 @@ $(function() { var $container = $('#cloudStack3-container'); - + // Login cloudStack.uiCustom.login({ $container: $container, - + // Use this for checking the session, to bypass login screen bypassLoginCheck: function(args) { var disabledLogin = document.location.href.split('?')[1] == 'login=disabled'; @@ -66,13 +66,31 @@ return args.response.error(); }, - // Show cloudStack main UI widget complete: function(args) { - $container.cloudStack($.extend(cloudStack, { - context: { - users: [args.user] + var context = { + users: [args.user] + }; + var cloudStackArgs = $.extend(cloudStack, { + context: context + }); + + // Check to invoke install wizard + cloudStack.installWizard.check({ + context: context, + response: { + success: function(args) { + if (args.doInstall) { + cloudStack.uiCustom.installWizard({ + $container: $container, + context: context + }); + } else { + // Show cloudStack main UI + $container.cloudStack(cloudStackArgs); + } + } } - })); + }); } }); }); 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/cloudStack.js b/ui/scripts/cloudStack.js index 8b3e1f54916..5125503face 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -151,11 +151,30 @@ // Show cloudStack main UI widget complete: function(args) { - $container.cloudStack($.extend(cloudStack, { - context: { - users: [args.user] + var context = { + users: [args.user] + }; + var cloudStackArgs = $.extend(cloudStack, { + context: context + }); + + // Check to invoke install wizard + cloudStack.installWizard.check({ + context: context, + response: { + success: function(args) { + if (args.doInstall) { + cloudStack.uiCustom.installWizard({ + $container: $container, + context: context + }); + } else { + // Show cloudStack main UI + $container.cloudStack(cloudStackArgs); + } + } } - })); + }); } }); }); diff --git a/ui/scripts/installWizard.js b/ui/scripts/installWizard.js new file mode 100644 index 00000000000..e4f67524b7c --- /dev/null +++ b/ui/scripts/installWizard.js @@ -0,0 +1,17 @@ +(function($, cloudStack, testData) { + cloudStack.installWizard = { + // Check if install wizard should be invoked + check: function(args) { + $.ajax({ + url: createURL('listZones'), + dataType: 'json', + async: true, + success: function(data) { + args.response.success({ + doInstall: !(data.listzonesresponse.zone && data.listzonesresponse.zone.length) + }); + } + }); + } + }; +}(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 diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index 31d8f24daac..239f7dbbab8 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -441,8 +441,9 @@ var $filters = $('
').addClass('filters reduced-hide'); $filters.append(''); - var $filterSelect = $('').appendTo($filters); - + var $filterSelect = $('').appendTo($filters); + $filterSelect.append(''); // Always appears by default + if (filters) $.each(filters, function(key) { var $option = $('