Files
ubicloud/routes/project/firewall.rb
Furkan Sahin 12dbeb57a1 Update location references with foreign key in the controlplane
We are basically updating the location references everywhere with a
location id and adding the location relationship to the models to be
able to fetch location names when needed.
This also makes the LocationNameConverter model obsolete, so we are
removing it.

Use model id as value for Sequel::Model in resource creation form

Use id of the location as preselected value in Postgres update form
2025-03-23 15:48:19 +01:00

33 lines
852 B
Ruby

# frozen_string_literal: true
class Clover
hash_branch(:project_prefix, "firewall") do |r|
r.get true do
dataset = firewall_list_dataset
if api?
firewall_list_api_response(dataset)
else
authorized_firewalls = dataset.eager(:location).all
@firewalls = Serializers::Firewall.serialize(authorized_firewalls, {include_path: true})
view "networking/firewall/index"
end
end
r.web do
r.get "create" do
authorize("Firewall:create", @project.id)
@option_tree, @option_parents = generate_firewall_options
@default_location = @project.default_location
view "networking/firewall/create"
end
r.post true do
next unless (@location = Location[r.params["location"]])
firewall_post(r.params["name"])
end
end
end
end