Created
February 23, 2020 19:26
-
-
Save abom/016643ce29dd01a4e1d5fdacf9915ca9 to your computer and use it in GitHub Desktop.
ansihtml.js can be found here https://github.com/agnoster/ansi2html/blob/master/lib/index.js (just copy and rename).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<link rel="stylesheet" href="codebase/webix.css" type="text/css"> | |
<script src="codebase/webix.js" type="text/javascript"></script> | |
<script src="ansi2html.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<script type="text/javascript" charset="utf-8"> | |
webix.ui({ | |
rows:[ | |
{ | |
view:"template", | |
type:"header", template:"Alert test app" | |
}, | |
{ | |
view:"datatable", | |
id: "alerts_table", | |
resizeColumn:true, | |
columns:[ | |
{ | |
id:"index", | |
header:"#", | |
sort: "int", | |
autowidth: true, | |
}, | |
{ id:"alert_type", header:"Type", sort: "string"}, | |
{ id:"status", header:"Status", sort: "string"}, | |
{ id:"level", header:"Level", sort: "int"}, | |
{ id: "cat", | |
header: [ | |
{ content:"textFilter" }, | |
"Title" | |
], | |
sort: "string"}, | |
{ id: "time_first", header: "First time", sort: "date", format: webix.Date.dateToStr("%Y-%m-%d %H %G:%i:%s"), width: 200}, | |
{ id: "time_last", header: "Last time", sort: "date", format: webix.Date.dateToStr("%Y-%m-%d %G:%i:%s"), width: 200}, | |
{ id: "message", header: [{ content:"textFilter" }, "Message"], sort: "str", fillspace: true, format: function(value) { | |
return ansi2html(value); | |
}}, | |
], | |
autoConfig:true, | |
// url:{ | |
// $proxy:true, | |
// load: function(view, params){ | |
// let data = webix.ajax("/zerobot/alerta/actors/alerta/list_alerts"); | |
// return data; | |
// }, | |
// } | |
scheme:{ | |
$init:function(obj){ obj.index = this.count(); } | |
}, | |
} | |
] | |
}); | |
webix.extend($$("alerts_table"), webix.ProgressBar); | |
webix.ready(function() { | |
$$("alerts_table").clearAll(); | |
$$("alerts_table").showProgress({hide:false}); | |
webix.ajax().get("/zerobot/alerta/actors/alerta/list_alerts", function(data) { | |
let alerts = JSON.parse(data).alerts; | |
$$('alerts_table').parse(alerts); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment