mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Pending history and admin controls #2557
This commit is contained in:
parent
6986b7b738
commit
07e4c0cd96
10 changed files with 95 additions and 84 deletions
35
app/controllers/admin/pendings_controller.rb
Normal file
35
app/controllers/admin/pendings_controller.rb
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
class Admin::PendingsController < AdminController
|
||||||
|
before_action :find_domain
|
||||||
|
before_action :check_status
|
||||||
|
|
||||||
|
def update
|
||||||
|
authorize! :update, :pending
|
||||||
|
|
||||||
|
@epp_domain = Epp::Domain.find(params[:domain_id]) # only epp domain has apply pending
|
||||||
|
if @epp_domain.apply_pending_update!
|
||||||
|
redirect_to admin_domain_path(@domain.id), notice: t(:successfully_updated)
|
||||||
|
else
|
||||||
|
redirect_to admin_edit_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
authorize! :destroy, :pending
|
||||||
|
|
||||||
|
if @domain.clean_pendings!
|
||||||
|
redirect_to admin_domain_path(@domain.id), notice: t(:successfully_destroyed)
|
||||||
|
else
|
||||||
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def find_domain
|
||||||
|
@domain = Domain.find(params[:domain_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_status
|
||||||
|
return redirect_to admin_domain_path(@domain.id), alert: t(:something_wrong) unless @domain.pending_update?
|
||||||
|
end
|
||||||
|
end
|
|
@ -123,7 +123,8 @@ class Ability
|
||||||
can :manage, WhiteIp
|
can :manage, WhiteIp
|
||||||
can :read, ApiLog::EppLog
|
can :read, ApiLog::EppLog
|
||||||
can :read, ApiLog::ReppLog
|
can :read, ApiLog::ReppLog
|
||||||
# can :index, :delayed_job
|
can :update, :pending
|
||||||
|
can :destroy, :pending
|
||||||
can :create, :zonefile
|
can :create, :zonefile
|
||||||
can :access, :settings_menu
|
can :access, :settings_menu
|
||||||
end
|
end
|
||||||
|
|
|
@ -367,6 +367,8 @@ class Domain < ActiveRecord::Base
|
||||||
self.pending_json = {}
|
self.pending_json = {}
|
||||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||||
statuses.delete(DomainStatus::PENDING_DELETE)
|
statuses.delete(DomainStatus::PENDING_DELETE)
|
||||||
|
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
||||||
|
status_notes[DomainStatus::PENDING_DELETE] = ''
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -433,9 +433,10 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
return unless update(frame, user, false)
|
return unless update(frame, user, false)
|
||||||
clean_pendings!
|
clean_pendings!
|
||||||
self.deliver_emails = true # turn on email delivery for epp
|
self.deliver_emails = true # turn on email delivery
|
||||||
DomainMailer.registrant_updated_notification_for_new_registrant(self).deliver_now
|
DomainMailer.registrant_updated_notification_for_new_registrant(self).deliver_now
|
||||||
old_registrant_email.deliver_now
|
old_registrant_email.deliver_now
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_pending_delete!
|
def apply_pending_delete!
|
||||||
|
@ -446,6 +447,7 @@ class Epp::Domain < Domain
|
||||||
DomainMailer.delete_confirmation(self).deliver_now
|
DomainMailer.delete_confirmation(self).deliver_now
|
||||||
|
|
||||||
clean_pendings! if epp_destroy(frame, user, false)
|
clean_pendings! if epp_destroy(frame, user, false)
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def attach_legal_document(legal_document_data)
|
def attach_legal_document(legal_document_data)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
- statuses_link ||= false
|
||||||
- version ||= false
|
- version ||= false
|
||||||
- domain ||= false
|
- domain ||= false
|
||||||
- pending_user ||= false
|
- pending_user ||= false
|
||||||
|
@ -11,30 +12,24 @@
|
||||||
- registrant = children[:registrant] || []
|
- registrant = children[:registrant] || []
|
||||||
- event = version.event
|
- event = version.event
|
||||||
- creator = plain_username(version.terminator)
|
- creator = plain_username(version.terminator)
|
||||||
- elsif pending_user # pending history
|
- else # pending history
|
||||||
- nameservers = domain.nameservers
|
- nameservers = domain.nameservers
|
||||||
- tech_contacts = domain.tech_contacts
|
- tech_contacts = domain.tech_contacts
|
||||||
- admin_contacts = domain.admin_contacts
|
- admin_contacts = domain.admin_contacts
|
||||||
- registrant = [domain.registrant]
|
- registrant = [domain.registrant]
|
||||||
- creator = pending_user.try(:username)
|
- creator = pending_user.try(:username)
|
||||||
- event = 'PENDING'
|
- event = 'pending'
|
||||||
- else # if legacy data not presentable
|
|
||||||
- nameservers = []
|
|
||||||
- tech_contacts = []
|
|
||||||
- admin_contacts = []
|
|
||||||
- registrant = []
|
|
||||||
- event = 'Log data is not viewable'
|
|
||||||
- creator = ''
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
%p.nowrap
|
%p.nowrap
|
||||||
= l(domain.updated_at, format: :short)
|
= l(domain.updated_at, format: :shorts)
|
||||||
|
- if statuses_link
|
||||||
|
%br= link_to t(:edit_statuses), edit_admin_domain_path(params[:domain_id])
|
||||||
|
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= event
|
= event
|
||||||
%br
|
%br
|
||||||
= creator
|
= creator
|
||||||
- if event == 'PENDING'
|
|
||||||
%br= link_to t(:manage), edit_admin_domain_path(params[:domain_id])
|
|
||||||
|
|
||||||
%td
|
%td
|
||||||
%p
|
%p
|
||||||
|
@ -48,7 +43,14 @@
|
||||||
%p
|
%p
|
||||||
- domain.statuses.each do |s|
|
- domain.statuses.each do |s|
|
||||||
= s
|
= s
|
||||||
|
- notes = domain.status_notes[s]
|
||||||
|
- if notes
|
||||||
|
%br
|
||||||
|
%i= notes
|
||||||
%br
|
%br
|
||||||
|
- if domain.pending_json.present?
|
||||||
|
%p
|
||||||
|
= link_to t(:pending_epp), '#', class: 'js-pending-toggle'
|
||||||
|
|
||||||
%td
|
%td
|
||||||
- registrant.each do |r|
|
- registrant.each do |r|
|
||||||
|
@ -89,69 +91,13 @@
|
||||||
%p
|
%p
|
||||||
= domain.registrar.name
|
= domain.registrar.name
|
||||||
|
|
||||||
-# %td
|
- if domain.pending_json.present?
|
||||||
-# = version.children.inspect
|
%tr.js-pending{ style: 'display: none;' }
|
||||||
|
%td{colspan: 8}
|
||||||
-# %td{ class: changes.include?(:domain) ? 'edit-highlight' : 'no-highlight' }
|
= preserve do
|
||||||
-# - if children[:domain]
|
%pre
|
||||||
-# %p{:style => "font-size:x-small;"}
|
- formatted_req = Nokogiri::XML(domain.pending_json['frame'])
|
||||||
-# = children[:domain][:period]
|
- if formatted_req.errors.none?
|
||||||
-# = children[:domain][:period_unit] if children[:domain][:period]
|
= formatted_req
|
||||||
-# - if children[:domain][:valid_to] && children[:domain][:valid_from]
|
- else
|
||||||
-# = ","
|
= domain.pending_json['frame']
|
||||||
-# = l(children[:domain][:valid_from], format: :date) + '-' + l(children[:domain][:valid_to], format: :date)
|
|
||||||
-# - if children[:domain].try(:[], :registrar_id)
|
|
||||||
-# = ","
|
|
||||||
-# = Registrar.find(children[:domain][:registrar_id]).try(:name)
|
|
||||||
-# - if children[:domain][:status]
|
|
||||||
-# = ',' + children[:domain][:status]
|
|
||||||
|
|
||||||
|
|
||||||
-# %td{ class: changes.include?(:registrant) ? 'edit-highlight' : 'no-highlight' }
|
|
||||||
-# - if children[:registrant]
|
|
||||||
-# %p{:style => "font-size:x-small;"}
|
|
||||||
-# = children[:registrant][:name]
|
|
||||||
-# = ","
|
|
||||||
-# = children[:registrant][:phone]
|
|
||||||
-# = ","
|
|
||||||
-# = children[:registrant][:email]
|
|
||||||
-# = ","
|
|
||||||
-# = children[:registrant][:code]
|
|
||||||
|
|
||||||
-# %td{ class: changes.include?(:admin_contacts) ? 'edit-highlight' : 'no-highlight' }
|
|
||||||
-# - if children[:admin_contacts]
|
|
||||||
-# - children[:admin_contacts].each do |ac|
|
|
||||||
-# %p{:style => "font-size:x-small;"}
|
|
||||||
-# = ac[:name]
|
|
||||||
-# = ","
|
|
||||||
-# = ac[:phone]
|
|
||||||
-# = ","
|
|
||||||
-# = ac[:email]
|
|
||||||
-# = ","
|
|
||||||
-# = ac[:code]
|
|
||||||
|
|
||||||
-# %td{ class: changes.include?(:tech_contacts) ? 'edit-highlight' : 'no-highlight' }
|
|
||||||
-# - if children[:tech_contacts]
|
|
||||||
-# - children[:tech_contacts].each do |tc|
|
|
||||||
-# %p{:style => "font-size:x-small;"}
|
|
||||||
-# = tc[:name]
|
|
||||||
-# = ","
|
|
||||||
-# = tc[:phone]
|
|
||||||
-# = ","
|
|
||||||
-# = tc[:email]
|
|
||||||
-# = ","
|
|
||||||
-# = tc[:code]
|
|
||||||
|
|
||||||
-# %td{ class: changes.include?(:nameservers) ? 'edit-highlight' : 'no-highlight' }
|
|
||||||
-# - if children[:nameservers]
|
|
||||||
-# - children[:nameservers].each do |ns|
|
|
||||||
-# %p{:style => "font-size:x-small;"}
|
|
||||||
-# = ns[:hostname]
|
|
||||||
-# = ","
|
|
||||||
-# = ns[:ipv4] || ns[:ipv6]
|
|
||||||
|
|
||||||
-# %td
|
|
||||||
-# %p{ :style => 'font-size:x-small;' }
|
|
||||||
-# = l(version.created_at, format: :short)
|
|
||||||
-# = whodunnit_with_protocol(version.whodunnit)
|
|
||||||
-# = version.event
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
%th{class: 'col-xs-1'}= t(:timestap)
|
%th{class: 'col-xs-1'}= t(:timestap)
|
||||||
%th{class: 'col-xs-1'}= t(:period)
|
%th{class: 'col-xs-1'}= t(:period)
|
||||||
%th{class: 'col-xs-2'}= t(:statuses)
|
%th{class: 'col-xs-2'}= t(:statuses)
|
||||||
%th{class: 'col-xs-2'}= t(:owner)
|
%th{class: 'col-xs-2'}= t(:registrant)
|
||||||
%th{class: 'col-xs-2'}= t(:admin)
|
%th{class: 'col-xs-2'}= t(:admin)
|
||||||
%th{class: 'col-xs-2'}= t(:tech)
|
%th{class: 'col-xs-2'}= t(:tech)
|
||||||
%th{class: 'col-xs-2'}= t(:nameservers)
|
%th{class: 'col-xs-2'}= t(:nameservers)
|
||||||
|
@ -21,14 +21,24 @@
|
||||||
- if @pending_domain.present?
|
- if @pending_domain.present?
|
||||||
%tr.small
|
%tr.small
|
||||||
= render 'admin/domain_versions/version',
|
= render 'admin/domain_versions/version',
|
||||||
domain: @pending_domain, pending_user: @pending_user
|
domain: @pending_domain, pending_user: @pending_user, statuses_link: true
|
||||||
|
|
||||||
|
-# current version
|
||||||
- if @domain.versions.present?
|
- if @domain.versions.present?
|
||||||
%tr.small
|
%tr.small
|
||||||
= render 'admin/domain_versions/version',
|
= render 'admin/domain_versions/version',
|
||||||
domain: @domain, version: @domain.versions.last
|
domain: @domain, version: @domain.versions.last
|
||||||
|
|
||||||
|
-# all other older versions
|
||||||
- @domain.versions.not_creates.reverse.each do |version|
|
- @domain.versions.not_creates.reverse.each do |version|
|
||||||
%tr.small
|
%tr.small
|
||||||
= render 'admin/domain_versions/version',
|
= render 'admin/domain_versions/version',
|
||||||
domain: version.reify, version: version.previous
|
domain: version.reify, version: version.previous
|
||||||
|
|
||||||
|
:coffee
|
||||||
|
$(document).on 'click', '.js-pending-toggle', (e) ->
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
$(document).on 'mousedown', '.js-pending-toggle', (e) ->
|
||||||
|
target = $(e.target)
|
||||||
|
target.parents('tr').next('tr.js-pending').toggle()
|
||||||
|
|
|
@ -1 +1,8 @@
|
||||||
yeah
|
- if (status == DomainStatus::PENDING_UPDATE && f.object.pending_json.present?)
|
||||||
|
= link_to(t(:apply_pending), admin_domain_pending_path(f.object.id, f.object.id),
|
||||||
|
method: :patch, data: { confirm: t(:are_you_sure) },
|
||||||
|
class: 'btn btn-danger btn-xs')
|
||||||
|
|
||||||
|
= link_to(t(:delete_pending), admin_domain_pending_path(f.object.id, f.object.id),
|
||||||
|
method: :delete, data: { confirm: t(:are_you_sure) },
|
||||||
|
class: 'btn btn-danger btn-xs')
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
.panel-heading.clearfix
|
.panel-heading.clearfix
|
||||||
.pull-left= t(:status)
|
.pull-left= t(:status)
|
||||||
.pull-right
|
.pull-right
|
||||||
|
- if model == 'domain'
|
||||||
|
= render 'admin/domains/form/pending_update', f: f, status: s
|
||||||
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
|
= link_to(t(:delete), '#', class: 'btn btn-danger btn-xs js-destroy-status', style: delete_style)
|
||||||
.panel-body
|
.panel-body
|
||||||
.form-group
|
.form-group
|
||||||
|
|
|
@ -22,6 +22,7 @@ en:
|
||||||
longer: "%a, %e. %b %Y, %H:%M"
|
longer: "%a, %e. %b %Y, %H:%M"
|
||||||
long: "%A, %e. %B %Y, %H:%M"
|
long: "%A, %e. %B %Y, %H:%M"
|
||||||
short: "%d.%m.%y, %H:%M"
|
short: "%d.%m.%y, %H:%M"
|
||||||
|
shorts: "%d.%m.%y, %H:%M:%S"
|
||||||
date: "%d.%m.%y"
|
date: "%d.%m.%y"
|
||||||
date_long: "%d. %B %Y"
|
date_long: "%d. %B %Y"
|
||||||
ydate: "%Y.%m.%d"
|
ydate: "%Y.%m.%d"
|
||||||
|
@ -654,7 +655,10 @@ en:
|
||||||
general: General
|
general: General
|
||||||
id_card: 'ID Card'
|
id_card: 'ID Card'
|
||||||
m_id: 'M-ID'
|
m_id: 'M-ID'
|
||||||
destroyed: It was successfully deleted.
|
successfully_destroyed: It was successfully deleted.
|
||||||
|
successfully_updated: It was successfully updated.
|
||||||
|
something_wrong: Not success, something went wrong!
|
||||||
|
failure: Not success
|
||||||
not_found: Not found
|
not_found: Not found
|
||||||
no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later.
|
no_connection_to_registry: Connection issue to the registry EPP or REPP server! Please try again later.
|
||||||
domain_not_found: 'Domain was not found'
|
domain_not_found: 'Domain was not found'
|
||||||
|
@ -904,4 +908,5 @@ en:
|
||||||
poll_pending_delete_rejected_by_registrant: 'Registrant rejected domain deletion'
|
poll_pending_delete_rejected_by_registrant: 'Registrant rejected domain deletion'
|
||||||
poll_pending_delete_confirmed_by_registrant: 'Registrant confirmed domain deletion'
|
poll_pending_delete_confirmed_by_registrant: 'Registrant confirmed domain deletion'
|
||||||
manage: Manage
|
manage: Manage
|
||||||
|
pending_epp: Pending epp
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :domains do
|
resources :domains do
|
||||||
resources :domain_versions
|
resources :domain_versions
|
||||||
|
resources :pendings
|
||||||
member do
|
member do
|
||||||
post 'set_force_delete'
|
post 'set_force_delete'
|
||||||
post 'unset_force_delete'
|
post 'unset_force_delete'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue