Sha256: a09c530ac60f061f2ba9c0fe3988867c878d96d64553425719394de838ee426b

Contents?: true

Size: 767 Bytes

Versions: 11

Compression:

Stored size: 767 Bytes

Contents

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

module Flipper
  module UI
    module Actions
      class PercentageOfActorsGate < UI::Action
        include FeatureNameFromRoute

        route %r{\A/features/(?<feature_name>.*)/percentage_of_actors/?\Z}

        def post
          feature = flipper[feature_name]
          @feature = Decorators::Feature.new(feature)

          begin
            feature.enable_percentage_of_actors params['value']
          rescue ArgumentError => exception
            error = "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

11 entries across 11 versions & 1 rubygems

Version Path
flipper-ui-0.25.3 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.25.2 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.25.1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.25.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.24.1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.24.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.23.1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.23.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.22.2 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.22.1 lib/flipper/ui/actions/percentage_of_actors_gate.rb
flipper-ui-0.22.0 lib/flipper/ui/actions/percentage_of_actors_gate.rb