flipper-ui 0.18.0 → 0.19.0
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/docs/ui/README.md +14 -25
- data/docs/ui/images/banner.png +0 -0
- data/docs/ui/images/description.png +0 -0
- data/docs/ui/images/feature.png +0 -0
- data/docs/ui/images/features.png +0 -0
- data/examples/ui/basic.ru +1 -0
- data/lib/flipper/ui/actions/features.rb +13 -1
- data/lib/flipper/ui/configuration.rb +10 -1
- data/lib/flipper/ui/views/features.erb +6 -1
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/ui/configuration_spec.rb +37 -0
- metadata +6 -6
- data/docs/ui/images/configured-ui.png +0 -0
- data/docs/ui/images/environment-banner.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f65bfa737d7cd159165e492c573629403da4f9d55fdeed90c1381900af75c8
|
4
|
+
data.tar.gz: e5804ef90798f479fa03577a76c3c48f8321c90f16f7b8fbaec12e57ce9d6da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6651d1dc8eb1f9920ad5eb9c519be5356344e4876c1c746eb92c6a3ef14c7add2cb2f9f8d60a15d2285a205e48b3ac3a0be8780a62576298be803c2ec63e1567
|
7
|
+
data.tar.gz: 23ee8e91d63cadb72fccd89c9a4effd5cf9186f4be58d051938a29f69a9b9ad32e04cf7bc35fa26662344d557a4ba6f4d5f75cfb970bac549f8825015e3dbba5
|
data/docs/ui/README.md
CHANGED
@@ -5,9 +5,11 @@ UI for the [Flipper](https://github.com/jnunemaker/flipper) gem.
|
|
5
5
|
## Screenshots
|
6
6
|
|
7
7
|
Viewing list of features:
|
8
|
+
|
8
9
|

|
9
10
|
|
10
11
|
Viewing an individual feature:
|
12
|
+
|
11
13
|

|
12
14
|
|
13
15
|
## Installation
|
@@ -127,28 +129,11 @@ See [examples/ui/basic.ru](https://github.com/jnunemaker/flipper/blob/master/exa
|
|
127
129
|
|
128
130
|
### Configuration
|
129
131
|
|
130
|
-
Flipper UI can be customized via `configure`, which yields a configuration instance
|
131
|
-
|
132
|
-
* `config.actors`
|
133
|
-
* `config.groups`
|
134
|
-
* `config.percentage_of_actors`
|
135
|
-
* `config.percentage_of_time`
|
136
|
-
* `config.delete`
|
137
|
-
|
138
|
-
Each of these methods returns a [Flipper::UI::Option](https://github.com/jnunemaker/flipper/blob/master/lib/flipper/ui/configuration/option.rb) that responds to `title=`, `description=` as seen below.
|
139
|
-
|
140
|
-
*e.g. customzing the percentage_of_actors and delete sections' titles and descriptions*
|
141
|
-
```ruby
|
142
|
-
Flipper::UI.configure do |config|
|
143
|
-
config.percentage_of_actors.title = "My Custom Title"
|
144
|
-
config.percentage_of_actors.description = "My custom description"
|
132
|
+
Flipper UI can be customized via `configure`, which yields a configuration instance.
|
145
133
|
|
146
|
-
|
147
|
-
config.delete.description = "YOU'VE BEEN WARNED!"
|
148
|
-
end
|
149
|
-
```
|
134
|
+
#### Description
|
150
135
|
|
151
|
-
We can
|
136
|
+
We can associate a `description` for each `feature` by providing a descriptions source:
|
152
137
|
|
153
138
|
```ruby
|
154
139
|
Flipper::UI.configure do |config|
|
@@ -156,14 +141,18 @@ Flipper::UI.configure do |config|
|
|
156
141
|
# descriptions loaded from YAML file or database (postgres, mysql, etc)
|
157
142
|
# return has to be hash of {String key => String description}
|
158
143
|
end
|
144
|
+
|
145
|
+
# Defaults to false. Set to true to show feature descriptions on the list
|
146
|
+
# page as well as the view page.
|
147
|
+
# config.show_feature_description_in_list = true
|
159
148
|
end
|
160
149
|
```
|
161
150
|
|
162
|
-
|
151
|
+
Descriptions show up in the UI like so:
|
163
152
|
|
164
|
-

|
165
154
|
|
166
|
-
|
155
|
+
#### Banner
|
167
156
|
|
168
157
|
Flipper UI can display a banner across the top of the page. The `banner_text` and `banner_class` can be configured by using the `Flipper::UI.configure` block as seen below.
|
169
158
|
|
@@ -178,9 +167,9 @@ By default the `environment` is set to an empty string so no banner will show. I
|
|
178
167
|
|
179
168
|
The above configuration results in:
|
180
169
|
|
181
|
-

|
182
171
|
|
183
|
-
|
172
|
+
#### Fun mode
|
184
173
|
|
185
174
|
By default, Flipper UI displays a videoclip when there are no flags. The `fun` mode can be configured by using the `Flipper::UI.configure` block as seen below.
|
186
175
|
|
Binary file
|
Binary file
|
data/docs/ui/images/feature.png
CHANGED
Binary file
|
data/docs/ui/images/features.png
CHANGED
Binary file
|
data/examples/ui/basic.ru
CHANGED
@@ -39,6 +39,7 @@ Flipper::UI.configure do |config|
|
|
39
39
|
# config.banner_class = 'danger'
|
40
40
|
config.feature_creation_enabled = true
|
41
41
|
config.feature_removal_enabled = true
|
42
|
+
# config.show_feature_description_in_list = true
|
42
43
|
config.descriptions_source = lambda do |_keys|
|
43
44
|
{
|
44
45
|
"search_performance_another_long_thing" => "Just to test feature name length.",
|
@@ -11,8 +11,20 @@ module Flipper
|
|
11
11
|
def get
|
12
12
|
@page_title = 'Features'
|
13
13
|
keys = flipper.features.map(&:key)
|
14
|
+
descriptions = if Flipper::UI.configuration.show_feature_description_in_list?
|
15
|
+
Flipper::UI.configuration.descriptions_source.call(keys)
|
16
|
+
else
|
17
|
+
{}
|
18
|
+
end
|
19
|
+
|
14
20
|
@features = flipper.features.map do |feature|
|
15
|
-
Decorators::Feature.new(feature)
|
21
|
+
decorated_feature = Decorators::Feature.new(feature)
|
22
|
+
|
23
|
+
if Flipper::UI.configuration.show_feature_description_in_list?
|
24
|
+
decorated_feature.description = descriptions[feature.key]
|
25
|
+
end
|
26
|
+
|
27
|
+
decorated_feature
|
16
28
|
end.sort
|
17
29
|
|
18
30
|
@show_blank_slate = @features.empty?
|
@@ -33,9 +33,13 @@ module Flipper
|
|
33
33
|
|
34
34
|
# Public: If you set this, Flipper::UI will fetch descriptions
|
35
35
|
# from your external source. Descriptions for `features` will be shown on `feature`
|
36
|
-
# and `features` pages. Defaults to empty block.
|
36
|
+
# page, and optionally the `features` pages. Defaults to empty block.
|
37
37
|
attr_accessor :descriptions_source
|
38
38
|
|
39
|
+
# Public: Should feature descriptions be show on the `features` list page.
|
40
|
+
# Default false. Only works when using descriptions.
|
41
|
+
attr_accessor :show_feature_description_in_list
|
42
|
+
|
39
43
|
VALID_BANNER_CLASS_VALUES = %w(
|
40
44
|
danger
|
41
45
|
dark
|
@@ -58,12 +62,17 @@ module Flipper
|
|
58
62
|
@fun = true
|
59
63
|
@add_actor_placeholder = "a flipper id"
|
60
64
|
@descriptions_source = DEFAULT_DESCRIPTIONS_SOURCE
|
65
|
+
@show_feature_description_in_list = false
|
61
66
|
end
|
62
67
|
|
63
68
|
def using_descriptions?
|
64
69
|
@descriptions_source != DEFAULT_DESCRIPTIONS_SOURCE
|
65
70
|
end
|
66
71
|
|
72
|
+
def show_feature_description_in_list?
|
73
|
+
using_descriptions? && @show_feature_description_in_list
|
74
|
+
end
|
75
|
+
|
67
76
|
def banner_class=(value)
|
68
77
|
unless VALID_BANNER_CLASS_VALUES.include?(value)
|
69
78
|
raise InvalidConfigurationValue, "The banner_class provided '#{value}' is " \
|
@@ -44,7 +44,12 @@
|
|
44
44
|
</div>
|
45
45
|
<div class="col-10">
|
46
46
|
<a href="<%= "#{script_name}/features/#{feature.key}" %>" class="d-block px-0 py-3 btn text-left text-dark">
|
47
|
-
<div class="text-truncate"><%= feature.key %></div>
|
47
|
+
<div class="text-truncate" style="font-weight: 500"><%= feature.key %></div>
|
48
|
+
<% if Flipper::UI.configuration.show_feature_description_in_list? && Flipper::UI::Util.present?(feature.description) %>
|
49
|
+
<div class="text-muted font-weight-light" style="line-height: 1.4; white-space: initial; padding: 8px 0">
|
50
|
+
<%= feature.description %>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
48
53
|
<div class="text-muted text-truncate">
|
49
54
|
<%== feature.gates_in_words %>
|
50
55
|
</div>
|
data/lib/flipper/version.rb
CHANGED
@@ -100,4 +100,41 @@ RSpec.describe Flipper::UI::Configuration do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
103
|
+
|
104
|
+
describe "#show_feature_description_in_list" do
|
105
|
+
it "has default value" do
|
106
|
+
expect(configuration.show_feature_description_in_list).to eq(false)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "can be updated" do
|
110
|
+
configuration.show_feature_description_in_list = true
|
111
|
+
expect(configuration.show_feature_description_in_list).to eq(true)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#show_feature_description_in_list?" do
|
116
|
+
subject { configuration.show_feature_description_in_list? }
|
117
|
+
|
118
|
+
context 'when using_descriptions? is false and show_feature_description_in_list is false' do
|
119
|
+
it { is_expected.to eq(false) }
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'when using_descriptions? is false and show_feature_description_in_list is true' do
|
123
|
+
before { configuration.show_feature_description_in_list = true }
|
124
|
+
it { is_expected.to eq(false) }
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'when using_descriptions? is true and show_feature_description_in_list is false' do
|
128
|
+
before { allow(configuration).to receive(:using_descriptions?).and_return(true) }
|
129
|
+
it { is_expected.to eq(false) }
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when using_descriptions? is true and show_feature_description_in_list is true' do
|
133
|
+
before do
|
134
|
+
allow(configuration).to receive(:using_descriptions?).and_return(true)
|
135
|
+
configuration.show_feature_description_in_list = true
|
136
|
+
end
|
137
|
+
it { is_expected.to eq(true) }
|
138
|
+
end
|
139
|
+
end
|
103
140
|
end
|
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.19.0
|
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-
|
11
|
+
date: 2020-09-25 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.19.0
|
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.19.0
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: erubi
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,8 +92,8 @@ extensions: []
|
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
94
|
- docs/ui/README.md
|
95
|
-
- docs/ui/images/
|
96
|
-
- docs/ui/images/
|
95
|
+
- docs/ui/images/banner.png
|
96
|
+
- docs/ui/images/description.png
|
97
97
|
- docs/ui/images/feature.png
|
98
98
|
- docs/ui/images/features.png
|
99
99
|
- examples/ui/basic.ru
|
Binary file
|
Binary file
|