diff --git a/lib/flipper/ui/configuration.rb b/lib/flipper/ui/configuration.rb index f3db15a19..d2476c093 100644 --- a/lib/flipper/ui/configuration.rb +++ b/lib/flipper/ui/configuration.rb @@ -49,6 +49,10 @@ class Configuration # Default is comma ",". attr_accessor :actors_separator + # Public: if you want to get a confirm pop up box while fully enabling a feature + # Default is false. + attr_accessor :confirm_fully_enable + VALID_BANNER_CLASS_VALUES = %w( danger dark @@ -74,6 +78,7 @@ def initialize @descriptions_source = DEFAULT_DESCRIPTIONS_SOURCE @show_feature_description_in_list = false @actors_separator = ',' + @confirm_fully_enable = false end def using_descriptions? diff --git a/lib/flipper/ui/public/js/application.js b/lib/flipper/ui/public/js/application.js index 874be8666..c62e5a5c1 100644 --- a/lib/flipper/ui/public/js/application.js +++ b/lib/flipper/ui/public/js/application.js @@ -4,6 +4,17 @@ $(function () { return $container.toggleClass("toggle-on"); }); + $("#enable_feature__button").on("click", function (e) { + const featureName = $("#feature_name").val(); + const promptMessage = prompt( + `Are you sure you want to fully enable this feature for everyone? Please enter the name of the feature to confirm it: ${featureName}` + ); + + if (promptMessage !== featureName) { + e.preventDefault(); + } + }); + $("#delete_feature__button").on("click", function (e) { const featureName = $("#feature_name").val(); const promptMessage = prompt( diff --git a/lib/flipper/ui/views/feature.erb b/lib/flipper/ui/views/feature.erb index e8d207371..e405fb0b8 100644 --- a/lib/flipper/ui/views/feature.erb +++ b/lib/flipper/ui/views/feature.erb @@ -224,13 +224,23 @@
<% unless @feature.boolean_value %> -
- -
+ <% if Flipper::UI.configuration.confirm_fully_enable %> +
+ +
+ <% else %> +
+ +
+ <% end %> <% end %> <% unless @feature.off? %>