Epp search

This commit is contained in:
Martin Lensment 2015-01-28 12:00:53 +02:00
parent 365e27086f
commit bf044e77bb
7 changed files with 64 additions and 6 deletions

View file

@ -1,5 +1,7 @@
ready = ->
$('.selectize').selectize();
$('.selectize').selectize({
allowEmptyOption: true
});
$(document).ready(ready)
$(document).on('page:load', ready)

View file

@ -2,7 +2,9 @@ class Admin::EppLogsController < ApplicationController
load_and_authorize_resource class: ApiLog::EppLog
def index
@epp_logs = ApiLog::EppLog.order(id: :desc).page(params[:page])
@q = ApiLog::EppLog.search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@epp_logs = @q.result.page(params[:page])
end
def show

View file

@ -2,7 +2,9 @@ class Admin::ReppLogsController < ApplicationController
load_and_authorize_resource class: ApiLog::ReppLog
def index
@repp_logs = ApiLog::ReppLog.order(id: :desc).page(params[:page])
@q = ApiLog::ReppLog.search(params[:q])
@q.sorts = 'id desc' if @q.sorts.empty?
@repp_logs = @q.result.page(params[:page])
end
def show

View file

@ -172,6 +172,7 @@ class EppController < ApplicationController
def write_to_epp_log
# return nil if EPP_LOG_ENABLED
puts params[:epp_object_type]
request_command = params[:command] || params[:action] # error receives :command, other methods receive :action
ApiLog::EppLog.create({
request: params[:raw_frame] || params[:frame],

View file

@ -1,9 +1,50 @@
.row
.col-sm-12
%h2.text-center-xs= t('epp_logs')
%hr
.row
.col-md-12
%hr
= search_form_for @q, url: [:admin, :epp_logs], html: { style: 'margin-bottom: 0;', class: 'js-form' } do |f|
.row
.col-md-3
.form-group
= f.label :request_command
= f.select :request_command_eq, [[t('choose'),''], 'hello', 'login', 'logout', 'info', 'create', 'update', 'delete', 'check', 'renew', 'transfer', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t('choose')
.col-md-3
.form-group
= f.label :request_object
= f.select :request_object_eq, [[t('choose'),''], 'contact', 'domain', 'poll', 'keyrelay'], {}, class: 'form-control selectize', placeholder: t('choose')
.col-md-3
.form-group
= f.label :request_successful
= f.select :request_successful_true, [[t('choose'), ''], 'true', 'false'], {}, class: 'form-control selectize', placeholder: t('choose')
.col-md-3
.form-group
= f.label :api_user
= f.search_field :api_user_name_cont, class: 'form-control', placeholder: t('api_user')
.row
.col-md-3
.form-group
= f.label :registrar
= f.search_field :api_user_registrar_cont, class: 'form-control', placeholder: t('registrar')
.col-md-3
.form-group
= f.label :created_at
= f.search_field :created_at_gteq, class: 'form-control', placeholder: t('created_at')
.col-md-3
.form-group
= f.label :created_at
= f.search_field :created_at_lteq, class: 'form-control', placeholder: t('created_at')
.col-md-3{style: 'padding-top: 25px;'}
%button.btn.btn-primary
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%button.btn.btn-default.js-reset-form
= t('clear_fields')
.row
.col-md-12
%hr
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
@ -13,7 +54,8 @@
%th{class: 'col-xs-2'}= t('request_successful')
%th{class: 'col-xs-2'}= t('api_user')
%th{class: 'col-xs-2'}= t('registrar')
%th{class: 'col-xs-2'}= t('created_at')
%th{class: 'col-xs-2'}
= sort_link(@q, 'created_at')
%tbody
- @epp_logs.each do |x|
%tr
@ -26,3 +68,8 @@
.row
.col-md-12
= paginate @epp_logs
:coffee
$(".js-reset-form").on "click", (e) ->
e.preventDefault();
window.location = "#{admin_epp_logs_path}"

View file

@ -13,7 +13,8 @@
%th{class: 'col-xs-2'}= t('response_code')
%th{class: 'col-xs-2'}= t('api_user')
%th{class: 'col-xs-2'}= t('registrar')
%th{class: 'col-xs-2'}= t('created_at')
%th{class: 'col-xs-2'}
= sort_link(@q, 'created_at')
%tbody
- @repp_logs.each do |x|
%tr

View file

@ -501,3 +501,6 @@ en:
unknown_expiry_absolute_pattern: 'Expiry absolute must be compatible to ISO 8601'
mutally_exclusive_params: 'Mutually exclusive parameters: %{params}'
attribute_is_invalid: 'Attribute is invalid: %{attribute}'
request_successful: 'Request successful'
choose: 'Choose...'
clear_fields: 'Clear fields'