From de879ef9b10adb1cb2bf709b062f8c14ce0b307d Mon Sep 17 00:00:00 2001 From: Dhruv Sharma Date: Fri, 9 Sep 2022 14:51:59 +0530 Subject: [PATCH 1/5] Pop up protection for confirming fully enable feature --- lib/flipper/ui/public/js/application.js | 11 +++++++++++ lib/flipper/ui/views/feature.erb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/flipper/ui/public/js/application.js b/lib/flipper/ui/public/js/application.js index 874be8666..3e2bbabe7 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"); }); + $("#confirm-warn-enable").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..2fbdcb579 100644 --- a/lib/flipper/ui/views/feature.erb +++ b/lib/flipper/ui/views/feature.erb @@ -225,7 +225,7 @@
<% unless @feature.boolean_value %>
- -
+ <% if Flipper::UI.configuration.confirm_fully_enable %> +
+ +
+ <% else %> +
+ +
+ <% end %> <% end %> <% unless @feature.off? %> From 8d13c7c7d4739b7d629f611e276d7759fdd972da Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Wed, 28 Sep 2022 10:37:52 -0400 Subject: [PATCH 4/5] Update lib/flipper/ui/configuration.rb --- lib/flipper/ui/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flipper/ui/configuration.rb b/lib/flipper/ui/configuration.rb index e09d12754..d2476c093 100644 --- a/lib/flipper/ui/configuration.rb +++ b/lib/flipper/ui/configuration.rb @@ -50,7 +50,7 @@ class Configuration attr_accessor :actors_separator # Public: if you want to get a confirm pop up box while fully enabling a feature - # Default is False + # Default is false. attr_accessor :confirm_fully_enable VALID_BANNER_CLASS_VALUES = %w( From 1a75cd6b79522bd2aa7e6ad916cc640dc418a1e6 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Wed, 28 Sep 2022 10:38:27 -0400 Subject: [PATCH 5/5] Update lib/flipper/ui/public/js/application.js --- lib/flipper/ui/public/js/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flipper/ui/public/js/application.js b/lib/flipper/ui/public/js/application.js index 34440a5b0..c62e5a5c1 100644 --- a/lib/flipper/ui/public/js/application.js +++ b/lib/flipper/ui/public/js/application.js @@ -7,7 +7,7 @@ $(function () { $("#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}` + `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) {