diff --git a/lib/flipper/ui/configuration.rb b/lib/flipper/ui/configuration.rb index 6b8b81b2c..c6b1bd242 100644 --- a/lib/flipper/ui/configuration.rb +++ b/lib/flipper/ui/configuration.rb @@ -63,6 +63,10 @@ class Configuration # Default is false. attr_accessor :confirm_fully_enable + # Public: if you want to get a confirm pop up box while disabling a feature + # Default is false. + attr_accessor :confirm_disable + VALID_BANNER_CLASS_VALUES = %w( danger dark @@ -91,6 +95,7 @@ def initialize @show_feature_description_in_list = false @actors_separator = ',' @confirm_fully_enable = false + @confirm_disable = true @read_only = false end diff --git a/lib/flipper/ui/public/js/application.js b/lib/flipper/ui/public/js/application.js index e00d670db..a752e0349 100644 --- a/lib/flipper/ui/public/js/application.js +++ b/lib/flipper/ui/public/js/application.js @@ -14,13 +14,24 @@ $(function () { e.preventDefault(); } }); - + + $("#disable_feature__button").on("click", function (e) { + const featureName = $(e.target).data("confirmation-text"); + const promptMessage = prompt( + `Are you sure you want to disable 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 = $(e.target).data("confirmation-text"); const promptMessage = prompt( `Are you sure you want to remove this feature from the list of features and disable it for everyone? Please enter the name of the feature to confirm it: ${featureName}` ); - + if (promptMessage !== featureName) { e.preventDefault(); } diff --git a/lib/flipper/ui/views/feature.erb b/lib/flipper/ui/views/feature.erb index 4b7325732..37b5ee575 100644 --- a/lib/flipper/ui/views/feature.erb +++ b/lib/flipper/ui/views/feature.erb @@ -263,8 +263,13 @@ <% unless @feature.off? %>
-