From 9d49ddba7c9052120c8df51971e620cb4e9ccdea Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 15 Jun 2018 15:51:37 +1000 Subject: [PATCH] Fixes installer including some c# bits, fixes the hash bang to be back to normal --- .../Configuration/UmbracoVersion.cs | 2 +- .../src/install.loader.js | 13 ++- .../src/installer.app.js | 6 +- .../src/installer/installer.service.js | 93 ++++++++++--------- src/Umbraco.Web.UI.Client/src/routes.js | 3 +- .../template-editor-controller.spec.js | 23 +---- .../Umbraco/js/installer.app.js | 6 +- .../umbraco/Install/Views/Index.cshtml | 4 +- .../Install/InstallSteps/UpgradeStep.cs | 9 +- 9 files changed, 75 insertions(+), 84 deletions(-) diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index c331ab5e89..96418d4536 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -59,7 +59,7 @@ namespace Umbraco.Core.Configuration { // fixme - this should live in its own independent file! NOT web.config! var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"]; - return SemVersion.TryParse(value, out var semver) ? semver : null; + return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null; } catch { diff --git a/src/Umbraco.Web.UI.Client/src/install.loader.js b/src/Umbraco.Web.UI.Client/src/install.loader.js index 25b784798e..e6aa4c95c0 100644 --- a/src/Umbraco.Web.UI.Client/src/install.loader.js +++ b/src/Umbraco.Web.UI.Client/src/install.loader.js @@ -1,13 +1,12 @@ LazyLoad.js([ 'lib/jquery/jquery.min.js', - /* 1.1.5 */ - 'lib/angular/1.1.5/angular.min.js', - 'lib/angular/1.1.5/angular-cookies.min.js', - 'lib/angular/1.1.5/angular-mobile.min.js', - 'lib/angular/1.1.5/angular-mocks.js', - 'lib/angular/1.1.5/angular-sanitize.min.js', + + 'lib/angular/angular.js', + 'lib/angular-cookies/angular-cookies.js', + 'lib/angular-touch/angular-touch.js', + 'lib/angular-sanitize/angular-sanitize.js', 'lib/underscore/underscore-min.js', - 'lib/angular-ui-sortable/sortable.js', + 'lib/angular-ui-sortable/sortable.js', 'js/installer.app.js', 'js/umbraco.directives.js', 'js/umbraco.installer.js' diff --git a/src/Umbraco.Web.UI.Client/src/installer.app.js b/src/Umbraco.Web.UI.Client/src/installer.app.js index 05315493b7..b7a2cfa989 100644 --- a/src/Umbraco.Web.UI.Client/src/installer.app.js +++ b/src/Umbraco.Web.UI.Client/src/installer.app.js @@ -2,6 +2,6 @@ var app = angular.module('umbraco', [ 'umbraco.directives', 'umbraco.install', 'ngCookies', - 'ngMobile', - 'ngSanitize' -]); \ No newline at end of file + 'ngSanitize', + 'ngTouch' +]); 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 efbb13fad4..661dfdbb4d 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.service.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.service.js @@ -233,56 +233,59 @@ angular.module("umbraco.install").factory('installerService', function($rootScop function processInstallStep() { - $http.post(Umbraco.Sys.ServerVariables.installApiBaseUrl + "PostPerformInstall", _installerModel) - .success(function(data, status, headers, config) { - if (!data.complete) { + $http.post(Umbraco.Sys.ServerVariables.installApiBaseUrl + "PostPerformInstall", _installerModel) + .then(function (response) { + var data = response.data; + if (!data.complete) { - //progress feedback - service.status.progress = calculateProgress(service.status.steps, data.nextStep); + //progress feedback + service.status.progress = calculateProgress(service.status.steps, data.nextStep); - if (data.view) { - //set the current view and model to whatever the process returns, the view is responsible for retriggering install(); - var v = resolveView(data.view); - service.status.current = { view: v, model: data.model }; + if (data.view) { + //set the current view and model to whatever the process returns, the view is responsible for retriggering install(); + var v = resolveView(data.view); + service.status.current = { view: v, model: data.model }; - //turn off loading bar and feedback - service.switchToConfiguration(); - } - else { - var desc = getDescriptionForStepName(service.status.steps, data.nextStep); - if (desc) { - service.status.feedback = desc; - } - processInstallStep(); - } - } - else { - service.complete(); - } - }).error(function(data, status, headers, config) { - //need to handle 500's separately, this will happen if something goes wrong outside - // of the installer (like app startup events or something) and these will get returned as text/html - // not as json. If this happens we can't actually load in external views since they will YSOD as well! + //turn off loading bar and feedback + service.switchToConfiguration(); + } + else { + var desc = getDescriptionForStepName(service.status.steps, data.nextStep); + if (desc) { + service.status.feedback = desc; + } + processInstallStep(); + } + } + else { + service.complete(); + } + }, function (response) { + + var data = response.data; + var status = response.status; + //need to handle 500's separately, this will happen if something goes wrong outside + // of the installer (like app startup events or something) and these will get returned as text/html + // not as json. If this happens we can't actually load in external views since they will YSOD as well! // so we need to display this in our own internal way - - if (status >= 500 && status < 600) { - service.status.current = { view: "ysod", model: null }; - var ysod = data; - //we need to manually write the html to the iframe - the html contains full html markup - $timeout(function () { - document.getElementById('ysod').contentDocument.write(ysod); - }, 500); - } - else { - //this is where we handle installer error - var v = data.view ? resolveView(data.view) : resolveView("error"); - var model = data.model ? data.model : data; - service.status.current = { view: v, model: model }; - } - service.switchToConfiguration(); - - }); + if (status >= 500 && status < 600) { + service.status.current = { view: "ysod", model: null }; + var ysod = data; + //we need to manually write the html to the iframe - the html contains full html markup + $timeout(function () { + document.getElementById('ysod').contentDocument.write(ysod); + }, 500); + } + else { + //this is where we handle installer error + var v = data.view ? resolveView(data.view) : resolveView("error"); + var model = data.model ? data.model : data; + service.status.current = { view: v, model: model }; + } + + service.switchToConfiguration(); + }); } processInstallStep(); }, diff --git a/src/Umbraco.Web.UI.Client/src/routes.js b/src/Umbraco.Web.UI.Client/src/routes.js index cbd99fb902..d41427c203 100644 --- a/src/Umbraco.Web.UI.Client/src/routes.js +++ b/src/Umbraco.Web.UI.Client/src/routes.js @@ -193,5 +193,6 @@ app.config(function ($routeProvider) { .otherwise({ redirectTo: '/login' }); }).config(function ($locationProvider) { - $locationProvider.html5Mode(false).hashPrefix(''); //turn html5 mode off + $locationProvider.html5Mode(false); //turn html5 mode off + $locationProvider.hashPrefix(''); }); diff --git a/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js b/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js index 989578f1cd..e939c25576 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js @@ -1,9 +1,4 @@ -/// -/// -/// -/// - -(function() { +(function() { "use strict"; describe("templates editor controller", @@ -17,22 +12,6 @@ controller, nada = function() {}; - // UNCOMMENT TO RUN WITH RESHARPERS TESTRUNNER FOR JS - //beforeEach(function() { - // angular.module('umbraco.filters', []); - // angular.module('umbraco.directives', []); - // angular.module('umbraco.resources', []); - // angular.module('umbraco.services', []); - // angular.module('umbraco.packages', []); - // angular.module('umbraco.views', []); - // angular.module('ngCookies', []); - // angular.module('ngSanitize', []); - // angular.module('ngMobile', []); - // angular.module('tmh.dynamicLocale', []); - // angular.module('ngFileUpload', []); - // angular.module('LocalStorageModule', []); - //}); - beforeEach(module("umbraco")); beforeEach(inject(function($controller, $rootScope, $q) { diff --git a/src/Umbraco.Web.UI/Umbraco/js/installer.app.js b/src/Umbraco.Web.UI/Umbraco/js/installer.app.js index 05315493b7..b7a2cfa989 100644 --- a/src/Umbraco.Web.UI/Umbraco/js/installer.app.js +++ b/src/Umbraco.Web.UI/Umbraco/js/installer.app.js @@ -2,6 +2,6 @@ var app = angular.module('umbraco', [ 'umbraco.directives', 'umbraco.install', 'ngCookies', - 'ngMobile', - 'ngSanitize' -]); \ No newline at end of file + 'ngSanitize', + 'ngTouch' +]); diff --git a/src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml b/src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml index bfbf5c4182..67adeaf84a 100644 --- a/src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml +++ b/src/Umbraco.Web.UI/umbraco/Install/Views/Index.cshtml @@ -36,7 +36,9 @@

This is most likely due to an error during application startup

-
+
+
+
diff --git a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs index 7e3bd57524..e6ad0500fa 100644 --- a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs @@ -19,7 +19,14 @@ namespace Umbraco.Web.Install.InstallSteps { get { - var currentVersion = UmbracoVersion.Local.ToString(); + var currentVersion = UmbracoVersion.Local; + + //fixme - in this case there's a db but the version is cleared which is fine and a normal way to force the upgrader + // to execute, but before we would detect the current version via the DB like DatabaseSchemaResult.DetermineInstalledVersion + // what now, do we need to? + if (currentVersion == null) + currentVersion = new Semver.SemVersion(0); + var newVersion = UmbracoVersion.SemanticVersion.ToString(); string FormatGuidState(string value)