From 923eb300e5d763011e48ccbfa043ba7126e0a8b9 Mon Sep 17 00:00:00 2001 From: perploug Date: Tue, 4 Mar 2014 19:11:27 +0100 Subject: [PATCH] Updates grunt file to run vs file copy --- .../Install/InstallHelperTests.cs | 14 +- src/Umbraco.Web.UI.Client/gruntFile.js | 18 +-- .../src/installer/installer.controller.js | 6 +- .../src/installer/installer.html | 4 +- .../src/installer/installer.service.js | 118 ++++++++++---- .../src/installer/steps/database.html | 151 +++++++++++------- .../src/installer/steps/error.html | 7 + .../src/installer/steps/starterkit.html | 12 +- .../src/installer/steps/upgrade.html | 15 +- .../src/less/installer.less | 47 ++++-- .../UmbracoInstall/Views/Install/Index.cshtml | 19 ++- .../config/ClientDependency.config | 2 +- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 21 +-- .../Controllers/InstallApiController.cs | 12 +- 14 files changed, 289 insertions(+), 157 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/installer/steps/error.html diff --git a/src/Umbraco.Tests/Install/InstallHelperTests.cs b/src/Umbraco.Tests/Install/InstallHelperTests.cs index 4c68a3df4a..1338df0239 100644 --- a/src/Umbraco.Tests/Install/InstallHelperTests.cs +++ b/src/Umbraco.Tests/Install/InstallHelperTests.cs @@ -34,9 +34,9 @@ namespace Umbraco.Tests.Install appCtx, true); - var helper = new InstallHelper(umbCtx, InstallStatusType.NewInstall); + var helper = new InstallHelper(umbCtx); - var steps = helper.GetSteps().ToArray(); + var steps = helper.GetAllSteps().ToArray(); var expected = new[] { @@ -65,9 +65,9 @@ namespace Umbraco.Tests.Install appCtx, true); - var helper = new InstallHelper(umbCtx, InstallStatusType.NewInstall); + var helper = new InstallHelper(umbCtx); - var steps = helper.GetSteps().ToArray(); + var steps = helper.GetAllSteps().ToArray(); //for new installs 2, don't require execution Assert.AreEqual(2, steps.Count(x => x.RequiresExecution() == false)); @@ -86,9 +86,9 @@ namespace Umbraco.Tests.Install appCtx, true); - var helper = new InstallHelper(umbCtx, InstallStatusType.Upgrade); - - var steps = helper.GetSteps().ToArray(); + var helper = new InstallHelper(umbCtx); + + var steps = helper.GetAllSteps().ToArray(); //for upgrades 4, don't require execution Assert.AreEqual(4, steps.Count(x => x.RequiresExecution() == false)); diff --git a/src/Umbraco.Web.UI.Client/gruntFile.js b/src/Umbraco.Web.UI.Client/gruntFile.js index 44b59d29d1..7ae0a96841 100644 --- a/src/Umbraco.Web.UI.Client/gruntFile.js +++ b/src/Umbraco.Web.UI.Client/gruntFile.js @@ -3,18 +3,18 @@ module.exports = function (grunt) { // Default task. grunt.registerTask('default', ['jshint:dev','build','karma:unit']); grunt.registerTask('dev', ['jshint:dev', 'build', 'webserver', 'open:dev', 'watch']); - + //run by the watch task grunt.registerTask('watch-js', ['jshint:dev','concat','copy:app','copy:mocks','copy:packages','copy:vs','karma:unit']); grunt.registerTask('watch-less', ['recess:build','recess:installer','copy:assets','copy:vs']); grunt.registerTask('watch-html', ['copy:views', 'copy:vs']); grunt.registerTask('watch-packages', ['copy:packages']); - grunt.registerTask('watch-installer', ['concat:install','concat:installJs','copy:installer']); + grunt.registerTask('watch-installer', ['concat:install','concat:installJs','copy:installer', 'copy:vs']); grunt.registerTask('watch-test', ['jshint:dev', 'karma:unit']); //triggered from grunt dev or grunt grunt.registerTask('build', ['clean','concat','recess:min','recess:installer','copy']); - + //utillity tasks grunt.registerTask('docs', ['ngdocs']); grunt.registerTask('webserver', ['connect:devserver']); @@ -220,7 +220,7 @@ module.exports = function (grunt) { } } }, - + recess: { build: { files: { @@ -321,7 +321,7 @@ module.exports = function (grunt) { //NOTE: we ignore tabs vs spaces because enforcing that causes lots of errors depending on the text editor being used smarttabs: true, globals:{} - } + } }, build:{ files:['<%= src.prod %>'], @@ -345,13 +345,13 @@ module.exports = function (grunt) { smarttabs: true, globalstrict:true, globals:{$:false, jQuery:false,define:false,require:false,window:false} - } + } } } }); - - + + grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-clean'); @@ -361,7 +361,7 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-recess'); grunt.loadNpmTasks('grunt-karma'); - + grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-contrib-connect'); diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js b/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js index b2e4c4f595..043e8d5152 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js @@ -16,4 +16,8 @@ angular.module("umbraco.install").controller("Umbraco.InstallerController", $scope.install = function(){ installerService.install(); }; -}); \ No newline at end of file + + $scope.gotoStep = function(step){ + installerService.gotoNamedStep(step); + }; +}); diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.html b/src/Umbraco.Web.UI.Client/src/installer/installer.html index 1d421db01e..17a9abf84e 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.html +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.html @@ -13,7 +13,7 @@ -
+
@@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js index 8f4c702d83..32215747c8 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js @@ -1,5 +1,5 @@ angular.module("umbraco.install").factory('installerService', function($q, $timeout, $http, $location){ - + var _status = { index: 0, current: undefined, @@ -13,10 +13,10 @@ angular.module("umbraco.install").factory('installerService', function($q, $time instructions: { DatabaseConfigure: { dbType: 0 }, StarterKitDownload: Umbraco.Sys.ServerVariables.defaultStarterKit - } + } }; - /* + /* Returns the description for the step at a given index based on the order of the serverOrder of steps Since they don't execute on the server in the order that they are displayed in the UI. */ @@ -28,10 +28,22 @@ angular.module("umbraco.install").factory('installerService', function($q, $time return null; } + function resolveView(view){ + + if(view.indexOf(".html") < 0){ + view = view + ".html"; + } + if(view.indexOf("/") < 0){ + view = "views/install/" + view; + } + + return view; + } + var service = { status : _status, - + getPackages : function(){ return $http.get(Umbraco.Sys.ServerVariables.installApiBaseUrl + "GetPackages"); }, @@ -48,10 +60,10 @@ angular.module("umbraco.install").factory('installerService', function($q, $time service.status.index = 0; _installerModel.installId = response.data.installId; service.findNextStep(); - + $timeout(function(){ service.status.loading = false; - service.status.installing = true; + service.status.configuring = true; }, 2000); }); } @@ -59,21 +71,35 @@ angular.module("umbraco.install").factory('installerService', function($q, $time gotoStep : function(index){ var step = service.status.steps[index]; - if(step.view.indexOf(".html") < 0){ - step.view = step.view + ".html"; - } - if(step.view.indexOf("/") < 0){ - step.view = "views/install/" + step.view; - } + step.view = resolveView(step.view); + if(!step.model){ step.model = {}; } + service.status.index = index; service.status.current = step; + service.retrieveCurrentStep(); + }, + + gotoNamedStep : function(step){ + var step = _.find(service.status.steps, function(s, index){ + if(s.view && s.name === step){ + service.status.index = index; + return true; + } + }); + + step.view = resolveView(step.view); + if(!step.model){ + step.model = {}; + } + service.retrieveCurrentStep(); + service.status.current = step; }, findNextStep : function(){ - var step = _.find(service.status.steps, function(s, index){ + var step = _.find(service.status.steps, function(s, index){ if(s.view && index >= service.status.index){ service.status.index = index; return true; @@ -93,12 +119,19 @@ angular.module("umbraco.install").factory('installerService', function($q, $time } service.status.current = step; - }, + service.retrieveCurrentStep(); + }, storeCurrentStep : function(){ _installerModel.instructions[service.status.current.name] = service.status.current.model; }, + retrieveCurrentStep : function(){ + if(_installerModel.instructions[service.status.current.name]){ + service.status.current.model = _installerModel.instructions[service.status.current.name]; + } + }, + forward : function(){ service.storeCurrentStep(); service.status.index++; @@ -111,40 +144,69 @@ angular.module("umbraco.install").factory('installerService', function($q, $time }, install : function(){ - service.storeCurrentStep(); - service.status.current = undefined; - service.status.feedback = []; - service.status.loading = true; - var feedback = 0; + service.storeCurrentStep(); + service.switchToFeedback(); service.status.feedback = getDescriptionForStepAtIndex(service.status.steps, 0); function processInstallStep(){ - $http.post(Umbraco.Sys.ServerVariables.installApiBaseUrl + "PostPerformInstall", + $http.post(Umbraco.Sys.ServerVariables.installApiBaseUrl + "PostPerformInstall", _installerModel).then(function(response){ if(!response.data.complete){ feedback++; - var desc = getDescriptionForStepAtIndex(service.status.steps, feedback); - if (desc) { - service.status.feedback = desc; - } + if(response.data.view){ - processInstallStep(); + //set the current view and model to whatever the process returns, the view is responsible for retriggering install(); + var v = resolveView(response.data.view); + service.status.current = {view: v, model: response.data.model}; + + //turn off loading bar and feedback + service.switchToConfiguration(); + }else{ + var desc = getDescriptionForStepAtIndex(service.status.steps, feedback); + if (desc) { + service.status.feedback = desc; + } + + processInstallStep(); + } }else{ service.status.done = true; - service.status.feedback = undefined; + service.status.feedback = "Redirecting you to Umbraco, please wait"; service.status.loading = false; service.complete(); } + }, function(err){ + //this is where we handle installer error + var v = err.data.view ? resolveView(err.data.view) : resolveView("error"); + var model = err.data.model ? err.data.model : err.data; + + service.status.current = {view: v, model: model}; + service.switchToConfiguration(); }); } processInstallStep(); }, + + switchToFeedback : function(){ + service.status.current = undefined; + service.status.loading = true; + service.status.configuring = false; + }, + + switchToConfiguration : function(){ + service.status.loading = false; + service.status.configuring = true; + service.status.feedback = undefined; + }, + complete : function(){ - window.location.href = Umbraco.Sys.ServerVariables.umbracoBaseUrl; + $timeout(function(){ + window.location.href = Umbraco.Sys.ServerVariables.umbracoBaseUrl; + }, 1500); } }; return service; -}); \ No newline at end of file +}); diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/database.html b/src/Umbraco.Web.UI.Client/src/installer/steps/database.html index fff2c33d1d..1035d32d8b 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/database.html +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/database.html @@ -1,16 +1,18 @@
- +

Configure your database

- Enter connection and authentication details for the database you want to install umbraco on + Enter connection and authentication details for the database you want to install Umbraco on

- + +
+ What type of database do you use?
- @@ -23,75 +25,100 @@
-
- -
- - - Enter a valid database connection string. +
+

Great!, no need to configure anything then, you simply click the continue button below to continue to the next step

+
+ + + +
+ + What is the exact connectionstring we should use? +
+ +
+ + + Enter a valid database connection string. +
-
- -
-
- -
- - Enter the domain or IP your database server is located +
+
+ Where do we find your database? +
+
+ +
+ + Enter server domain or IP +
+
+
+ +
+
+ +
+ + Enter the name of the database +
+
-
- -
- - Enter the name of the database -
-
-
-
-
- -
- - Enter the database user name -
-
+
+ What credentials are used to access the database? +
+
+ +
+ + Enter the database user name +
+
+
-
- -
- - Enter the database password -
-
+
+
+ +
+ + Enter the database password +
+
+
-
- -
- -
+
+
+ +
+
+
+
+ + +
+
+
+
- -
-
- -
-
+ + -
\ No newline at end of file +
diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/error.html b/src/Umbraco.Web.UI.Client/src/installer/steps/error.html new file mode 100644 index 0000000000..5c4dabf96e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/error.html @@ -0,0 +1,7 @@ +
+

Error during installation

+ +

{{installer.current.model.message}}

+ + +
diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/starterkit.html b/src/Umbraco.Web.UI.Client/src/installer/steps/starterkit.html index 62dd4518d6..4183df869d 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/starterkit.html +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/starterkit.html @@ -1,8 +1,9 @@

Install a starter website

+

- Installing a starter website helps you learn how Umbraco works, and gives you a solid - a simple foundation to build ontop of. + Installing a starter website helps you learn how Umbraco works, and gives you a solid + and simple foundation to build on top of.

    @@ -10,8 +11,9 @@ {{package.name}} - +
- No thanks, I do not want to install a starter website -
\ No newline at end of file + + No thanks, I do not want to install a starter website +
diff --git a/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html b/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html index 8cbff93233..ebbcd1d641 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html +++ b/src/Umbraco.Web.UI.Client/src/installer/steps/upgrade.html @@ -1,3 +1,14 @@ 
- Start upgrade! -
\ No newline at end of file +

Upgrading Umbraco

+

+ Welcome to the Umbraco installer. You see this screen because your Umbraco installation needs a quick upgrade of its database and files, + it is completely harmless and will simply ensure your website is kept as fast, secure and uptodate as possible. +

+

+ Simply click continue below to be guided through the rest of the upgrade

+

+ +

+ +

+
diff --git a/src/Umbraco.Web.UI.Client/src/less/installer.less b/src/Umbraco.Web.UI.Client/src/less/installer.less index 952649076c..e589315d49 100644 --- a/src/Umbraco.Web.UI.Client/src/less/installer.less +++ b/src/Umbraco.Web.UI.Client/src/less/installer.less @@ -19,8 +19,8 @@ } -html { - background: url('../img/installer.jpg') no-repeat center center fixed; +html { + background: url('../img/installer.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; @@ -32,7 +32,7 @@ body { padding: 0; height: 100%; width: 100%; - + font-family: @baseFontFamily; font-size: @baseFontSize; line-height: @baseLineHeight; @@ -53,15 +53,13 @@ body { #installer{ margin: auto; background: white; - min-height: 400px; - min-width: 500px; - max-width: 700px; - - height: 500px; - - padding: 40px; + width: 750px; + height: 550px; + text-align: left; + padding: 30px; } + #overlay{ position: absolute; top: 0; @@ -72,6 +70,28 @@ body { z-index: 666; } +#feedback{ + color: #fff; + text-shadow: 0px 0px 4px black; + font-size: 40px; + text-align: center; + width: 750px; + height: 150px; + line-height: 60px; + z-index: 667; +} + + +h1{ + border-bottom: 1px solid @grayLighter; + padding-bottom: 10px; + color: @gray; +} + +.error h1, .error .message{ color: @red;} + +legend{font-size: 14px; font-weight: bold} + input.ng-dirty.ng-invalid{border-color: #b94a48; color: #b94a48;} .disabled{ @@ -136,7 +156,7 @@ animation-duration:1s; animation-iteration-count:infinite; animation-timing-function:linear; width:100%; -height:1px; +height: 5px; } @@ -194,10 +214,11 @@ height:1px; } //loader defaults -.umb-loader{ +.umb-loader-container{ height: 5px; position: absolute; bottom: 0; left: 0; right: 0; -} \ No newline at end of file + overflow: hidden; +} diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml index 307d0316dc..8d5f89d6e0 100644 --- a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml @@ -13,23 +13,26 @@ Install Umbraco - + - @*
*@ +
+
+
-
+
+ ng-cloak + ng-animate="'fade'" + ng-show="installer.configuring">
-

{{installer.feedback}}...

+

{{installer.feedback}}

+ - \ No newline at end of file + diff --git a/src/Umbraco.Web.UI/config/ClientDependency.config b/src/Umbraco.Web.UI/config/ClientDependency.config index 02486b0ff6..585ff05a10 100644 --- a/src/Umbraco.Web.UI/config/ClientDependency.config +++ b/src/Umbraco.Web.UI/config/ClientDependency.config @@ -10,7 +10,7 @@ NOTES: * Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config * A new version will invalidate both client and server cache and create new persisted files --> - +