Refactor zones

- Rename "zonefile_setting" to "zone"
- Remove version

#475
This commit is contained in:
Artur Beljajev 2017-04-20 17:20:36 +03:00
parent f1d7e53734
commit bff7437277
51 changed files with 425 additions and 389 deletions

View file

@ -0,0 +1,64 @@
module Admin
module DNS
class ZonesController < AdminController
#load_and_authorize_resource(class: DNS::Zone)
skip_authorization_check
before_action :load_zone, only: %i[edit update destroy]
def index
@zones = ::DNS::Zone.all
end
def new
@zone = ::DNS::Zone.new
end
def create
@zone = ::DNS::Zone.new(zone_params)
if @zone.save
flash[:notice] = t('.created')
redirect_to_index
else
render :new
end
end
def edit
@zone = ::DNS::Zone.find(params[:id])
end
def update
if @zone.update(zone_params)
flash[:notice] = t('.updated')
redirect_to_index
else
render :edit
end
end
def destroy
@zone.destroy!
flash[:notice] = t('.destroyed')
redirect_to_index
end
private
def load_zone
@zone = ::DNS::Zone.find(params[:id])
end
def zone_params
params.require(:zone).permit(
:origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email,
:master_nameserver, :ns_records, :a_records, :a4_records
)
end
def redirect_to_index
redirect_to admin_zones_url
end
end
end
end

View file

@ -1,60 +0,0 @@
class Admin::ZonefileSettingsController < AdminController
load_and_authorize_resource
before_action :set_zonefile_setting, only: [:update, :edit]
def index
@zonefile_settings = ZonefileSetting.all
end
def new
@zonefile_setting = ZonefileSetting.new
end
def create
@zonefile_setting = ZonefileSetting.new(zonefile_setting_params)
if @zonefile_setting.save
flash[:notice] = I18n.t('record_created')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_create_record')
render 'new'
end
end
def edit
@zonefile_setting = ZonefileSetting.find(params[:id])
end
def update
if @zonefile_setting.update(zonefile_setting_params)
flash[:notice] = I18n.t('record_updated')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_update_record')
render 'edit'
end
end
def destroy
if @zonefile_setting.destroy
flash[:notice] = I18n.t('record_deleted')
redirect_to admin_zonefile_settings_path
else
flash.now[:alert] = I18n.t('failed_to_delete_record')
render 'edit'
end
end
private
def set_zonefile_setting
@zonefile_setting = ZonefileSetting.find(params[:id])
end
def zonefile_setting_params
params.require(:zonefile_setting).permit(
:origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email,
:master_nameserver, :ns_records, :a_records, :a4_records
)
end
end

View file

@ -3,7 +3,7 @@ class Admin::ZonefilesController < ApplicationController
# TODO: Refactor this # TODO: Refactor this
def create def create
if ZonefileSetting.origins.include?(params[:origin]) if DNS::Zone.origins.include?(params[:origin])
@zonefile = ActiveRecord::Base.connection.execute( @zonefile = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{params[:origin]}')" "select generate_zonefile('#{params[:origin]}')"

View file

@ -93,7 +93,7 @@ class Ability
can :manage, Setting can :manage, Setting
can :manage, BlockedDomain can :manage, BlockedDomain
can :manage, ReservedDomain can :manage, ReservedDomain
can :manage, ZonefileSetting can :manage, DNS::Zone
can :manage, DomainVersion can :manage, DomainVersion
can :manage, ContactVersion can :manage, ContactVersion
can :manage, Pricelist can :manage, Pricelist

5
app/models/dns.rb Normal file
View file

@ -0,0 +1,5 @@
module DNS
def self.use_relative_model_naming?
true
end
end

48
app/models/dns/zone.rb Normal file
View file

@ -0,0 +1,48 @@
module DNS
class Zone < ActiveRecord::Base
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
validates :origin, uniqueness: true
before_destroy :check_for_dependencies
def check_for_dependencies
dc = Domain.where("name ILIKE ?", "%.#{origin}").count
return if dc == 0
errors.add(:base, I18n.t('there_are_count_domains_in_this_zone', count: dc))
false
end
def self.generate_zonefiles
pluck(:origin).each do |origin|
generate_zonefile(origin)
end
end
def self.generate_zonefile(origin)
filename = "#{origin}.zone"
STDOUT << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
zf = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{origin}')"
)[0]['generate_zonefile']
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
STDOUT << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
end
def self.origins
pluck(:origin)
end
def to_s
origin
end
def to_partial_path
'zone'
end
end
end

View file

@ -1,5 +0,0 @@
class ZonefileSettingVersion < PaperTrail::Version
include VersionSession
self.table_name = :log_zonefile_settings
self.sequence_name = :log_zonefile_settings_id_seq
end

View file

@ -1,42 +0,0 @@
class ZonefileSetting < ActiveRecord::Base
include Versions # version/zonefile_setting_version.rb
validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true
validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true }
validates :origin, uniqueness: true
before_destroy :check_for_dependencies
def check_for_dependencies
dc = Domain.where("name ILIKE ?", "%.#{origin}").count
return if dc == 0
errors.add(:base, I18n.t('there_are_count_domains_in_this_zone', count: dc))
false
end
def self.generate_zonefiles
pluck(:origin).each do |origin|
generate_zonefile(origin)
end
end
def self.generate_zonefile(origin)
filename = "#{origin}.zone"
STDOUT << "#{Time.zone.now.utc} - Generating zonefile #{filename}\n"
zf = ActiveRecord::Base.connection.execute(
"select generate_zonefile('#{origin}')"
)[0]['generate_zonefile']
File.open("#{ENV['zonefile_export_dir']}/#{filename}", 'w') { |f| f.write(zf) }
STDOUT << "#{Time.zone.now.utc} - Successfully generated zonefile #{filename}\n"
end
def self.origins
pluck(:origin)
end
def to_s
origin
end
end

View file

@ -12,7 +12,7 @@ class DomainNameValidator < ActiveModel::EachValidator
return true unless value return true unless value
value = value.mb_chars.downcase.strip value = value.mb_chars.downcase.strip
origins = ZonefileSetting.origins origins = DNS::Zone.origins
# if someone tries to register an origin domain, let this validation pass # if someone tries to register an origin domain, let this validation pass
# the error will be caught in blocked domains validator # the error will be caught in blocked domains validator
return true if origins.include?(value) return true if origins.include?(value)
@ -38,7 +38,7 @@ class DomainNameValidator < ActiveModel::EachValidator
def validate_blocked(value) def validate_blocked(value)
return true unless value return true unless value
return false if BlockedDomain.where(name: value).count > 0 return false if BlockedDomain.where(name: value).count > 0
ZonefileSetting.where(origin: value).count.zero? DNS::Zone.where(origin: value).count.zero?
end end
end end
end end

View file

@ -31,7 +31,7 @@
%li.divider %li.divider
%li.dropdown-header= t(:system) %li.dropdown-header= t(:system)
%li= link_to t(:settings), admin_settings_path %li= link_to t(:settings), admin_settings_path
%li= link_to t(:zonefile), admin_zonefile_settings_path %li= link_to t('.zones'), admin_zones_path
%li= link_to t('.blocked_domains'), admin_blocked_domains_path %li= link_to t('.blocked_domains'), admin_blocked_domains_path
%li= link_to t('.reserved_domains'), admin_reserved_domains_path %li= link_to t('.reserved_domains'), admin_reserved_domains_path
%li= link_to t(:mail_templates), admin_mail_templates_path %li= link_to t(:mail_templates), admin_mail_templates_path

View file

@ -1,5 +1,4 @@
= form_for [:admin, zone], html: { class: 'form-horizontal' } do |f|
= form_for [:admin, @zonefile_setting], html: { class: 'form-horizontal' } do |f|
.row .row
.col-md-8 .col-md-8
#domain-statuses #domain-statuses
@ -9,7 +8,7 @@
.col-md-4.control-label .col-md-4.control-label
= f.label :origin = f.label :origin
.col-md-8 .col-md-8
- if @zonefile_setting.persisted? - if zone.persisted?
= f.text_field :origin, class: 'form-control', disabled: true = f.text_field :origin, class: 'form-control', disabled: true
- else - else
= f.text_field :origin, class: 'form-control' = f.text_field :origin, class: 'form-control'
@ -77,4 +76,4 @@
%hr %hr
.row .row
.col-md-8.text-right .col-md-8.text-right
%button.btn.btn-primary= t(:save) %button.btn.btn-success= t(".#{zone.new_record? ? 'create' : 'update'}_btn")

View file

@ -0,0 +1,9 @@
<tr>
<td><%= zone.origin %></td>
<td>
<%= link_to t('.edit_btn'), edit_admin_zone_path(zone), class: 'btn btn-xs btn-primary' %>
<%= link_to t('.generate_zone_file_btn'),
admin_zonefiles_path(origin: zone.origin),
method: 'post', class: 'btn btn-xs btn-primary' %>
</td>
</tr>

View file

@ -0,0 +1,20 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.dns.zones.index.title'), admin_zones_path %></li>
</ol>
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to(t('.delete_btn'), admin_zone_path(@zone),
method: :delete,
data: { confirm: t('.delete_btn_confirm') },
class: 'btn btn-danger') %>
</div>
</div>
</div>
<%= render 'form', zone: @zone %>

View file

@ -0,0 +1,28 @@
<div class="page-header">
<div class="row">
<div class="col-sm-10">
<h1><%= t '.title' %></h1>
</div>
<div class="col-sm-2 text-right">
<%= link_to t('.new_btn'), new_admin_zone_path, class: 'btn btn-primary' %>
</div>
</div>
</div>
<% if @zones.present? %>
<table class="table table-hover table-bordered table-wrapped">
<thead>
<tr>
<th><%= DNS::Zone.human_attribute_name :origin %></th>
<th></th>
</tr>
</thead>
<tbody>
<%= render @zones %>
</tbody>
</table>
<% else %>
<div class="alert alert-info"><%= t '.not_found' %></div>
<% end %>

View file

@ -0,0 +1,9 @@
<ol class="breadcrumb">
<li><%= link_to t('admin.dns.zones.index.title'), admin_zones_path %></li>
</ol>
<div class="page-header">
<h1><%= t '.title' %></h1>
</div>
<%= render 'form', zone: @zone %>

View file

@ -1,7 +0,0 @@
- content_for :actions do
= link_to(t(:back), admin_zonefile_settings_path, class: 'btn btn-default')
= link_to(t(:delete), admin_zonefile_setting_path(@zonefile_setting),
method: :delete, data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger')
= render 'shared/title', name: t(:edit_zone)
= render 'form'

View file

@ -1,22 +0,0 @@
- content_for :actions do
= link_to(t(:new), new_admin_zonefile_setting_path, class: 'btn btn-primary')
= render 'shared/title', name: t(:zonefile_settings)
.row
.col-md-12
.table-responsive
%table.table.table-hover.table-bordered.table-condensed
%thead
%tr
%th{class: 'col-xs-10'}
= t(:origin)
%th{class: 'col-xs-2'}
= t(:action)
%tbody
- @zonefile_settings.each do |x|
%tr
%td= link_to(x, edit_admin_zonefile_setting_path(x))
%td
= link_to(t(:generate_zonefile),
admin_zonefiles_path(origin: x.origin),
method: 'post', class: 'btn btn-xs btn-primary')

View file

@ -1,5 +0,0 @@
- content_for :actions do
= link_to(t(:back), admin_zonefile_settings_path, class: 'btn btn-default')
= render 'shared/title', name: t(:new_zone)
= render 'form'

View file

@ -0,0 +1,33 @@
en:
admin:
dns:
zones:
index:
title: Zones
new_btn: New zone
not_found: No zone found
new:
title: New zone
create:
created: Zone has been created
edit:
title: Edit zone
delete_btn: Delete
delete_btn_confirm: Are you sure you want to delete zone?
update:
updated: Zone has been updated
destroy:
destroyed: Zone has been deleted
form:
create_btn: Create zone
update_btn: Update zone
zone:
edit_btn: Edit
generate_zone_file_btn: Generate zone file

View file

@ -7,6 +7,7 @@ en:
archive: Archive archive: Archive
domain_history: Domain history domain_history: Domain history
contact_history: Contact history contact_history: Contact history
zones: Zones
blocked_domains: Blocked domains blocked_domains: Blocked domains
reserved_domains: Reserved domains reserved_domains: Reserved domains
epp_log: EPP log epp_log: EPP log

View file

@ -232,14 +232,6 @@ en:
protocol: 'Protocol' protocol: 'Protocol'
alg: 'Algorithm' alg: 'Algorithm'
public_key: 'Public key' public_key: 'Public key'
zonefile_setting:
ttl: 'TTL'
refresh: 'Refresh'
retry: 'Retry'
expire: 'Expire'
minimum_ttl: 'Minimum TTL'
email: 'E-Mail'
registrar: registrar:
billing_email: 'Billing e-mail' billing_email: 'Billing e-mail'
phone: 'Contact phone' phone: 'Contact phone'
@ -436,7 +428,6 @@ en:
transfer_requested: 'Transfer requested.' transfer_requested: 'Transfer requested.'
message_was_not_found: 'Message was not found' message_was_not_found: 'Message was not found'
host_obj_is_not_allowed: 'hostObj object is not allowed' host_obj_is_not_allowed: 'hostObj object is not allowed'
generate_zonefile: 'Generate zonefile'
zonefile: 'Zonefile' zonefile: 'Zonefile'
only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}' only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}'
exactly_one_parameter_required: 'Exactly one parameter required: %{params}' exactly_one_parameter_required: 'Exactly one parameter required: %{params}'
@ -450,7 +441,6 @@ en:
ds_data_with_key_allowed: 'Allow DS data with key' ds_data_with_key_allowed: 'Allow DS data with key'
key_data_allowed: 'Allow key data' key_data_allowed: 'Allow key data'
ds_digest_type: 'DS digest type' ds_digest_type: 'DS digest type'
zonefile_settings: 'Zonefile settings'
background_jobs: Background jobs background_jobs: Background jobs
domains_history: Domains history domains_history: Domains history
role: 'Role' role: 'Role'
@ -895,8 +885,6 @@ en:
failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached' failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached'
is_too_small_minimum_deposit_is: 'is too small. Minimum deposit is %{amount} %{currency}' is_too_small_minimum_deposit_is: 'is too small. Minimum deposit is %{amount} %{currency}'
a4_records: 'AAAA records' a4_records: 'AAAA records'
new_zone: 'New zone'
edit_zone: 'Edit zone'
there_are_count_domains_in_this_zone: 'There are %{count} domains in this zone' there_are_count_domains_in_this_zone: 'There are %{count} domains in this zone'
poll_pending_update_confirmed_by_registrant: 'Registrant confirmed domain update' poll_pending_update_confirmed_by_registrant: 'Registrant confirmed domain update'
poll_pending_update_rejected_by_registrant: 'Registrant rejected domain update' poll_pending_update_rejected_by_registrant: 'Registrant rejected domain update'

View file

@ -170,7 +170,7 @@ Rails.application.routes.draw do
namespace :admin do namespace :admin do
resources :keyrelays resources :keyrelays
resources :zonefiles resources :zonefiles
resources :zonefile_settings resources :zones, controller: 'dns/zones', except: %i[show]
resources :legal_documents resources :legal_documents
resources :keyrelays resources :keyrelays
resources :pricelists resources :pricelists

View file

@ -14,7 +14,7 @@ set :output, 'log/cron.log'
if @cron_group == 'registry' if @cron_group == 'registry'
every 10.minutes do every 10.minutes do
runner 'ZonefileSetting.generate_zonefiles' runner 'DNS::Zone.generate_zonefiles'
end end
every 6.months, at: '12:01am' do every 6.months, at: '12:01am' do

View file

@ -0,0 +1,5 @@
class RenameZonefileSettingsToZones < ActiveRecord::Migration
def change
rename_table :zonefile_settings, :zones
end
end

View file

@ -0,0 +1,5 @@
class RemoveLogZonefileSettings < ActiveRecord::Migration
def change
drop_table :log_zonefile_settings
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170221115548) do ActiveRecord::Schema.define(version: 20170420125200) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -914,22 +914,6 @@ ActiveRecord::Schema.define(version: 20170221115548) do
t.string "uuid" t.string "uuid"
end end
create_table "log_zonefile_settings", force: :cascade do |t|
t.string "item_type", null: false
t.integer "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.json "object"
t.json "object_changes"
t.datetime "created_at"
t.string "session"
t.json "children"
t.string "uuid"
end
add_index "log_zonefile_settings", ["item_type", "item_id"], name: "index_log_zonefile_settings_on_item_type_and_item_id", using: :btree
add_index "log_zonefile_settings", ["whodunnit"], name: "index_log_zonefile_settings_on_whodunnit", using: :btree
create_table "mail_templates", force: :cascade do |t| create_table "mail_templates", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "subject" t.string "subject"
@ -1141,7 +1125,7 @@ ActiveRecord::Schema.define(version: 20170221115548) do
add_index "whois_records", ["domain_id"], name: "index_whois_records_on_domain_id", using: :btree add_index "whois_records", ["domain_id"], name: "index_whois_records_on_domain_id", using: :btree
add_index "whois_records", ["registrar_id"], name: "index_whois_records_on_registrar_id", using: :btree add_index "whois_records", ["registrar_id"], name: "index_whois_records_on_registrar_id", using: :btree
create_table "zonefile_settings", force: :cascade do |t| create_table "zones", force: :cascade do |t|
t.string "origin" t.string "origin"
t.integer "ttl" t.integer "ttl"
t.integer "refresh" t.integer "refresh"

View file

@ -34,7 +34,7 @@ ActiveRecord::Base.transaction do
roles: ['admin'] roles: ['admin']
) )
ZonefileSetting.create!( DNS::Zone.create!(
origin: 'tld', origin: 'tld',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,

View file

@ -2374,44 +2374,6 @@ CREATE SEQUENCE log_white_ips_id_seq
ALTER SEQUENCE log_white_ips_id_seq OWNED BY log_white_ips.id; ALTER SEQUENCE log_white_ips_id_seq OWNED BY log_white_ips.id;
--
-- Name: log_zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE log_zonefile_settings (
id integer NOT NULL,
item_type character varying NOT NULL,
item_id integer NOT NULL,
event character varying NOT NULL,
whodunnit character varying,
object json,
object_changes json,
created_at timestamp without time zone,
session character varying,
children json,
uuid character varying
);
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE log_zonefile_settings_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: log_zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE log_zonefile_settings_id_seq OWNED BY log_zonefile_settings.id;
-- --
-- Name: mail_templates; Type: TABLE; Schema: public; Owner: -; Tablespace: -- Name: mail_templates; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- --
@ -2968,10 +2930,10 @@ ALTER SEQUENCE whois_records_id_seq OWNED BY whois_records.id;
-- --
-- Name: zonefile_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- --
CREATE TABLE zonefile_settings ( CREATE TABLE zones (
id integer NOT NULL, id integer NOT NULL,
origin character varying, origin character varying,
ttl integer, ttl integer,
@ -2992,10 +2954,10 @@ CREATE TABLE zonefile_settings (
-- --
-- Name: zonefile_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- Name: zones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
-- --
CREATE SEQUENCE zonefile_settings_id_seq CREATE SEQUENCE zones_id_seq
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
@ -3004,10 +2966,10 @@ CREATE SEQUENCE zonefile_settings_id_seq
-- --
-- Name: zonefile_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- Name: zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
-- --
ALTER SEQUENCE zonefile_settings_id_seq OWNED BY zonefile_settings.id; ALTER SEQUENCE zones_id_seq OWNED BY zones.id;
-- --
@ -3381,13 +3343,6 @@ ALTER TABLE ONLY log_users ALTER COLUMN id SET DEFAULT nextval('log_users_id_seq
ALTER TABLE ONLY log_white_ips ALTER COLUMN id SET DEFAULT nextval('log_white_ips_id_seq'::regclass); ALTER TABLE ONLY log_white_ips ALTER COLUMN id SET DEFAULT nextval('log_white_ips_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY log_zonefile_settings ALTER COLUMN id SET DEFAULT nextval('log_zonefile_settings_id_seq'::regclass);
-- --
-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- Name: id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3490,7 +3445,7 @@ ALTER TABLE ONLY whois_records ALTER COLUMN id SET DEFAULT nextval('whois_record
-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- Name: id; Type: DEFAULT; Schema: public; Owner: -
-- --
ALTER TABLE ONLY zonefile_settings ALTER COLUMN id SET DEFAULT nextval('zonefile_settings_id_seq'::regclass); ALTER TABLE ONLY zones ALTER COLUMN id SET DEFAULT nextval('zones_id_seq'::regclass);
-- --
@ -3917,14 +3872,6 @@ ALTER TABLE ONLY log_white_ips
ADD CONSTRAINT log_white_ips_pkey PRIMARY KEY (id); ADD CONSTRAINT log_white_ips_pkey PRIMARY KEY (id);
--
-- Name: log_zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY log_zonefile_settings
ADD CONSTRAINT log_zonefile_settings_pkey PRIMARY KEY (id);
-- --
-- Name: mail_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- Name: mail_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- --
@ -4038,11 +3985,11 @@ ALTER TABLE ONLY whois_records
-- --
-- Name: zonefile_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- --
ALTER TABLE ONLY zonefile_settings ALTER TABLE ONLY zones
ADD CONSTRAINT zonefile_settings_pkey PRIMARY KEY (id); ADD CONSTRAINT zones_pkey PRIMARY KEY (id);
-- --
@ -4675,20 +4622,6 @@ CREATE INDEX index_log_users_on_item_type_and_item_id ON log_users USING btree (
CREATE INDEX index_log_users_on_whodunnit ON log_users USING btree (whodunnit); CREATE INDEX index_log_users_on_whodunnit ON log_users USING btree (whodunnit);
--
-- Name: index_log_zonefile_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_item_type_and_item_id ON log_zonefile_settings USING btree (item_type, item_id);
--
-- Name: index_log_zonefile_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_zonefile_settings_on_whodunnit ON log_zonefile_settings USING btree (whodunnit);
-- --
-- Name: index_messages_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- Name: index_messages_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
-- --
@ -5280,3 +5213,7 @@ INSERT INTO schema_migrations (version) VALUES ('20161227193500');
INSERT INTO schema_migrations (version) VALUES ('20170221115548'); INSERT INTO schema_migrations (version) VALUES ('20170221115548');
INSERT INTO schema_migrations (version) VALUES ('20170419120048');
INSERT INTO schema_migrations (version) VALUES ('20170420125200');

View file

@ -142,11 +142,6 @@
<ellipse fill="none" stroke="black" cx="118" cy="246" rx="118.079" ry="18"/> <ellipse fill="none" stroke="black" cx="118" cy="246" rx="118.079" ry="18"/>
<text text-anchor="middle" x="118" y="249.7" font-family="Times,serif" font-size="14.00">Admin::DashboardsController</text> <text text-anchor="middle" x="118" y="249.7" font-family="Times,serif" font-size="14.00">Admin::DashboardsController</text>
</g> </g>
<!-- Admin::ZonefileSettingsController -->
<g id="node27" class="node"><title>Admin::ZonefileSettingsController</title>
<ellipse fill="none" stroke="black" cx="135" cy="186" rx="134.576" ry="18"/>
<text text-anchor="middle" x="135" y="189.7" font-family="Times,serif" font-size="14.00">Admin::ZonefileSettingsController</text>
</g>
<!-- Admin::RegistrarsController --> <!-- Admin::RegistrarsController -->
<g id="node28" class="node"><title>Admin::RegistrarsController</title> <g id="node28" class="node"><title>Admin::RegistrarsController</title>
<ellipse fill="none" stroke="black" cx="412" cy="186" rx="112.38" ry="18"/> <ellipse fill="none" stroke="black" cx="412" cy="186" rx="112.38" ry="18"/>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

@ -377,20 +377,6 @@
<polyline fill="none" stroke="black" points="-720,16.5 -538,16.5 "/> <polyline fill="none" stroke="black" points="-720,16.5 -538,16.5 "/>
<text text-anchor="start" x="-712" y="31.7" font-family="Times,serif" font-size="14.00">_layout</text> <text text-anchor="start" x="-712" y="31.7" font-family="Times,serif" font-size="14.00">_layout</text>
</g> </g>
<!-- Admin::ZonefileSettingsController -->
<g id="node27" class="node"><title>Admin::ZonefileSettingsController</title>
<path fill="none" stroke="black" d="M532.5,279.5C532.5,279.5 715.5,279.5 715.5,279.5 721.5,279.5 727.5,273.5 727.5,267.5 727.5,267.5 727.5,138.5 727.5,138.5 727.5,132.5 721.5,126.5 715.5,126.5 715.5,126.5 532.5,126.5 532.5,126.5 526.5,126.5 520.5,132.5 520.5,138.5 520.5,138.5 520.5,267.5 520.5,267.5 520.5,273.5 526.5,279.5 532.5,279.5"/>
<text text-anchor="middle" x="624" y="141.7" font-family="Times,serif" font-size="14.00">Admin::ZonefileSettingsController</text>
<polyline fill="none" stroke="black" points="520.5,149.5 727.5,149.5 "/>
<text text-anchor="start" x="528.5" y="164.7" font-family="Times,serif" font-size="14.00">edit</text>
<text text-anchor="start" x="528.5" y="179.7" font-family="Times,serif" font-size="14.00">index</text>
<text text-anchor="start" x="528.5" y="194.7" font-family="Times,serif" font-size="14.00">update</text>
<polyline fill="none" stroke="black" points="520.5,202.5 727.5,202.5 "/>
<polyline fill="none" stroke="black" points="520.5,226.5 727.5,226.5 "/>
<text text-anchor="start" x="528.5" y="241.7" font-family="Times,serif" font-size="14.00">_layout</text>
<text text-anchor="start" x="528.5" y="256.7" font-family="Times,serif" font-size="14.00">set_zonefile_setting</text>
<text text-anchor="start" x="528.5" y="271.7" font-family="Times,serif" font-size="14.00">zonefile_setting_params</text>
</g>
<!-- Admin::RegistrarsController --> <!-- Admin::RegistrarsController -->
<g id="node28" class="node"><title>Admin::RegistrarsController</title> <g id="node28" class="node"><title>Admin::RegistrarsController</title>
<path fill="none" stroke="black" d="M-67.5,479.5C-67.5,479.5 81.5,479.5 81.5,479.5 87.5,479.5 93.5,473.5 93.5,467.5 93.5,467.5 93.5,278.5 93.5,278.5 93.5,272.5 87.5,266.5 81.5,266.5 81.5,266.5 -67.5,266.5 -67.5,266.5 -73.5,266.5 -79.5,272.5 -79.5,278.5 -79.5,278.5 -79.5,467.5 -79.5,467.5 -79.5,473.5 -73.5,479.5 -67.5,479.5"/> <path fill="none" stroke="black" d="M-67.5,479.5C-67.5,479.5 81.5,479.5 81.5,479.5 87.5,479.5 93.5,473.5 93.5,467.5 93.5,467.5 93.5,278.5 93.5,278.5 93.5,272.5 87.5,266.5 81.5,266.5 81.5,266.5 -67.5,266.5 -67.5,266.5 -73.5,266.5 -79.5,272.5 -79.5,278.5 -79.5,278.5 -79.5,467.5 -79.5,467.5 -79.5,473.5 -73.5,479.5 -67.5,479.5"/>

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Before After
Before After

View file

@ -337,17 +337,6 @@
<ellipse fill="none" stroke="#d1286a" cx="3516.25" cy="-77.2469" rx="4.00001" ry="4.00001"/> <ellipse fill="none" stroke="#d1286a" cx="3516.25" cy="-77.2469" rx="4.00001" ry="4.00001"/>
<polygon fill="#d1286a" stroke="#d1286a" points="1658.36,-20.9371 1648.46,-16.2185 1653.36,-20.8273 1648.36,-20.7174 1648.36,-20.7174 1648.36,-20.7174 1653.36,-20.8273 1648.26,-25.2164 1658.36,-20.9371 1658.36,-20.9371"/> <polygon fill="#d1286a" stroke="#d1286a" points="1658.36,-20.9371 1648.46,-16.2185 1653.36,-20.8273 1648.36,-20.7174 1648.36,-20.7174 1648.36,-20.7174 1653.36,-20.8273 1648.26,-25.2164 1658.36,-20.9371 1658.36,-20.9371"/>
</g> </g>
<!-- ZonefileSettingVersion -->
<g id="node31" class="node"><title>ZonefileSettingVersion</title>
<ellipse fill="none" stroke="black" cx="3746.99" cy="-91" rx="92.8835" ry="18"/>
<text text-anchor="middle" x="3746.99" y="-87.3" font-family="Times,serif" font-size="14.00">ZonefileSettingVersion</text>
</g>
<!-- ZonefileSettingVersion&#45;&gt;VersionAssociation -->
<g id="edge29" class="edge"><title>ZonefileSettingVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#fb178f" d="M3674.74,-76.7667C3664.77,-75.2902 3654.65,-73.9712 3644.99,-73 3407.38,-49.0969 3346.71,-60.9372 3107.99,-54 2557.18,-37.9931 1895.3,-25.0664 1658.57,-20.6418"/>
<ellipse fill="none" stroke="#fb178f" cx="3678.73" cy="-77.3767" rx="4.00001" ry="4.00001"/>
<polygon fill="#fb178f" stroke="#fb178f" points="1658.29,-20.6367 1648.38,-15.9509 1653.29,-20.5434 1648.3,-20.4501 1648.3,-20.4501 1648.3,-20.4501 1653.29,-20.5434 1648.21,-24.9493 1658.29,-20.6367 1658.29,-20.6367"/>
</g>
<!-- DomainVersion --> <!-- DomainVersion -->
<g id="node32" class="node"><title>DomainVersion</title> <g id="node32" class="node"><title>DomainVersion</title>
<ellipse fill="none" stroke="black" cx="1244.99" cy="-307" rx="67.6881" ry="18"/> <ellipse fill="none" stroke="black" cx="1244.99" cy="-307" rx="67.6881" ry="18"/>
@ -1219,18 +1208,6 @@
<ellipse fill="none" stroke="black" cx="4032.99" cy="-523" rx="89.0842" ry="18"/> <ellipse fill="none" stroke="black" cx="4032.99" cy="-523" rx="89.0842" ry="18"/>
<text text-anchor="middle" x="4032.99" y="-519.3" font-family="Times,serif" font-size="14.00">RegistrantVerification</text> <text text-anchor="middle" x="4032.99" y="-519.3" font-family="Times,serif" font-size="14.00">RegistrantVerification</text>
</g> </g>
<!-- ZonefileSetting -->
<g id="node49" class="node"><title>ZonefileSetting</title>
<ellipse fill="none" stroke="black" cx="3746.99" cy="-199" rx="65.7887" ry="18"/>
<text text-anchor="middle" x="3746.99" y="-195.3" font-family="Times,serif" font-size="14.00">ZonefileSetting</text>
</g>
<!-- ZonefileSetting&#45;&gt;ZonefileSettingVersion -->
<g id="edge74" class="edge"><title>ZonefileSetting&#45;&gt;ZonefileSettingVersion</title>
<path fill="none" stroke="#881b39" d="M3746.99,-172.795C3746.99,-156.735 3746.99,-135.927 3746.99,-119.45"/>
<ellipse fill="none" stroke="#881b39" cx="3746.99" cy="-176.969" rx="4" ry="4"/>
<polygon fill="#881b39" stroke="#881b39" points="3746.99,-119.341 3751.49,-109.341 3746.99,-114.341 3746.99,-109.341 3746.99,-109.341 3746.99,-109.341 3746.99,-114.341 3742.49,-109.341 3746.99,-119.341 3746.99,-119.341"/>
<text text-anchor="middle" x="3769.99" y="-141.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- TechDomainContact&#45;&gt;DomainContactVersion --> <!-- TechDomainContact&#45;&gt;DomainContactVersion -->
<g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title> <g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title>
<path fill="none" stroke="#727588" d="M1971.52,-284.313C1929.46,-250.063 1844.49,-181.719 1769.99,-127 1764.3,-122.814 1758.15,-118.466 1752.18,-114.317"/> <path fill="none" stroke="#727588" d="M1971.52,-284.313C1929.46,-250.063 1844.49,-181.719 1769.99,-127 1764.3,-122.814 1758.15,-118.466 1752.18,-114.317"/>

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Before After
Before After

View file

@ -665,28 +665,6 @@
<ellipse fill="none" stroke="#9131a9" cx="3586.29" cy="-75.9354" rx="4.00002" ry="4.00002"/> <ellipse fill="none" stroke="#9131a9" cx="3586.29" cy="-75.9354" rx="4.00002" ry="4.00002"/>
<polygon fill="#9131a9" stroke="#9131a9" points="1845.79,-21.5158 1835.92,-16.7338 1840.79,-21.3739 1835.79,-21.232 1835.79,-21.232 1835.79,-21.232 1840.79,-21.3739 1835.67,-25.7301 1845.79,-21.5158 1845.79,-21.5158"/> <polygon fill="#9131a9" stroke="#9131a9" points="1845.79,-21.5158 1835.92,-16.7338 1840.79,-21.3739 1835.79,-21.232 1835.79,-21.232 1835.79,-21.232 1840.79,-21.3739 1835.67,-25.7301 1845.79,-21.5158 1845.79,-21.5158"/>
</g> </g>
<!-- ZonefileSettingVersion -->
<g id="node31" class="node"><title>ZonefileSettingVersion</title>
<path fill="none" stroke="black" d="M3937.5,-73.5C3937.5,-73.5 4056.5,-73.5 4056.5,-73.5 4062.5,-73.5 4068.5,-79.5 4068.5,-85.5 4068.5,-85.5 4068.5,-242.5 4068.5,-242.5 4068.5,-248.5 4062.5,-254.5 4056.5,-254.5 4056.5,-254.5 3937.5,-254.5 3937.5,-254.5 3931.5,-254.5 3925.5,-248.5 3925.5,-242.5 3925.5,-242.5 3925.5,-85.5 3925.5,-85.5 3925.5,-79.5 3931.5,-73.5 3937.5,-73.5"/>
<text text-anchor="middle" x="3997" y="-239.3" font-family="Times,serif" font-size="14.00">ZonefileSettingVersion</text>
<polyline fill="none" stroke="black" points="3925.5,-231.5 4068.5,-231.5 "/>
<text text-anchor="start" x="3933.5" y="-216.3" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="3933.5" y="-201.3" font-family="Times,serif" font-size="14.00">item_type :string</text>
<text text-anchor="start" x="3933.5" y="-186.3" font-family="Times,serif" font-size="14.00">item_id :integer</text>
<text text-anchor="start" x="3933.5" y="-171.3" font-family="Times,serif" font-size="14.00">event :string</text>
<text text-anchor="start" x="3933.5" y="-156.3" font-family="Times,serif" font-size="14.00">whodunnit :string</text>
<text text-anchor="start" x="3933.5" y="-141.3" font-family="Times,serif" font-size="14.00">object :json</text>
<text text-anchor="start" x="3933.5" y="-126.3" font-family="Times,serif" font-size="14.00">object_changes :json</text>
<text text-anchor="start" x="3933.5" y="-111.3" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="3933.5" y="-96.3" font-family="Times,serif" font-size="14.00">session :string</text>
<text text-anchor="start" x="3933.5" y="-81.3" font-family="Times,serif" font-size="14.00">children :json</text>
</g>
<!-- ZonefileSettingVersion&#45;&gt;VersionAssociation -->
<g id="edge29" class="edge"><title>ZonefileSettingVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#cc510c" d="M3917.83,-129.497C3865.31,-109.014 3794.29,-84.5899 3729,-73 3542.63,-39.9179 2207.66,-23.7038 1846.75,-19.8943"/>
<ellipse fill="none" stroke="#cc510c" cx="3921.72" cy="-131.026" rx="4.00001" ry="4.00001"/>
<polygon fill="#cc510c" stroke="#cc510c" points="1846.61,-19.8929 1836.66,-15.2881 1841.61,-19.8404 1836.61,-19.7879 1836.61,-19.7879 1836.61,-19.7879 1841.61,-19.8404 1836.57,-24.2876 1846.61,-19.8929 1846.61,-19.8929"/>
</g>
<!-- DomainVersion --> <!-- DomainVersion -->
<g id="node32" class="node"><title>DomainVersion</title> <g id="node32" class="node"><title>DomainVersion</title>
<path fill="none" stroke="black" d="M1277.5,-1158.5C1277.5,-1158.5 1400.5,-1158.5 1400.5,-1158.5 1406.5,-1158.5 1412.5,-1164.5 1412.5,-1170.5 1412.5,-1170.5 1412.5,-1372.5 1412.5,-1372.5 1412.5,-1378.5 1406.5,-1384.5 1400.5,-1384.5 1400.5,-1384.5 1277.5,-1384.5 1277.5,-1384.5 1271.5,-1384.5 1265.5,-1378.5 1265.5,-1372.5 1265.5,-1372.5 1265.5,-1170.5 1265.5,-1170.5 1265.5,-1164.5 1271.5,-1158.5 1277.5,-1158.5"/> <path fill="none" stroke="black" d="M1277.5,-1158.5C1277.5,-1158.5 1400.5,-1158.5 1400.5,-1158.5 1406.5,-1158.5 1412.5,-1164.5 1412.5,-1170.5 1412.5,-1170.5 1412.5,-1372.5 1412.5,-1372.5 1412.5,-1378.5 1406.5,-1384.5 1400.5,-1384.5 1400.5,-1384.5 1277.5,-1384.5 1277.5,-1384.5 1271.5,-1384.5 1265.5,-1378.5 1265.5,-1372.5 1265.5,-1372.5 1265.5,-1170.5 1265.5,-1170.5 1265.5,-1164.5 1271.5,-1158.5 1277.5,-1158.5"/>
@ -1981,32 +1959,6 @@
<text text-anchor="start" x="4134" y="-2436.8" font-family="Times,serif" font-size="14.00">domain_id :integer</text> <text text-anchor="start" x="4134" y="-2436.8" font-family="Times,serif" font-size="14.00">domain_id :integer</text>
<text text-anchor="start" x="4134" y="-2421.8" font-family="Times,serif" font-size="14.00">action_type :string</text> <text text-anchor="start" x="4134" y="-2421.8" font-family="Times,serif" font-size="14.00">action_type :string</text>
</g> </g>
<!-- ZonefileSetting -->
<g id="node49" class="node"><title>ZonefileSetting</title>
<path fill="none" stroke="black" d="M4115.5,-481C4115.5,-481 4252.5,-481 4252.5,-481 4258.5,-481 4264.5,-487 4264.5,-493 4264.5,-493 4264.5,-695 4264.5,-695 4264.5,-701 4258.5,-707 4252.5,-707 4252.5,-707 4115.5,-707 4115.5,-707 4109.5,-707 4103.5,-701 4103.5,-695 4103.5,-695 4103.5,-493 4103.5,-493 4103.5,-487 4109.5,-481 4115.5,-481"/>
<text text-anchor="middle" x="4184" y="-691.8" font-family="Times,serif" font-size="14.00">ZonefileSetting</text>
<polyline fill="none" stroke="black" points="4103.5,-684 4264.5,-684 "/>
<text text-anchor="start" x="4111.5" y="-668.8" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="4111.5" y="-653.8" font-family="Times,serif" font-size="14.00">origin :string</text>
<text text-anchor="start" x="4111.5" y="-638.8" font-family="Times,serif" font-size="14.00">ttl :integer</text>
<text text-anchor="start" x="4111.5" y="-623.8" font-family="Times,serif" font-size="14.00">refresh :integer</text>
<text text-anchor="start" x="4111.5" y="-608.8" font-family="Times,serif" font-size="14.00">retry :integer</text>
<text text-anchor="start" x="4111.5" y="-593.8" font-family="Times,serif" font-size="14.00">expire :integer</text>
<text text-anchor="start" x="4111.5" y="-578.8" font-family="Times,serif" font-size="14.00">minimum_ttl :integer</text>
<text text-anchor="start" x="4111.5" y="-563.8" font-family="Times,serif" font-size="14.00">email :string</text>
<text text-anchor="start" x="4111.5" y="-548.8" font-family="Times,serif" font-size="14.00">master_nameserver :string</text>
<text text-anchor="start" x="4111.5" y="-533.8" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="4111.5" y="-518.8" font-family="Times,serif" font-size="14.00">updated_at :datetime</text>
<text text-anchor="start" x="4111.5" y="-503.8" font-family="Times,serif" font-size="14.00">creator_str :string</text>
<text text-anchor="start" x="4111.5" y="-488.8" font-family="Times,serif" font-size="14.00">updator_str :string</text>
</g>
<!-- ZonefileSetting&#45;&gt;ZonefileSettingVersion -->
<g id="edge74" class="edge"><title>ZonefileSetting&#45;&gt;ZonefileSettingVersion</title>
<path fill="none" stroke="#afb253" d="M4139.2,-472.941C4115.67,-412.317 4085.46,-338.025 4055,-273 4053.6,-270.013 4052.16,-266.991 4050.68,-263.95"/>
<ellipse fill="none" stroke="#afb253" cx="4140.74" cy="-476.912" rx="4.00001" ry="4.00001"/>
<polygon fill="#afb253" stroke="#afb253" points="4050.59,-263.757 4050.21,-252.798 4048.38,-259.272 4046.17,-254.786 4046.17,-254.786 4046.17,-254.786 4048.38,-259.272 4042.13,-256.775 4050.59,-263.757 4050.59,-263.757"/>
<text text-anchor="middle" x="4154" y="-360.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- TechDomainContact&#45;&gt;DomainContactVersion --> <!-- TechDomainContact&#45;&gt;DomainContactVersion -->
<g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title> <g id="edge75" class="edge"><title>TechDomainContact&#45;&gt;DomainContactVersion</title>
<path fill="none" stroke="#5e4961" d="M2208.23,-1157.73C2184.3,-1002.55 2136.91,-714.902 2080,-473 2058.81,-382.908 2056.36,-358.939 2022,-273 2020.78,-269.96 2019.51,-266.893 2018.19,-263.812"/> <path fill="none" stroke="#5e4961" d="M2208.23,-1157.73C2184.3,-1002.55 2136.91,-714.902 2080,-473 2058.81,-382.908 2056.36,-358.939 2022,-273 2020.78,-269.96 2019.51,-266.893 2018.19,-263.812"/>

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Before After
Before After

View file

@ -604,7 +604,7 @@ namespace :import do
ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1) ns_records, a_records, a4_records = parse_zone_ns_data('ee', 1)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'ee', origin: 'ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -621,7 +621,7 @@ namespace :import do
# edu.ee # edu.ee
ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6) ns_records, a_records, a4_records = parse_zone_ns_data('edu.ee', 6)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'edu.ee', origin: 'edu.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -638,7 +638,7 @@ namespace :import do
# aip.ee # aip.ee
ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9) ns_records, a_records, a4_records = parse_zone_ns_data('aip.ee', 9)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'aip.ee', origin: 'aip.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -655,7 +655,7 @@ namespace :import do
# org.ee # org.ee
ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10) ns_records, a_records, a4_records = parse_zone_ns_data('org.ee', 10)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'org.ee', origin: 'org.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -672,7 +672,7 @@ namespace :import do
# pri.ee # pri.ee
ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2) ns_records, a_records, a4_records = parse_zone_ns_data('pri.ee', 2)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'pri.ee', origin: 'pri.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -689,7 +689,7 @@ namespace :import do
# med.ee # med.ee
ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3) ns_records, a_records, a4_records = parse_zone_ns_data('med.ee', 3)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'med.ee', origin: 'med.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -706,7 +706,7 @@ namespace :import do
# fie.ee # fie.ee
ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4) ns_records, a_records, a4_records = parse_zone_ns_data('fie.ee', 4)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'fie.ee', origin: 'fie.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -723,7 +723,7 @@ namespace :import do
# com.ee # com.ee
ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5) ns_records, a_records, a4_records = parse_zone_ns_data('com.ee', 5)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'com.ee', origin: 'com.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -740,7 +740,7 @@ namespace :import do
# gov.ee # gov.ee
ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7) ns_records, a_records, a4_records = parse_zone_ns_data('gov.ee', 7)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'gov.ee', origin: 'gov.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,
@ -757,7 +757,7 @@ namespace :import do
# riik.ee # riik.ee
ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8) ns_records, a_records, a4_records = parse_zone_ns_data('riik.ee', 8)
ZonefileSetting.create!({ DNS::Zone.create!({
origin: 'riik.ee', origin: 'riik.ee',
ttl: 43200, ttl: 43200,
refresh: 3600, refresh: 3600,

View file

@ -1,4 +1,4 @@
Fabricator(:zonefile_setting) do Fabricator(:zone, from: 'DNS::Zone') do
origin 'ee' origin 'ee'
ttl 43200 ttl 43200
refresh 3600 refresh 3600

View file

@ -0,0 +1,12 @@
FactoryGirl.define do
factory :zone, class: DNS::Zone do
origin 'test'
ttl 1
refresh 1
add_attribute :retry, 1
expire 1
minimum_ttl 1
email 'test@test.test'
master_nameserver 'test.test'
end
end

View file

@ -0,0 +1,16 @@
require 'rails_helper'
RSpec.feature 'Deleting zone in admin area' do
given!(:zone) { create(:zone) }
background do
sign_in_to_admin_area
end
scenario 'deletes zone' do
visit edit_admin_zone_url(zone)
click_link_or_button t('admin.dns.zones.edit.delete_btn')
expect(page).to have_text(t('admin.dns.zones.destroy.destroyed'))
end
end

View file

@ -0,0 +1,29 @@
require 'rails_helper'
RSpec.feature 'Editing zone in admin area' do
given!(:zone) { create(:zone) }
background do
sign_in_to_admin_area
end
scenario 'updates zone' do
open_list
open_form
submit_form
expect(page).to have_text(t('admin.dns.zones.update.updated'))
end
def open_list
click_link_or_button t('admin.menu.zones')
end
def open_form
click_link_or_button t('admin.dns.zones.zone.edit_btn')
end
def submit_form
click_link_or_button t('admin.dns.zones.form.update_btn')
end
end

View file

@ -0,0 +1,39 @@
require 'rails_helper'
RSpec.feature 'New zone in admin area' do
background do
sign_in_to_admin_area
end
scenario 'it creates new zone' do
open_list
open_form
fill_form
submit_form
expect(page).to have_text(t('admin.dns.zones.create.created'))
end
def open_list
click_link_or_button t('admin.menu.zones')
end
def open_form
click_link_or_button t('admin.dns.zones.index.new_btn')
end
def fill_form
fill_in 'zone_origin', with: 'test'
fill_in 'zone_ttl', with: '1'
fill_in 'zone_refresh', with: '1'
fill_in 'zone_retry', with: '1'
fill_in 'zone_expire', with: '1'
fill_in 'zone_minimum_ttl', with: '1'
fill_in 'zone_email', with: 'test@test.com'
fill_in 'zone_master_nameserver', with: 'test.test'
end
def submit_form
click_link_or_button t('admin.dns.zones.form.create_btn')
end
end

View file

@ -7,7 +7,7 @@ RSpec.describe Domain, db: false do
before :example do before :example do
travel_to Time.zone.parse('05.07.2010 00:00') travel_to Time.zone.parse('05.07.2010 00:00')
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
Fabricate.create(:domain, id: 1, expire_time: Time.zone.parse('04.07.2010 23:59')) Fabricate.create(:domain, id: 1, expire_time: Time.zone.parse('04.07.2010 23:59'))
Fabricate.create(:domain, id: 2, expire_time: Time.zone.parse('05.07.2010 00:00')) Fabricate.create(:domain, id: 2, expire_time: Time.zone.parse('05.07.2010 00:00'))

View file

@ -4,7 +4,7 @@ RSpec.describe Domain do
it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) } it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) }
before :example do before :example do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
it 'should set force delete time' do it 'should set force delete time' do

View file

@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe Contact do RSpec.describe Contact do
before :example do before :example do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'about class' do context 'about class' do
@ -328,7 +328,7 @@ end
describe Contact, '.destroy_orphans' do describe Contact, '.destroy_orphans' do
before do before do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
@contact_1 = Fabricate(:contact, code: 'asd12') @contact_1 = Fabricate(:contact, code: 'asd12')
@contact_2 = Fabricate(:contact, code: 'asd13') @contact_2 = Fabricate(:contact, code: 'asd13')
end end

View file

@ -1,10 +1,6 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe ZonefileSetting, db: false do RSpec.describe DNS::Zone do
it 'has versions' do
expect(described_class.new.versions).to eq([])
end
describe '::origins' do describe '::origins' do
before :example do before :example do
expect(described_class).to receive(:pluck).with(:origin).and_return('origins') expect(described_class).to receive(:pluck).with(:origin).and_return('origins')

View file

@ -21,7 +21,7 @@ describe Dnskey do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do

View file

@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe DomainCron do RSpec.describe DomainCron do
it 'should expire domains' do it 'should expire domains' do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
@domain = Fabricate(:domain) @domain = Fabricate(:domain)
Setting.expire_warning_period = 1 Setting.expire_warning_period = 1
@ -25,7 +25,7 @@ RSpec.describe DomainCron do
end end
it 'should start redemption grace period' do it 'should start redemption grace period' do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
@domain = Fabricate(:domain) @domain = Fabricate(:domain)
old_valid_to = Time.zone.now - 10.days old_valid_to = Time.zone.now - 10.days

View file

@ -21,11 +21,11 @@ RSpec.describe Domain do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
Fabricate(:zonefile_setting, origin: 'pri.ee') Fabricate(:zone, origin: 'pri.ee')
Fabricate(:zonefile_setting, origin: 'med.ee') Fabricate(:zone, origin: 'med.ee')
Fabricate(:zonefile_setting, origin: 'fie.ee') Fabricate(:zone, origin: 'fie.ee')
Fabricate(:zonefile_setting, origin: 'com.ee') Fabricate(:zone, origin: 'com.ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do
@ -809,7 +809,7 @@ RSpec.describe Domain, db: false do
before :example do before :example do
travel_to Time.zone.parse('05.07.2010 00:00') travel_to Time.zone.parse('05.07.2010 00:00')
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
Fabricate.create(:domain, id: 1, outzone_time: Time.zone.parse('04.07.2010 23:59')) Fabricate.create(:domain, id: 1, outzone_time: Time.zone.parse('04.07.2010 23:59'))
Fabricate.create(:domain, id: 2, outzone_time: Time.zone.parse('05.07.2010 00:00')) Fabricate.create(:domain, id: 2, outzone_time: Time.zone.parse('05.07.2010 00:00'))
@ -825,7 +825,7 @@ RSpec.describe Domain, db: false do
before :example do before :example do
travel_to Time.zone.parse('05.07.2010 00:00') travel_to Time.zone.parse('05.07.2010 00:00')
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
Fabricate.create(:domain, id: 1, delete_time: Time.zone.parse('04.07.2010 23:59')) Fabricate.create(:domain, id: 1, delete_time: Time.zone.parse('04.07.2010 23:59'))
Fabricate.create(:domain, id: 2, delete_time: Time.zone.parse('05.07.2010 00:00')) Fabricate.create(:domain, id: 2, delete_time: Time.zone.parse('05.07.2010 00:00'))

View file

@ -21,7 +21,7 @@ describe DomainTransfer do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do

View file

@ -21,7 +21,7 @@ describe Keyrelay do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do

View file

@ -3,11 +3,11 @@ require 'rails_helper'
describe LegalDocument do describe LegalDocument do
context 'tasks' do context 'tasks' do
it 'make files uniq' do it 'make files uniq' do
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
Fabricate(:zonefile_setting, origin: 'pri.ee') Fabricate(:zone, origin: 'pri.ee')
Fabricate(:zonefile_setting, origin: 'med.ee') Fabricate(:zone, origin: 'med.ee')
Fabricate(:zonefile_setting, origin: 'fie.ee') Fabricate(:zone, origin: 'fie.ee')
Fabricate(:zonefile_setting, origin: 'com.ee') Fabricate(:zone, origin: 'com.ee')
LegalDocument.explicitly_write_file = true LegalDocument.explicitly_write_file = true
PaperTrail.enabled = true PaperTrail.enabled = true

View file

@ -21,7 +21,7 @@ describe Nameserver do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do

View file

@ -21,7 +21,7 @@ describe RegistrantVerification do
Setting.client_side_status_editing_enabled = true Setting.client_side_status_editing_enabled = true
Fabricate(:zonefile_setting, origin: 'ee') Fabricate(:zone, origin: 'ee')
end end
context 'with invalid attribute' do context 'with invalid attribute' do
before :example do before :example do

View file

@ -0,0 +1,40 @@
require 'rails_helper'
RSpec.describe 'admin/dns/zones/index' do
let(:zones) { [] }
before :example do
assign(:zones, zones)
stub_template '_zone' => 'zone-row'
end
it 'has title' do
render
expect(rendered).to have_text(t('admin.dns.zones.index.title'))
end
context 'when zones are present' do
let(:zones) { [build_stubbed(:zone)] }
it 'has zone row' do
render
expect(rendered).to have_text('zone-row')
end
it 'has no :not_found message' do
render
expect(rendered).to_not have_text(not_found_message)
end
end
context 'when zones are absent' do
it 'has :not_found message' do
render
expect(rendered).to have_text(not_found_message)
end
end
def not_found_message
t('admin.dns.zones.index.not_found')
end
end