web47core 3.2.71 → 3.2.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd58683233c1800970202e91f0a50d4ea0bc5d60815aadd96761343fb45dc6f4
4
- data.tar.gz: 9fbef584fe1fe6088d08efaeb9e4ae44d7c10113edc75c0a9ab75ecff69018d6
3
+ metadata.gz: 82fb6705d4462ea089384969fc1e0064bd89414af7b3910066de2a18e700fead
4
+ data.tar.gz: 2669a9f7f8f74ddf50f27dcb5c44642390bc5b18fd4aec85e304df26688f453b
5
5
  SHA512:
6
- metadata.gz: f25391c847282c4e47698c7ad2c71e2c72cef76f32ce781126ae94ea7e18f6bcaa71f70d7ec62dd300682483b0728f4fb4d71b834c9ea9b351dbe4ec79c7b309
7
- data.tar.gz: 8e095be082a4f598471bc3afa61095aa89dbafbf679c2088bb1569982ff0855d34a57bd82c331816d55443b8866ff223401f1fb588e0716ef3ab9611a84009b2
6
+ metadata.gz: 11e12bf105d793a994fda1c2fba13ec42f16d3fe38d35c993e6b2e982a66b47bf4cdcdc8538c03cc98b473bf826de4d7f0e075e0eeb2d0e6815132177909c07d
7
+ data.tar.gz: 2b2f90b06fd76b10cd46286e82983bdbda243b53565ac58afb955d9850cab50207e454ca725a5dc261a69adc065b4fe9760701a122f89266e889e25eb99752ec
@@ -28,4 +28,87 @@ module CoreNavBarHelper
28
28
  end
29
29
  states.join(' ')
30
30
  end
31
+
32
+ # @abstract Determines which css attributes should be assigned to the current menu, options are
33
+ # @param [Array, String, Symbol] names - make active it the current controller matches
34
+ # @param [Boolean] read_only - the menu is greyed out and disabled
35
+ # @param [Boolean] enabled - a lock icon appears
36
+ # @param [Boolean] visible - If this menu should be visible at all
37
+ # @return Array - a collection of css parameters based on current controllers
38
+ def nav_bar_css(names, read_only: false, enabled: true, visible: true)
39
+ states = []
40
+ states << 'read-only' if read_only
41
+ states << 'locked' unless enabled
42
+ states << 'd-none' unless visible
43
+ case names
44
+ when String
45
+ states << 'active' if names.eql?(controller.controller_name)
46
+ when Array
47
+ states << 'active' if names.include?(controller.controller_name)
48
+ else
49
+ states << 'active' if names.to_s.eql?(controller.controller_name)
50
+ end
51
+ states
52
+ end
53
+
54
+ # @abstract Add a badge to the current element
55
+ # @param [String] name - Name of the badge
56
+ # @param [Hash] options - Options for the badge, values
57
+ def new_count_badge(name, options = {})
58
+ return if options.blank?
59
+
60
+ badge_count = options[:new_badge_count]
61
+ return if badge_count.blank? || badge_count <= 0
62
+
63
+ content_tag(:span, class: 'badge', title: "#{badge_count} New #{name.pluralize}") { badge_count.to_s }
64
+ end
65
+
66
+ def nav_link(name, action_path, badge_count: 0, classes: [])
67
+ ac = [classes, 'truncate', 'nav-link'].compact.join(' ')
68
+ content_tag(:a, href: action_path, class: ac) do
69
+ concat(content_tag(:span, class: 'nav-link-icon d-md-none d-lg-inline-block') { svg_icon(name) })
70
+ concat(content_tag(:span, class: 'nav-link-title') { nav_menu_title(name) })
71
+ concat(new_count_badge(name, badge_count: badge_count))
72
+ end
73
+ end
74
+
75
+ def nav_item_link(name, action_path, badge_count: 0, classes: [])
76
+ lic = [classes, 'nav-item',].compact.join(' ')
77
+ content_tag(:div, class: lic) do
78
+ concat(nav_link(name, action_path, badge_count: badge_count))
79
+ end
80
+ end
81
+
82
+ def nav_item_group(name, classes: [], badge_count: 0, &block)
83
+ lic = [classes, 'nav-item'].flatten.compact.join(' ')
84
+ ac = [classes, 'nav-link'].flatten.compact.join(' ')
85
+ open_close = 'false'
86
+ nav_css = %w[nav nav-vertical collapse]
87
+ if classes.include?('active')
88
+ open_close = 'true'
89
+ nav_css << 'show'
90
+ end
91
+ content_tag(:div, class: lic) do
92
+ concat(content_tag(:a, class: ac, data: { bs_toggle: :collapse }, role: :button, href: "##{name}", aria: { expanded: open_close, controls: :nav_group_settings }) do
93
+ concat(content_tag(:span, class: 'nav-link-icon d-md-none d-lg-inline-block') { svg_icon(name) })
94
+ concat(content_tag(:span, class: 'nav-link-title') { nav_menu_title(name) })
95
+ concat(tag(:span, class: 'nav-link-toggle'))
96
+ end)
97
+ concat(content_tag(:div, class: nav_css.join(' '), id: name.to_s, &block))
98
+ end
99
+ end
100
+
101
+ def nav_menu_title(name)
102
+ nav_localized(:titles, name)
103
+ end
104
+
105
+ def nav_localized(type, name)
106
+ if I18n.exists?("nav.#{type}.#{name}")
107
+ I18n.t("nav.#{type}.#{name}")
108
+ else
109
+ name.to_s.titleize
110
+ end
111
+ rescue StandardError
112
+ name
113
+ end
31
114
  end
@@ -0,0 +1,133 @@
1
+ module CoreTableActionHelper
2
+
3
+ def table_action_show_tag(record, path, options = {})
4
+ return unless can?(:read, record)
5
+
6
+ options[:title] ||= 'Show'
7
+ options[:icon_name] ||= :info
8
+ table_action_tag(path, options)
9
+ end
10
+
11
+ def table_action_run_tag(record, path, options = {})
12
+ return unless can?(:manage, record) && record.edit_able?
13
+
14
+ options[:tool_tip] ||= 'Run'
15
+ options[:icon_name] ||= :run
16
+ table_action_tag(path, options)
17
+ end
18
+
19
+ def table_action_edit_tag(record, path, options = {})
20
+ return unless can?(:edit, record) && record.edit_able?
21
+
22
+ options[:tool_tip] ||= 'Edit'
23
+ options[:icon_name] ||= :edit
24
+ table_action_tag(path, options)
25
+ end
26
+
27
+ def table_action_restore_tag(record, path, options = {})
28
+ return unless can?(:edit, record) && record.restore_able?
29
+
30
+ options[:tool_tip] ||= 'Restore'
31
+ options[:icon_name] ||= :restore
32
+ table_action_tag(path, options)
33
+ end
34
+
35
+ def table_action_deploy_tag(record, path, options = {})
36
+ return unless can?(:edit, record) && record.deploy_able?
37
+
38
+ options[:tool_tip] ||= 'Deploy'
39
+ options[:icon_name] ||= :deploy
40
+ table_action_tag(path, options)
41
+ end
42
+
43
+ def table_action_revoke_tag(record, path, options = {})
44
+ return unless can?(:edit, record) && record.revoke_able?
45
+
46
+ options[:tool_tip] ||= 'Revoke'
47
+ options[:classes] ||= %w[text-danger]
48
+ options[:icon_name] ||= :revoke
49
+ options[:confirm] ||= "Are you sure you want to revoke this #{record.class.name.humanize}?"
50
+ table_action_tag(path, options)
51
+ end
52
+
53
+ def table_action_replay_tag(record, path, options = {})
54
+ return unless can?(:update, record)
55
+
56
+ options[:tool_tip] ||= 'Replay'
57
+ options[:icon_name] ||= :repeat
58
+ options[:confirm] ||= "Are you sure you want to restart this #{record.class.name.humanize}?"
59
+ table_action_tag(path, options)
60
+ end
61
+
62
+ def table_action_demote_tag(record, path, options = {})
63
+ return unless can?(:update, record)
64
+
65
+ options[:tool_tip] ||= 'Demote'
66
+ options[:classes] ||= %i[text-warning]
67
+ options[:icon_name] ||= 'thumb-down'
68
+ options[:method] ||= :delete
69
+ options[:confirm] ||= "Are you sure you want to demote this #{record.class.name.humanize}?"
70
+ table_action_tag(path, options)
71
+ end
72
+
73
+ def table_action_delete_tag(record, path, options = {})
74
+ return unless can?(:destroy, record)
75
+
76
+ options[:tool_tip] ||= 'Delete'
77
+ options[:classes] ||= %i[text-danger]
78
+ options[:icon_name] ||= :delete
79
+ options[:method] ||= :delete
80
+ options[:confirm] ||= "Are you sure you want to delete this #{record.class.name.humanize}?"
81
+ table_action_tag(path, options)
82
+ end
83
+
84
+ def table_action_archive_tag(record, path, options = {})
85
+ return unless can?(:destroy, record) && record.archive_able?
86
+
87
+ options[:tool_tip] ||= 'Archive'
88
+ options[:classes] ||= %i[text-danger]
89
+ options[:icon_name] ||= :archive
90
+ options[:method] ||= :delete
91
+ options[:confirm] ||= "Are you sure you want to archive this #{record.class.name.humanize}?"
92
+ table_action_tag(path, options)
93
+ end
94
+
95
+ def table_action_download_tag(record, options = {})
96
+ return unless can?(:read, record)
97
+
98
+ link_classes = tooltip_data(options, 'Download')
99
+ content_tag(:a, href: download_polymorphic_path(record), class: link_classes.join(' ')) do
100
+ svg_icon('download', type: options[:type] || :outline)
101
+ end
102
+ end
103
+
104
+ private
105
+
106
+ def tooltip_data(options, default_title)
107
+ classes = ['btn-floating', 'btn-small']
108
+ classes << 'tooltipped' unless options[:no_tooltip]
109
+ classes << options[:class] if options[:class]
110
+ classes
111
+ end
112
+
113
+ def table_action_tag(path, options = {})
114
+ link_options = link_options(path, options)
115
+ content_tag(:a, link_options) do
116
+ svg_icon(link_options[:icon_name])
117
+ end
118
+ end
119
+
120
+ def link_options(path, options = {}, title: nil, confirm: nil)
121
+ link_options = { href: path, icon_name: options[:icon_name] }
122
+ link_options[:class] = (options[:classes] || []).join(' ')
123
+ link_options[:data] = { method: options[:method].presence || 'get' }
124
+ tooltip = options[:tooltip] || options[:tool_tip] || title
125
+ if tooltip.present?
126
+ link_options[:data][:bs_toggle] = :tooltip
127
+ link_options[:title] = tooltip
128
+ end
129
+ confirm = options[:confirm] || options[:confirmation] || confirm
130
+ link_options[:data][:confirm] = confirm if confirm.present?
131
+ link_options
132
+ end
133
+ end
@@ -1,12 +1,9 @@
1
- - create_label ||= t('ui_form.actions.create')
2
- - cancel_label ||= t('ui_form.actions.cancel')
3
- .card-action
4
- .row
5
- .col.s6.center-align
6
- %a.btn-large.waves-effect.waves-light.grey{href: form_cancel_path}
7
- = cancel_label
8
- %i.material-icons.right cancel
9
- .col.s6.center-align
10
- %button.btn-large.waves-effect.waves-light{type: :submit}
11
- = create_label
12
- %i.material-icons.right save
1
+ - create_label ||= nav_menu_title(:create)
2
+ - cancel_label ||= nav_menu_title(:cancel)
3
+ .card-footer.d-flex.justify-content-between
4
+ %a.btn.btn-secondary{href: form_cancel_path}
5
+ = cancel_label
6
+ = svg_icon(:cancel, size: 32, classes: %w[ms-2])
7
+ %button.btn.btn-primary{type: :submit}
8
+ = create_label
9
+ = svg_icon(:create, size: 32, classes: %w[ms-2])
@@ -1,7 +1,4 @@
1
- .flash
2
- - flash.each do |key, value|
3
- - next if 'timedout'.eql?(key)
4
- .message
5
- %i.material-icons
6
- = flash_map_name(key)
7
- %p=value
1
+ - flash.each do |key, message|
2
+ .alert{ class: "#{flash_color(key)} alert-dismissible", role: 'alert' }
3
+ = message
4
+ %a.btn-close{ data: { bs_dismiss: 'alert' }, aria: { label: 'Close' } }
@@ -1,10 +1,9 @@
1
- .card-action
2
- .row
3
- .col.s6.center-align
4
- %a.btn-large.waves-effect.waves-light.grey{href: form_cancel_path}
5
- = t('ui_form.actions.cancel')
6
- %i.material-icons.right cancel
7
- .col.s6.center-align
8
- %button.btn-large.waves-effect.waves-light{type: :submit}
9
- = t('ui_form.actions.update')
10
- %i.material-icons.right save
1
+ - update_label ||= nav_menu_title(:update)
2
+ - cancel_label ||= nav_menu_title(:cancel)
3
+ .card-footer.d-flex.justify-content-between
4
+ %a.btn.btn-secondary{href: form_cancel_path}
5
+ = cancel_label
6
+ = svg_icon(:cancel, size: 32, classes: %w[ms-2])
7
+ %button.btn.btn-primary{type: :submit}
8
+ = update_label
9
+ = svg_icon(:update, size: 32, classes: %w[ms-2])
@@ -19,10 +19,9 @@
19
19
  - if server.alive?
20
20
  = svg_icon(:alive)
21
21
  %td= current_user.local_time(server.last_check_in_at)
22
- %td
23
- =dropdown_menu do
24
- - if server.primary?
25
- =demote_dropdown_item(server, demote_cron_server_path(server))
26
- - else
27
- =delete_dropdown_item(server, cron_server_path(server))
22
+ %td.actions
23
+ - if server.primary?
24
+ =table_action_demote_tag(server, demote_cron_server_path(server))
25
+ - else
26
+ =table_action_delete_tag(server, cron_server_path(server))
28
27
 
@@ -7,11 +7,11 @@
7
7
  .card
8
8
  .card-body
9
9
  .container
10
- .row.row-cols-md-6.row-cols-lg-4.row-cols-xl-3.row-cols-sm-1.g-4
11
- = html5_text_field(@cron_tab, :min)
12
- = html5_text_field(@cron_tab, :hour)
13
- = html5_text_field(@cron_tab, :mday)
14
- = html5_text_field(@cron_tab, :month)
15
- = html5_text_field(@cron_tab, :wday)
16
- = html5_checkbox(@cron_tab, :enabled)
17
- .card-footer= render 'common/form_actions', form_cancel_path: cron_tabs_path
10
+ .row.row-cols-md-2.row-cols-lg-3.row-cols-xl-6.row-cols-sm-1.g-4
11
+ = form_text_field(@cron_tab, :min)
12
+ = form_text_field(@cron_tab, :hour)
13
+ = form_text_field(@cron_tab, :mday)
14
+ = form_text_field(@cron_tab, :month)
15
+ = form_text_field(@cron_tab, :wday)
16
+ = form_checkbox(@cron_tab, :enabled)
17
+ .card-footer= render 'common/update_actions', form_cancel_path: cron_tabs_path
@@ -14,7 +14,7 @@
14
14
  %th WDay
15
15
  %th Enabled
16
16
  %th Actions
17
- %tbody.table-border-bottom-0
17
+ %tbody
18
18
  - Cron::JobTab.each do |tab|
19
19
  %tr
20
20
  %td.name=tab.name.humanize
@@ -26,10 +26,9 @@
26
26
  %td=tab.wday
27
27
  %td
28
28
  - if tab.valid_environment?
29
- = svg_icon('check', type: :fill)
30
- %td
31
- =dropdown_menu do
32
- =edit_dropdown_item(tab, edit_cron_tab_path(tab))
33
- - if tab.valid_environment?
34
- =run_dropdown_item(tab, run_now_cron_tab_path(tab))
29
+ = svg_icon(:check)
30
+ %td.actions
31
+ = table_action_edit_tag(tab, edit_cron_tab_path(tab))
32
+ - if tab.valid_environment?
33
+ = table_action_run_tag(tab, run_now_cron_tab_path(tab))
35
34
 
@@ -2,7 +2,7 @@
2
2
  .card
3
3
  .card-body
4
4
  .table-responsive.text-nowrap
5
- %table.table.card-table.border.table-striped
5
+ %table.table.border.table-hover.table-vcenter.datatable.card-table.no-wrap.responsive
6
6
  %thead
7
7
  %tr
8
8
  %th Name
@@ -10,7 +10,7 @@
10
10
  %th Min/Avg/Max
11
11
  %th Last Run At
12
12
  %th Actions
13
- %tbody.table-border-bottom-0
13
+ %tbody
14
14
  - @metrics.each do |m|
15
15
  %tr
16
16
  %td.name=m.name
@@ -18,5 +18,5 @@
18
18
  %td=[m.min.round(3), m.avg.round(3), m.max.round(3)].join('/')
19
19
  %td=current_user.local_time(m.last_run_at)
20
20
  %td.actions
21
- = delete_dropdown_item(m, model_path(m))
21
+ = table_action_delete_tag(m, model_path(m))
22
22
 
@@ -2,7 +2,7 @@
2
2
  .card
3
3
  .card-body
4
4
  .table-responsive.text-nowrap
5
- %table.table.card-table.border.table-striped
5
+ %table.table.border.table-hover.table-vcenter.datatable.card-table.no-wrap.responsive
6
6
  %thead
7
7
  %tr
8
8
  %th Host Name
@@ -11,7 +11,7 @@
11
11
  %th Last Check In
12
12
  %th Runs
13
13
  %th Actions
14
- %tbody.table-border-bottom-0
14
+ %tbody
15
15
  - @workers.each do |worker|
16
16
  %tr
17
17
  %td=worker.host_name
@@ -26,5 +26,5 @@
26
26
  %td=current_user.local_time(worker.last_check_in_at)
27
27
  %td=worker.runs.count
28
28
  %td.actions
29
- = delete_dropdown_item(worker, model_path(worker))
29
+ = table_action_delete_tag(worker, model_path(worker))
30
30
 
@@ -1,17 +1,23 @@
1
1
  - title t('.title')
2
- = multiple_floating_action_button do
3
- = delete_floating_action_button(Delayed::Backend::Mongoid::Job, class_action_path(:destroy_all, failed_only:true), title: t('.destroy_failed'), confirm: t('.confirm_destroy_failed'))
4
- = delete_floating_action_button(Delayed::Backend::Mongoid::Job, class_action_path(:destroy_all, failed_only:false), title: t('.destroy_all'), confirm: t('.confirm_destroy_all'))
5
- = refresh_floating_action_link(Delayed::Backend::Mongoid::Job, class_action_path(:resbumit_all, failed_only:true), title: t('.resubmit_failed'), confirm: t('.confirm_resubmit_failed'))
6
- = refresh_floating_action_link(Delayed::Backend::Mongoid::Job, class_action_path(:resbumit_all, failed_only:false), title: t('.resubmit_all'), confirm: t('.confirm_resubmit_all'))
7
2
  .card
8
- .card-header
3
+ .card-header.d-flex.justify-content-between
9
4
  .card-title
10
5
  %h4=t('.title')
6
+ .btn-list
7
+ - if can?(:manage, Delayed::Backend::Mongoid::Job)
8
+ %a.btn.bg-warning{href: class_action_path(:destroy_all, failed_only:true), title: t('.destroy_failed'), data: {bs_toggle: :tooltip, confirm: t('.confirm_destroy_failed')} }
9
+ =svg_icon(:trash, classes: %w(text-white))
10
+ %a.btn.bg-danger{href: class_action_path(:destroy_all, failed_only:false), title: t('.destroy_all'), data: {bs_toggle: :tooltip, confirm: t('.confirm_destroy_all')} }
11
+ =svg_icon(:trash, classes: %w(text-white))
12
+ - if can?(:update, Delayed::Backend::Mongoid::Job)
13
+ %a.btn.bg-warning{href: class_action_path(:resubmit_all, failed_only:true), title: t('.resubmit_failed'), data: {bs_toggle: :tooltip, confirm: t('.confirm_resubmit_failed')} }
14
+ =svg_icon(:repeat, classes: %w(text-white))
15
+ %a.btn.bg-danger{href: class_action_path(:resubmit_all, failed_only:false), title: t('.resubmit_all'), data: {bs_toggle: :tooltip, confirm: t('.confirm_resubmit_all')} }
16
+ =svg_icon(:repeat, classes: %w(text-white))
11
17
 
12
18
  .card-body
13
19
  .table-responsive.text-no-wrap
14
- %table.table.card-table.border.table-striped
20
+ %table.table.border.table-hover.table-vcenter.datatable.card-table.no-wrap.responsive
15
21
  %thead
16
22
  %tr
17
23
  %th Run At
@@ -27,6 +33,5 @@
27
33
  %td=delayed_job.priority
28
34
  %td=delayed_job.status_description
29
35
  %td.actions
30
- = dropdown_menu do
31
- = replay_dropdown_item(delayed_job, model_action_path(delayed_job, :resubmit), confirm: 'Are you sure you want to restart this job?')
32
- = delete_dropdown_item(delayed_job, model_path(delayed_job))
36
+ = table_action_replay_tag(delayed_job, model_action_path(delayed_job, :resubmit), confirm: 'Are you sure you want to restart this job?')
37
+ = table_action_delete_tag(delayed_job, model_path(delayed_job))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.71'
4
+ VERSION = '3.2.72'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.71
4
+ version: 3.2.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-30 00:00:00.000000000 Z
11
+ date: 2025-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -554,6 +554,7 @@ files:
554
554
  - app/helpers/core_nav_bar_helper.rb
555
555
  - app/helpers/core_select_two_helper.rb
556
556
  - app/helpers/core_sso_servers_helper.rb
557
+ - app/helpers/core_table_action_helper.rb
557
558
  - app/helpers/core_table_helper.rb
558
559
  - app/helpers/model_modal_helper.rb
559
560
  - app/helpers/svg_icon_helper.rb