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

@ -61,16 +61,44 @@
"apiName": "services", "apiName": "services",
"filters": {} "filters": {}
}, },
"customViewsConfig": { "customViewsConfig": {
"customView1": { "customView1": {
"cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"], "cells": {
"apiName": "hosts", "text": [
"filters": {} "Host",
}, "Address",
"customView2": { "Duration",
"cells": ["host", "service_check", "duration", "last_check"], "Last check",
"apiName": "services", "Host status"
"filters": {} ],
} "name": [
} "hosts_host",
"host_address",
"duration",
"last_check",
"host_status"
]
},
"apiName": "hosts",
"filters": {}
},
"customView2": {
"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> <section class="main__content tabpanel">
<adg-table cells="{{customViewCells}}" api-name="{{customViewApiName}}" filters="{{customViewFilters}}"></adg-table> <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>
</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) { if (!!$routeParams.view) {
viewName = $routeParams.view; viewName = $routeParams.view;
} else { } 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; 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.customViewApiName = customViewsConfig[viewName].apiName;
$scope.customViewFilters = customViewsConfig[viewName].filters; $scope.customViewFilters = customViewsConfig[viewName].filters;
}]) }])