-
Queues
-
View and monitor bus events and notifications.
+
+
+
Queues
+
View and monitor bus events and notifications.
+
+ <%= render "kaui/components/button/button", {
+ label: "Download JSON",
+ icon: 'kaui/download.svg',
+ html_class: "kaui-button custom-hover",
+ variant: "btn-outline-secondary d-inline-flex align-items-center gap-1",
+ type: "button",
+ html_options: {
+ id: "queuesDownloadButton",
+ onclick: "downloadActiveQueuesTab()"
+ }
+ } %>
@@ -139,7 +152,7 @@
<%= truncate_millis(bus_event['createdDate']) %> |
-
<%= truncate_class_name(bus_event['className'], false) %> |
+
<%= truncate_class_name(bus_event['className'], false) %> |
<%= "#{JSON.pretty_generate(bus_event['event'])}".html_safe %> |
<%= bus_event['userToken'] %> |
<% if @account_id.blank? %>
@@ -278,6 +291,62 @@
<%= javascript_tag do %>
+ function downloadActiveQueuesTab() {
+ var activeTab = $('#queuesNavTabs .nav-link.active').attr('id');
+ var tableId, filename;
+ if (activeTab === 'notifications-tab') {
+ tableId = '#notifications-table';
+ filename = 'notifications-' + new Date().toISOString().split('T')[0] + '.json';
+ } else {
+ tableId = '#bus-table';
+ filename = 'bus-events-' + new Date().toISOString().split('T')[0] + '.json';
+ }
+
+ var table = $(tableId).DataTable();
+ var headers = [];
+ var visibleColumnIndexes = [];
+
+ $(tableId + ' thead th').each(function(index) {
+ if (index === 0) return; // skip timeline dot column
+ var column = table.column(index);
+ if (column.visible()) {
+ var headerText = $(this).find('.header-text').text().trim();
+ headers.push(headerText);
+ visibleColumnIndexes.push(index);
+ }
+ });
+
+ var jsonRows = [];
+
+ table.rows({ search: 'applied' }).nodes().each(function(row) {
+ var cells = $(row).find('td');
+ var obj = {};
+ visibleColumnIndexes.forEach(function(colIdx, i) {
+ var $cell = $(cells[colIdx]);
+ var fullValue = $cell.data('full-value');
+ var cellText = fullValue !== undefined ? String(fullValue) : $cell.text().trim();
+ var key = headers[i];
+ try {
+ obj[key] = JSON.parse(cellText);
+ } catch (e) {
+ obj[key] = cellText;
+ }
+ });
+ jsonRows.push(obj);
+ });
+
+ var jsonContent = JSON.stringify(jsonRows, null, 2);
+ var blob = new Blob([jsonContent], { type: 'application/json;charset=utf-8;' });
+ var url = URL.createObjectURL(blob);
+ var a = document.createElement('a');
+ a.href = url;
+ a.download = filename;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ }
+
$(document).ready(function() {
var busTable = $('#bus-table').DataTable({
"dom": "t<'row dt-footer-row'<'col-md-6'i><'col-md-6'p>>",
diff --git a/app/views/kaui/subscriptions/edit_bcd.erb b/app/views/kaui/subscriptions/edit_bcd.erb
index 983b0f900..46ee8da9a 100644
--- a/app/views/kaui/subscriptions/edit_bcd.erb
+++ b/app/views/kaui/subscriptions/edit_bcd.erb
@@ -31,7 +31,7 @@
-
+