Class: Flipper::UI::Configuration
- Inherits:
-
Object
- Object
- Flipper::UI::Configuration
- Defined in:
- lib/flipper/ui/configuration.rb
Constant Summary collapse
- VALID_BANNER_CLASS_VALUES =
%w( danger dark info light primary secondary success warning ).freeze
- DEFAULT_DESCRIPTIONS_SOURCE =
->(_keys) { {} }
Instance Attribute Summary collapse
-
#actors_separator ⇒ Object
Public: What should be used to denote you are trying to add multiple actors at once (instead of just a single actor).
-
#add_actor_placeholder ⇒ Object
Public: What should show up in the form to add actors.
-
#application_breadcrumb_href ⇒ Object
Public: If you set this, the UI will always have a first breadcrumb that says “App” which points to this href.
-
#banner_class ⇒ Object
Returns the value of attribute banner_class.
-
#banner_text ⇒ Object
Returns the value of attribute banner_text.
-
#cloud_recommendation ⇒ Object
Public: Tired of seeing the awesome message about Cloud? Set this to false and it will go away.
-
#confirm_fully_enable ⇒ Object
Public: if you want to get a confirm pop up box while fully enabling a feature Default is false.
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
-
#descriptions_source ⇒ Object
Public: If you set this, Flipper::UI will fetch descriptions from your external source.
-
#feature_creation_enabled ⇒ Object
Public: Is feature creation allowed from the UI? Defaults to true.
-
#feature_removal_enabled ⇒ Object
Public: Is feature deletion allowed from the UI? Defaults to true.
-
#fun ⇒ Object
Public: Are you feeling lucky? Defaults to true.
-
#read_only ⇒ Object
Public: Is the UI in read only mode or not.
-
#show_feature_description_in_list ⇒ Object
Public: Should feature descriptions be show on the ‘features` list page.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #show_feature_description_in_list? ⇒ Boolean
- #using_descriptions? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/flipper/ui/configuration.rb', line 74 def initialize @delete = Option.new("Danger Zone", "Deleting a feature removes it from the list of features and disables it for everyone.") @banner_text = nil @banner_class = 'danger' @feature_creation_enabled = true @feature_removal_enabled = true @fun = true @cloud_recommendation = true @add_actor_placeholder = "a flipper id" @descriptions_source = DEFAULT_DESCRIPTIONS_SOURCE @show_feature_description_in_list = false @actors_separator = ',' @confirm_fully_enable = false @read_only = false end |
Instance Attribute Details
#actors_separator ⇒ Object
Public: What should be used to denote you are trying to add multiple actors at once (instead of just a single actor). Default is comma “,”.
55 56 57 |
# File 'lib/flipper/ui/configuration.rb', line 55 def actors_separator @actors_separator end |
#add_actor_placeholder ⇒ Object
Public: What should show up in the form to add actors. This can be different per application since flipper_id’s can be whatever an application needs. Defaults to “a flipper id”.
41 42 43 |
# File 'lib/flipper/ui/configuration.rb', line 41 def add_actor_placeholder @add_actor_placeholder end |
#application_breadcrumb_href ⇒ Object
Public: If you set this, the UI will always have a first breadcrumb that says “App” which points to this href. The href can be a path (ie: “/”) or full url (“app.example.com/”).
19 20 21 |
# File 'lib/flipper/ui/configuration.rb', line 19 def @application_breadcrumb_href end |
#banner_class ⇒ Object
Returns the value of attribute banner_class.
8 9 10 |
# File 'lib/flipper/ui/configuration.rb', line 8 def @banner_class end |
#banner_text ⇒ Object
Returns the value of attribute banner_text.
8 9 10 |
# File 'lib/flipper/ui/configuration.rb', line 8 def @banner_text end |
#cloud_recommendation ⇒ Object
Public: Tired of seeing the awesome message about Cloud? Set this to false and it will go away. Defaults to true.
36 37 38 |
# File 'lib/flipper/ui/configuration.rb', line 36 def cloud_recommendation @cloud_recommendation end |
#confirm_fully_enable ⇒ Object
Public: if you want to get a confirm pop up box while fully enabling a feature Default is false.
59 60 61 |
# File 'lib/flipper/ui/configuration.rb', line 59 def confirm_fully_enable @confirm_fully_enable end |
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
6 7 8 |
# File 'lib/flipper/ui/configuration.rb', line 6 def delete @delete end |
#descriptions_source ⇒ Object
Public: If you set this, Flipper::UI will fetch descriptions from your external source. Descriptions for ‘features` will be shown on `feature` page, and optionally the `features` pages. Defaults to empty block.
46 47 48 |
# File 'lib/flipper/ui/configuration.rb', line 46 def descriptions_source @descriptions_source end |
#feature_creation_enabled ⇒ Object
Public: Is feature creation allowed from the UI? Defaults to true. If set to false, users of the UI cannot create features. All feature creation will need to be done through the configured flipper instance.
24 25 26 |
# File 'lib/flipper/ui/configuration.rb', line 24 def feature_creation_enabled @feature_creation_enabled end |
#feature_removal_enabled ⇒ Object
Public: Is feature deletion allowed from the UI? Defaults to true. If set to false, users won’t be able to delete features from the UI.
28 29 30 |
# File 'lib/flipper/ui/configuration.rb', line 28 def feature_removal_enabled @feature_removal_enabled end |
#fun ⇒ Object
Public: Are you feeling lucky? Defaults to true. If set to false, users won’t see a videoclip of Taylor Swift when there aren’t any features
32 33 34 |
# File 'lib/flipper/ui/configuration.rb', line 32 def fun @fun end |
#read_only ⇒ Object
Public: Is the UI in read only mode or not. Default is false. This supersedes all other write-related options such as (feature_creation_enabled and feature_removal_enabled).
14 15 16 |
# File 'lib/flipper/ui/configuration.rb', line 14 def read_only @read_only end |
#show_feature_description_in_list ⇒ Object
Public: Should feature descriptions be show on the ‘features` list page. Default false. Only works when using descriptions.
50 51 52 |
# File 'lib/flipper/ui/configuration.rb', line 50 def show_feature_description_in_list @show_feature_description_in_list end |
Instance Method Details
#show_feature_description_in_list? ⇒ Boolean
94 95 96 |
# File 'lib/flipper/ui/configuration.rb', line 94 def show_feature_description_in_list? using_descriptions? && @show_feature_description_in_list end |
#using_descriptions? ⇒ Boolean
90 91 92 |
# File 'lib/flipper/ui/configuration.rb', line 90 def using_descriptions? @descriptions_source != DEFAULT_DESCRIPTIONS_SOURCE end |