mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
Merge pull request #109 from internetee/114554395-log_limits
114554395 log limits
This commit is contained in:
commit
abad5accf8
6 changed files with 57 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
|||
class Admin::AccountActivitiesController < AdminController
|
||||
load_and_authorize_resource
|
||||
before_action :set_default_dates, only: [:index]
|
||||
|
||||
def index # rubocop: disable Metrics/AbcSize
|
||||
params[:q] ||= {}
|
||||
|
||||
ca_cache = params[:q][:created_at_lteq]
|
||||
begin
|
||||
|
@ -41,4 +41,20 @@ class Admin::AccountActivitiesController < AdminController
|
|||
|
||||
params[:q][:created_at_lteq] = ca_cache
|
||||
end
|
||||
|
||||
def set_default_dates
|
||||
params[:q] ||= {}
|
||||
|
||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||
|
||||
default_date = params[:created_after]
|
||||
|
||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||
default_date = 'today'
|
||||
end
|
||||
|
||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class Admin::EppLogsController < AdminController
|
||||
load_and_authorize_resource class: ApiLog::EppLog
|
||||
before_action :set_default_dates, only: [:index]
|
||||
|
||||
def index
|
||||
@q = ApiLog::EppLog.search(params[:q])
|
||||
|
@ -10,4 +11,19 @@ class Admin::EppLogsController < AdminController
|
|||
def show
|
||||
@epp_log = ApiLog::EppLog.find(params[:id])
|
||||
end
|
||||
|
||||
def set_default_dates
|
||||
params[:q] ||= {}
|
||||
|
||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||
default_date = params[:created_after]
|
||||
|
||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||
default_date = 'today'
|
||||
end
|
||||
|
||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class Admin::ReppLogsController < AdminController
|
||||
load_and_authorize_resource class: ApiLog::ReppLog
|
||||
before_action :set_default_dates, only: [:index]
|
||||
|
||||
def index
|
||||
@q = ApiLog::ReppLog.search(params[:q])
|
||||
|
@ -10,4 +11,20 @@ class Admin::ReppLogsController < AdminController
|
|||
def show
|
||||
@repp_log = ApiLog::ReppLog.find(params[:id])
|
||||
end
|
||||
|
||||
def set_default_dates
|
||||
params[:q] ||= {}
|
||||
|
||||
if params[:q][:created_at_gteq].nil? && params[:q][:created_at_lteq].nil? && params[:created_after].present?
|
||||
|
||||
default_date = params[:created_after]
|
||||
|
||||
if !['today', 'tomorrow', 'yesterday'].include?(default_date)
|
||||
default_date = 'today'
|
||||
end
|
||||
|
||||
params[:q][:created_at_gteq] = Date.send(default_date).strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_after)
|
||||
= f.search_field :created_at_gteq, class: 'form-control', placeholder: t(:created_after), autocomplete: 'off'
|
||||
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_after), autocomplete: 'off'
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_before)
|
||||
= f.search_field :created_at_lteq, class: 'form-control', placeholder: t(:created_before), autocomplete: 'off'
|
||||
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_before), autocomplete: 'off'
|
||||
.col-md-3{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-primary
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_after)
|
||||
= f.search_field :created_at_gteq, class: 'form-control', placeholder: t(:created_after), autocomplete: 'off'
|
||||
= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control datepicker', placeholder: t(:created_after), autocomplete: 'off'
|
||||
.col-md-3
|
||||
.form-group
|
||||
= f.label t(:created_before)
|
||||
= f.search_field :created_at_lteq, class: 'form-control', placeholder: t(:created_before), autocomplete: 'off'
|
||||
= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control datepicker', placeholder: t(:created_before), autocomplete: 'off'
|
||||
.col-md-3{style: 'padding-top: 25px;'}
|
||||
%button.btn.btn-primary
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
%li= link_to t(:pricelists), admin_pricelists_path
|
||||
%li= link_to t(:bank_statements), admin_bank_statements_path
|
||||
%li= link_to t(:invoices), admin_invoices_path
|
||||
%li= link_to t(:account_activities), admin_account_activities_path
|
||||
%li= link_to t(:account_activities), admin_account_activities_path(created_after: 'today')
|
||||
%li.divider
|
||||
%li.dropdown-header= t(:system)
|
||||
%li= link_to t(:settings), admin_settings_path
|
||||
|
@ -64,8 +64,8 @@
|
|||
%li= link_to t(:reserved_domains), admin_reserved_domains_path
|
||||
%li= link_to t(:mail_templates), admin_mail_templates_path
|
||||
-# %li= link_to t(:domains_history), admin_domain_versions_path
|
||||
%li= link_to t(:epp_logs), admin_epp_logs_path
|
||||
%li= link_to t(:repp_logs), admin_repp_logs_path
|
||||
%li= link_to t(:epp_logs), admin_epp_logs_path(created_after: 'today')
|
||||
%li= link_to t(:repp_logs), admin_repp_logs_path(created_after: 'today')
|
||||
%li= link_to t(:que), '/admin/que'
|
||||
|
||||
- if signed_in?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue