|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | # ActiveAdmin's default string predicates, with "equals" first instead of "contains". |
4 | | -STRING_FILTERS = %i[eq cont start end].freeze |
| 4 | +# A local, not a constant: app/admin is reloaded on every delayed_job poll in |
| 5 | +# development, and a top-level constant warns "already initialized" on each reload. |
| 6 | +string_filters = %i[eq cont start end].freeze |
5 | 7 |
|
6 | 8 | ActiveAdmin.register Cdr::Cdr, as: 'CDR' do |
7 | 9 | menu parent: 'CDR', priority: 95, label: 'CDR history' |
@@ -85,9 +87,9 @@ def try_cdr_replica(&) |
85 | 87 | label: 'Customer Auth', |
86 | 88 | scope: -> { CustomersAuth.order(:name) }, |
87 | 89 | path: '/customers_auths/search' |
88 | | - filter :src_prefix_routing, filters: STRING_FILTERS |
| 90 | + filter :src_prefix_routing, filters: string_filters |
89 | 91 | filter :src_area, collection: proc { Routing::Area.select(%i[id name]) }, input_html: { class: 'tom-select' } |
90 | | - filter :dst_prefix_routing, filters: STRING_FILTERS |
| 92 | + filter :dst_prefix_routing, filters: string_filters |
91 | 93 | filter :dst_area, collection: proc { Routing::Area.select(%i[id name]) }, input_html: { class: 'tom-select' } |
92 | 94 |
|
93 | 95 | country_filter :src_country_id_eq, label: 'SRC Country' |
@@ -154,47 +156,47 @@ def try_cdr_replica(&) |
154 | 156 | multiple: true, |
155 | 157 | 'data-path': '/disconnect_codes/search' |
156 | 158 | } |
157 | | - filter :internal_disconnect_reason, filters: STRING_FILTERS |
| 159 | + filter :internal_disconnect_reason, filters: string_filters |
158 | 160 | filter :lega_disconnect_code |
159 | | - filter :lega_disconnect_reason, filters: STRING_FILTERS |
| 161 | + filter :lega_disconnect_reason, filters: string_filters |
160 | 162 | filter :lega_q850_cause_eq, label: 'LegA Q.850 cause', as: :select, collection: System::Q850::CAUSES.invert, input_html: { class: 'tom-select' } |
161 | 163 |
|
162 | 164 | filter :legb_disconnect_code |
163 | | - filter :legb_disconnect_reason, filters: STRING_FILTERS |
| 165 | + filter :legb_disconnect_reason, filters: string_filters |
164 | 166 | filter :legb_q850_cause_eq, label: 'LegB Q.850 cause', as: :select, collection: System::Q850::CAUSES.invert, input_html: { class: 'tom-select' } |
165 | 167 |
|
166 | | - filter :src_prefix_in, filters: STRING_FILTERS |
167 | | - filter :dst_prefix_in, filters: STRING_FILTERS |
168 | | - filter :src_prefix_out, filters: STRING_FILTERS |
169 | | - filter :dst_prefix_out, filters: STRING_FILTERS |
170 | | - filter :lrn, filters: STRING_FILTERS |
171 | | - filter :diversion_in, filters: STRING_FILTERS |
172 | | - filter :diversion_out, filters: STRING_FILTERS |
173 | | - filter :src_name_in, filters: STRING_FILTERS |
174 | | - filter :src_name_out, filters: STRING_FILTERS |
| 168 | + filter :src_prefix_in, filters: string_filters |
| 169 | + filter :dst_prefix_in, filters: string_filters |
| 170 | + filter :src_prefix_out, filters: string_filters |
| 171 | + filter :dst_prefix_out, filters: string_filters |
| 172 | + filter :lrn, filters: string_filters |
| 173 | + filter :diversion_in, filters: string_filters |
| 174 | + filter :diversion_out, filters: string_filters |
| 175 | + filter :src_name_in, filters: string_filters |
| 176 | + filter :src_name_out, filters: string_filters |
175 | 177 | filter :node, input_html: { class: 'tom-select' } |
176 | 178 | filter :pop, input_html: { class: 'tom-select' } |
177 | | - filter :local_tag, filters: STRING_FILTERS |
178 | | - filter :legb_local_tag, filters: STRING_FILTERS |
179 | | - filter :orig_call_id, as: :string, filters: STRING_FILTERS |
180 | | - filter :term_call_id, as: :string, filters: STRING_FILTERS |
| 179 | + filter :local_tag, filters: string_filters |
| 180 | + filter :legb_local_tag, filters: string_filters |
| 181 | + filter :orig_call_id, as: :string, filters: string_filters |
| 182 | + filter :term_call_id, as: :string, filters: string_filters |
181 | 183 | filter :routing_attempt |
182 | 184 | filter :customer_price |
183 | 185 | filter :vendor_price |
184 | 186 | filter :profit |
185 | 187 | filter :routing_delay |
186 | 188 | filter :pdd |
187 | 189 | filter :rtt |
188 | | - filter :p_charge_info_in, filters: STRING_FILTERS |
| 190 | + filter :p_charge_info_in, filters: string_filters |
189 | 191 | filter :uuid_equals, label: 'UUID' |
190 | 192 | filter :auth_orig_ip_covers, |
191 | 193 | as: :string, |
192 | 194 | input_html: { class: 'search_filter_string' }, |
193 | 195 | label: I18n.t('activerecord.attributes.cdr.auth_orig_ip') |
194 | | - filter :sign_orig_ip, filters: STRING_FILTERS |
195 | | - filter :sign_orig_local_ip, filters: STRING_FILTERS |
196 | | - filter :sign_term_local_ip, filters: STRING_FILTERS |
197 | | - filter :sign_term_ip, filters: STRING_FILTERS |
| 196 | + filter :sign_orig_ip, filters: string_filters |
| 197 | + filter :sign_orig_local_ip, filters: string_filters |
| 198 | + filter :sign_term_local_ip, filters: string_filters |
| 199 | + filter :sign_term_ip, filters: string_filters |
198 | 200 | filter :customer_auth_external_type_eq, as: :string, label: 'CUSTOMER AUTH EXTERNAL TYPE' |
199 | 201 | filter :lega_ss_status_id_eq, label: 'LegA SS status', as: :select, collection: Cdr::Cdr::SS_STATUSES.invert, input_html: { class: 'tom-select' } |
200 | 202 | filter :legb_ss_status_id_eq, label: 'LegB SS status', as: :select, collection: Cdr::Cdr::SS_STATUSES.invert, input_html: { class: 'tom-select' } |
|
0 commit comments