Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Jul 29, 2023
1 parent 9473e29 commit 304d383
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lib/karafka/web/ui/public/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Nicer display of time distance from a given event
function updateTimeAgo() {
var selection = document.querySelectorAll('time');

Expand All @@ -7,11 +8,15 @@ function updateTimeAgo() {
}
}

// To prevent from flickering, the UI is initially hidden and visible when all the JS components
// are fully initialized
function displayUi() {
var content = document.getElementById('content');
content.style.display = 'inherit';
}

// When using explorer, we can select the desired partition. This code redirects without having
// to press a button after a select
function redirectToPartition() {
var selector = document.getElementById('current-partition');

Expand All @@ -31,8 +36,8 @@ function addListeners() {
updateTimeAgo();
redirectToPartition();
manageTabs();
displayUi();
manageCharts();
displayUi();
}

var ready = (callback) => {
Expand Down
6 changes: 4 additions & 2 deletions lib/karafka/web/ui/public/javascripts/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ function refreshCharts(new_doc) {
{
data: datasets[key],
label: key,
hidden: disabled_sets.includes(i)
hidden: disabled_sets.includes(i),
borderWidth: 2.5
}
)
})
Expand Down Expand Up @@ -314,7 +315,8 @@ function renderCharts() {
{
data: datasets[key],
label: key,
hidden: disabled_sets.includes(i)
hidden: disabled_sets.includes(i),
borderWidth: 2.5
}
)
})
Expand Down
4 changes: 3 additions & 1 deletion lib/karafka/web/ui/public/javascripts/live_poll.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// inspired by https://github.com/mperham/sidekiq JS code
// Inspired by https://github.com/mperham/sidekiq JS code
//
// Live polls changes but won't refresh DOM if the payload is the same and will stop polling if
// user is selecting anything.
//
// In case of pages with charts, DOM won't be refreshed but charts will be updated

var livePollTimer = null;
var oldDOM = null;
Expand Down
5 changes: 5 additions & 0 deletions lib/karafka/web/ui/public/javascripts/tabs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Bootstrap tabs management with local storage for selected tab + restore
//
// Because we have pages where tabs are under the same view and some of them include charts, we
// keep track of them and in case user is back, we restore the last tab that was active

function readAllActiveTabs() {
let raw_active_tabs = localStorage.karafkaActiveTabs

Expand Down

0 comments on commit 304d383

Please sign in to comment.