Custom Views support configurable table header names

This commit is contained in:
Frédéric Vachon 2015-02-16 15:09:42 -05:00
parent a254b8ab6c
commit ee942f82d6
3 changed files with 60 additions and 19 deletions

View File

@ -63,12 +63,40 @@
},
"customViewsConfig": {
"customView1": {
"cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"],
"cells": {
"text": [
"Host",
"Address",
"Duration",
"Last check",
"Host status"
],
"name": [
"hosts_host",
"host_address",
"duration",
"last_check",
"host_status"
]
},
"apiName": "hosts",
"filters": {}
},
"customView2": {
"cells": ["host", "service_check", "duration", "last_check"],
"cells": {
"text": [
"Host",
"Service check",
"Duration",
"Last check"
],
"name": [
"host",
"service_check",
"duration",
"last_check"
]
},
"apiName": "services",
"filters": {}
}

View File

@ -1,7 +1,19 @@
<div ng-controller="CustomViewsCtrl" id="tactical">
<article ng-controller="CustomViewsCtrl" id="tactical">
<h2>Custom View</h2>
<adg-table cells="{{customViewCells}}" api-name="{{customViewApiName}}" filters="{{customViewFilters}}"></adg-table>
<section class="main__content tabpanel">
<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>
</header>
</div>
</div>
<adg-table cells-name="{{customViewCellsName}}"
cells-text="{{customViewCellsText}}"
api-name="{{customViewApiName}}"
filters="{{customViewFilters}}">
</section>
</article>

View File

@ -23,11 +23,12 @@ angular.module('adagios.view.custom', ['ngRoute',
if (!!$routeParams.view) {
viewName = $routeParams.view;
} else {
console.log("ERROR : 'view' GET parameter must be the custom view name");
console.error("ERROR : 'view' GET parameter must be the custom view name");
return;
}
$scope.customViewCells = customViewsConfig[viewName].cells.join();
$scope.customViewCellsText = customViewsConfig[viewName].cells.text.join();
$scope.customViewCellsName = customViewsConfig[viewName].cells.name.join();
$scope.customViewApiName = customViewsConfig[viewName].apiName;
$scope.customViewFilters = customViewsConfig[viewName].filters;
}])