diff --git a/webui/src/app/core/providers.resource.js b/webui/src/app/core/providers.resource.js index e785290ba..2aa806a0a 100644 --- a/webui/src/app/core/providers.resource.js +++ b/webui/src/app/core/providers.resource.js @@ -8,7 +8,40 @@ angular .module(traefikCoreProvider, ['ngResource']) .factory('Providers', Providers); - /** @ngInject */ - function Providers($resource) { - return $resource('../api/providers'); - } \ No newline at end of file +/** @ngInject */ +function Providers($resource) { + const resourceProvider = $resource('../api/providers'); + return { + get: function () { + const rawProviders = resourceProvider.get(); + + for (let providerName in rawProviders) { + if (rawProviders.hasOwnProperty(providerName)) { + + // BackEnds mapping + let bckends = rawProviders[providerName].backends; + + rawProviders[providerName].backends = Object.keys(bckends) + .map(key => { + const goodBackend = bckends[key]; + goodBackend.backendId = key; + return goodBackend; + }); + + // FrontEnds mapping + let frtends = rawProviders[providerName].frontends; + + rawProviders[providerName].frontends = Object.keys(frtends) + .map(key => { + const goodFrontend = frtends[key]; + goodFrontend.frontendId = key; + return goodFrontend; + }); + + } + } + + return rawProviders; + } + }; +} diff --git a/webui/src/app/sections/providers/backend-monitor/backend-monitor.directive.js b/webui/src/app/sections/providers/backend-monitor/backend-monitor.directive.js index b05740726..89415db0e 100644 --- a/webui/src/app/sections/providers/backend-monitor/backend-monitor.directive.js +++ b/webui/src/app/sections/providers/backend-monitor/backend-monitor.directive.js @@ -8,8 +8,7 @@ function backendMonitor() { controllerAs: 'backendCtrl', bindToController: true, scope: { - backend: '=', - backendId: '=' + backend: '=' } }; } @@ -18,4 +17,4 @@ function BackendMonitorController() { // Nothing } -module.exports = backendMonitor; \ No newline at end of file +module.exports = backendMonitor; diff --git a/webui/src/app/sections/providers/backend-monitor/backend-monitor.html b/webui/src/app/sections/providers/backend-monitor/backend-monitor.html index 100f03172..6001d1384 100644 --- a/webui/src/app/sections/providers/backend-monitor/backend-monitor.html +++ b/webui/src/app/sections/providers/backend-monitor/backend-monitor.html @@ -1,6 +1,6 @@
- {{backendCtrl.backendId}} + {{backendCtrl.backend.backendId}}
diff --git a/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.directive.js b/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.directive.js index 7b6107202..bdfdfdad5 100644 --- a/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.directive.js +++ b/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.directive.js @@ -8,8 +8,7 @@ function frontendMonitor() { controllerAs: 'frontendCtrl', bindToController: true, scope: { - frontend: '=', - frontendId: '=' + frontend: '=' } }; } diff --git a/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.html b/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.html index eb5f8187f..57c26628e 100644 --- a/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.html +++ b/webui/src/app/sections/providers/frontend-monitor/frontend-monitor.html @@ -1,6 +1,6 @@
- {{frontendCtrl.frontendId}} + {{frontendCtrl.frontend.frontendId}}
diff --git a/webui/src/app/sections/providers/providers.controller.js b/webui/src/app/sections/providers/providers.controller.js index 7898d8a86..8f0a4a273 100644 --- a/webui/src/app/sections/providers/providers.controller.js +++ b/webui/src/app/sections/providers/providers.controller.js @@ -2,17 +2,18 @@ /** @ngInject */ function ProvidersController($scope, $interval, $log, Providers) { - var vm = this; + const vm = this; vm.providers = Providers.get(); - var intervalId = $interval(function () { + const intervalId = $interval(function () { Providers.get(function (providers) { vm.providers = providers; }, function (error) { vm.providers = {}; $log.error(error); }); + }, 2000); $scope.$on('$destroy', function () { @@ -20,4 +21,4 @@ function ProvidersController($scope, $interval, $log, Providers) { }); } -module.exports = ProvidersController; \ No newline at end of file +module.exports = ProvidersController; diff --git a/webui/src/app/sections/providers/providers.html b/webui/src/app/sections/providers/providers.html index fd5557f7f..384b649b3 100644 --- a/webui/src/app/sections/providers/providers.html +++ b/webui/src/app/sections/providers/providers.html @@ -1,16 +1,18 @@
+
+
-
- +
+
-
- +
+
diff --git a/webui/src/app/version/version.controller.js b/webui/src/app/version/version.controller.js index 373f28b06..eb30fdd0e 100644 --- a/webui/src/app/version/version.controller.js +++ b/webui/src/app/version/version.controller.js @@ -1,7 +1,7 @@ 'use strict'; /** @ngInject */ -function VersionController($scope, $interval, $log, Version) { +function VersionController($scope, Version) { Version.get(function (version) { $scope.version = version; });