From 7c20adef0ea622f22b0e5e88e8b211199e153436 Mon Sep 17 00:00:00 2001 From: Steve <6131869+SteveVaneeckhout@users.noreply.github.com> Date: Mon, 23 Nov 2020 10:40:18 +0100 Subject: [PATCH 1/5] Track ng-repeat with id instead of label (#9340) (cherry picked from commit 39c4dcdaaa4d18acc4fd0134e69c48af17dbb535) --- .../src/views/components/content/umb-tabbed-content.html | 2 +- .../elementeditor/umb-element-editor-content.component.html | 2 +- .../src/views/components/member/umb-member-node-info.html | 2 +- .../src/views/media/apps/content/content.html | 2 +- .../src/views/member/apps/content/content.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html index d534cd77ed..022c140a2f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html @@ -1,6 +1,6 @@ 
-
+
{{ group.label }}
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html b/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html index fae639562f..ecbe880eee 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html @@ -2,7 +2,7 @@
+ ng-repeat="group in vm.model.variants[0].tabs track by group.id">
{{ group.label }}
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/member/umb-member-node-info.html b/src/Umbraco.Web.UI.Client/src/views/components/member/umb-member-node-info.html index 62b2052771..bf8eeffa6f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/member/umb-member-node-info.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/member/umb-member-node-info.html @@ -1,7 +1,7 @@
- +
{{ group.label }}
diff --git a/src/Umbraco.Web.UI.Client/src/views/media/apps/content/content.html b/src/Umbraco.Web.UI.Client/src/views/media/apps/content/content.html index 633eccdf62..816ca987f7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/apps/content/content.html +++ b/src/Umbraco.Web.UI.Client/src/views/media/apps/content/content.html @@ -1,5 +1,5 @@
-
+
{{ group.label }}
diff --git a/src/Umbraco.Web.UI.Client/src/views/member/apps/content/content.html b/src/Umbraco.Web.UI.Client/src/views/member/apps/content/content.html index 29df5ba638..7ac2bbd390 100644 --- a/src/Umbraco.Web.UI.Client/src/views/member/apps/content/content.html +++ b/src/Umbraco.Web.UI.Client/src/views/member/apps/content/content.html @@ -1,6 +1,6 @@
-
+
{{ group.label }}
From 3927a8db670d51f396740d835f473c8b4b6ffc78 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 14 Dec 2020 12:04:19 +1100 Subject: [PATCH 2/5] Ensure we capture exceptions that occur when trying to create a transaction --- src/Umbraco.Core/Runtime/MainDom.cs | 12 ++- src/Umbraco.Core/Runtime/SqlMainDomLock.cs | 96 +++++++++++++++------- 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/src/Umbraco.Core/Runtime/MainDom.cs b/src/Umbraco.Core/Runtime/MainDom.cs index e6780ec876..02f37f654e 100644 --- a/src/Umbraco.Core/Runtime/MainDom.cs +++ b/src/Umbraco.Core/Runtime/MainDom.cs @@ -144,8 +144,16 @@ namespace Umbraco.Core.Runtime _logger.Info("Acquiring."); - // Get the lock - var acquired = _mainDomLock.AcquireLockAsync(LockTimeoutMilliseconds).GetAwaiter().GetResult(); + // Get the lock + var acquired = false; + try + { + acquired = _mainDomLock.AcquireLockAsync(LockTimeoutMilliseconds).GetAwaiter().GetResult(); + } + catch (Exception ex) + { + _logger.Error(ex, "Error while acquiring"); + } if (!acquired) { diff --git a/src/Umbraco.Core/Runtime/SqlMainDomLock.cs b/src/Umbraco.Core/Runtime/SqlMainDomLock.cs index 209b99aef1..84d98775d9 100644 --- a/src/Umbraco.Core/Runtime/SqlMainDomLock.cs +++ b/src/Umbraco.Core/Runtime/SqlMainDomLock.cs @@ -1,4 +1,5 @@ -using System; +using NPoco; +using System; using System.Data; using System.Data.SqlClient; using System.Diagnostics; @@ -48,7 +49,9 @@ namespace Umbraco.Core.Runtime } if (!(_dbFactory.SqlContext.SqlSyntax is SqlServerSyntaxProvider sqlServerSyntaxProvider)) + { throw new NotSupportedException("SqlMainDomLock is only supported for Sql Server"); + } _sqlServerSyntax = sqlServerSyntaxProvider; @@ -56,11 +59,13 @@ namespace Umbraco.Core.Runtime var tempId = Guid.NewGuid().ToString(); - using var db = _dbFactory.CreateDatabase(); - using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); + IUmbracoDatabase db = null; try { + db = _dbFactory.CreateDatabase(); + db.BeginTransaction(IsolationLevel.ReadCommitted); + try { // wait to get a write lock @@ -101,7 +106,8 @@ namespace Umbraco.Core.Runtime } finally { - transaction.Complete(); + db?.CompleteTransaction(); + db?.Dispose(); } @@ -154,11 +160,11 @@ namespace Umbraco.Core.Runtime // new MainDom will just take over. if (_cancellationTokenSource.IsCancellationRequested) return; - - using var db = _dbFactory.CreateDatabase(); - using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); + IUmbracoDatabase db = null; try { + db = _dbFactory.CreateDatabase(); + db.BeginTransaction(IsolationLevel.ReadCommitted); // get a read lock _sqlServerSyntax.ReadLock(db, Constants.Locks.MainDom); @@ -182,7 +188,8 @@ namespace Umbraco.Core.Runtime } finally { - transaction.Complete(); + db?.CompleteTransaction(); + db?.Dispose(); } } @@ -201,34 +208,47 @@ namespace Umbraco.Core.Runtime return Task.Run(() => { - using var db = _dbFactory.CreateDatabase(); - - var watch = new Stopwatch(); - watch.Start(); - while (true) + try { - // poll very often, we need to take over as fast as we can - // local testing shows the actual query to be executed from client/server is approx 300ms but would change depending on environment/IO - Thread.Sleep(1000); + using var db = _dbFactory.CreateDatabase(); - var acquired = TryAcquire(db, tempId, updatedTempId); - if (acquired.HasValue) - return acquired.Value; - - if (watch.ElapsedMilliseconds >= millisecondsTimeout) + var watch = new Stopwatch(); + watch.Start(); + while (true) { - return AcquireWhenMaxWaitTimeElapsed(db); + // poll very often, we need to take over as fast as we can + // local testing shows the actual query to be executed from client/server is approx 300ms but would change depending on environment/IO + Thread.Sleep(1000); + + var acquired = TryAcquire(db, tempId, updatedTempId); + if (acquired.HasValue) + return acquired.Value; + + if (watch.ElapsedMilliseconds >= millisecondsTimeout) + { + return AcquireWhenMaxWaitTimeElapsed(db); + } } } + catch (Exception ex) + { + _logger.Error(ex, "An error occurred trying to acquire and waiting for existing SqlMainDomLock to shutdown"); + return false; + } + }, _cancellationTokenSource.Token); } private bool? TryAcquire(IUmbracoDatabase db, string tempId, string updatedTempId) { - using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); + // Creates a separate transaction to the DB instance so we aren't allocating tons of new DB instances for each transaction + // since this is executed in a tight loop + + ITransaction transaction = null; try { + transaction = db.GetTransaction(IsolationLevel.ReadCommitted); // get a read lock _sqlServerSyntax.ReadLock(db, Constants.Locks.MainDom); @@ -274,7 +294,8 @@ namespace Umbraco.Core.Runtime } finally { - transaction.Complete(); + transaction?.Complete(); + transaction?.Dispose(); } return null; // continue @@ -282,6 +303,9 @@ namespace Umbraco.Core.Runtime private bool AcquireWhenMaxWaitTimeElapsed(IUmbracoDatabase db) { + // Creates a separate transaction to the DB instance so we aren't allocating tons of new DB instances for each transaction + // since this is executed in a tight loop + // if the timeout has elapsed, it either means that the other main dom is taking too long to shutdown, // or it could mean that the previous appdomain was terminated and didn't clear out the main dom SQL row // and it's just been left as an orphan row. @@ -291,10 +315,12 @@ namespace Umbraco.Core.Runtime _logger.Debug("Timeout elapsed, assuming orphan row, acquiring MainDom."); - using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); + ITransaction transaction = null; try { + transaction = db.GetTransaction(IsolationLevel.ReadCommitted); + _sqlServerSyntax.WriteLock(db, Constants.Locks.MainDom); // so now we update the row with our appdomain id @@ -317,7 +343,8 @@ namespace Umbraco.Core.Runtime } finally { - transaction.Complete(); + transaction?.Complete(); + transaction?.Dispose(); } } @@ -368,11 +395,12 @@ namespace Umbraco.Core.Runtime if (_dbFactory.Configured) { - using var db = _dbFactory.CreateDatabase(); - using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); - + IUmbracoDatabase db = null; try { + db = _dbFactory.CreateDatabase(); + db.BeginTransaction(IsolationLevel.ReadCommitted); + // get a write lock _sqlServerSyntax.WriteLock(db, Constants.Locks.MainDom); @@ -399,7 +427,15 @@ namespace Umbraco.Core.Runtime } finally { - transaction.Complete(); + try + { + db?.CompleteTransaction(); + db?.Dispose(); + } + catch (Exception ex) + { + _logger.Error(ex, "Unexpected error during dispose when completing transaction."); + } } } } From 60dbfb66f74aa6b485264c37d3fd59810faf8181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 14 Dec 2020 10:21:23 +0100 Subject: [PATCH 3/5] changed wording --- src/Umbraco.Web.UI/Umbraco/config/lang/da.xml | 2 +- src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 2 +- src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index 35279a75f3..345a523789 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1439,7 +1439,7 @@ Mange hilsner fra Umbraco robotten Dette benyttes ikke for en Element-type Du har lavet ændringer til denne egenskab. Er du sikker på at du vil kassere dem? Visning - Flyt label over editoren + Label hen over (fuld brede) Tilføj sprog diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index 3c864e2d66..0a9ea1d147 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -1697,7 +1697,7 @@ To manage your website, simply open the Umbraco back office and start adding con This is not applicable for an Element type You have made changes to this property. Are you sure you want to discard them? Appearance - Display label on top of editor. + Label above (full-width) Add language diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index a5144bf450..621491112e 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1717,7 +1717,7 @@ To manage your website, simply open the Umbraco back office and start adding con This is not applicable for an element type You have made changes to this property. Are you sure you want to discard them? Appearance - Display label on top of editor. + Label above (full-width) Add language From 734d33fe1cf1f1f1dc02bd58f43a4c54ba12211e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 14 Dec 2020 11:14:12 +0100 Subject: [PATCH 4/5] change dialog --- .../src/preview/preview.controller.js | 19 +++++++++++++++---- .../Umbraco/Views/Preview/Index.cshtml | 6 ++++-- src/Umbraco.Web.UI/Umbraco/config/lang/da.xml | 5 +++-- src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 7 ++++--- .../Umbraco/config/lang/en_us.xml | 7 ++++--- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/preview/preview.controller.js b/src/Umbraco.Web.UI.Client/src/preview/preview.controller.js index 78f753a8ca..a21ce75c30 100644 --- a/src/Umbraco.Web.UI.Client/src/preview/preview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/preview/preview.controller.js @@ -228,9 +228,10 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi // Ask to re-enter preview mode? const localizeVarsFallback = { - "returnToPreviewHeadline": "Preview content?", - "returnToPreviewDescription":"You have ended preview mode, do you want to continue previewing this content?", - "returnToPreviewButton":"Preview" + "returnToPreviewHeadline": "Preview website?", + "returnToPreviewDescription":"You have ended preview mode, do you want to enable it again to view the latest saved version of your website?", + "returnToPreviewAcceptButton":"Preview latest version", + "returnToPreviewDeclineButton":"View published version" }; const umbLocalizedVars = Object.assign(localizeVarsFallback, $window.umbLocalizedVars); @@ -333,10 +334,20 @@ var app = angular.module("umbraco.preview", ['umbraco.resources', 'umbraco.servi
${umbLocalizedVars.returnToPreviewDescription}
`; con.appendChild(modal); + var declineButton = document.createElement("button"); + declineButton.type = "button"; + declineButton.innerHTML = umbLocalizedVars.returnToPreviewDeclineButton; + declineButton.addEventListener("click", () => { + bodyEl.removeChild(fragment); + $scope.exitPreview(); + hasPreviewDialog = false; + }); + modal.appendChild(declineButton); + var continueButton = document.createElement("button"); continueButton.type = "button"; continueButton.className = "umbraco-preview-dialog__continue"; - continueButton.innerHTML = umbLocalizedVars.returnToPreviewButton; + continueButton.innerHTML = umbLocalizedVars.returnToPreviewAcceptButton; continueButton.addEventListener("click", () => { bodyEl.removeChild(fragment); reenterPreviewMode(); diff --git a/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml b/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml index c3365f06fc..eb89211652 100644 --- a/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml @@ -22,7 +22,8 @@ var OpenWebsiteTitle = textService.Localize("preview", "openWebsiteTitle"); var returnToPreviewHeadline = textService.Localize("preview", "returnToPreviewHeadline"); var returnToPreviewDescription = textService.Localize("preview", "returnToPreviewDescription"); - var returnToPreviewButton = textService.Localize("preview", "returnToPreviewButton"); + var returnToPreviewAcceptButton = textService.Localize("preview", "returnToPreviewAcceptButton"); + var returnToPreviewDeclineButton = textService.Localize("preview", "returnToPreviewDeclineButton"); } @@ -39,7 +40,8 @@ window.umbLocalizedVars = { 'returnToPreviewHeadline': '@returnToPreviewHeadline', 'returnToPreviewDescription':'@returnToPreviewDescription', - 'returnToPreviewButton':'@returnToPreviewButton' + 'returnToPreviewAcceptButton':'@returnToPreviewAcceptButton', + 'returnToPreviewDeclineButton':'@returnToPreviewDeclineButton' }; diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index 35279a75f3..59ee0eb2d9 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1873,8 +1873,9 @@ Mange hilsner fra Umbraco robotten Vis i nyt vindue Åben forhåndsvisning i nyt vindue Forhåndsvisning af indholdet? - Du har afslutet forhåndsvisning, vil du se dette indhold i forhåndsvisning? - Fortsæt + Du har afslutet forhåndsvisning, vil du starte forhåndsvisning igen for at se seneste gemte version af indholdet? + Start forhåndsvisning + Se udgivet indhold Se udgivet indhold? Du er i forhåndsvisning, vil du afslutte for at se den udgivet version? Se udgivet version diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index 3c864e2d66..687d7f61a0 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -2531,9 +2531,10 @@ To manage your website, simply open the Umbraco back office and start adding con End preview mode Preview website Open website in preview mode - Preview content? - You have ended preview mode, do you want to continue previewing this content? - Preview + Preview website? + ou have ended preview mode, do you want to enable it again to view the latest saved version of your website? + Preview latest version + View published version View published version? You are in Preview Mode, do you want exit in order to view the published version of your website? View published version diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index a5144bf450..b0987236f3 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -2553,9 +2553,10 @@ To manage your website, simply open the Umbraco back office and start adding con End preview mode Preview website Open website in preview mode - Preview content? - You have ended preview mode, do you want to continue previewing this content? - Preview + Preview website? + ou have ended preview mode, do you want to enable it again to view the latest saved version of your website? + Preview latest version + View published version View published version? You are in Preview Mode, do you want exit in order to view the published version of your website? View published version From b2dac7947fc3bb9718ffbd65385d6661320b7bdd Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Mon, 14 Dec 2020 13:29:53 +0000 Subject: [PATCH 5/5] Bump version to 8.10.0 .\build SetUmbracoVersion 8.10.0 --- src/SolutionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 89997c0a01..c503fcd03e 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -19,4 +19,4 @@ using System.Resources; // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.10.0")] -[assembly: AssemblyInformationalVersion("8.10.0-rc")] +[assembly: AssemblyInformationalVersion("8.10.0")]