Skip to content

Commit cd7a0a0

Browse files
feat: add notes column to MerchantSync to save details related to sync
1 parent f127854 commit cd7a0a0

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

app/controllers/admin/merchant_syncs_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def merchant_sync_update_params
105105
payload_soft_deleted_merchants
106106
payload_countries
107107
process_logs
108+
notes
108109
]
109110
)
110111
end

app/models/merchant_sync.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,5 @@ def parse_json_strings
183183
# created_at :datetime not null
184184
# updated_at :datetime not null
185185
# payload_nostr :json not null
186+
# notes :text
186187
#

app/views/admin/merchant_syncs/_form.html.slim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
= f.input :updated_merchants_count
2222
= f.input :soft_deleted_merchants_count
2323

24+
= f.input :notes
2425
= f.input :payload_added_merchants,
2526
as: :text,
2627
input_html: { \

app/views/admin/merchant_syncs/_merchant_sync.html.slim

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,19 @@ tr id=dom_id(merchant_sync)
4646
td
4747
- label = MerchantSync.human_enum_name(:status, merchant_sync.status)
4848

49-
- if merchant_sync.success?
50-
.badge.badge-success= label
51-
- elsif merchant_sync.error?
52-
.badge.badge-error= label
53-
- else
54-
.badge.badge-soft.animate-pulse= label
49+
.flex.items-center.gap-2
50+
- if merchant_sync.success?
51+
.badge.badge-success= label
52+
- elsif merchant_sync.error?
53+
.badge.badge-error= label
54+
- else
55+
.badge.badge-soft.animate-pulse= label
56+
57+
- if merchant_sync.notes.present?
58+
= render 'tooltip',
59+
position: :top,
60+
text: simple_format(merchant_sync.notes),
61+
mode: 'info'
5562

5663
td
5764
- if merchant_sync.pending?
@@ -71,6 +78,15 @@ tr id=dom_id(merchant_sync)
7178
= social_contact_icon(:nostr, klass: '-mr-1')
7279
=< t('.see_on_nostr')
7380

81+
/ Careful: condition does not work whit Turbo broadcast
82+
- if allowed_to?(:update?, merchant_sync, namespace: Admin)
83+
li
84+
= edit_link_to edit_admin_merchant_sync_path(merchant_sync)
85+
86+
- if allowed_to?(:destroy?, merchant_sync, namespace: Admin)
87+
li
88+
= destroy_link_to admin_merchant_sync_path(merchant_sync)
89+
7490
= render 'dropdown_actions', item_id: merchant_sync.id
7591

7692
- if merchant_sync.pending? || merchant_sync.ended_at >= Setting::MERCHANTS_DELTA_SYNC_TIME.ago

app/views/admin/merchant_syncs/_process_logs.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- elsif row['mode'] == 'error'
2929
pre.text-error data-prefix=">"
30-
code
30+
code.whitespace-normal
3131
- if row['timestamp']
3232
span.italic.text-xs.opacity-50=> "[#{l(Time.at(row['timestamp']), format: :hms)}]"
3333
= row['message']

app/views/application/_tooltip.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
.tooltip.tooltip-primary class=("tooltip-#{position}" if defined?(position)) class=("tooltip-#{mode}" if defined?(mode))
99
.tooltip-content.p-2
1010
== text
11-
= lucide_icon icon, class: 'w-5 h-5 cursor-pointer'
11+
= lucide_icon icon, class: 'text-base-content/70 w-5 h-5 cursor-pointer'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddNotesToMerchantSyncs < ActiveRecord::Migration[8.1]
2+
def change
3+
add_column :merchant_syncs, :notes, :text
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)