flipper-ui 0.20.1 → 0.21.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/ui/authorization.ru +84 -0
- data/examples/ui/basic.ru +9 -22
- data/lib/flipper/ui/configuration.rb +5 -0
- data/lib/flipper/ui/public/images/logo.png +0 -0
- data/lib/flipper/ui/views/features.erb +1 -1
- data/lib/flipper/ui/views/layout.erb +15 -0
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/ui/configuration_spec.rb +11 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc6e65be89bdc77c49f532927aad5bb44642f1f24afefeb5d3612ce3492c9045
|
4
|
+
data.tar.gz: ede8502f7963f6e2e4e5788685dc51fb0499496a82bdaddecb0a9469fbb7e903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6074c2cfc83e5b378a803c6809d1b92b4396077a430aca11046963a8eff28404c4cf619a8e3541fdb520869623773da86b9152699e7606434514f3fbefdd6854
|
7
|
+
data.tar.gz: 7ab5ff10ac2c708cca835c4629312b1b785147cb596f6282ba5bee59bfd030fe2d4f200563accd811d905effcb5b6bfdb4249648eab70367cd22410255b5d410
|
@@ -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,20 +1,16 @@
|
|
1
1
|
#
|
2
2
|
# Usage:
|
3
|
-
#
|
4
|
-
#
|
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
|
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
|
-
require "active_support/notifications"
|
18
14
|
|
19
15
|
Flipper.register(:admins) { |actor|
|
20
16
|
actor.respond_to?(:admin?) && actor.admin?
|
@@ -24,21 +20,12 @@ Flipper.register(:early_access) { |actor|
|
|
24
20
|
actor.respond_to?(:early?) && actor.early?
|
25
21
|
}
|
26
22
|
|
27
|
-
# Setup logging of flipper calls.
|
28
|
-
if ENV["LOG"] == "1"
|
29
|
-
$logger = Logger.new(STDOUT)
|
30
|
-
require "flipper/instrumentation/log_subscriber"
|
31
|
-
Flipper::Instrumentation::LogSubscriber.logger = $logger
|
32
|
-
end
|
33
|
-
|
34
|
-
adapter = Flipper::Adapters::PStore.new
|
35
|
-
flipper = Flipper.new(adapter, instrumenter: ActiveSupport::Notifications)
|
36
|
-
|
37
23
|
Flipper::UI.configure do |config|
|
38
24
|
# config.banner_text = 'Production Environment'
|
39
25
|
# config.banner_class = 'danger'
|
40
26
|
config.feature_creation_enabled = true
|
41
27
|
config.feature_removal_enabled = true
|
28
|
+
config.cloud_recommendation = true
|
42
29
|
# config.show_feature_description_in_list = true
|
43
30
|
config.descriptions_source = lambda do |_keys|
|
44
31
|
{
|
@@ -66,6 +53,6 @@ end
|
|
66
53
|
# flipper[:new_cache].enable_percentage_of_actors 15
|
67
54
|
# flipper["a/b"].add
|
68
55
|
|
69
|
-
run Flipper::UI.app
|
56
|
+
run Flipper::UI.app { |builder|
|
70
57
|
builder.use Rack::Session::Cookie, secret: "_super_secret"
|
71
58
|
}
|
@@ -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
|
@@ -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 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>
|
data/lib/flipper/version.rb
CHANGED
@@ -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.
|
4
|
+
version: 0.21.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-08 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.
|
59
|
+
version: 0.21.0.rc2
|
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.
|
66
|
+
version: 0.21.0.rc2
|
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:
|
178
|
+
version: 1.3.1
|
178
179
|
requirements: []
|
179
180
|
rubygems_version: 3.0.3
|
180
181
|
signing_key:
|