diff --git a/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboard.html b/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboard.html index 0aab0750..d619fcb6 100644 --- a/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboard.html +++ b/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboard.html @@ -8,7 +8,7 @@
  • {{tab.name}}
  • -
  • History
  • +
  • History
  • Config
  • About
  • @@ -196,6 +196,7 @@ Name + User Changes Sync Type Date @@ -205,6 +206,7 @@ {{item.name}} + {{item.user}} {{getChangeCount(item.actions)}} {{item.type}} {{item.date}} diff --git a/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboardController.js b/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboardController.js index a71c28fc..3eb70cb7 100644 --- a/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboardController.js +++ b/Jumoo.uSync.BackOffice/App_Plugins/uSync/uSyncDashboardController.js @@ -23,10 +23,19 @@ $scope.getuSyncMode(); $scope.loading = false; - $scope.loadHistory(); + // $scope.loadHistory(); }); } + $scope.historyLoaded = false; + + $scope.initHistory = function () { + if (!$scope.historyLoaded) { + $scope.historyLoaded = true; + $scope.loadHistory(); + } + } + $scope.loadHistory = function () { uSyncDashboardService.getHistory() .then(function (response) { diff --git a/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeApiController.cs b/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeApiController.cs index 1616db60..ebf7fa2f 100644 --- a/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeApiController.cs +++ b/Jumoo.uSync.BackOffice/Controllers/uSyncBackOfficeApiController.cs @@ -59,7 +59,7 @@ public IEnumerable Export(bool deleteAction = false) // we write a log - when there have been changes, a zero run doesn't get // a file written to disk. if (actions.Any(x => x.Change > ChangeType.NoChange)) - uSyncActionLogger.SaveActionLog("Export", actions); + uSyncActionLogger.SaveActionLog("Export", Security?.CurrentUser?.Username, actions); return actions; } @@ -89,7 +89,7 @@ public IEnumerable Import(bool force) // we write a log - when there have been changes, a zero run doesn't get // a file written to disk. if (actions.Any(x => x.Change > ChangeType.NoChange)) - uSyncActionLogger.SaveActionLog("Import", actions); + uSyncActionLogger.SaveActionLog("Import", Security?.CurrentUser?.Username, actions); return actions; } diff --git a/Jumoo.uSync.BackOffice/uSyncAction.cs b/Jumoo.uSync.BackOffice/uSyncAction.cs index 07e89cbe..d4814e2f 100644 --- a/Jumoo.uSync.BackOffice/uSyncAction.cs +++ b/Jumoo.uSync.BackOffice/uSyncAction.cs @@ -121,7 +121,7 @@ public static uSyncAction ReportAction(bool willUpdate, string name, string mess public class uSyncActionLogger { - public static void SaveActionLog(string name, IEnumerable actions) + public static void SaveActionLog(string name, string user, IEnumerable actions) { try { // creates an action log (xml file) of the actions... @@ -142,6 +142,7 @@ public static void SaveActionLog(string name, IEnumerable actions) XElement logFile = new XElement("uSync", new XAttribute("Name", string.IsNullOrEmpty(name) ? "" : name), + new XAttribute("User", string.IsNullOrEmpty(user) ? "Background" : user), new XAttribute("DateTime", DateTime.Now.ToString("U"))); XElement logNode = new XElement("Actions"); @@ -237,6 +238,7 @@ public static uSyncHistory LoadHistoryData(FileInfo file) { info.type = data.Attribute("Name").ValueOrDefault(""); info.date = data.Attribute("DateTime").ValueOrDefault(""); + info.user = data.Attribute("User").ValueOrDefault(""); info.actions = new List(); @@ -308,6 +310,9 @@ public static void LogActions(List actions) public class uSyncHistory { public string name { get; set; } + + public string user { get; set; } + public string path { get; set; } public string type { get; set; } public string date { get; set; } diff --git a/Jumoo.uSync.BackOffice/uSyncApplicationEventHandler.cs b/Jumoo.uSync.BackOffice/uSyncApplicationEventHandler.cs index 3434df94..2c0a5364 100644 --- a/Jumoo.uSync.BackOffice/uSyncApplicationEventHandler.cs +++ b/Jumoo.uSync.BackOffice/uSyncApplicationEventHandler.cs @@ -95,7 +95,7 @@ private void Setup() // we write a log - when there have been changes, a zero run doesn't get // a file written to disk. if (setupActions.Any(x => x.Change > ChangeType.NoChange)) - uSyncActionLogger.SaveActionLog("Startup", setupActions); + uSyncActionLogger.SaveActionLog("Startup", "", setupActions); sw.Stop(); diff --git a/Jumoo.uSync.Site/App_Plugins/uSync/package.manifest b/Jumoo.uSync.Site/App_Plugins/uSync/package.manifest index 52fdc3d7..0751598b 100644 --- a/Jumoo.uSync.Site/App_Plugins/uSync/package.manifest +++ b/Jumoo.uSync.Site/App_Plugins/uSync/package.manifest @@ -1,4 +1,4 @@ -{ +{ javascript: [ '~/App_Plugins/uSync/uSyncDashboardController.js', '~/App_Plugins/uSync/uSyncDashboardService.js' diff --git a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.css b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.css index 0a165fdf..fc3f8235 100644 --- a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.css +++ b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.css @@ -1,4 +1,4 @@ -.usync-dash .report-detail { +.usync-dash .report-detail { padding-top: 1em; } diff --git a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.html b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.html index c3148dea..d619fcb6 100644 --- a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.html +++ b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboard.html @@ -1,4 +1,4 @@ -
    +
    Error: {{errorMsg}}
    @@ -8,7 +8,7 @@
  • {{tab.name}}
  • -
  • History
  • +
  • History
  • Config
  • About
  • @@ -196,6 +196,7 @@ Name + User Changes Sync Type Date @@ -205,6 +206,7 @@ {{item.name}} + {{item.user}} {{getChangeCount(item.actions)}} {{item.type}} {{item.date}} diff --git a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardController.js b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardController.js index 4ff9790b..3eb70cb7 100644 --- a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardController.js +++ b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardController.js @@ -1,4 +1,4 @@ -angular.module('umbraco').controller('uSyncDashboardController', +angular.module('umbraco').controller('uSyncDashboardController', function ($scope, $http, uSyncDashboardService) { $scope.snapshotsUrl = "/app_plugins/usync/test.html"; @@ -23,10 +23,19 @@ angular.module('umbraco').controller('uSyncDashboardController', $scope.getuSyncMode(); $scope.loading = false; - $scope.loadHistory(); + // $scope.loadHistory(); }); } + $scope.historyLoaded = false; + + $scope.initHistory = function () { + if (!$scope.historyLoaded) { + $scope.historyLoaded = true; + $scope.loadHistory(); + } + } + $scope.loadHistory = function () { uSyncDashboardService.getHistory() .then(function (response) { diff --git a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardService.js b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardService.js index 12b32e9d..4dd55b7e 100644 --- a/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardService.js +++ b/Jumoo.uSync.Site/App_Plugins/uSync/uSyncDashboardService.js @@ -1,4 +1,4 @@ -angular.module('umbraco.resources').factory('uSyncDashboardService', +angular.module('umbraco.resources').factory('uSyncDashboardService', function ($q, $http) { var serviceRoot = 'backoffice/uSync/uSyncApi/';