From ee942f82d665234b6715d4cc2a1f45c686095459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Vachon?= Date: Mon, 16 Feb 2015 15:09:42 -0500 Subject: [PATCH] Custom Views support configurable table header names --- app/components/config/config.json | 52 +++++++++++++++++++++++------- app/custom_views/custom_views.html | 22 ++++++++++--- app/custom_views/custom_views.js | 5 +-- 3 files changed, 60 insertions(+), 19 deletions(-) diff --git a/app/components/config/config.json b/app/components/config/config.json index e700a04..99db4b8 100644 --- a/app/components/config/config.json +++ b/app/components/config/config.json @@ -61,16 +61,44 @@ "apiName": "services", "filters": {} }, - "customViewsConfig": { - "customView1": { - "cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"], - "apiName": "hosts", - "filters": {} - }, - "customView2": { - "cells": ["host", "service_check", "duration", "last_check"], - "apiName": "services", - "filters": {} - } - } + "customViewsConfig": { + "customView1": { + "cells": { + "text": [ + "Host", + "Address", + "Duration", + "Last check", + "Host status" + ], + "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": {} + } + } } diff --git a/app/custom_views/custom_views.html b/app/custom_views/custom_views.html index c254d9b..cf1e87e 100644 --- a/app/custom_views/custom_views.html +++ b/app/custom_views/custom_views.html @@ -1,7 +1,19 @@ -
+
+ +
+ +
+
+
+

Custom View

+
+
+
-

Custom View

+ - - -
+ + diff --git a/app/custom_views/custom_views.js b/app/custom_views/custom_views.js index 74bb0c3..a79c65b 100644 --- a/app/custom_views/custom_views.js +++ b/app/custom_views/custom_views.js @@ -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; }])