From f0e7f815cf9681922ccb5f2c17d0f9c3b1dd3a33 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 2 Nov 2021 13:51:39 +0100 Subject: [PATCH 01/24] init rollback ui prototype --- .../src/common/services/editor.service.js | 2 +- src/Umbraco.Web.UI.Client/src/less/belle.less | 2 + .../rollback/rollback.controller.js | 22 +- .../infiniteeditors/rollback/rollback.html | 192 +++++++++++------- .../infiniteeditors/rollback/rollback.less | 18 ++ 5 files changed, 162 insertions(+), 74 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.less diff --git a/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js b/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js index a68f68fbb35f..7b2b49d8f73c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/editor.service.js @@ -527,7 +527,7 @@ When building a custom infinite editor view you can use the same components as a */ function rollback(editor) { editor.view = "views/common/infiniteeditors/rollback/rollback.html"; - if (!editor.size) editor.size = "medium"; + if (!editor.size) editor.size = ""; open(editor); } diff --git a/src/Umbraco.Web.UI.Client/src/less/belle.less b/src/Umbraco.Web.UI.Client/src/less/belle.less index 6f95608d7a8d..ba4df33aa0b3 100644 --- a/src/Umbraco.Web.UI.Client/src/less/belle.less +++ b/src/Umbraco.Web.UI.Client/src/less/belle.less @@ -203,6 +203,8 @@ @import "components/umbemailmarketing.less"; +// Editors +@import "../views/common/infiniteeditors/rollback/rollback.less"; // Property Editors @import "../views/components/blockcard/umb-block-card-grid.less"; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js index 4b0dfcb8b47a..07247fcdac92 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js @@ -10,6 +10,8 @@ vm.changeVersion = changeVersion; vm.submit = submit; vm.close = close; + vm.pinVersion = pinVersion; + vm.goToPage = goToPage; ////////// @@ -22,6 +24,10 @@ vm.rollbackButtonDisabled = true; vm.labels = {}; + // TODO: implement + vm.totalPages = 25; + vm.currentPage = 1; + // find the current version for invariant nodes if($scope.model.node.variants.length === 1) { vm.currentVersion = $scope.model.node.variants[0]; @@ -68,7 +74,7 @@ if(version && version.versionId) { - vm.loading = true; + vm.loadingDiff = true; const culture = $scope.model.node.variants.length > 1 ? vm.currentVersion.language.culture : null; @@ -78,10 +84,10 @@ vm.previousVersion.versionId = version.versionId; createDiff(vm.currentVersion, vm.previousVersion); - vm.loading = false; + vm.loadingDiff = false; vm.rollbackButtonDisabled = false; }, function () { - vm.loading = false; + vm.loadingDiff = false; }); } else { @@ -200,6 +206,16 @@ } } + // TODO: implement + function pinVersion (version) { + console.log('PIN VERSION', version); + } + + // TODO: implement + function goToPage (pageNumber) { + console.log('PAGE NUMBER', pageNumber); + } + onInit(); } diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html index e48b5991f602..e91ec55df197 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html @@ -1,4 +1,4 @@ -
+
@@ -16,75 +16,127 @@ ng-if="vm.loading"> - - - -
-
Language
- -
- -
- -
Current version
-

{{vm.currentVersion.name}} (Created: {{vm.currentVersion.createDate}})

- -
Rollback to
- -
- -
- -
Changes
- - - This shows the differences between the current version and the selected version
Red text will be - removed in the selected version, green text will be added -
-
- - - - - - - - - - - - -
- Name - - - {{part.value}} - {{part.value}} - {{part.value}} - -
{{property.label}} - - {{part.value}} - {{part.value}} - {{part.value}} - -
- -
- -
-
+
+ + + + +
+
Language
+ +
+ +
+ +
Current version
+

{{vm.currentVersion.name}} (Created: {{vm.currentVersion.createDate}})

+ + + +
+ +
+
+
+
Version
+
+
+
+ +
+
+
+
{{ version.displayValue }}
+
+ + +
+
+
+ +
+
+ + + + +
+
+ + + + + + + + + Select version to compare + + +
+ + + + This shows the differences between the current version and the selected version
Red text will be + removed in the selected version, green text will be added +
+
+ + + + + + + + + + + + +
+ Name + + + {{part.value}} + {{part.value}} + {{part.value}} + +
{{property.label}} + + {{part.value}} + {{part.value}} + {{part.value}} + +
+ +
+ +
+
+ +
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.less b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.less new file mode 100644 index 000000000000..347ba456cc7b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.less @@ -0,0 +1,18 @@ +.editor-rollback { + + .main-content { + display: flex; + gap: 20px; + } + + .side-panel { + flex: 0 0 30%; + + } + + .compare-panel { + flex: 1 1 auto; + position: relative; + } + +} \ No newline at end of file From 896dcf673cdf5cd3cef391c2579ec995b89e9501 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 2 Nov 2021 15:45:12 +0100 Subject: [PATCH 02/24] add busy state to button, deselect version, add pagination status --- .../rollback/rollback.controller.js | 21 +++++++++---- .../infiniteeditors/rollback/rollback.html | 30 ++++++++----------- .../views/components/buttons/umb-button.html | 6 ++-- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js index 07247fcdac92..42b6072c45db 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function RollbackController($scope, contentResource, localizationService, assetsService, dateHelper, userService) { + function RollbackController($scope, $timeout, contentResource, localizationService, assetsService, dateHelper, userService) { var vm = this; @@ -25,7 +25,8 @@ vm.labels = {}; // TODO: implement - vm.totalPages = 25; + vm.itemsPerPage = 10; + vm.totalPages = 10; vm.currentPage = 1; // find the current version for invariant nodes @@ -72,16 +73,21 @@ function changeVersion(version) { - if(version && version.versionId) { + if (vm.previousVersion && version && vm.previousVersion.versionId === version.versionId) { + vm.previousVersion = null; + vm.diff = null; + return; + } + if (version && version.versionId) { vm.loadingDiff = true; - const culture = $scope.model.node.variants.length > 1 ? vm.currentVersion.language.culture : null; contentResource.getRollbackVersion(version.versionId, culture) .then(function(data) { vm.previousVersion = data; vm.previousVersion.versionId = version.versionId; + vm.previousVersion.displayValue = version.displayValue; createDiff(vm.currentVersion, vm.previousVersion); vm.loadingDiff = false; @@ -208,7 +214,12 @@ // TODO: implement function pinVersion (version) { - console.log('PIN VERSION', version); + version.pinningState = 'busy'; + + $timeout(() => { + version.pinningState = 'init'; + version.isPinned = !version.isPinned; + }, 2000); } // TODO: implement diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html index e91ec55df197..8f57c19ab907 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html @@ -19,6 +19,10 @@
+ + Showing version {{ (vm.currentPage * vm.itemsPerPage - vm.itemsPerPage) + 1 }} to {{ vm.currentPage * vm.itemsPerPage }} of {{ vm.itemsPerPage * vm.totalPages }} versions + +
@@ -32,24 +36,13 @@
Language
- -
Current version
-

{{vm.currentVersion.name}} (Created: {{vm.currentVersion.createDate}})

- - +
+ Current version: + {{vm.currentVersion.name}} (Created: {{vm.currentVersion.createDate}}) +
-
-
-
-
Version
-
-
-
-
Rollback to button-style="outline" type="button" size="xxs" + state="version.pinningState" action="vm.pinVersion(version)" - label="Pin"> + label="{{ version.isPinned ? 'Unpin' : 'Pin' }}">
@@ -85,6 +79,8 @@
Rollback to
+ + @@ -96,7 +92,7 @@
Rollback to
- + This shows the differences between the current version and the selected version
Red text will be diff --git a/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-button.html b/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-button.html index 552d0ffdb578..365aad38171a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-button.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-button.html @@ -1,9 +1,9 @@
- - -
+ + +
From 77185c73955ed2fc2f3db4b8a082c088f495a9e2 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 2 Nov 2021 21:18:30 +0100 Subject: [PATCH 03/24] add localisation --- .../common/infiniteeditors/rollback/rollback.html | 10 ++++++++-- src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html index 8f57c19ab907..79e761d39bf0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html @@ -20,7 +20,13 @@ - Showing version {{ (vm.currentPage * vm.itemsPerPage - vm.itemsPerPage) + 1 }} to {{ vm.currentPage * vm.itemsPerPage }} of {{ vm.itemsPerPage * vm.totalPages }} versions + + + + @@ -88,7 +94,7 @@
Language
- Select version to compare +
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 b16765c66a65..d53df40079e9 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1396,6 +1396,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Rollback to Select version View + Edit script file From a0a0ea107f83e4a8148aa033374c96e7eef29e43 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 2 Nov 2021 21:33:09 +0100 Subject: [PATCH 04/24] style current version --- .../common/infiniteeditors/rollback/rollback.html | 6 +++--- .../common/infiniteeditors/rollback/rollback.less | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html index 79e761d39bf0..a7db7f1ff353 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.html @@ -32,9 +32,9 @@
-
Language
+
Language