diff --git a/uSync8.BackOffice/App_Plugins/uSync8/settings/default.html b/uSync8.BackOffice/App_Plugins/uSync8/settings/default.html
index b4589c92..6f8494cd 100644
--- a/uSync8.BackOffice/App_Plugins/uSync8/settings/default.html
+++ b/uSync8.BackOffice/App_Plugins/uSync8/settings/default.html
@@ -58,8 +58,8 @@
-
-
+
+
@@ -67,9 +67,14 @@
+
+
+
+
+
-
+
diff --git a/uSync8.BackOffice/App_Plugins/uSync8/settings/uSyncController.js b/uSync8.BackOffice/App_Plugins/uSync8/settings/uSyncController.js
index da4b727c..59d94416 100644
--- a/uSync8.BackOffice/App_Plugins/uSync8/settings/uSyncController.js
+++ b/uSync8.BackOffice/App_Plugins/uSync8/settings/uSyncController.js
@@ -15,6 +15,7 @@
vm.reported = false;
vm.syncing = false;
vm.hideLink = false;
+ vm.showSpinner = false;
vm.showAdvanced = false;
@@ -317,6 +318,7 @@
vm.reported = vm.showAll = false;
vm.working = true;
+ vm.showSpinner = false;
vm.runmode = mode;
vm.hideLink = false;
vm.savings.show = false;
@@ -328,6 +330,11 @@
Handlers: vm.handlers
};
+ if (!vm.hub.active) {
+ vm.status.Message = 'Working ';
+ vm.showSpinner = true;
+ }
+
vm.update = {
Message: '',
Count: 0,
diff --git a/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js b/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js
index 2e0fdbc5..795f2cb2 100644
--- a/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js
+++ b/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js
@@ -8,7 +8,7 @@
var scripts = [
Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/lib/signalr/jquery.signalR.js',
- Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/backoffice/signalr/hubs'];
+ Umbraco.Sys.ServerVariables.uSync.signalRHub];
var resource = {
initHub: initHub
@@ -62,30 +62,41 @@
function hubSetup(callback) {
var proxy = $.connection.uSyncHub;
- var hub = {
- start: function () {
- $.connection.hub.start();
- },
- on: function (eventName, callback) {
- proxy.on(eventName, function (result) {
- $rootScope.$apply(function () {
- if (callback) {
- callback(result);
- }
- });
- });
- },
- invoke: function (methodName, callback) {
- proxy.invoke(methodName)
- .done(function (result) {
+ var hub = {};
+ if (proxy !== undefined) {
+ hub = {
+ active: true,
+ start: function () {
+ $.connection.hub.start();
+ },
+ on: function (eventName, callback) {
+ proxy.on(eventName, function (result) {
$rootScope.$apply(function () {
if (callback) {
callback(result);
}
});
});
- }
- };
+ },
+ invoke: function (methodName, callback) {
+ proxy.invoke(methodName)
+ .done(function (result) {
+ $rootScope.$apply(function () {
+ if (callback) {
+ callback(result);
+ }
+ });
+ });
+ }
+ };
+ }
+ else {
+ hub = {
+ on: function () { },
+ invoke: function () { },
+ start: function () { console.log('no hub to start - missing signalR library ?'); }
+ };
+ }
return callback(hub);
}
diff --git a/uSync8.BackOffice/Configuration/BackOfficeConfig.cs b/uSync8.BackOffice/Configuration/BackOfficeConfig.cs
index 356379f9..3bb41f58 100644
--- a/uSync8.BackOffice/Configuration/BackOfficeConfig.cs
+++ b/uSync8.BackOffice/Configuration/BackOfficeConfig.cs
@@ -82,6 +82,10 @@ public uSyncSettings LoadSettings()
settings.CacheFolderKeys = node.Element("CacheFolderKeys").ValueOrDefault(true);
+ settings.SignalRRoot = ValueFromWebConfigOrDefault("SignalRRoot", node.Element("SignalRRoot")
+ .ValueOrDefault("backoffice/signalr/hubs"))
+ .TrimStart(new[] { '/' });
+
settings.DefaultHandlerSettings = LoadKeyValueSettings(node.Element("HandlerDefaults"));
diff --git a/uSync8.BackOffice/Configuration/uSyncSettings.cs b/uSync8.BackOffice/Configuration/uSyncSettings.cs
index 22ffedc8..64e8eed1 100644
--- a/uSync8.BackOffice/Configuration/uSyncSettings.cs
+++ b/uSync8.BackOffice/Configuration/uSyncSettings.cs
@@ -108,6 +108,11 @@ public HandlerSet DefaultHandlerSet()
/// options you can set at the top level, that are then set on all handlers.
///
public IDictionary DefaultHandlerSettings { get; set; }
+
+ ///
+ /// location of SignalR hub script (/
+ ///
+ public string SignalRRoot { get; set; }
}
public class HandlerSet
diff --git a/uSync8.BackOffice/uSyncBackofficeComponent.cs b/uSync8.BackOffice/uSyncBackofficeComponent.cs
index f65fd7d2..9383d2d8 100644
--- a/uSync8.BackOffice/uSyncBackofficeComponent.cs
+++ b/uSync8.BackOffice/uSyncBackofficeComponent.cs
@@ -8,6 +8,7 @@
using Umbraco.Core;
using Umbraco.Core.Composing;
+using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Web;
using Umbraco.Web.JavaScript;
@@ -25,13 +26,17 @@ public class uSyncBackofficeComponent : IComponent
private readonly SyncHandlerFactory handlerFactory;
private readonly SyncFileService syncFileService;
- private readonly uSyncSettings globalSettings;
+ private readonly uSyncSettings uSyncSettings;
private readonly uSyncService uSyncService;
private readonly IRuntimeState runtimeState;
private readonly IUmbracoContextFactory umbracoContextFactory;
+ private readonly string UmbracoMvcArea;
+
public uSyncBackofficeComponent(
+ IGlobalSettings globalSettings,
+ uSyncConfig uSyncConfig,
SyncHandlerFactory handlerFactory,
IProfilingLogger logger,
SyncFileService fileService,
@@ -39,7 +44,9 @@ public uSyncBackofficeComponent(
IRuntimeState runtimeState,
IUmbracoContextFactory umbracoContextFactory)
{
- globalSettings = Current.Configs.uSync();
+ uSyncSettings = uSyncConfig.Settings;
+
+ UmbracoMvcArea = globalSettings.GetUmbracoMvcArea();
this.runtimeState = runtimeState;
this.logger = logger;
@@ -85,7 +92,8 @@ private void ServerVariablesParser_Parsing(object sender, Dictionary
{
- { "uSyncService", urlHelper.GetUmbracoApiServiceBaseUrl(controller => controller.GetApi()) }
+ { "uSyncService", urlHelper.GetUmbracoApiServiceBaseUrl(controller => controller.GetApi()) },
+ { "signalRHub", UriUtility.ToAbsolute($"~/{UmbracoMvcArea}/{uSyncSettings.SignalRRoot}") }
});
}
@@ -99,20 +107,20 @@ private void InitBackOffice()
using (var reference = umbracoContextFactory.EnsureUmbracoContext())
{
- if (globalSettings.ExportAtStartup || (globalSettings.ExportOnSave && !syncFileService.RootExists(globalSettings.RootFolder)))
+ if (uSyncSettings.ExportAtStartup || (uSyncSettings.ExportOnSave && !syncFileService.RootExists(uSyncSettings.RootFolder)))
{
logger.Info("uSync: Running Export at startup");
- uSyncService.Export(globalSettings.RootFolder, default(SyncHandlerOptions));
+ uSyncService.Export(uSyncSettings.RootFolder, default(SyncHandlerOptions));
}
- if (globalSettings.ImportAtStartup)
+ if (uSyncSettings.ImportAtStartup)
{
logger.Info("uSync: Running Import at startup");
- if (!HasStopFile(globalSettings.RootFolder))
+ if (!HasStopFile(uSyncSettings.RootFolder))
{
- uSyncService.Import(globalSettings.RootFolder, false, default(SyncHandlerOptions));
- ProcessOnceFile(globalSettings.RootFolder);
+ uSyncService.Import(uSyncSettings.RootFolder, false, default(SyncHandlerOptions));
+ ProcessOnceFile(uSyncSettings.RootFolder);
}
else
{
@@ -120,7 +128,7 @@ private void InitBackOffice()
}
}
- if (globalSettings.ExportOnSave)
+ if (uSyncSettings.ExportOnSave)
{
var handlers = handlerFactory
.GetValidHandlers(new SyncHandlerOptions(handlerFactory.DefaultSet, HandlerActions.Save))
@@ -149,7 +157,7 @@ private void InitBackOffice()
public void Terminate()
{
logger.Debug("Terminiating Component");
- if (globalSettings.ExportOnSave)
+ if (uSyncSettings.ExportOnSave)
{
var handlers = handlerFactory
.GetValidHandlers(new SyncHandlerOptions(handlerFactory.DefaultSet, HandlerActions.Save))
diff --git a/uSync8.Site/App_Plugins/uSync8/settings/default.html b/uSync8.Site/App_Plugins/uSync8/settings/default.html
index d40d79c1..f32f7b5e 100644
--- a/uSync8.Site/App_Plugins/uSync8/settings/default.html
+++ b/uSync8.Site/App_Plugins/uSync8/settings/default.html
@@ -58,8 +58,8 @@
-
-
+
+
@@ -67,9 +67,14 @@
+
+
+
+
+
-
+
diff --git a/uSync8.Site/App_Plugins/uSync8/settings/uSyncController.js b/uSync8.Site/App_Plugins/uSync8/settings/uSyncController.js
index cb71702d..2224f5c2 100644
--- a/uSync8.Site/App_Plugins/uSync8/settings/uSyncController.js
+++ b/uSync8.Site/App_Plugins/uSync8/settings/uSyncController.js
@@ -15,6 +15,7 @@
vm.reported = false;
vm.syncing = false;
vm.hideLink = false;
+ vm.showSpinner = false;
vm.showAdvanced = false;
@@ -317,6 +318,7 @@
vm.reported = vm.showAll = false;
vm.working = true;
+ vm.showSpinner = false;
vm.runmode = mode;
vm.hideLink = false;
vm.savings.show = false;
@@ -328,6 +330,11 @@
Handlers: vm.handlers
};
+ if (!vm.hub.active) {
+ vm.status.Message = 'Working ';
+ vm.showSpinner = true;
+ }
+
vm.update = {
Message: '',
Count: 0,
diff --git a/uSync8.Site/App_Plugins/uSync8/uSyncHub.js b/uSync8.Site/App_Plugins/uSync8/uSyncHub.js
index 94ed42b4..2594b282 100644
--- a/uSync8.Site/App_Plugins/uSync8/uSyncHub.js
+++ b/uSync8.Site/App_Plugins/uSync8/uSyncHub.js
@@ -8,7 +8,7 @@
var scripts = [
Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/lib/signalr/jquery.signalR.js',
- Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath + '/backoffice/signalr/hubs'];
+ Umbraco.Sys.ServerVariables.uSync.signalRHub];
var resource = {
initHub: initHub
@@ -62,30 +62,41 @@
function hubSetup(callback) {
var proxy = $.connection.uSyncHub;
- var hub = {
- start: function () {
- $.connection.hub.start();
- },
- on: function (eventName, callback) {
- proxy.on(eventName, function (result) {
- $rootScope.$apply(function () {
- if (callback) {
- callback(result);
- }
- });
- });
- },
- invoke: function (methodName, callback) {
- proxy.invoke(methodName)
- .done(function (result) {
+ var hub = {};
+ if (proxy !== undefined) {
+ hub = {
+ active: true,
+ start: function () {
+ $.connection.hub.start();
+ },
+ on: function (eventName, callback) {
+ proxy.on(eventName, function (result) {
$rootScope.$apply(function () {
if (callback) {
callback(result);
}
});
});
- }
- };
+ },
+ invoke: function (methodName, callback) {
+ proxy.invoke(methodName)
+ .done(function (result) {
+ $rootScope.$apply(function () {
+ if (callback) {
+ callback(result);
+ }
+ });
+ });
+ }
+ };
+ }
+ else {
+ hub = {
+ on: function () { },
+ invoke: function () { },
+ start: function () { console.log('no hub to start - missing signalR library ?'); }
+ };
+ }
return callback(hub);
}
diff --git a/uSync8.Site/config/uSync8.config b/uSync8.Site/config/uSync8.config
index 746b92bf..057cdfa2 100644
--- a/uSync8.Site/config/uSync8.config
+++ b/uSync8.Site/config/uSync8.config
@@ -18,17 +18,17 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+