REPP logs view

This commit is contained in:
Martin Lensment 2015-01-13 16:25:59 +02:00
parent b10815810d
commit 24a016cf48
9 changed files with 104 additions and 1 deletions

View file

@ -0,0 +1,11 @@
class Admin::ReppLogsController < ApplicationController
load_and_authorize_resource class: ApiLog::ReppLog
def index
@repp_logs = ApiLog::ReppLog.order(id: :desc).page(params[:page])
end
def show
@repp_log = ApiLog::ReppLog.find(params[:id])
end
end

View file

@ -25,6 +25,7 @@ class Ability
can :manage, Keyrelay can :manage, Keyrelay
can :manage, LegalDocument can :manage, LegalDocument
can :read, ApiLog::EppLog can :read, ApiLog::EppLog
can :read, ApiLog::ReppLog
can :index, :delayed_job can :index, :delayed_job
can :create, :zonefile can :create, :zonefile
can :access, :settings_menu can :access, :settings_menu

View file

@ -55,4 +55,3 @@
= preserve do = preserve do
%pre %pre
= @epp_log.response = @epp_log.response

View file

@ -0,0 +1,28 @@
.row
.col-sm-12
%h2.text-center-xs= t('repp_logs')
%hr
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-2'}= t('request_path')
%th{class: 'col-xs-2'}= t('request_method')
%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')
%tbody
- @repp_logs.each do |x|
%tr
%td= link_to(x.request_path, admin_repp_log_path(x))
%td= x.request_method
%td= x.response_code
%td= x.api_user_name
%td= x.api_user_registrar
%td= l(x.created_at)
.row
.col-md-12
= paginate @repp_logs

View file

@ -0,0 +1,54 @@
.row
.col-sm-6
%h2.text-center-xs
= t('repp_log')
.col-sm-6
%h2.text-right.text-center-xs
= link_to(t('back'), :back, class: 'btn btn-primary')
%hr
.row
.col-md-12
.panel.panel-default
.panel-heading
%h3.panel-title= t('details')
.panel-body
%dl.dl-horizontal
%dt= t('request_path')
%dd= @repp_log.request_path
%dt= t('request_method')
%dd= @repp_log.request_method
%dt= t('response_code')
%dd= @repp_log.response_code
%dt= t('api_user')
%dd= @repp_log.api_user_name
%dt= t('registrar')
%dd= @repp_log.api_user_registrar
%dt= t('ip')
%dd= @repp_log.ip
%dt= t('created_at')
%dd= @repp_log.created_at
.row
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t('request_params')
.panel-body
= preserve do
%pre
= JSON.pretty_generate(JSON.parse(@repp_log.request_params))
/ = @repp_log.request_params
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t('response')
.panel-body
= preserve do
%pre
= JSON.pretty_generate(JSON.parse(@repp_log.response))

View file

@ -49,6 +49,7 @@
%li= link_to t('zonefile'), admin_zonefile_settings_path %li= link_to t('zonefile'), admin_zonefile_settings_path
%li= link_to t(:domains_history), admin_domain_versions_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(:epp_logs), admin_epp_logs_path
%li= link_to t(:repp_logs), admin_repp_logs_path
%li= link_to t(:background_jobs), admin_delayed_jobs_path %li= link_to t(:background_jobs), admin_delayed_jobs_path
%li.divider %li.divider

View file

@ -490,3 +490,9 @@ en:
response: 'Response' response: 'Response'
details: 'Details' details: 'Details'
ip: 'IP' ip: 'IP'
request_path: 'Request path'
request_method: 'Request method'
response_code: 'Response code'
request_params: 'Request params'
repp_log: 'REPP log'
repp_logs: 'REPP logs'

View file

@ -41,6 +41,7 @@ Rails.application.routes.draw do
resource :dashboard resource :dashboard
resources :epp_logs resources :epp_logs
resources :repp_logs
root 'domains#index' root 'domains#index'
end end

View file

@ -22,6 +22,7 @@ describe User do
it { should be_able_to(:manage, Keyrelay.new) } it { should be_able_to(:manage, Keyrelay.new) }
it { should be_able_to(:manage, LegalDocument.new) } it { should be_able_to(:manage, LegalDocument.new) }
it { should be_able_to(:read, ApiLog::EppLog.new) } it { should be_able_to(:read, ApiLog::EppLog.new) }
it { should be_able_to(:read, ApiLog::ReppLog.new) }
it { should be_able_to(:index, :delayed_job) } it { should be_able_to(:index, :delayed_job) }
it { should be_able_to(:create, :zonefile) } it { should be_able_to(:create, :zonefile) }
it { should be_able_to(:access, :settings_menu) } it { should be_able_to(:access, :settings_menu) }
@ -40,6 +41,7 @@ describe User do
it { should_not be_able_to(:manage, EppUser.new) } it { should_not be_able_to(:manage, EppUser.new) }
it { should_not be_able_to(:manage, LegalDocument.new) } it { should_not be_able_to(:manage, LegalDocument.new) }
it { should_not be_able_to(:read, ApiLog::EppLog.new) } it { should_not be_able_to(:read, ApiLog::EppLog.new) }
it { should_not be_able_to(:read, ApiLog::ReppLog.new) }
it { should_not be_able_to(:index, :delayed_job) } it { should_not be_able_to(:index, :delayed_job) }
it { should_not be_able_to(:create, :zonefile) } it { should_not be_able_to(:create, :zonefile) }
it { should_not be_able_to(:access, :settings_menu) } it { should_not be_able_to(:access, :settings_menu) }