Sha256: a6e1a529760d59dc388700677561fd218d1cd6dcdecef8243a6dfc72d23c44ee

Contents?: true

Size: 814 Bytes

Versions: 17

Compression:

Stored size: 814 Bytes

Contents

require 'flipper/ui/action'
require 'flipper/ui/decorators/feature'

module Flipper
  module UI
    module Actions
      class PercentageOfActorsGate < UI::Action
        route %r{features/[^/]*/percentage_of_actors/?\Z}

        def post
          feature_name = Rack::Utils.unescape(request.path.split('/')[-2])
          feature = flipper[feature_name.to_sym]
          @feature = Decorators::Feature.new(feature)

          begin
            feature.enable_percentage_of_actors params['value']
          rescue ArgumentError => exception
            error = Rack::Utils.escape("Invalid percentage of actors value: #{exception.message}")
            redirect_to("/features/#{@feature.key}?error=#{error}")
          end

          redirect_to "/features/#{@feature.key}"
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
flipper-ui-0.15.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.14.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.13.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.13.0.beta1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.12.2 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.12.1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.12.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.rc1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta9 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta8 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta7 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta6 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta5 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta4 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta3 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.11.0.beta1 lib/flipper/ui/actions/percentage_of_actors_gate.rb