flipper-ui 0.25.3 → 0.25.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e325cd3eabbcc4208252d87f731d8614dc120fa31be2bfdf17a3f604cd4c00b
4
- data.tar.gz: 2daced14062f8e51006e10e90c3b0d04f3fe212588324cae0706ed320112530d
3
+ metadata.gz: c8387d32b596eda073c7289c8ce794fb8badbe43e5f235ef2032106cb9968089
4
+ data.tar.gz: c767b97195e28a665a483a63d310c216e09175866826c2e16e501488849b469d
5
5
  SHA512:
6
- metadata.gz: 1f313cbfb15d6eb7f1976d29f82f1901b485d310509e59d494fafbc17dba9a90457f88ff83476b33f05c0dc19ec509758e950957af8e8c584f4b6f5b409a148b
7
- data.tar.gz: 432fd42201befa751cc3386ed4c5617053de7555d05c11e1f269cb743968ba3c6fe4f99ffc60acab5b13e07547df08b35514b6835c73a8f36c8c515d9e98ec62
6
+ metadata.gz: bea51d75cc9e66dceb9287e50b0868a501355cacf54253031f017e307f2eeefe2b680b40e49a2d5d917a216a33daeecf03177f8330292742cf4ceb9dc6882e84
7
+ data.tar.gz: 29d04be79be90455fa4c9fd6c450b3cfddbcaf7f068a4d35d134c63b25811e87198bc273dd6525b78185363738759629a2ddcbd62dca504b2ad1b0b5631a3101
@@ -0,0 +1,43 @@
1
+ #
2
+ # Usage:
3
+ # # if you want it to not reload and be really fast
4
+ # bin/rackup examples/ui/read_only.ru -p 9999
5
+ #
6
+ # # if you want reloading
7
+ # bin/shotgun examples/ui/read_only.ru -p 9999
8
+ #
9
+ # http://localhost:9999/
10
+ #
11
+ require 'bundler/setup'
12
+ require "flipper/ui"
13
+ require "flipper/adapters/pstore"
14
+
15
+ Flipper.register(:admins) { |actor|
16
+ actor.respond_to?(:admin?) && actor.admin?
17
+ }
18
+
19
+ Flipper.register(:early_access) { |actor|
20
+ actor.respond_to?(:early?) && actor.early?
21
+ }
22
+
23
+ Flipper::UI.configure do |config|
24
+ config.banner_text = 'Read only mode.'
25
+ config.banner_class = 'danger'
26
+ config.read_only = true
27
+ end
28
+
29
+ # You can uncomment these to get some default data:
30
+ # Flipper.enable(:search_performance_another_long_thing)
31
+ # Flipper.disable(:gauges_tracking)
32
+ # Flipper.disable(:unused)
33
+ # Flipper.enable_actor(:suits, Flipper::Actor.new('1'))
34
+ # Flipper.enable_actor(:suits, Flipper::Actor.new('6'))
35
+ # Flipper.enable_group(:secrets, :admins)
36
+ # Flipper.enable_group(:secrets, :early_access)
37
+ # Flipper.enable_percentage_of_time(:logging, 5)
38
+ # Flipper.enable_percentage_of_actors(:new_cache, 15)
39
+ # Flipper.add("a/b")
40
+
41
+ run Flipper::UI.app { |builder|
42
+ builder.use Rack::Session::Cookie, secret: "_super_secret"
43
+ }
@@ -271,6 +271,18 @@ module Flipper
271
271
  VALID_REQUEST_METHOD_NAMES.include?(request_method_name)
272
272
  end
273
273
 
274
+ # Internal: Method to call when the UI is in read only mode and you want
275
+ # to inform people of that fact.
276
+ def read_only
277
+ status 403
278
+
279
+ breadcrumb 'Home', '/'
280
+ breadcrumb 'Features', '/features'
281
+ breadcrumb 'Noooooope'
282
+
283
+ halt view_response(:read_only)
284
+ end
285
+
274
286
  def bootstrap_css
275
287
  SOURCES[:bootstrap_css]
276
288
  end
@@ -23,6 +23,8 @@ module Flipper
23
23
  end
24
24
 
25
25
  def post
26
+ read_only if Flipper::UI.configuration.read_only
27
+
26
28
  feature = flipper[feature_name]
27
29
  value = params['value'].to_s.strip
28
30
  values = value.split(UI.configuration.actors_separator).map(&:strip).uniq
@@ -8,6 +8,8 @@ module Flipper
8
8
  route %r{\A/features/new/?\Z}
9
9
 
10
10
  def get
11
+ read_only if Flipper::UI.configuration.read_only
12
+
11
13
  unless Flipper::UI.configuration.feature_creation_enabled
12
14
  status 403
13
15
 
@@ -10,6 +10,8 @@ module Flipper
10
10
  route %r{\A/features/(?<feature_name>.*)/boolean/?\Z}
11
11
 
12
12
  def post
13
+ read_only if Flipper::UI.configuration.read_only
14
+
13
15
  feature = flipper[feature_name]
14
16
  @feature = Decorators::Feature.new(feature)
15
17
 
@@ -25,6 +25,8 @@ module Flipper
25
25
  end
26
26
 
27
27
  def delete
28
+ read_only if Flipper::UI.configuration.read_only
29
+
28
30
  unless Flipper::UI.configuration.feature_removal_enabled
29
31
  status 403
30
32
 
@@ -36,6 +36,8 @@ module Flipper
36
36
  end
37
37
 
38
38
  def post
39
+ read_only if Flipper::UI.configuration.read_only
40
+
39
41
  unless Flipper::UI.configuration.feature_creation_enabled
40
42
  status 403
41
43
 
@@ -22,6 +22,8 @@ module Flipper
22
22
  end
23
23
 
24
24
  def post
25
+ read_only if Flipper::UI.configuration.read_only
26
+
25
27
  feature = flipper[feature_name]
26
28
  value = params['value'].to_s.strip
27
29
 
@@ -10,6 +10,8 @@ module Flipper
10
10
  route %r{\A/features/(?<feature_name>.*)/percentage_of_actors/?\Z}
11
11
 
12
12
  def post
13
+ read_only if Flipper::UI.configuration.read_only
14
+
13
15
  feature = flipper[feature_name]
14
16
  @feature = Decorators::Feature.new(feature)
15
17
 
@@ -10,6 +10,8 @@ module Flipper
10
10
  route %r{\A/features/(?<feature_name>.*)/percentage_of_time/?\Z}
11
11
 
12
12
  def post
13
+ read_only if Flipper::UI.configuration.read_only
14
+
13
15
  feature = flipper[feature_name]
14
16
  @feature = Decorators::Feature.new(feature)
15
17
 
@@ -8,6 +8,11 @@ module Flipper
8
8
  attr_accessor :banner_text,
9
9
  :banner_class
10
10
 
11
+ # Public: Is the UI in read only mode or not. Default is false. This
12
+ # supersedes all other write-related options such as
13
+ # (feature_creation_enabled and feature_removal_enabled).
14
+ attr_accessor :read_only
15
+
11
16
  # Public: If you set this, the UI will always have a first breadcrumb that
12
17
  # says "App" which points to this href. The href can be a path (ie: "/")
13
18
  # or full url ("https://app.example.com/").
@@ -79,6 +84,7 @@ module Flipper
79
84
  @show_feature_description_in_list = false
80
85
  @actors_separator = ','
81
86
  @confirm_fully_enable = false
87
+ @read_only = false
82
88
  end
83
89
 
84
90
  def using_descriptions?
@@ -40,20 +40,22 @@
40
40
  </strong>
41
41
  </h6>
42
42
  </div>
43
- <div class="col col-auto toggle-block-when-off">
44
- <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add an actor</button>
45
- </div>
46
- <div class="col toggle-block-when-on">
47
- <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post" class="form-inline">
48
- <%== csrf_input_tag %>
49
- <input type="hidden" name="operation" value="enable">
50
- <input type="text" name="value" placeholder="<%= Flipper::UI.configuration.add_actor_placeholder %>" class="form-control form-control-sm mr-sm-2 mb-2 mb-sm-0">
51
- <input type="submit" value="Add Actor" class="btn btn-sm btn-light">
52
- </form>
53
- </div>
54
- <div class="col col-auto toggle-block-when-on">
55
- <button type="button" class="btn btn-outline-secondary js-toggle-trigger">Cancel</button>
56
- </div>
43
+ <% unless Flipper::UI.configuration.read_only %>
44
+ <div class="col col-auto toggle-block-when-off">
45
+ <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add an actor</button>
46
+ </div>
47
+ <div class="col toggle-block-when-on">
48
+ <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post" class="form-inline">
49
+ <%== csrf_input_tag %>
50
+ <input type="hidden" name="operation" value="enable">
51
+ <input type="text" name="value" placeholder="<%= Flipper::UI.configuration.add_actor_placeholder %>" class="form-control form-control-sm mr-sm-2 mb-2 mb-sm-0">
52
+ <input type="submit" value="Add Actor" class="btn btn-sm btn-light">
53
+ </form>
54
+ </div>
55
+ <div class="col col-auto toggle-block-when-on">
56
+ <button type="button" class="btn btn-outline-secondary js-toggle-trigger">Cancel</button>
57
+ </div>
58
+ <% end %>
57
59
  </div>
58
60
  </div>
59
61
 
@@ -65,14 +67,16 @@
65
67
  <h6 class="m-0"><%= item %></h6>
66
68
  </div>
67
69
  <div class="col col-auto">
68
- <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post">
69
- <%== csrf_input_tag %>
70
- <input type="hidden" name="operation" value="disable">
71
- <input type="hidden" name="value" value="<%= item %>">
72
- <button type="submit" value="Disable" class="btn btn-outline-danger" data-toggle="tooltip" title="Disable <%= item %>" data-placement="left">
73
- Remove
74
- </button>
75
- </form>
70
+ <% unless Flipper::UI.configuration.read_only %>
71
+ <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post">
72
+ <%== csrf_input_tag %>
73
+ <input type="hidden" name="operation" value="disable">
74
+ <input type="hidden" name="value" value="<%= item %>">
75
+ <button type="submit" value="Disable" class="btn btn-outline-danger" data-toggle="tooltip" title="Disable <%= item %>" data-placement="left">
76
+ Remove
77
+ </button>
78
+ </form>
79
+ <% end %>
76
80
  </div>
77
81
  </div>
78
82
  </div>
@@ -92,29 +96,31 @@
92
96
  </strong>
93
97
  </h6>
94
98
  </div>
95
- <div class="col col-auto toggle-block-when-off">
96
- <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add a group</button>
97
- </div>
98
- <div class="col collapse toggle-block-when-on">
99
- <% if @feature.disabled_groups.empty? %>
100
- All groups enabled.
101
- <% else %>
102
- <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post" class="form-inline">
103
- <%== csrf_input_tag %>
104
- <input type="hidden" name="operation" value="enable">
105
- <select name="value" class="form-control form-control-sm mr-sm-2 mb-2 mb-sm-0">
106
- <option value="">Select a group...</option>
107
- <% @feature.disabled_groups.each do |group| %>
108
- <option value="<%= group.name %>"><%= group.name %></option>
109
- <% end %>
110
- </select>
111
- <input type="submit" value="Add Group" class="btn btn-sm btn-light btn">
112
- </form>
113
- <% end %>
114
- </div>
115
- <div class="col col-auto toggle-block-when-on">
116
- <button type="button" class="btn btn-outline-secondary js-toggle-trigger">Cancel</button>
117
- </div>
99
+ <% unless Flipper::UI.configuration.read_only %>
100
+ <div class="col col-auto toggle-block-when-off">
101
+ <button class="btn btn-outline-secondary js-toggle-trigger" data-toggle="collapse" data-target="#add-actor">Add a group</button>
102
+ </div>
103
+ <div class="col collapse toggle-block-when-on">
104
+ <% if @feature.disabled_groups.empty? %>
105
+ All groups enabled.
106
+ <% else %>
107
+ <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post" class="form-inline">
108
+ <%== csrf_input_tag %>
109
+ <input type="hidden" name="operation" value="enable">
110
+ <select name="value" class="form-control form-control-sm mr-sm-2 mb-2 mb-sm-0">
111
+ <option value="">Select a group...</option>
112
+ <% @feature.disabled_groups.each do |group| %>
113
+ <option value="<%= group.name %>"><%= group.name %></option>
114
+ <% end %>
115
+ </select>
116
+ <input type="submit" value="Add Group" class="btn btn-sm btn-light btn">
117
+ </form>
118
+ <% end %>
119
+ </div>
120
+ <div class="col col-auto toggle-block-when-on">
121
+ <button type="button" class="btn btn-outline-secondary js-toggle-trigger">Cancel</button>
122
+ </div>
123
+ <% end %>
118
124
  </div>
119
125
  </div>
120
126
 
@@ -126,14 +132,16 @@
126
132
  <h6 class="m-0"><%= item %></h6>
127
133
  </div>
128
134
  <div class="col col-auto">
129
- <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post">
130
- <%== csrf_input_tag %>
131
- <input type="hidden" name="operation" value="disable">
132
- <input type="hidden" name="value" value="<%= item %>">
133
- <button type="submit" value="Disable" class="btn btn-outline-danger" data-toggle="tooltip" title="Disable <%= item %>" data-placement="left">
134
- Remove
135
- </button>
136
- </form>
135
+ <% unless Flipper::UI.configuration.read_only %>
136
+ <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post">
137
+ <%== csrf_input_tag %>
138
+ <input type="hidden" name="operation" value="disable">
139
+ <input type="hidden" name="value" value="<%= item %>">
140
+ <button type="submit" value="Disable" class="btn btn-outline-danger" data-toggle="tooltip" title="Disable <%= item %>" data-placement="left">
141
+ Remove
142
+ </button>
143
+ </form>
144
+ <% end %>
137
145
  </div>
138
146
  </div>
139
147
  </div>
@@ -146,36 +154,40 @@
146
154
  <div class="col col-mr-auto">
147
155
  <h6 class="m-0"><strong class="<%= "text-muted" unless @feature.percentage_of_actors_value > 0 %>">Enabled for <%= @feature.percentage_of_actors_value %>% of actors</strong></h6>
148
156
  </div>
149
- <div class="col col-auto toggle-block-when-off">
150
- <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
151
- </div>
152
- <div class="col col-auto toggle-block-when-on">
153
- <button class="btn btn-outline-secondary js-toggle-trigger">Hide</button>
154
- </div>
157
+ <% unless Flipper::UI.configuration.read_only %>
158
+ <div class="col col-auto toggle-block-when-off">
159
+ <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
160
+ </div>
161
+ <div class="col col-auto toggle-block-when-on">
162
+ <button class="btn btn-outline-secondary js-toggle-trigger">Hide</button>
163
+ </div>
164
+ <% end %>
155
165
  </div>
156
166
  </div>
157
167
 
158
- <div class="card-body border-bottom toggle-block-when-on bg-lightest">
159
- <div class="row">
160
- <div class="col-12 col-md-6 mb-3 mb-md-0">
161
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
162
- <%== csrf_input_tag %>
163
- <div class="btn-group">
164
- <% @percentages.each do |number| %>
165
- <input type="submit" name="value" value="<%= number %>%" class="btn btn-light btn-sm" <% if number == @feature.percentage_of_actors_value %>disabled<% end %>>
166
- <% end %>
167
- </div>
168
- </form>
169
- </div>
170
- <div class="col-12 col-md-6">
171
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post" class="form-inline">
172
- <%== csrf_input_tag %>
173
- <input type="text" name="value" <% if @feature.percentage_of_actors_value > 0 %>value="<%= @feature.percentage_of_actors_value %>"<% end %> placeholder="custom (26, 32, etc.)" class="form-control form-control-sm mr-sm-2 mb-2 mb-md-0">
174
- <input type="submit" name="action" value="Save" class="btn btn-light btn-sm">
175
- </form>
168
+ <% unless Flipper::UI.configuration.read_only %>
169
+ <div class="card-body border-bottom toggle-block-when-on bg-lightest">
170
+ <div class="row">
171
+ <div class="col-12 col-md-6 mb-3 mb-md-0">
172
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
173
+ <%== csrf_input_tag %>
174
+ <div class="btn-group">
175
+ <% @percentages.each do |number| %>
176
+ <input type="submit" name="value" value="<%= number %>%" class="btn btn-light btn-sm" <% if number == @feature.percentage_of_actors_value %>disabled<% end %>>
177
+ <% end %>
178
+ </div>
179
+ </form>
180
+ </div>
181
+ <div class="col-12 col-md-6">
182
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post" class="form-inline">
183
+ <%== csrf_input_tag %>
184
+ <input type="text" name="value" <% if @feature.percentage_of_actors_value > 0 %>value="<%= @feature.percentage_of_actors_value %>"<% end %> placeholder="custom (26, 32, etc.)" class="form-control form-control-sm mr-sm-2 mb-2 mb-md-0">
185
+ <input type="submit" name="action" value="Save" class="btn btn-light btn-sm">
186
+ </form>
187
+ </div>
176
188
  </div>
177
189
  </div>
178
- </div>
190
+ <% end %>
179
191
  </div>
180
192
 
181
193
  <%# % of Time %>
@@ -185,36 +197,40 @@
185
197
  <div class="col col-mr-auto">
186
198
  <h6 class="m-0"><strong class="<%= "text-muted" unless @feature.percentage_of_time_value > 0 %>">Enabled for <%= @feature.percentage_of_time_value %>% of time</strong></h6>
187
199
  </div>
188
- <div class="col col-auto toggle-block-when-off">
189
- <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
190
- </div>
191
- <div class="col col-auto toggle-block-when-on">
192
- <button class="btn btn-outline-secondary js-toggle-trigger">Hide</button>
193
- </div>
200
+ <% unless Flipper::UI.configuration.read_only %>
201
+ <div class="col col-auto toggle-block-when-off">
202
+ <button class="btn btn-outline-secondary js-toggle-trigger">Edit</button>
203
+ </div>
204
+ <div class="col col-auto toggle-block-when-on">
205
+ <button class="btn btn-outline-secondary js-toggle-trigger">Hide</button>
206
+ </div>
207
+ <% end %>
194
208
  </div>
195
209
  </div>
196
210
 
197
- <div class="card-body border-bottom toggle-block-when-on bg-lightest">
198
- <div class="row">
199
- <div class="col-12 col-md-6 mb-3 mb-md-0">
200
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
201
- <%== csrf_input_tag %>
202
- <div class="btn-group">
203
- <% @percentages.each do |number| %>
204
- <input type="submit" name="value" value="<%= number %>%" class="btn btn-light btn-sm" <% if number == @feature.percentage_of_time_value %>disabled<% end %>>
205
- <% end %>
206
- </div>
207
- </form>
208
- </div>
209
- <div class="col-12 col-md-6">
210
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post" class="form-inline">
211
- <%== csrf_input_tag %>
212
- <input type="text" name="value" <% if @feature.percentage_of_time_value > 0 %>value="<%= @feature.percentage_of_time_value %>"<% end %> placeholder="custom (26, 32, etc.)" class="form-control form-control-sm mr-sm-2 mb-2 mb-md-0">
213
- <input type="submit" name="action" value="Save" class="btn btn-light btn-sm">
214
- </form>
211
+ <% unless Flipper::UI.configuration.read_only %>
212
+ <div class="card-body border-bottom toggle-block-when-on bg-lightest">
213
+ <div class="row">
214
+ <div class="col-12 col-md-6 mb-3 mb-md-0">
215
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
216
+ <%== csrf_input_tag %>
217
+ <div class="btn-group">
218
+ <% @percentages.each do |number| %>
219
+ <input type="submit" name="value" value="<%= number %>%" class="btn btn-light btn-sm" <% if number == @feature.percentage_of_time_value %>disabled<% end %>>
220
+ <% end %>
221
+ </div>
222
+ </form>
223
+ </div>
224
+ <div class="col-12 col-md-6">
225
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post" class="form-inline">
226
+ <%== csrf_input_tag %>
227
+ <input type="text" name="value" <% if @feature.percentage_of_time_value > 0 %>value="<%= @feature.percentage_of_time_value %>"<% end %> placeholder="custom (26, 32, etc.)" class="form-control form-control-sm mr-sm-2 mb-2 mb-md-0">
228
+ <input type="submit" name="action" value="Save" class="btn btn-light btn-sm">
229
+ </form>
230
+ </div>
215
231
  </div>
216
232
  </div>
217
- </div>
233
+ <% end %>
218
234
  </div>
219
235
  <% end %>
220
236
 
@@ -225,8 +241,14 @@
225
241
  <div class="row">
226
242
  <% unless @feature.boolean_value %>
227
243
  <div class="col">
228
- <button type="submit" name="action" value="Enable" <% if Flipper::UI.configuration.confirm_fully_enable %>id="enable_feature__button"<% end %> class="btn btn-outline-success btn-block">
229
- <span class="d-block" data-toggle="tooltip" title="Enable for everyone">
244
+ <button type="submit" name="action" value="Enable" <% if Flipper::UI.configuration.confirm_fully_enable %>id="enable_feature__button"<% end %> class="btn btn-outline-success btn-block" <% if Flipper::UI.configuration.read_only %>disabled<% end %>>
245
+ <span class="d-block" data-toggle="tooltip"
246
+ <% if Flipper::UI.configuration.read_only %>
247
+ title="Fully enable is not allowed in read only mode."
248
+ <% else %>
249
+ title="Enable for everyone"
250
+ <% end %>
251
+ >
230
252
  Fully Enable
231
253
  </span>
232
254
  </button>
@@ -235,8 +257,13 @@
235
257
 
236
258
  <% unless @feature.off? %>
237
259
  <div class="col">
238
- <button type="submit" name="action" value="Disable" class="btn btn-outline-danger btn-block">
239
- <span class="d-block" data-toggle="tooltip" title="Disable for everyone by clearing all percentages, groups and actors.">
260
+ <button type="submit" name="action" value="Disable" class="btn btn-outline-danger btn-block" <% if Flipper::UI.configuration.read_only %>disabled<% end %>>
261
+ <span class="d-block" data-toggle="tooltip"
262
+ <% if Flipper::UI.configuration.read_only %>
263
+ title="Disable is not allowed in read only mode.">
264
+ <% else %>
265
+ title="Disable for everyone by clearing all percentages, groups and actors.">
266
+ <% end %>
240
267
  Disable
241
268
  </span>
242
269
  </button>
@@ -249,7 +276,7 @@
249
276
  </div>
250
277
  </div>
251
278
 
252
- <% if Flipper::UI.configuration.feature_removal_enabled %>
279
+ <% if !Flipper::UI.configuration.read_only && Flipper::UI.configuration.feature_removal_enabled %>
253
280
  <div class="row">
254
281
  <div class="col">
255
282
  <div class="card border">
@@ -3,7 +3,7 @@
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>
6
- <%- if Flipper::UI.configuration.feature_creation_enabled -%>
6
+ <%- if !Flipper::UI.configuration.read_only && Flipper::UI.configuration.feature_creation_enabled -%>
7
7
  <p>
8
8
  <a class="btn btn-primary btn-sm" href="<%= script_name %>/features/new">Add Feature</a>
9
9
  </p>
@@ -11,7 +11,7 @@
11
11
  <% else %>
12
12
  <h4>Getting Started</h4>
13
13
  <p class="mb-1">You have not added any features to configure yet.</p>
14
- <%- if Flipper::UI.configuration.feature_creation_enabled -%>
14
+ <%- if !Flipper::UI.configuration.read_only && Flipper::UI.configuration.feature_creation_enabled -%>
15
15
  <p class="mt-2">
16
16
  <a class="btn btn-primary btn-sm" href="<%= script_name %>/features/new">Add Feature</a>
17
17
  </p>
@@ -26,7 +26,7 @@
26
26
  <% else %>
27
27
  <div class="card">
28
28
  <div class="card-header">
29
- <%- if Flipper::UI.configuration.feature_creation_enabled -%>
29
+ <%- if !Flipper::UI.configuration.read_only && Flipper::UI.configuration.feature_creation_enabled -%>
30
30
  <div class="float-right">
31
31
  <a class="btn btn-primary btn-sm" href="<%= script_name %>/features/new">Add Feature</a>
32
32
  </div>
@@ -0,0 +1,3 @@
1
+ <div class="alert alert-danger">
2
+ The UI is currently in read only mode. To change this, you'll need to set <code>Flipper::UI.configuration.read_only = false</code> wherever flipper is running from.
3
+ </div>
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.25.3'.freeze
2
+ VERSION = '0.25.4'.freeze
3
3
  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.25.3
4
+ version: 0.25.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-03 00:00:00.000000000 Z
11
+ date: 2022-11-07 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.25.3
59
+ version: 0.25.4
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.25.3
66
+ version: 0.25.4
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: erubi
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,7 @@ extra_rdoc_files: []
107
107
  files:
108
108
  - examples/ui/authorization.ru
109
109
  - examples/ui/basic.ru
110
+ - examples/ui/read_only.ru
110
111
  - flipper-ui.gemspec
111
112
  - lib/flipper-ui.rb
112
113
  - lib/flipper/ui.rb
@@ -141,6 +142,7 @@ files:
141
142
  - lib/flipper/ui/views/feature_removal_disabled.erb
142
143
  - lib/flipper/ui/views/features.erb
143
144
  - lib/flipper/ui/views/layout.erb
145
+ - lib/flipper/ui/views/read_only.erb
144
146
  - lib/flipper/version.rb
145
147
  - spec/flipper/ui/action_spec.rb
146
148
  - spec/flipper/ui/actions/actors_gate_spec.rb