83 lines
1.7 KiB
JavaScript
83 lines
1.7 KiB
JavaScript
/**
|
|
* R3.Query.Alerts.List
|
|
* @param apiComponent
|
|
* @constructor
|
|
*/
|
|
R3.Query.Alerts.List = function(
|
|
apiComponent
|
|
) {
|
|
|
|
__RUNTIME_COMPONENT__;
|
|
|
|
R3.Query.Alerts.call(
|
|
this,
|
|
true
|
|
);
|
|
|
|
};
|
|
|
|
R3.Query.Alerts.List.prototype = Object.create(R3.Query.Alerts.prototype);
|
|
R3.Query.Alerts.List.prototype.constructor = R3.Query.Alerts.List;
|
|
|
|
/**
|
|
* Updates the instance with the current state
|
|
*/
|
|
R3.Query.Alerts.List.prototype.createInstance = function() {
|
|
|
|
this.instance = true;
|
|
|
|
__CREATE_INSTANCE__;
|
|
|
|
};
|
|
|
|
/**
|
|
* Updates the instance with the current state
|
|
*/
|
|
R3.Query.Alerts.List.prototype.updateInstance = function(property) {
|
|
|
|
R3.Query.Alerts.prototype.updateInstance.call(this, property);
|
|
|
|
};
|
|
|
|
R3.Query.Alerts.List.prototype.parse = function(data) {
|
|
|
|
this.columns = [
|
|
{
|
|
type : 'datetime',
|
|
name : 'Time'
|
|
},
|
|
{
|
|
type : 'number',
|
|
name : 'Priority'
|
|
},
|
|
{
|
|
type : 'string',
|
|
name : 'Alert Type'
|
|
},
|
|
{
|
|
type : 'boolean',
|
|
name : 'Acknowledged'
|
|
}
|
|
];
|
|
|
|
this.rows = data.hits.hits.reduce(
|
|
function(result, hit) {
|
|
|
|
var row = [];
|
|
row.push(new Date(hit._source.timestamp));
|
|
row.push(hit._source.priority);
|
|
row.push(hit._source.alert_type);
|
|
row.push(hit._source.acknowledged);
|
|
// if (hit._source.acknowledged) {
|
|
// row.push({v:'ButtonName', f:'<input type="button" value="test" />'});
|
|
// } else {
|
|
// row.push({v:'ButtonName', f:'<input type="button" value="test" />'});
|
|
// }
|
|
result.push(row);
|
|
return result;
|
|
},
|
|
[]
|
|
);
|
|
|
|
};
|