flipper-ui 0.20.0 → 0.21.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfa566d9ce94dadf56643f0f8effcd75795dc478e8098a91374fa20b612d772c
4
- data.tar.gz: 0423fa89225c97f21cfe5bc851b43c8d13dbe930764989a8255cd61ab23bdada
3
+ metadata.gz: 1892ab407f3f56ccddb2268e6ce53d7d02ef68a5004c914bc68a61c791c1a97f
4
+ data.tar.gz: cff24cf7ed9f5521118d16af76cd2b8bc9b7ef90b345610450f2c2d836cc915d
5
5
  SHA512:
6
- metadata.gz: b65bcd93a19db4a5807f6ef4900d99ec9e8bf3232e569d0e5c27d4ad54b294657055448d5b45ee68bc66b9bf03a5810c090b210adf1de7501ea3bd61cdbd4c39
7
- data.tar.gz: 52c3fbade80bc667eed46f94059d65f84c1e46330a456dda768c6cbc5e807b0681bb5d8952e88fde8b4dae992009ac559c5073073987bfdc581b55ca75482790
6
+ metadata.gz: 1c3afd4b54efb3d6df85b1be0df6671083d208a451526a71483519eb748ff87aaf4b5ca1d4d4594981b6172fbb7e4b82e6e7cab3268d26c237f98da499c3bf18
7
+ data.tar.gz: fc85ea7b8bae97535e34321b1c89ae1dcda2b834dc31876d91ddc7ec5387d52a2f912c53c1cf8a965c3442e655676923ee1040385fe3bd73df4b8c2a82af4c04
@@ -0,0 +1,84 @@
1
+ #
2
+ # Usage:
3
+ # bundle exec rackup examples/ui/authorization.ru -p 9999
4
+ # bundle exec shotgun examples/ui/authorization.ru -p 9999
5
+ # http://localhost:9999/
6
+ #
7
+ require 'bundler/setup'
8
+ require "logger"
9
+
10
+ require "flipper-ui"
11
+ require "flipper/adapters/pstore"
12
+ require "active_support/notifications"
13
+
14
+ Flipper.register(:admins) { |actor|
15
+ actor.respond_to?(:admin?) && actor.admin?
16
+ }
17
+
18
+ Flipper.register(:early_access) { |actor|
19
+ actor.respond_to?(:early?) && actor.early?
20
+ }
21
+
22
+ # Setup logging of flipper calls.
23
+ if ENV["LOG"] == "1"
24
+ $logger = Logger.new(STDOUT)
25
+ require "flipper/instrumentation/log_subscriber"
26
+ Flipper::Instrumentation::LogSubscriber.logger = $logger
27
+ end
28
+
29
+ adapter = Flipper::Adapters::PStore.new
30
+ flipper = Flipper.new(adapter, instrumenter: ActiveSupport::Notifications)
31
+
32
+ Flipper::UI.configure do |config|
33
+ # config.banner_text = 'Production Environment'
34
+ # config.banner_class = 'danger'
35
+ config.feature_creation_enabled = true
36
+ config.feature_removal_enabled = true
37
+ # config.show_feature_description_in_list = true
38
+ config.descriptions_source = lambda do |_keys|
39
+ {
40
+ "search_performance_another_long_thing" => "Just to test feature name length.",
41
+ "gauges_tracking" => "Should we track page views with gaug.es.",
42
+ "unused" => "Not used.",
43
+ "suits" => "Are suits necessary in business?",
44
+ "secrets" => "Secrets are lies.",
45
+ "logging" => "Log all the things.",
46
+ "new_cache" => "Like the old cache but newer.",
47
+ "a/b" => "Why would someone use a slash? I don't know but someone did. Let's make this really long so they regret using slashes. Please don't use slashes.",
48
+ }
49
+ end
50
+ end
51
+
52
+ # Example middleware to allow reading the Flipper UI but nothing else.
53
+ class FlipperReadOnlyMiddleware
54
+ def initialize(app)
55
+ @app = app
56
+ end
57
+
58
+ def call(env)
59
+ request = Rack::Request.new(env)
60
+
61
+ if request.get?
62
+ @app.call(env)
63
+ else
64
+ [401, {}, ["You can only look"]]
65
+ end
66
+ end
67
+ end
68
+
69
+ # You can uncomment these to get some default data:
70
+ # flipper[:search_performance_another_long_thing].enable
71
+ # flipper[:gauges_tracking].enable
72
+ # flipper[:unused].disable
73
+ # flipper[:suits].enable_actor Flipper::Actor.new('1')
74
+ # flipper[:suits].enable_actor Flipper::Actor.new('6')
75
+ # flipper[:secrets].enable_group :admins
76
+ # flipper[:secrets].enable_group :early_access
77
+ # flipper[:logging].enable_percentage_of_time 5
78
+ # flipper[:new_cache].enable_percentage_of_actors 15
79
+ # flipper["something/slashed"].add
80
+
81
+ run Flipper::UI.app(flipper) { |builder|
82
+ builder.use Rack::Session::Cookie, secret: "_super_secret"
83
+ builder.use FlipperReadOnlyMiddleware
84
+ }
data/examples/ui/basic.ru CHANGED
@@ -1,17 +1,14 @@
1
1
  #
2
2
  # Usage:
3
- # bundle exec rackup examples/ui/basic.ru -p 9999
4
- # bundle exec shotgun examples/ui/basic.ru -p 9999
3
+ # # if you want it to not reload and be really fast
4
+ # bin/rackup examples/ui/basic.ru -p 9999
5
+ #
6
+ # # if you want reloading
7
+ # bin/shotgun examples/ui/basic.ru -p 9999
8
+ #
5
9
  # http://localhost:9999/
6
10
  #
7
- require "pp"
8
- require "logger"
9
- require "pathname"
10
-
11
- root_path = Pathname(__FILE__).dirname.join("..").expand_path
12
- lib_path = root_path.join("lib")
13
- $:.unshift(lib_path)
14
-
11
+ require 'bundler/setup'
15
12
  require "flipper-ui"
16
13
  require "flipper/adapters/pstore"
17
14
  require "active_support/notifications"
@@ -39,6 +36,7 @@ Flipper::UI.configure do |config|
39
36
  # config.banner_class = 'danger'
40
37
  config.feature_creation_enabled = true
41
38
  config.feature_removal_enabled = true
39
+ config.cloud_recommendation = true
42
40
  # config.show_feature_description_in_list = true
43
41
  config.descriptions_source = lambda do |_keys|
44
42
  {
@@ -26,6 +26,10 @@ module Flipper
26
26
  # won't see a videoclip of Taylor Swift when there aren't any features
27
27
  attr_accessor :fun
28
28
 
29
+ # Public: Tired of seeing the awesome message about Cloud? Set this to
30
+ # false and it will go away. Defaults to true.
31
+ attr_accessor :cloud_recommendation
32
+
29
33
  # Public: What should show up in the form to add actors. This can be
30
34
  # different per application since flipper_id's can be whatever an
31
35
  # application needs. Defaults to "a flipper id".
@@ -60,6 +64,7 @@ module Flipper
60
64
  @feature_creation_enabled = true
61
65
  @feature_removal_enabled = true
62
66
  @fun = true
67
+ @cloud_recommendation = true
63
68
  @add_actor_placeholder = "a flipper id"
64
69
  @descriptions_source = DEFAULT_DESCRIPTIONS_SOURCE
65
70
  @show_feature_description_in_list = false
Binary file
@@ -1,5 +1,5 @@
1
1
  <% if @show_blank_slate %>
2
- <div class="jumbotron text-center">
2
+ <div class="jumbotron text-center m-0">
3
3
  <% if Flipper::UI.configuration.fun %>
4
4
  <h4>But I've got a blank space baby...</h4>
5
5
  <p>And I'll flip your features.</p>
@@ -35,6 +35,21 @@
35
35
  <div>
36
36
  <%== yield %>
37
37
  </div>
38
+
39
+ <% if Flipper::UI.configuration.cloud_recommendation %>
40
+ <div class="d-flex justify-content-center mt-5">
41
+ <div class="row" style="max-width: 350px;">
42
+ <div class="col-auto d-flex align-items-center">
43
+ <a href="https://www.flippercloud.io/?utm_source=oss&utm_medium=ui&utm_campaign=spread_the_love">
44
+ <img src="<%= script_name %>/images/logo.png" width="50" />
45
+ </a>
46
+ </div>
47
+ <div class="col text-muted p-0">
48
+ <small>For support, audit history, finer-grained permissions, multi-environment sync, and all your projects in one place check out <a href="https://www.flippercloud.io/?utm_source=oss&utm_medium=ui&utm_campaign=spread_the_love">Flipper&nbsp;Cloud</a>.</small>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <% end %>
38
53
  </div>
39
54
 
40
55
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.20.0'.freeze
2
+ VERSION = '0.21.0.rc1'.freeze
3
3
  end
@@ -59,6 +59,17 @@ RSpec.describe Flipper::UI::Configuration do
59
59
  end
60
60
  end
61
61
 
62
+ describe "#cloud_recommendation" do
63
+ it "has default value" do
64
+ expect(configuration.cloud_recommendation).to eq(true)
65
+ end
66
+
67
+ it "can be updated" do
68
+ configuration.cloud_recommendation = false
69
+ expect(configuration.cloud_recommendation).to eq(false)
70
+ end
71
+ end
72
+
62
73
  describe "#feature_removal_enabled" do
63
74
  it "has default value" do
64
75
  expect(configuration.feature_removal_enabled).to eq(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-20 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: 0.20.0
59
+ version: 0.21.0.rc1
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: 0.20.0
66
+ version: 0.21.0.rc1
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: erubi
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +96,7 @@ files:
96
96
  - docs/ui/images/description.png
97
97
  - docs/ui/images/feature.png
98
98
  - docs/ui/images/features.png
99
+ - examples/ui/authorization.ru
99
100
  - examples/ui/basic.ru
100
101
  - flipper-ui.gemspec
101
102
  - lib/flipper-ui.rb
@@ -172,9 +173,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  requirements:
175
- - - ">="
176
+ - - ">"
176
177
  - !ruby/object:Gem::Version
177
- version: '0'
178
+ version: 1.3.1
178
179
  requirements: []
179
180
  rubygems_version: 3.0.3
180
181
  signing_key: