1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-11-30 21:32:30 +00:00

remove types from ip pools

closes #24
هذا الالتزام موجود في:
Adam Cooke
2017-04-28 16:40:53 +01:00
الأصل 88974cee85
التزام 698b580db4
10 ملفات معدلة مع 14 إضافات و29 حذوفات

عرض الملف

@@ -38,7 +38,7 @@ class IPPoolsController < ApplicationController
private
def safe_params
params.require(:ip_pool).permit(:name, :type, :default)
params.require(:ip_pool).permit(:name, :default)
end
end

عرض الملف

@@ -4,7 +4,7 @@ class OrganizationIPPoolsController < ApplicationController
before_action :admin_required, :only => [:assignments]
def index
@ip_pools = organization.ip_pools.dedicated.order(:name)
@ip_pools = organization.ip_pools.order(:name)
end
def assignments

عرض الملف

@@ -8,7 +8,6 @@
# created_at :datetime
# updated_at :datetime
# default :boolean default(FALSE)
# type :string(255)
#
# Indexes
#
@@ -17,8 +16,6 @@
class IPPool < ApplicationRecord
TYPES = ['Transactional', 'Bulk', 'Forwarding', 'Dedicated']
include HasUUID
validates :name, :presence => true
@@ -28,21 +25,8 @@ class IPPool < ApplicationRecord
has_many :organization_ip_pools, :dependent => :destroy
has_many :organizations, :through => :organization_ip_pools
scope :transactional, -> { where(:type => 'Transactional') }
scope :bulk, -> { where(:type => 'Bulk') }
scope :forwarding, -> { where(:type => 'Forwarding') }
scope :dedicated, -> { where(:type => 'Dedicated') }
def self.default
where(:default => true).order(:id).first
end
def description
desc = "#{name}"
if self.type == 'Dedicated'
desc += " (#{ip_addresses.map(&:ipv4).to_sentence})"
end
desc
end
end

عرض الملف

@@ -48,8 +48,8 @@ class Organization < ApplicationRecord
has_many :ip_pool_rules, :dependent => :destroy, :as => :owner
after_create do
if pool = IPPool.transactional.default
self.ip_pools << IPPool.transactional.default
if pool = IPPool.default
self.ip_pools << IPPool.default
end
end

عرض الملف

@@ -24,7 +24,7 @@
.fieldSet__field
= f.label :ip_pool_id, "IP Pool", :class => 'fieldSet__label'
.fieldSet__input
= f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :description, {}, :class => 'input input--select'
= f.collection_select :ip_pool_id, organization.ip_pools.includes(:ip_addresses).order("`default` desc, name asc"), :id, :name, {}, :class => 'input input--select'
%p.fieldSet__text
This is the IP pool that this message should be delivered from.

عرض الملف

@@ -59,7 +59,7 @@
%dl.ipPoolRuleList__condition
%dt Will be sent using:
%dd= ip_pool_rule.ip_pool.description
%dd= ip_pool_rule.ip_pool.name
- if @server
%p.ipPoolRuleListDefault.u-margin All mail that doesn't match a rule above will be sent using #{@server.ip_pool.description}.
%p.ipPoolRuleListDefault.u-margin All mail that doesn't match a rule above will be sent using #{@server.ip_pool.name}.
%p.u-center= link_to "Add another rule", [:new, organization, @server, :ip_pool_rule], :class => "button button--positive"

عرض الملف

@@ -4,9 +4,6 @@
.fieldSet__field
= f.label :name, :class => 'fieldSet__label'
.fieldSet__input= f.text_field :name, :autofocus => true, :class => 'input input--text'
.fieldSet__field
= f.label :type, :class => 'fieldSet__label'
.fieldSet__input= f.select :type, IPPool::TYPES, {}, :class => 'input input--select'
- if @ip_pool.persisted?
%table.dataTable.u-margin-half

عرض الملف

@@ -1,4 +1,4 @@
.navBar.navBar--secondary
%ul
%li.navBar__item= link_to "Dedicated IPs", organization_ip_pools_path(organization), :class => ['navBar__link', active_nav == :ips ? 'is-active' : '']
%li.navBar__item= link_to "IP Pools", organization_ip_pools_path(organization), :class => ['navBar__link', active_nav == :ips ? 'is-active' : '']
%li.navBar__item= link_to "Rules", organization_ip_pool_rules_path(organization), :class => ['navBar__link', active_nav == :rules ? 'is-active' : '']

عرض الملف

@@ -0,0 +1,5 @@
class RemoveTypeFromIPPools < ActiveRecord::Migration[5.0]
def change
remove_column :ip_pools, :type, :string
end
end

عرض الملف

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170421195415) do
ActiveRecord::Schema.define(version: 20170428153353) do
create_table "additional_route_endpoints", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
t.integer "route_id"
@@ -141,7 +141,6 @@ ActiveRecord::Schema.define(version: 20170421195415) do
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.boolean "default", default: false
t.string "type"
t.index ["uuid"], name: "index_ip_pools_on_uuid", length: { uuid: 8 }, using: :btree
end