Skip to content

Commit d9819bc

Browse files
mkuratczykmichaelklishin
authored andcommitted
Prevent accidentally enabling experimental FFs
1 parent b105ca9 commit d9819bc

File tree

1 file changed

+75
-1
lines changed

1 file changed

+75
-1
lines changed

deps/rabbitmq_management/priv/www/js/tmpl/feature-flags.ejs

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</p>
1414
<% } %>
1515
<div class="section">
16-
<h2>All Feature Flags</h2>
16+
<h2>Feature Flags</h2>
1717
<div class="hider">
1818
<%= filter_ui(feature_flags) %>
1919
<div class="updatable">
@@ -30,6 +30,9 @@
3030
<%
3131
for (var i = 0; i < feature_flags.length; i++) {
3232
var feature_flag = feature_flags[i];
33+
if (feature_flag.stability == "experimental") {
34+
continue;
35+
}
3336
var state_color = "grey";
3437
if (feature_flag.state == "enabled") {
3538
state_color = "green";
@@ -76,3 +79,74 @@
7679
</div>
7780
</div>
7881
</div>
82+
83+
84+
85+
<div class="section">
86+
<h2>Experimental Feature Flags</h2>
87+
<div class="hider">
88+
<% if (feature_flags.length > 0) { %>
89+
<p class="warning">
90+
Feature flags listed below are experimental. They should not be enabled in a produciton deployment.
91+
</p>
92+
<table class="list">
93+
<thead>
94+
<tr>
95+
<th><%= fmt_sort('Name', 'name') %></th>
96+
<th class="c"><%= fmt_sort('State', 'state') %></th>
97+
<th>Description</th>
98+
</tr>
99+
</thead>
100+
<tbody>
101+
<%
102+
for (var i = 0; i < feature_flags.length; i++) {
103+
var feature_flag = feature_flags[i];
104+
if (feature_flag.stability != "experimental") {
105+
continue;
106+
}
107+
var state_color = "grey";
108+
if (feature_flag.state == "enabled") {
109+
state_color = "green";
110+
} else if (feature_flag.state == "disabled") {
111+
state_color = "yellow";
112+
} else if (feature_flag.state == "unsupported") {
113+
state_color = "red";
114+
}
115+
%>
116+
<tr<%= alt_rows(i)%>>
117+
<td><%= fmt_string(feature_flag.name) %></td>
118+
<td class="c">
119+
<% if (feature_flag.state == "disabled") { %>
120+
<div>
121+
<input id="<%= feature_flag.name %>" type="checkbox" class="riskCheckbox" onclick="this.parentNode.querySelector('.enable-feature-flag input[type=submit]').disabled = !this.checked;">
122+
<label for="<%= feature_flag.name %>"> I understand the risk</label><br>
123+
<br>
124+
<form action="#/feature-flags-enable" method="put" style="display: inline-block" class="enable-feature-flag">
125+
<input type="hidden" name="name" value="<%= fmt_string(feature_flag.name) %>"/>
126+
<input type="submit" value="Enable" class="c" disabled="disabled"/>
127+
</div>
128+
</form>
129+
<% } else { %>
130+
<abbr class="status-<%= fmt_string(state_color) %>"
131+
style="text-transform: capitalize"
132+
title="Feature flag state: <%= fmt_string(feature_flag.state) %>">
133+
<%= fmt_string(feature_flag.state) %>
134+
</abbr>
135+
<% } %>
136+
</td>
137+
<td>
138+
<p><%= fmt_string(feature_flag.desc) %></p>
139+
<% if (feature_flag.doc_url) { %>
140+
<p><a href="<%= fmt_string(feature_flag.doc_url) %>">[Learn more]</a></p>
141+
<% } %>
142+
</td>
143+
</tr>
144+
<% } %>
145+
</tbody>
146+
</table>
147+
<% } else { %>
148+
<p>... no feature_flags ...</p>
149+
<% } %>
150+
</div>
151+
</div>
152+
</div>

0 commit comments

Comments
 (0)