karafka-web 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +3 -3
- data/karafka-web.gemspec +1 -1
- data/lib/karafka/web/pro/ui/app.rb +35 -0
- data/lib/karafka/web/pro/ui/controllers/scheduled_messages/base_controller.rb +29 -0
- data/lib/karafka/web/pro/ui/controllers/scheduled_messages/explorer_controller.rb +65 -0
- data/lib/karafka/web/pro/ui/controllers/scheduled_messages/schedules_controller.rb +84 -0
- data/lib/karafka/web/pro/ui/views/explorer/_partition_option.erb +10 -2
- data/lib/karafka/web/pro/ui/views/recurring_tasks/_not_active.erb +1 -1
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/_breadcrumbs.erb +30 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/_message.erb +84 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/_messages.erb +28 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/partition.erb +72 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/explorer/topic.erb +33 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/_breadcrumbs.erb +21 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/_no_groups.erb +11 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/index.erb +38 -0
- data/lib/karafka/web/pro/ui/views/scheduled_messages/schedules/show.erb +48 -0
- data/lib/karafka/web/pro/ui/views/search/_breadcrumbs.erb +1 -0
- data/lib/karafka/web/pro/ui/views/shared/_navigation.erb +10 -0
- data/lib/karafka/web/tracking/consumers/listeners/errors.rb +3 -1
- data/lib/karafka/web/ui/base.rb +1 -1
- data/lib/karafka/web/ui/controllers/base_controller.rb +18 -3
- data/lib/karafka/web/ui/helpers/application_helper.rb +21 -7
- data/lib/karafka/web/ui/helpers/paths_helper.rb +18 -0
- data/lib/karafka/web/ui/models/recurring_tasks/log.rb +0 -11
- data/lib/karafka/web/ui/models/recurring_tasks/schedule.rb +0 -11
- data/lib/karafka/web/ui/models/recurring_tasks/task.rb +0 -11
- data/lib/karafka/web/ui/public/javascripts/application.min.js +1 -1
- data/lib/karafka/web/ui/public/javascripts/application.min.js.br +0 -0
- data/lib/karafka/web/ui/public/javascripts/application.min.js.gz +0 -0
- data/lib/karafka/web/ui/public/javascripts/components/live_poll.js +15 -0
- data/lib/karafka/web/ui/public/stylesheets/application.min.css +1 -1
- data/lib/karafka/web/ui/public/stylesheets/application.min.css.br +0 -0
- data/lib/karafka/web/ui/public/stylesheets/application.min.css.gz +0 -0
- data/lib/karafka/web/ui/public/stylesheets/libs/tailwind.css +1 -1
- data/lib/karafka/web/ui/views/shared/_breadcrumbs.erb +1 -1
- data/lib/karafka/web/ui/views/shared/_navigation.erb +10 -0
- data/lib/karafka/web/ui/views/shared/icons/_calendar.erb +3 -0
- data/lib/karafka/web/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +19 -5
- metadata.gz.sig +0 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
<% view_title @schedule_name %>
|
2
|
+
|
3
|
+
<% @states.each do |partition, details| %>
|
4
|
+
<h3 class="h3">
|
5
|
+
Partition <%= partition %>
|
6
|
+
</h3>
|
7
|
+
|
8
|
+
<% if details %>
|
9
|
+
<div class="data-table-wrapper">
|
10
|
+
<table class="data-table">
|
11
|
+
<thead>
|
12
|
+
<tr>
|
13
|
+
<th>Date</th>
|
14
|
+
<th>For Dispatch</th>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
<% details[:daily].each do |date, for_dispatch| %>
|
19
|
+
<tr>
|
20
|
+
<td><%= date %></td>
|
21
|
+
<td><%= for_dispatch %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<p class="table_metadata">
|
28
|
+
Metadata:
|
29
|
+
<span class="badge">
|
30
|
+
Schema version: <%= details[:schema_version] %>
|
31
|
+
</span>
|
32
|
+
|
33
|
+
<span class="badge">
|
34
|
+
Reported at:
|
35
|
+
<%== relative_time(details[:dispatched_at]) %>
|
36
|
+
</span>
|
37
|
+
|
38
|
+
<span class="badge badge-<%= details[:state] == 'loaded' ? 'success' : 'warning' %>">
|
39
|
+
State: <%= details[:state] %>
|
40
|
+
</span>
|
41
|
+
</p>
|
42
|
+
</div>
|
43
|
+
<% else %>
|
44
|
+
<div class="mb-4">
|
45
|
+
<%== alert_warning 'No state information for this partition is available.' %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%== partial 'explorer/breadcrumbs' %>
|
@@ -72,6 +72,16 @@
|
|
72
72
|
</a>
|
73
73
|
</li>
|
74
74
|
|
75
|
+
<li>
|
76
|
+
<a
|
77
|
+
class="sidebar-nav-item <%= nav_class(start_with: '/scheduled_messages') %>"
|
78
|
+
href="<%= root_path('scheduled_messages') %>"
|
79
|
+
>
|
80
|
+
<%== icon(:calendar) %>
|
81
|
+
Schedules
|
82
|
+
</a>
|
83
|
+
</li>
|
84
|
+
|
75
85
|
<li>
|
76
86
|
<a
|
77
87
|
class="sidebar-nav-item <%= nav_class(start_with: '/errors') %>"
|
@@ -73,7 +73,9 @@ module Karafka
|
|
73
73
|
partition: consumer.partition,
|
74
74
|
first_offset: consumer.messages.metadata.first_offset,
|
75
75
|
last_offset: consumer.messages.metadata.last_offset,
|
76
|
-
|
76
|
+
# We set it to -1000 if non-existent because after subtracting one, we will end up
|
77
|
+
# with -1001, which is "N/A" offset position for all the offsets here
|
78
|
+
committed_offset: (consumer.coordinator.seek_offset || -1_000) - 1,
|
77
79
|
consumer: consumer.class.to_s,
|
78
80
|
tags: consumer.tags
|
79
81
|
}
|
data/lib/karafka/web/ui/base.rb
CHANGED
@@ -133,7 +133,7 @@ module Karafka
|
|
133
133
|
# @param query_data [Hash] query params we want to add to the current path
|
134
134
|
path :current do |query_data = {}|
|
135
135
|
# Merge existing request parameters with new query data
|
136
|
-
merged_params = request.params
|
136
|
+
merged_params = deep_merge(request.params, query_data)
|
137
137
|
|
138
138
|
# Flatten the merged parameters
|
139
139
|
flattened_params = flatten_params('', merged_params)
|
@@ -28,13 +28,28 @@ module Karafka
|
|
28
28
|
|
29
29
|
# Builds the render data object with assigned attributes based on instance variables.
|
30
30
|
#
|
31
|
+
# @param attributes [Hash] attributes coming from the outside (in case of rebind)
|
31
32
|
# @return [Responses::Render] data that should be used to render appropriate view
|
32
|
-
def render
|
33
|
-
attributes =
|
33
|
+
def render(attributes: {})
|
34
|
+
attributes = attributes.dup
|
35
|
+
|
36
|
+
full_parts = self.class.to_s.split('::')
|
37
|
+
separator = full_parts.index('Controllers')
|
38
|
+
base = full_parts[(separator + 1)..]
|
39
|
+
|
40
|
+
base.map!.with_index do |path_part, index|
|
41
|
+
if index == (base.size - 1)
|
42
|
+
path_part.gsub(/(.)([A-Z])/, '\1_\2').downcase.gsub('_controller', '')
|
43
|
+
else
|
44
|
+
path_part.gsub(/(.)([A-Z])/, '\1_\2').downcase
|
45
|
+
end
|
46
|
+
end
|
34
47
|
|
35
|
-
scope =
|
48
|
+
scope = base.join('/')
|
36
49
|
action = caller_locations(1, 1)[0].label.split('#').last
|
37
50
|
|
51
|
+
attributes[:breadcrums_scope] = scope
|
52
|
+
|
38
53
|
instance_variables.each do |iv|
|
39
54
|
next if iv.to_s.start_with?('@_')
|
40
55
|
next if iv.to_s.start_with?('@params')
|
@@ -50,13 +50,6 @@ module Karafka
|
|
50
50
|
object.to_s.include?('#<') ? object.class.to_s : object.to_s
|
51
51
|
end
|
52
52
|
|
53
|
-
# Renders per scope breadcrumbs
|
54
|
-
def render_breadcrumbs
|
55
|
-
scope = request.path.delete_prefix(root_path).split('/')[0]
|
56
|
-
|
57
|
-
render "#{scope}/_breadcrumbs"
|
58
|
-
end
|
59
|
-
|
60
53
|
# Takes a status and recommends background style color
|
61
54
|
#
|
62
55
|
# @param status [String] status
|
@@ -376,6 +369,27 @@ module Karafka
|
|
376
369
|
def icon(name)
|
377
370
|
render "shared/icons/_#{name}"
|
378
371
|
end
|
372
|
+
|
373
|
+
# Merges two hashes deeply, combining nested hashes recursively.
|
374
|
+
#
|
375
|
+
# @param hash1 [Hash] The first hash to merge.
|
376
|
+
# @param hash2 [Hash] The second hash to merge.
|
377
|
+
# @return [Hash] A new hash that is the result of a deep merge of the two provided hashes.
|
378
|
+
def deep_merge(hash1, hash2)
|
379
|
+
merged_hash = hash1.dup
|
380
|
+
|
381
|
+
hash2.each_pair do |k, v|
|
382
|
+
tv = merged_hash[k]
|
383
|
+
|
384
|
+
merged_hash[k] = if tv.is_a?(Hash) && v.is_a?(Hash)
|
385
|
+
deep_merge(tv, v)
|
386
|
+
else
|
387
|
+
v
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
merged_hash
|
392
|
+
end
|
379
393
|
end
|
380
394
|
end
|
381
395
|
end
|
@@ -65,6 +65,24 @@ module Karafka
|
|
65
65
|
def explorer_path(topic_name = nil, partition_id = nil, offset = nil, action = nil)
|
66
66
|
root_path(*['explorer', topic_name, partition_id, offset, action].compact)
|
67
67
|
end
|
68
|
+
|
69
|
+
# Helps build scheduled messages paths.
|
70
|
+
# Similar to the explorer helper one
|
71
|
+
# @param topic_name [String]
|
72
|
+
# @param partition_id [Integer, nil]
|
73
|
+
# @param offset [Integer, nil]
|
74
|
+
# @param action [String, nil]
|
75
|
+
# @return [String] path to the expected location
|
76
|
+
def scheduled_messages_explorer_path(
|
77
|
+
topic_name = nil,
|
78
|
+
partition_id = nil,
|
79
|
+
offset = nil,
|
80
|
+
action = nil
|
81
|
+
)
|
82
|
+
root_path(
|
83
|
+
*['scheduled_messages', 'explorer', topic_name, partition_id, offset, action].compact
|
84
|
+
)
|
85
|
+
end
|
68
86
|
end
|
69
87
|
end
|
70
88
|
end
|
@@ -1,16 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# This Karafka component is a Pro component under a commercial license.
|
4
|
-
# This Karafka component is NOT licensed under LGPL.
|
5
|
-
#
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
-
# repository and their usage requires commercial license agreement.
|
8
|
-
#
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
-
#
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
-
# your code to Maciej Mensfeld.
|
13
|
-
|
14
3
|
module Karafka
|
15
4
|
module Web
|
16
5
|
module Ui
|
@@ -1,16 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# This Karafka component is a Pro component under a commercial license.
|
4
|
-
# This Karafka component is NOT licensed under LGPL.
|
5
|
-
#
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
-
# repository and their usage requires commercial license agreement.
|
8
|
-
#
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
-
#
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
-
# your code to Maciej Mensfeld.
|
13
|
-
|
14
3
|
module Karafka
|
15
4
|
module Web
|
16
5
|
module Ui
|
@@ -1,16 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# This Karafka component is a Pro component under a commercial license.
|
4
|
-
# This Karafka component is NOT licensed under LGPL.
|
5
|
-
#
|
6
|
-
# All of the commercial components are present in the lib/karafka/pro directory of this
|
7
|
-
# repository and their usage requires commercial license agreement.
|
8
|
-
#
|
9
|
-
# Karafka has also commercial-friendly license, commercial support and commercial components.
|
10
|
-
#
|
11
|
-
# By sending a pull request to the pro components, you are agreeing to transfer the copyright of
|
12
|
-
# your code to Maciej Mensfeld.
|
13
|
-
|
14
3
|
module Karafka
|
15
4
|
module Web
|
16
5
|
module Ui
|
@@ -53,7 +53,7 @@ let DataFormattingUtils={niceBytes(e,t=2){let i=0,s=parseInt(e,10)||0;for(;1024<
|
|
53
53
|
/*! Source: lib/karafka/web/ui/public/javascripts/charts/dataset_state_manager.js */class DatasetStateManager{constructor(){this.storageKey="karafkaDisabledDatasets"}readAll(){var e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):{}}saveAll(e){localStorage.setItem(this.storageKey,JSON.stringify(e))}saveCurrent(){var e=document.querySelectorAll(".chartjs"),t=window.location.href.split("?")[0];let i={};var s=this.readAll();e.forEach(e=>{var e=e.id,t=Chart.getChart(e);t&&t.legend&&t.legend.legendItems&&0<(t=t.legend.legendItems.map((e,t)=>e.hidden?t:null).filter(e=>null!==e)).length&&(i[e]=t)}),s[t]=i,this.saveAll(s)}getCurrentChart(e){var t=window.location.href.split("?")[0];return(this.readAll()[t]||{})[e]||[]}}
|
54
54
|
/*! Source: lib/karafka/web/ui/public/javascripts/components/btn_toggle_manager.js */class BtnToggleManager{constructor(){this.init()}init(){document.querySelectorAll(".btn-toggle").forEach(t=>{let i=t.getAttribute("data-toggle-target"),s=document.getElementById(i);s&&(this.restoreVisibility(t,s),t.addEventListener("click",()=>{var e=!s.classList.contains("hidden");s.classList.toggle("hidden"),t.classList.toggle("active",!e),this.saveVisibility(i,!e)}))})}saveVisibility(e,t){localStorage.setItem(e+"_visibility",t)}restoreVisibility(e,t){var i=localStorage.getItem(t.id+"_visibility"),i=i?"true"===i:!t.classList.contains("hidden");t.classList.toggle("hidden",!i),e.classList.toggle("active",i)}}
|
55
55
|
/*! Source: lib/karafka/web/ui/public/javascripts/components/charts.js */function refreshCharts(e){(new LineChartsManager).refreshAndRender(e,!0),(new BarChartManager).refreshAndRenderBarCharts(e,!0)}function manageCharts(){(new LineChartsManager).refreshAndRender(document,!1),(new BarChartManager).refreshAndRenderBarCharts(document,!1)}
|
56
|
-
/*! Source: lib/karafka/web/ui/public/javascripts/components/live_poll.js */var livePollTimer=null,oldDOM=null,datePicker=null,startURL=window.location.href;let isHoveringOverClickable=!1;function initLivePolling(){document.addEventListener("mouseover",function(e){isElementClickable(e.target)&&(isHoveringOverClickable=!0)}),document.addEventListener("mouseout",function(e){isElementClickable(e.target)&&(isHoveringOverClickable=!1)}),null==localStorage.karafkaLivePoll&&(localStorage.karafkaLivePoll="enabled")}function isElementClickable(e){return!!("A"===e.tagName||"BUTTON"===e.tagName||"INPUT"===e.tagName&&("button"===e.type||"submit"===e.type)||e.hasAttribute("onclick")||"function"==typeof e.onclick||"SPAN"===e.tagName&&e.closest(".tab-container"))}function isUserHoveringOverClickable(){return isHoveringOverClickable}function isAnyTextSelected(){var e="";return void 0!==window.getSelection?e=window.getSelection().toString():void 0!==document.selection&&"Text"==document.selection.type&&(e=document.selection.createRange().text),""!=e}function isCollapsingHappening(){return 0<document.querySelectorAll(".collapsing").length}function isPollingPossible(e=!1){return!isUserHoveringOverClickable()
|
56
|
+
/*! Source: lib/karafka/web/ui/public/javascripts/components/live_poll.js */var livePollTimer=null,oldDOM=null,datePicker=null,startURL=window.location.href;let isHoveringOverClickable=!1;function initLivePolling(){document.addEventListener("mouseover",function(e){isElementClickable(e.target)&&(isHoveringOverClickable=!0)}),document.addEventListener("mouseout",function(e){isElementClickable(e.target)&&(isHoveringOverClickable=!1)}),null==localStorage.karafkaLivePoll&&(localStorage.karafkaLivePoll="enabled")}function isFormActive(){var e=document.activeElement;return["INPUT","TEXTAREA","SELECT","BUTTON","FIELDSET"].includes(e.tagName)}function isElementClickable(e){return!!("A"===e.tagName||"BUTTON"===e.tagName||"INPUT"===e.tagName&&("button"===e.type||"submit"===e.type)||e.hasAttribute("onclick")||"function"==typeof e.onclick||"SPAN"===e.tagName&&e.closest(".tab-container")||e.closest("button")||e.closest("a"))}function isUserHoveringOverClickable(){return isHoveringOverClickable}function isAnyTextSelected(){var e="";return void 0!==window.getSelection?e=window.getSelection().toString():void 0!==document.selection&&"Text"==document.selection.type&&(e=document.selection.createRange().text),""!=e}function isCollapsingHappening(){return 0<document.querySelectorAll(".collapsing").length}function isPollingPossible(e=!1){return!(isFormActive()||isUserHoveringOverClickable()||isAnyTextSelected()||isOffsetLookupCalendarVisible()||isAnyModalOpen()||isCollapsingHappening()||isTurboOperating()||e&&startURL!=window.location.href)}function isAnyModalOpen(){var e;for(e of document.querySelectorAll("dialog"))if(e.open)return!0;return!1}function bindPollingButtonClick(){var e=document.getElementById("live-poll");null!=e&&e.addEventListener("click",handleLivePollingButtonClick)}function handleLivePollingButtonClick(){toggleLivePollState(),setLivePollButton(),setPollingListener()}function toggleLivePollState(){"enabled"==localStorage.karafkaLivePoll?localStorage.karafkaLivePoll="disabled":localStorage.karafkaLivePoll="enabled"}function setLivePollButton(){null!=(selector=document.getElementById("live-poll"))&&("enabled"==localStorage.karafkaLivePoll?(selector.classList.add("text-base-content"),selector.classList.remove("text-gray-500")):(selector.classList.add("text-gray-500"),selector.classList.remove("text-base-content")))}function checkResponse(e){if(e.ok)return e;throw e}function refreshPage(e){if(!isPollingPossible())return!1;var t,e=(new DOMParser).parseFromString(e,"text/html"),i=e.getElementById("content");oldDOM!=i.innerHTML&&(t=document.querySelectorAll(".chartjs").length,0==i.querySelectorAll(".chartjs").length||0==t?(document.getElementById("content").replaceWith(i),addListeners()):(t=e.getElementById("refreshable"),document.getElementById("refreshable").replaceWith(t),refreshCharts(e)),oldDOM=i.innerHTML)}function showError(e){console.error(e)}function scheduleLivePoll(){null==oldDOM&&(oldDOM=document.getElementById("content").innerHTML);let e=parseInt(localStorage.karafkaTimeInterval)||5e3;e<1e3&&(localStorage.karafkaTimeInterval=5e3,e=5e3),livePollTimer=setTimeout(livePollCallback,e)}function livePollCallback(){clearTimeout(livePollTimer),livePollTimer=null,isPollingPossible(!1)?(startURL=window.location.href,fetch(window.location.href).then(checkResponse).then(e=>e.text()).then(refreshPage).catch(showError).finally(setPollingListener)):setPollingListener()}function setPollingListener(){var e=document.getElementById("live-poll"),t=localStorage.karafkaLivePoll;"disabled"==t||null==t||null==e?(clearTimeout(livePollTimer),livePollTimer=null):(clearTimeout(livePollTimer),scheduleLivePoll())}
|
57
57
|
/*! Source: lib/karafka/web/ui/public/javascripts/components/offset_datetime.js */function loadOffsetLookupDatePicker(){var e={locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",dateFormat:"yyyy-MM-dd",timeFormat:"HH:mm",firstDay:1},timepicker:!0,onSelect:({})=>{document.getElementById("offset-lookup-datepicker").value=""},onShow:function(){offsetLookupDatePicker.selectDate((new Date).getTime()),offsetLookupDatePicker.maxDate=new Date},onHide:function(){offsetLookupDatePicker.selectDate((new Date).getTime())},buttons:[{content(e){return"Go to offset"},onClick(e){var t=e.selectedDates[0]||new Date,i=e.$el.dataset.target;e.hide(),location.href=i+"/"+formatRedirectDateTime(t)}}]};null!=offsetLookupDatePicker&&offsetLookupDatePicker.destroy(),null!=document.getElementById("offset-lookup-datepicker")&&((offsetLookupDatePicker=new AirDatepicker("#offset-lookup-datepicker",e)).maxDate=new Date,offsetLookupDatePicker.selectDate((new Date).getTime()))}function formatRedirectDateTime(e){return e.getFullYear()+`-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}/${String(e.getHours()).padStart(2,"0")}:`+String(e.getMinutes()).padStart(2,"0")}function isOffsetLookupCalendarVisible(){return null!=offsetLookupDatePicker&&offsetLookupDatePicker.visible}
|
58
58
|
/*! Source: lib/karafka/web/ui/public/javascripts/components/search.js */offsetLookupDatePicker=null;class SearchModalManager{constructor(){this.init()}init(){var t=document.getElementById("offset-input");if(!t)return!1;var i=document.getElementById("offset-timestamp-input"),e=document.querySelectorAll('input[name="search[offset_type]"]'),s=document.getElementById("no-search-criteria"),r=document.getElementById("search-form-errors");e.forEach(function(e){e.addEventListener("change",function(){t.disabled=!document.getElementById("offset-value").checked,t.required=document.getElementById("offset-value").checked,i.disabled=!document.getElementById("offset-timestamp").checked,i.required=document.getElementById("offset-timestamp").checked})}),t.disabled=!document.getElementById("offset-value").checked,t.required=document.getElementById("offset-value").checked,i.disabled=!document.getElementById("offset-timestamp").checked,i.required=document.getElementById("offset-timestamp").checked,document.getElementById("show-search-modal").addEventListener("click",function(){document.getElementById("messages_search_modal").showModal();var e=document.querySelector('#messages_search_modal input[type="text"]');e&&e.focus()}),(s||r)&&(document.getElementById("messages_search_modal").showModal(),e=document.querySelector('#messages_search_modal input[type="text"]'))&&e.focus()}}class SearchMetadataVisibilityManager{constructor(){this.storageKey="karafkaSearchMetadataVisibility",this.metadataElement=document.getElementById("search-metadata-details"),this.toggleButton=document.getElementById("toggle-search-metadata"),this.metadataElement&&this.init()}init(){this.restoreVisibility(),self=this;var t=document.getElementById("toggle-search-metadata");t.addEventListener("click",function(){var e=document.getElementById("search-metadata-details");e.classList.toggle("hidden"),t.classList.toggle("active"),self.saveVisibility(!e.classList.contains("hidden"))})}readVisibility(){return"true"===localStorage.getItem(this.storageKey)}saveVisibility(e){localStorage.setItem(this.storageKey,e)}restoreVisibility(){this.readVisibility()&&(document.getElementById("toggle-search-metadata").classList.add("active"),document.getElementById("search-metadata-details").classList.remove("hidden"))}}
|
59
59
|
/*! Source: lib/karafka/web/ui/public/javascripts/components/tabs_manager.js */class TabsManager{constructor(){this.storageKey="karafkaActiveTabsv2"}readAllActiveTabs(){var e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):{}}saveAllActiveTabs(e){localStorage.setItem(this.storageKey,JSON.stringify(e))}saveCurrentActiveTabs(){var e=document.querySelectorAll(".inline-tabs > .active"),t=window.location.href.split("?")[0];let i=[];var s=this.readAllActiveTabs();e.forEach(e=>{i.push(e.id)}),s[t]=i,this.saveAllActiveTabs(s)}setActiveTabs(){var e=window.location.href.split("?")[0],e=this.readAllActiveTabs()[e];(e=e||Array.from(document.querySelectorAll(".inline-tabs > .active")).map(e=>e.id))&&e.forEach(e=>{e=document.getElementById(e);e&&(e.parentElement.querySelectorAll(".custom-tab").forEach(function(e){e.classList.remove("active")}),e.classList.add("active"),document.getElementById(e.getAttribute("data-target")).classList.remove("hidden"))})}manageTabs(){this.setActiveTabs();var t=this;document.querySelectorAll(".inline-tabs > .custom-tab").forEach(function(e){e.addEventListener("click",function(e){this.parentElement.querySelectorAll(".custom-tab").forEach(function(e){e.classList.remove("active");e=e.getAttribute("data-target");document.getElementById(e).classList.add("hidden")}),this.classList.add("active"),t.saveCurrentActiveTabs(),t.setActiveTabs()})})}}
|
Binary file
|
Binary file
|
@@ -32,6 +32,14 @@ function initLivePolling() {
|
|
32
32
|
localStorage.karafkaLivePoll = "enabled"
|
33
33
|
}
|
34
34
|
|
35
|
+
function isFormActive() {
|
36
|
+
// Get the currently focused element
|
37
|
+
const activeElement = document.activeElement;
|
38
|
+
|
39
|
+
// Check if the focused element is a form control
|
40
|
+
return ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'FIELDSET'].includes(activeElement.tagName);
|
41
|
+
}
|
42
|
+
|
35
43
|
function isElementClickable(element) {
|
36
44
|
// Check for common clickable elements
|
37
45
|
if (element.tagName === 'A' ||
|
@@ -47,6 +55,12 @@ function isElementClickable(element) {
|
|
47
55
|
return true;
|
48
56
|
}
|
49
57
|
|
58
|
+
// Check if the element is wrapped in a <button>
|
59
|
+
if (element.closest('button')) { return true }
|
60
|
+
|
61
|
+
// Check if element is wrapped with a link
|
62
|
+
if (element.closest('a')) { return true }
|
63
|
+
|
50
64
|
return false;
|
51
65
|
}
|
52
66
|
|
@@ -79,6 +93,7 @@ function isCollapsingHappening() {
|
|
79
93
|
// We should not poll and update if we have any text selected and we should not do it as well, when
|
80
94
|
// datetime picker with time selection is present
|
81
95
|
function isPollingPossible(check_url = false){
|
96
|
+
if (isFormActive()) { return false }
|
82
97
|
if (isUserHoveringOverClickable()) { return false }
|
83
98
|
if (isAnyTextSelected()) { return false }
|
84
99
|
if (isOffsetLookupCalendarVisible()) { return false }
|