From e3dc0f29e271f5205d57b00f031509ac79e28f7b Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Fri, 28 Feb 2014 15:01:38 +0100 Subject: [PATCH] The interfaces will now redirect based on their arangos rule: Dispatchers point to cluster.html, all others point to index.html --- js/apps/system/aardvark/cluster.js | 4 ++++ .../aardvark/clusterFrontend/js/routers/startApp.js | 10 ++++++++++ .../system/aardvark/frontend/js/routers/startApp.js | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/js/apps/system/aardvark/cluster.js b/js/apps/system/aardvark/cluster.js index 255ec990da..41f5771d7e 100644 --- a/js/apps/system/aardvark/cluster.js +++ b/js/apps/system/aardvark/cluster.js @@ -44,6 +44,10 @@ * given in the body */ + controller.get("/amIDispatcher", function(req, res) { + res.json(!cluster.dispatcherDisabled()); + }); + if (!cluster.dispatcherDisabled()) { var Plans = require("./repositories/plans.js"), plans = new Plans.Repository( diff --git a/js/apps/system/aardvark/clusterFrontend/js/routers/startApp.js b/js/apps/system/aardvark/clusterFrontend/js/routers/startApp.js index c519d142f1..00bdfff623 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/routers/startApp.js +++ b/js/apps/system/aardvark/clusterFrontend/js/routers/startApp.js @@ -3,6 +3,16 @@ (function() { "use strict"; + + $.get("cluster/amIDispatcher", function(data) { + if (!data) { + var url = window.location.origin; + url += window.location.pathname; + url = url.replace("cluster", "index"); + window.location.replace(url); + } + }); + $(document).ready(function() { window.App = new window.ClusterRouter(); diff --git a/js/apps/system/aardvark/frontend/js/routers/startApp.js b/js/apps/system/aardvark/frontend/js/routers/startApp.js index 1a90e4e86f..019697b34a 100644 --- a/js/apps/system/aardvark/frontend/js/routers/startApp.js +++ b/js/apps/system/aardvark/frontend/js/routers/startApp.js @@ -3,6 +3,16 @@ (function() { "use strict"; + + $.get("cluster/amIDispatcher", function(data) { + if (data) { + var url = window.location.origin; + url += window.location.pathname; + url = url.replace("index", "cluster"); + window.location.replace(url); + } + }); + $(document).ready(function() { window.App = new window.Router(); Backbone.history.start();