Impoved query for text items - get only last value.
This commit is contained in:
@@ -132,7 +132,13 @@ function (angular, _) {
|
||||
|
||||
p.getItems = function() {
|
||||
var params = {
|
||||
output: ['name', 'key_', 'value_type', 'hostid', 'status', 'state'],
|
||||
output: [
|
||||
'name', 'key_',
|
||||
'value_type',
|
||||
'hostid',
|
||||
'status',
|
||||
'state'
|
||||
],
|
||||
sortfield: 'name',
|
||||
selectApplications: []
|
||||
};
|
||||
@@ -140,6 +146,20 @@ function (angular, _) {
|
||||
return this.request('item.get', params);
|
||||
};
|
||||
|
||||
p.getLastValue = function(itemid) {
|
||||
var params = {
|
||||
output: ['lastvalue'],
|
||||
itemids: itemid
|
||||
};
|
||||
return this.request('item.get', params).then(function(items) {
|
||||
if (items.length) {
|
||||
return items[0].lastvalue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform history query from Zabbix API
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user