0
0
mirror of https://github.com/alerta/alerta.git synced 2024-12-04 12:57:32 +00:00
alerta_alerta/examples/oembed.html
Andrey Kuzmin cc8f93000c Oembed fix (#853)
* Fix oembed.

Use usual json (not jsonp request) with Access-Control-Allow-Origin header.
Correct path to oembed location.

* Move styling to embedding page from embedded to simplify configure.

Removed width/height from parameters.
Allow to hide title.

* More powerfull oembed.

Auto-renew.
Ability to open page locally (we heed to set http/https prefixes).
Fix loading: we need to set alerta defaults only after script loading.

* oembed example for grafana.

* Remove unused width/height from js.

* Ability to set empty background in case of no alerts.

* Oembed work fix.

qb.from_params forms incorrect arguments for query.

* Grafana load fix.

Grafana won't load script on "load". So it's better to embed js.

* Revert api path to usual environment prefix.

But leave a comment, how to use it with alerta, running in docker.
2019-03-24 20:57:21 +01:00

46 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<link href='http://fonts.googleapis.com/css?family=Sintony:700' rel='stylesheet' type='text/css'>
</head>
<body>
<style>
.alerta-div {width:100%; padding:20px;}
.alerta-table {width:100%; border:1px solid lightgrey; text-align:center;}
</style>
<div class="mobile-alerts">Loading...</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!-- Use http://localhost:8080/api/embed.js if you run docker image with alerta. -->
<script src="http://localhost:8080/embed.js"></script>
<script>
$(window).on('load', function () {
// Use http://localhost:8080/api as endpoint, if you run docker image with alerta.
//
// $.alerta.defaults.endpoint = 'http://localhost:8080';
// $.alerta.defaults.key = 'demo-key';
// or
$.alerta.defaults = {
endpoint: 'http://localhost:8080', // oEmbed endpoint becomes http://localhost:8080/oembed
key: 'demo-key'
};
function renew() {
$('.mobile-alerts').alerta('http://localhost:8080/alerts/count?service=Mobile&status=open', {title:'Mobile Service'});
setTimeout(renew, 30000);
}
renew();
});
</script>
</body>
</html>