Fix templatig issue, when no values returned, closes #354

This commit is contained in:
Alexander Zobnin
2017-02-11 16:26:23 +03:00
parent eca809679d
commit 94c24e9be4
8 changed files with 17 additions and 17 deletions

View File

@@ -484,7 +484,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
} }
return result.then(function (metrics) { return result.then(function (metrics) {
return metrics.map(formatMetric); return _.map(metrics, formatMetric);
}); });
} }
}, { }, {

File diff suppressed because one or more lines are too long

View File

@@ -194,14 +194,14 @@ System.register(['angular', 'lodash', './utils', './zabbixAPI.service.js', './za
* Find group, host, app or item by given name. * Find group, host, app or item by given name.
* @param list list of groups, apps or other * @param list list of groups, apps or other
* @param name visible name * @param name visible name
* @return array with finded element or undefined * @return array with finded element or empty array
*/ */
function findByName(list, name) { function findByName(list, name) {
var finded = _.find(list, { 'name': name }); var finded = _.find(list, { 'name': name });
if (finded) { if (finded) {
return [finded]; return [finded];
} else { } else {
return undefined; return [];
} }
} }
@@ -211,14 +211,14 @@ System.register(['angular', 'lodash', './utils', './zabbixAPI.service.js', './za
* which return only first finded. * which return only first finded.
* @param {[type]} list list of elements * @param {[type]} list list of elements
* @param {[type]} name app name * @param {[type]} name app name
* @return {[type]} array with finded element or undefined * @return {[type]} array with finded element or empty array
*/ */
function filterByName(list, name) { function filterByName(list, name) {
var finded = _.filter(list, { 'name': name }); var finded = _.filter(list, { 'name': name });
if (finded) { if (finded) {
return finded; return finded;
} else { } else {
return undefined; return [];
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -378,7 +378,7 @@ var ZabbixAPIDatasource = function () {
} }
return result.then(function (metrics) { return result.then(function (metrics) {
return metrics.map(formatMetric); return _lodash2.default.map(metrics, formatMetric);
}); });
} }

View File

@@ -214,14 +214,14 @@ _angular2.default.module('grafana.services').factory('Zabbix', ZabbixFactory);
* Find group, host, app or item by given name. * Find group, host, app or item by given name.
* @param list list of groups, apps or other * @param list list of groups, apps or other
* @param name visible name * @param name visible name
* @return array with finded element or undefined * @return array with finded element or empty array
*/ */
function findByName(list, name) { function findByName(list, name) {
var finded = _lodash2.default.find(list, { 'name': name }); var finded = _lodash2.default.find(list, { 'name': name });
if (finded) { if (finded) {
return [finded]; return [finded];
} else { } else {
return undefined; return [];
} }
} }
@@ -231,14 +231,14 @@ function findByName(list, name) {
* which return only first finded. * which return only first finded.
* @param {[type]} list list of elements * @param {[type]} list list of elements
* @param {[type]} name app name * @param {[type]} name app name
* @return {[type]} array with finded element or undefined * @return {[type]} array with finded element or empty array
*/ */
function filterByName(list, name) { function filterByName(list, name) {
var finded = _lodash2.default.filter(list, { 'name': name }); var finded = _lodash2.default.filter(list, { 'name': name });
if (finded) { if (finded) {
return finded; return finded;
} else { } else {
return undefined; return [];
} }
} }

View File

@@ -314,7 +314,7 @@ class ZabbixAPIDatasource {
} }
return result.then(metrics => { return result.then(metrics => {
return metrics.map(formatMetric); return _.map(metrics, formatMetric);
}); });
} }

View File

@@ -165,14 +165,14 @@ angular
* Find group, host, app or item by given name. * Find group, host, app or item by given name.
* @param list list of groups, apps or other * @param list list of groups, apps or other
* @param name visible name * @param name visible name
* @return array with finded element or undefined * @return array with finded element or empty array
*/ */
function findByName(list, name) { function findByName(list, name) {
var finded = _.find(list, {'name': name}); var finded = _.find(list, {'name': name});
if (finded) { if (finded) {
return [finded]; return [finded];
} else { } else {
return undefined; return [];
} }
} }
@@ -182,14 +182,14 @@ function findByName(list, name) {
* which return only first finded. * which return only first finded.
* @param {[type]} list list of elements * @param {[type]} list list of elements
* @param {[type]} name app name * @param {[type]} name app name
* @return {[type]} array with finded element or undefined * @return {[type]} array with finded element or empty array
*/ */
function filterByName(list, name) { function filterByName(list, name) {
var finded = _.filter(list, {'name': name}); var finded = _.filter(list, {'name': name});
if (finded) { if (finded) {
return finded; return finded;
} else { } else {
return undefined; return [];
} }
} }