diff --git a/Gruntfile.js b/Gruntfile.js index 4cc3f93..11382e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -109,9 +109,9 @@ module.exports = function (grunt) { '<%= project.app %>/components/table/cell_hosts_host/cell_hosts_host.js', '<%= project.app %>/components/table/cell_host_address/cell_host_address.js', '<%= project.app %>/components/table/cell_host_status/cell_host_status.js', - '<%= project.app %>/dashboard/dashboard.js', '<%= project.app %>/routing_view/routing_view.js', - '<%= project.app %>/single_table/single_table.js' + '<%= project.app %>/templates/dashboard/dashboard.js', + '<%= project.app %>/templates/single_table/single_table.js' ] }], options: { @@ -143,9 +143,9 @@ module.exports = function (grunt) { '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js': '<%= project.app %>/components/table/cell_hosts_host/cell_hosts_host.js', '<%= project.build %>/components/table/cell_host_address/cell_host_address.js': '<%= project.app %>/components/table/cell_host_address/cell_host_address.js', '<%= project.build %>/components/table/cell_host_status/cell_host_status.js': '<%= project.app %>/components/table/cell_host_status/cell_host_status.js', - '<%= project.build %>/dashboard/dashboard.js': '<%= project.app %>/dashboard/dashboard.js', '<%= project.build %>/routing_view/routing_view.js': '<%= project.app %>/routing_view/routing_view.js', - '<%= project.build %>/single_table/single_table.js' : '<%= project.app %>/single_table/single_table.js' + '<%= project.build %>/templates/dashboard/dashboard.js': '<%= project.app %>/templates/dashboard/dashboard.js', + '<%= project.build %>/templates/single_table/single_table.js' : '<%= project.app %>/templates/single_table/single_table.js' }, { '<%= project.build %>/js/adagios.min.js' : [ @@ -171,9 +171,9 @@ module.exports = function (grunt) { '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js', '<%= project.build %>/components/table/cell_host_address/cell_host_address.js', '<%= project.build %>/components/table/cell_host_status/cell_host_status.js', - '<%= project.build %>/dashboard/dashboard.js', '<%= project.build %>/routing_view/routing_view.js', - '<%= project.build %>/single_table/single_table.js' + '<%= project.build %>/templates/dashboard/dashboard.js', + '<%= project.build %>/templates/single_table/single_table.js' ] } ], diff --git a/app/app.js b/app/app.js index f759bf5..588167d 100644 --- a/app/app.js +++ b/app/app.js @@ -28,8 +28,8 @@ angular.module('adagios', [ }]) // Reinitialise objects on url change - .run(['$rootScope', 'reinitTables', function($rootScope, reinitTables) { - $rootScope.$on('$locationChangeStart', function() { + .run(['$rootScope', 'reinitTables', function ($rootScope, reinitTables) { + $rootScope.$on('$locationChangeStart', function () { reinitTables(); }); }]); diff --git a/app/components/config/config.json b/app/components/config/config.json index ffeab98..51e8c01 100644 --- a/app/components/config/config.json +++ b/app/components/config/config.json @@ -147,7 +147,7 @@ "hostsConfig": { "title": "Hosts", "refreshInterval": 0, - "template": "singleTable", + "template": "single_table", "components": [ { "type": "table", @@ -180,7 +180,7 @@ "servicesConfig": { "title": "Services", "refreshInterval": 0, - "template": "singleTable", + "template": "single_table", "components": [{ "type": "table", "config": { diff --git a/app/components/sidebar/sidebar.html b/app/components/sidebar/sidebar.html index 0ba87cb..b92ca14 100644 --- a/app/components/sidebar/sidebar.html +++ b/app/components/sidebar/sidebar.html @@ -22,9 +22,9 @@ diff --git a/app/routing_view/routing_view.js b/app/routing_view/routing_view.js index 8c27ef4..bfd3003 100644 --- a/app/routing_view/routing_view.js +++ b/app/routing_view/routing_view.js @@ -16,7 +16,13 @@ angular.module('adagios.view', ['ngRoute', .controller('ViewCtrl', ['$scope', '$routeParams', 'viewsTemplate', function ($scope, $routeParams, viewsTemplate) { var templateName = viewsTemplate[$routeParams.view], - templateUrl = templateName + '/' + templateName + '.html'; + templateUrl = 'templates/' + templateName + '/' + templateName + '.html'; + + if (!!$routeParams.view) { + $scope.viewName = $routeParams.view; + } else { + throw new Error("ERROR : 'view' GET parameter must be the custom view name"); + } $scope.templateUrl = templateUrl; }]) diff --git a/app/dashboard/dashboard.html b/app/templates/dashboard/dashboard.html similarity index 98% rename from app/dashboard/dashboard.html rename to app/templates/dashboard/dashboard.html index 6e81202..4db0a83 100644 --- a/app/dashboard/dashboard.html +++ b/app/templates/dashboard/dashboard.html @@ -1,4 +1,4 @@ -
+

{{dashboardTactical[0].title}}

diff --git a/app/dashboard/dashboard.js b/app/templates/dashboard/dashboard.js similarity index 83% rename from app/dashboard/dashboard.js rename to app/templates/dashboard/dashboard.js index a760bfc..ecad763 100644 --- a/app/dashboard/dashboard.js +++ b/app/templates/dashboard/dashboard.js @@ -8,14 +8,7 @@ angular.module('adagios.view.dashboard', ['ngRoute', .value('dashboardConfig', {}) - .config(['$routeProvider', function ($routeProvider) { - $routeProvider.when('/dashboard', { - templateUrl: 'dashboard/dashboard.html', - controller: 'DashboardCtrl' - }); - }]) - - .controller('DashboardCtrl', ['$scope', '$routeParams', 'dashboardConfig', 'getServices', + .controller('DashboardCtrl', ['$scope', '$routeParams', 'dashboardConfig', 'getServices', 'TableConfigObj', 'TacticalConfigObj', 'getHostOpenProblems', 'getServiceOpenProblems', 'getHostProblems', 'getServiceProblems', function ($scope, $routeParams, dashboardConfig, getServices, TableConfigObj, @@ -23,15 +16,9 @@ angular.module('adagios.view.dashboard', ['ngRoute', var components = [], component, config, - viewName, + viewName = $scope.viewName, i = 0; - if (!!$routeParams.view) { - viewName = $routeParams.view; - } else { - throw new Error("ERROR : 'view' GET parameter must be the custom view name"); - } - $scope.dashboardTitle = dashboardConfig[viewName].title; $scope.dashboardTemplate = dashboardConfig[viewName].template; $scope.dashboardRefreshInterval = dashboardConfig[viewName].refreshInterval; diff --git a/app/single_table/single_table.html b/app/templates/single_table/single_table.html similarity index 93% rename from app/single_table/single_table.html rename to app/templates/single_table/single_table.html index 502d248..dca7b53 100644 --- a/app/single_table/single_table.html +++ b/app/templates/single_table/single_table.html @@ -1,4 +1,4 @@ -
+
diff --git a/app/single_table/single_table.js b/app/templates/single_table/single_table.js similarity index 69% rename from app/single_table/single_table.js rename to app/templates/single_table/single_table.js index c4e163c..525a400 100644 --- a/app/single_table/single_table.js +++ b/app/templates/single_table/single_table.js @@ -9,22 +9,9 @@ angular.module('adagios.view.singleTable', ['ngRoute', .value('singleTableConfig', {}) - .config(['$routeProvider', function ($routeProvider) { - $routeProvider.when('/singleTable', { - templateUrl: 'single_table/single_table.html', - controller: 'SingleTableCtrl' - }); - }]) - .controller('SingleTableCtrl', ['$scope', '$routeParams', 'singleTableConfig', 'TableConfigObj', function ($scope, $routeParams, singleTableConfig, TableConfigObj) { - var viewName = ""; - - if (!!$routeParams.view) { - viewName = $routeParams.view; - } else { - throw new Error("ERROR : 'view' GET parameter must be the custom view name"); - } + var viewName = $scope.viewName; $scope.tableConfig = new TableConfigObj(singleTableConfig[viewName].components[0].config); @@ -36,7 +23,7 @@ angular.module('adagios.view.singleTable', ['ngRoute', var viewsConfig = readConfig.data; angular.forEach(viewsConfig, function (config, view) { - if (config.template === 'singleTable') { + if (config.template === 'single_table') { singleTableConfig[view] = config; } });