mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-05 22:31:57 +08:00
If there are existing private subnets created, this shows a select box to select one. If selected, that private subnet is connected to the private subnet created for the PostgreSQL database. This will allow virtual machines in the connected subnet to connect to the PostgreSQL database over the private IP address, allowing you to better restrict access to the PostgreSQL database from the internet.
50 lines
3.3 KiB
Text
50 lines
3.3 KiB
Text
<%
|
|
@flavor = typecast_params.nonempty_str("flavor", PostgresResource::Flavor::STANDARD)
|
|
@flavor = PostgresResource::Flavor::STANDARD unless Option::POSTGRES_FLAVOR_OPTIONS.any? { |k,| k == @flavor }
|
|
@prices = fetch_location_based_prices("PostgresVCpu", "PostgresStorage")
|
|
@has_valid_payment_method = @project.has_valid_payment_method?
|
|
@enabled_postgres_sizes = Option::VmSizes.select { @project.quota_available?("PostgresVCpu", it.vcpus) }.map(&:name)
|
|
connectable_subnets = dataset_authorize(@project.private_subnets_dataset, "PrivateSubnet:connect").order(:name).all
|
|
@option_tree, @option_parents = generate_postgres_options(flavor: @flavor, connectable_subnets:)
|
|
|
|
@page_title, logo = postgres_flavors[@flavor].yield_self { ["Create #{it.title}", "logo-#{it.brand}.png"] }
|
|
logo = nil if @flavor == PostgresResource::Flavor::STANDARD
|
|
%>
|
|
|
|
<%== render("components/billing_warning") %>
|
|
|
|
<%== part(
|
|
"components/page_header",
|
|
breadcrumbs: [
|
|
%w[Projects /project],
|
|
[@project.name, @project.path],
|
|
["PostgreSQL Databases", "#{@project.path}/postgres"],
|
|
%w[Create #]
|
|
],
|
|
right_items: [logo ? "<img src=\"/#{logo}\" class=\"h-6 object-contain\"/>" : nil]
|
|
) %>
|
|
|
|
<%
|
|
form_elements = [
|
|
{name: "flavor", type: "hidden", value: @flavor},
|
|
{name: "name", type: "text", label: "Name", required: "required", placeholder: "Enter name", opening_tag: "<div class='sm:col-span-3'>"},
|
|
{name: "location", type: "radio_small_cards", label: "Location", required: "required", content_generator: ContentGenerator::Postgres.method(:location)},
|
|
{name: "family", type: "radio_small_cards", label: "Server family", required: "required", content_generator: ContentGenerator::Postgres.method(:family)},
|
|
{name: "size", type: "radio_small_cards", label: "Server size", required: "required", content_generator: ContentGenerator::Postgres.method(:size)},
|
|
{name: "storage_size", type: "radio_small_cards", label: "Storage size", required: "required", content_generator: ContentGenerator::Postgres.method(:storage_size)},
|
|
{name: "version", type: "radio_small_cards", label: "Version", required: "required", content_generator: ContentGenerator::Postgres.method(:version)},
|
|
{name: "ha_type", type: "radio_small_cards", label: "High Availability", required: "required", content_generator: ContentGenerator::Postgres.method(:ha_type)},
|
|
]
|
|
|
|
if connectable_subnets.any?
|
|
form_elements << {name: "connect_to_subnet_id", type: "select", label: "Connect to Private Subnet", placeholder: "None", description_html: "Connecting to a private subnet will allow access to the PostgreSQL database from virtual machines in the connected subnet, potentially allowing you to better restrict access to the database.", content_generator: ContentGenerator::Postgres.method(:private_subnet), opening_tag: "<div class='sm:col-span-3'>"}
|
|
end
|
|
|
|
if [PostgresResource::Flavor::PARADEDB, PostgresResource::Flavor::LANTERN].include?(@flavor)
|
|
form_elements << {name: "partnership_notice", type: "partnership_notice", label: "Partnership Notice", required: "required", content_generator: ContentGenerator::Postgres.method(:partnership_notice)}
|
|
end
|
|
|
|
action = "#{@project.path}/postgres"
|
|
%>
|
|
|
|
<%== part("components/form/resource_creation_form", action:, form_elements:, option_tree: @option_tree, option_parents: @option_parents) %>
|