lib/karafka/web/pro/ui/app.rb in karafka-web-0.9.1 vs lib/karafka/web/pro/ui/app.rb in karafka-web-0.10.0.beta1

- old
+ new

@@ -30,10 +30,23 @@ plugin :additional_view_directories, [ Karafka::Web.gem_root.join('lib/karafka/web/ui/views') ] + before do + assets_path = root_path("assets/#{Karafka::Web::VERSION}/") + + # Always allow assets + break true if request.path.start_with?(assets_path) + # If policies extension is not loaded, allow as this is the default + break true unless Web.config.ui.respond_to?(:policies) + break true if Web.config.ui.policies.requests.allow?(env) + + # Do not allow if given request violates requests policies + raise(Errors::Ui::ForbiddenError) + end + route do |r| r.root { r.redirect root_path('dashboard') } # Serve current version specific assets to prevent users from fetching old assets # after upgrade @@ -49,11 +62,10 @@ r.on 'consumers' do controller = Controllers::ConsumersController.new(params) r.get 'overview' do - @breadcrumbs = false controller.index end r.get 'performance' do controller.performance @@ -153,10 +165,17 @@ controller.index end end r.on 'explorer' do + r.get String, 'search' do |topic_id| + # Search has it's own controller but we want to have this in the explorer routing + # namespace because topic search is conceptually part of the explorer + controller = Controllers::SearchController.new(params) + controller.index(topic_id) + end + controller = Controllers::ExplorerController.new(params) r.get String, Integer, 'recent' do |topic_id, partition_id| controller.recent(topic_id, partition_id) end @@ -260,22 +279,30 @@ end r.on 'topics' do controller = Controllers::TopicsController.new(params) - r.get String, 'config' do |topic_name| - controller.config(topic_name) + r.get String, 'config' do |topic_id| + controller.config(topic_id) end - r.get String, 'replication' do |topic_name| - controller.replication(topic_name) + r.get String, 'replication' do |topic_id| + controller.replication(topic_id) end - r.get String, 'distribution' do |topic_name| - controller.distribution(topic_name) + r.get String, 'distribution' do |topic_id| + controller.distribution(topic_id) end + r.get String, 'offsets' do |topic_id| + controller.offsets(topic_id) + end + + r.get String do |topic_id| + r.redirect root_path('topics', topic_id, 'config') + end + r.get do controller.index end end @@ -304,9 +331,19 @@ controller.index end r.get 'status' do controller = Controllers::StatusController.new(params) + controller.show + end + + r.get 'ux' do + controller = Controllers::UxController.new(params) + controller.show + end + + r.get 'support' do + controller = Controllers::SupportController.new(params) controller.show end end end end