Customizable view title

This commit is contained in:
Frédéric Vachon 2015-02-16 15:29:30 -05:00
parent ee942f82d6
commit 3420ac0901
11 changed files with 25 additions and 12 deletions

View File

@ -1,5 +1,6 @@
{
"dashboardConfig": {
"title": "Unhandled service problems",
"cells": {
"text": [
"Host",
@ -24,6 +25,7 @@
}
},
"hostsConfig": {
"title": "Hosts",
"cells": {
"text": [
"Host",
@ -44,6 +46,7 @@
"filters": {}
},
"servicesConfig": {
"title": "Services",
"cells": {
"text": [
"Host",
@ -63,6 +66,7 @@
},
"customViewsConfig": {
"customView1": {
"title": "Custom View 1",
"cells": {
"text": [
"Host",
@ -83,6 +87,7 @@
"filters": {}
},
"customView2": {
"title": "Custom View 2",
"cells": {
"text": [
"Host",

View File

@ -3,9 +3,9 @@
angular.module('adagios.table.cell_host', ['adagios.table'])
.controller('CellHostCtrl', ['$scope', function ($scope) {
if ($scope.entry.host_state == 0) {
if ($scope.entry.host_state === 0) {
$scope.state = 'state--ok';
} else if ($scope.entry.host_state == 1) {
} else if ($scope.entry.host_state === 1) {
$scope.state = 'state--warning';
} else {
$scope.state = 'state--error';

View File

@ -3,9 +3,9 @@
angular.module('adagios.table.cell_service_check', ['adagios.table'])
.controller('CellServiceCheckCtrl', ['$scope', function ($scope) {
if ($scope.entry.state == 0) {
if ($scope.entry.state === 0) {
$scope.state = 'state--ok';
} else if ($scope.entry == 1) {
} else if ($scope.entry === 1) {
$scope.state = 'state--warning';
} else {
$scope.state = 'state--error';

View File

@ -19,13 +19,14 @@ angular.module('adagios.table', ['adagios.live',
.controller('TableCtrl', ['$scope', 'getServices', 'readConfig', 'tableConfig', function ($scope, getServices, readConfig, tableConfig) {
var requestFields = [],
filters = JSON.parse(tableConfig.filters);
filters = JSON.parse(tableConfig.filters),
i;
$scope.cellsName = tableConfig.cells.name;
$scope.cellsText = tableConfig.cells.text;
$scope.cellIndexes = [];
for (var i = 0; i < $scope.cellsName.length; i++) {
for (i = 0; i < $scope.cellsName.length; i += 1) {
$scope.cellIndexes.push(i);
}

View File

@ -5,7 +5,7 @@
<div class="tab-content">
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
<header class="main__content__header clearfix">
<h2 class="main__content__title">Custom View</h2>
<h2 class="main__content__title">{{customViewTitle}}</h2>
</header>
</div>
</div>

View File

@ -27,6 +27,7 @@ angular.module('adagios.view.custom', ['ngRoute',
return;
}
$scope.customViewTitle = customViewsConfig[viewName].title;
$scope.customViewCellsText = customViewsConfig[viewName].cells.text.join();
$scope.customViewCellsName = customViewsConfig[viewName].cells.name.join();
$scope.customViewApiName = customViewsConfig[viewName].apiName;

View File

@ -15,6 +15,7 @@ angular.module('adagios.view.dashboard', ['ngRoute',
}])
.controller('DashboardCtrl', ['$scope', 'dashboardConfig', function ($scope, dashboardConfig) {
$scope.dashboardTitle = dashboardConfig.title;
$scope.dashboardCellsText = dashboardConfig.cellsText.join();
$scope.dashboardCellsName = dashboardConfig.cellsName.join();
$scope.dashboardApiName = dashboardConfig.apiName;
@ -22,6 +23,7 @@ angular.module('adagios.view.dashboard', ['ngRoute',
}])
.run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) {
dashboardConfig.title = readConfig.data.dashboardConfig.title;
dashboardConfig.cellsText = readConfig.data.dashboardConfig.cells.text;
dashboardConfig.cellsName = readConfig.data.dashboardConfig.cells.name;
dashboardConfig.apiName = readConfig.data.dashboardConfig.apiName;

View File

@ -5,7 +5,7 @@
<div class="tab-content">
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
<header class="main__content__header clearfix">
<h2 class="main__content__title">Hosts</h2>
<h2 class="main__content__title">{{hostsTitle}}</h2>
</header>
</div>
</div>

View File

@ -14,6 +14,7 @@ angular.module('adagios.view.hosts', ['ngRoute',
}])
.controller('HostsCtrl', ['$scope', 'hostsConfig', function ($scope, hostsConfig) {
$scope.hostsTitle = hostsConfig.title;
$scope.hostsCellsText = hostsConfig.cellsText.join();
$scope.hostsCellsName = hostsConfig.cellsName.join();
$scope.hostsApiName = hostsConfig.apiName;
@ -21,6 +22,7 @@ angular.module('adagios.view.hosts', ['ngRoute',
}])
.run(['readConfig', 'hostsConfig', function (readConfig, hostsConfig) {
hostsConfig.title = readConfig.data.hostsConfig.title;
hostsConfig.cellsText = readConfig.data.hostsConfig.cells.text;
hostsConfig.cellsName = readConfig.data.hostsConfig.cells.name;
hostsConfig.apiName = readConfig.data.hostsConfig.apiName;

View File

@ -5,7 +5,7 @@
<div class="tab-content">
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
<header class="main__content__header clearfix">
<h2 class="main__content__title">Services</h2>
<h2 class="main__content__title">{{servicesTitle}}</h2>
</header>
</div>
</div>

View File

@ -14,6 +14,7 @@ angular.module('adagios.view.services', ['ngRoute',
}])
.controller('ServicesCtrl', ['$scope', 'servicesConfig', function ($scope, servicesConfig) {
$scope.servicesTitle = servicesConfig.title;
$scope.servicesCellsText = servicesConfig.cellsText.join();
$scope.servicesCellsName = servicesConfig.cellsName.join();
$scope.servicesApiName = servicesConfig.apiName;
@ -21,6 +22,7 @@ angular.module('adagios.view.services', ['ngRoute',
}])
.run(['readConfig', 'servicesConfig', function (readConfig, servicesConfig) {
servicesConfig.title = readConfig.data.servicesConfig.title;
servicesConfig.cellsText = readConfig.data.servicesConfig.cells.text;
servicesConfig.cellsName = readConfig.data.servicesConfig.cells.name;
servicesConfig.apiName = readConfig.data.servicesConfig.apiName;