diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-07-11 23:38:14 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-13 18:26:03 +0200 |
commit | a5593d66ea541dfbcd2597f81dcbc51965c51cfc (patch) | |
tree | e778fa93380d0244bfd8d115143996bad51612aa /ishtar_common/static/js | |
parent | 05495e0b37da09deb7b7d2e5629112a046042836 (diff) | |
download | Ishtar-a5593d66ea541dfbcd2597f81dcbc51965c51cfc.tar.bz2 Ishtar-a5593d66ea541dfbcd2597f81dcbc51965c51cfc.zip |
Manage alerts
Diffstat (limited to 'ishtar_common/static/js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index a71450fab..60840bcf8 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -38,7 +38,10 @@ function manage_async_link(event){ function get_next_table_id(){} function get_previous_table_id(){} +var datatable_submit_search = function() {}; + var shortcut_url = ''; +var alert_url = ''; var datatables_i18n; var current_modal; @@ -222,6 +225,7 @@ function load_shortcut_menu(opened){ cache: false, success:function(html){ init_shortcut_menu(html); + load_alerts(); if(opened){ $("#dropdown-toggle-shortcut-menu").click(); } @@ -232,6 +236,34 @@ function load_shortcut_menu(opened){ }); } +var load_alerts = function(){ + if (!alert_url) return; + $('.modal-progress').modal('show'); + $.ajax({ + url: alert_url, + cache: false, + success:function(json){ + $('.modal-progress').modal('hide'); + var html = ""; + for (idx in json["alerts"]){ + var b = json["alerts"][idx]; + var url = "/bookmark/" + b["query_id"] + "/" ; + html += '<a class="badge badge-secondary" href="' + url + '">'; + html += b["label"]; + html += ' <span class="badge badge-light">'; + html += b["number"]; + html += '</span>'; + html += '</a> '; + } + $("#alert-list").html(html); + }, + error:function(XMLHttpRequest, textStatus, errorThrows){ + close_wait(); + }, + dataType: 'json' + }); +} + function dynamic_load(url, target){ $.ajax({ url: url, |