Skip to content
This repository was archived by the owner on Jul 22, 2020. It is now read-only.

Commit e333965

Browse files
authored
Merge pull request #105 from cloudflare/rename-status
Rename @status to @State
2 parents 62fea80 + 8a77d62 commit e333965

File tree

18 files changed

+115
-115
lines changed

18 files changed

+115
-115
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ run: $(NAME)
5252
COLOR_LABELS_UNIQUE="instance cluster" \
5353
COLOR_LABELS_STATIC="job" \
5454
DEBUG="$(GIN_DEBUG)" \
55-
FILTER_DEFAULT="@status=active" \
55+
FILTER_DEFAULT="@state=active" \
5656
PORT=$(PORT) \
5757
./$(NAME)
5858

assets/static/autocomplete.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ var Autocomplete = (function() {
3030
// this is used to generate quick filters for label modal
3131
var generateHints = function(label_key, label_val) {
3232
var hints = [];
33-
if (label_key == "@status") {
33+
if (label_key == "@state") {
3434
// static list of hints for @silenced label
35-
hints.push("@status=active");
36-
hints.push("@status=suppressed");
37-
hints.push("@status=unprocessed");
38-
hints.push("@status!=active");
39-
hints.push("@status!=suppressed");
40-
hints.push("@status!=unprocessed");
35+
hints.push("@state=active");
36+
hints.push("@state=suppressed");
37+
hints.push("@state=unprocessed");
38+
hints.push("@state!=active");
39+
hints.push("@state!=suppressed");
40+
hints.push("@state!=unprocessed");
4141
} else {
4242
// equal and non-equal hints for everything else
4343
hints.push(label_key + "=" + label_val);

assets/static/colors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var Colors = (function() {
55
staticColorLabels;
66

77
var specialLabels = {
8-
"@status: unprocessed": "label-default",
9-
"@status: active": "label-danger",
10-
"@status: suppressed": "label-success",
8+
"@state: unprocessed": "label-default",
9+
"@state: active": "label-danger",
10+
"@state: suppressed": "label-success",
1111
};
1212

1313
var update = function(colorData) {

assets/templates/alertgroup.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
<script type="application/json" id="alert-group-elements">
5252
<% var cls_indicator = 'incident-indicator-danger' %>
53-
<% if (alert.status === "suppressed") { cls_indicator = 'incident-indicator-success' } %>
53+
<% if (alert.state === "suppressed") { cls_indicator = 'incident-indicator-success' } %>
5454
<div>
5555
<% if (alert.generatorURL) { %>
5656
<a class="label label-list label-default"
@@ -74,8 +74,8 @@
7474
<%- text %>
7575
</a>
7676
<% }) %>
77-
<% var attrs = Alerts.GetLabelAttrs("@status", alert.status) %>
78-
<%= Templates.Render('buttonLabel', {elem: 'span', attrs: attrs, label: {key: '@status', value: alert.status, text: '@status: ' + alert.status}}) %>
77+
<% var attrs = Alerts.GetLabelAttrs("@state", alert.state) %>
78+
<%= Templates.Render('buttonLabel', {elem: 'span', attrs: attrs, label: {key: '@state', value: alert.state, text: '@state: ' + alert.state}}) %>
7979
<% if (alert.silencedBy.length == 0) { %>
8080
<% var labels = [] %>
8181
<% _.each(Alerts.SortMapByKey(alert.labels), function(label) { %>
@@ -197,9 +197,9 @@
197197
<script type="application/json" id="alert-group">
198198
<div class="incident" id="<%= group.id %>" data-hash="<%= group.hash %>">
199199
<% var cls_panel = 'panel-default' %>
200-
<% if (group.statusCount.active > 0) { %>
200+
<% if (group.stateCount.active > 0) { %>
201201
<% cls_panel = 'panel-danger' %>
202-
<% } else if (group.statusCount.suppressed > 0) { %>
202+
<% } else if (group.stateCount.suppressed > 0) { %>
203203
<% cls_panel = 'panel-success' %>
204204
<% } %>
205205
<div class="panel <%= cls_panel %>">
@@ -218,9 +218,9 @@
218218
<% labelMap[text].hits++ %>
219219
<% } %>
220220
<% }) %>
221-
<% var statusText = '@status: ' + alert.status %>
222-
<% if (labelMap[statusText] == undefined) { labelMap[statusText] = {key: '@status', value: alert.status, hits: 0} } %>
223-
<% labelMap[statusText].hits++ %>
221+
<% var stateText = '@state: ' + alert.state %>
222+
<% if (labelMap[stateText] == undefined) { labelMap[stateText] = {key: '@state', value: alert.state, hits: 0} } %>
223+
<% labelMap[stateText].hits++ %>
224224
<% } else { %>
225225
<% var cls_body = '' %>
226226
<% if (i < group.alerts.length - 1) { cls_body = 'incident-group-separator' } %>

assets/templates/help.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,23 @@ <h1>
130130
</thead>
131131
<tbody>
132132
<tr>
133-
<td id="help-status">
134-
<code>@status=(active suppresed unprocessed)</code>
133+
<td id="help-state">
134+
<code>@state=(active suppresed unprocessed)</code>
135135
</td>
136136
<td>
137-
<p>Match alerts based on the status.</p>
137+
<p>Match alerts based on the state.</p>
138138
<table class="table examples">
139139
<tbody>
140140
<tr>
141-
<td><span class="label label-info">@status=active</span></td>
141+
<td><span class="label label-info">@state=active</span></td>
142142
<td>Match only active alerts.</td>
143143
</tr>
144144
<tr>
145-
<td><span class="label label-info">@status=suppressed</span></td>
145+
<td><span class="label label-info">@state=suppressed</span></td>
146146
<td>Match only suppressed alerts.</td>
147147
</tr>
148148
<tr>
149-
<td><span class="label label-info">@status=unprocessed</span></td>
149+
<td><span class="label label-info">@state=unprocessed</span></td>
150150
<td>Match only unprocessed alerts.</td>
151151
</tr>
152152
</tbody>
@@ -163,15 +163,15 @@ <h1>
163163
<tbody>
164164
<tr>
165165
<td><span class="label label-info">@silence_author=me@domain1.com</span></td>
166-
<td>Match alerts status by <em>me@domain1.com</em>.</td>
166+
<td>Match alerts silenced by <em>me@domain1.com</em>.</td>
167167
</tr>
168168
<tr>
169169
<td><span class="label label-info">@silence_author!=me@domain1.com</span></td>
170-
<td>Match alerts not status by <em>me@domain1.com</em>.</td>
170+
<td>Match alerts not silenced by <em>me@domain1.com</em>.</td>
171171
</tr>
172172
<tr>
173173
<td><span class="label label-info">@silence_author=~@domain2.com</span></td>
174-
<td>Match alerts status by username that match regular expression <code>/.*@domain2.com.*/</code>.</td>
174+
<td>Match alerts silenced by username that match regular expression <code>/.*@domain2.com.*/</code>.</td>
175175
</tr>
176176
</tbody>
177177
</table>
@@ -187,15 +187,15 @@ <h1>
187187
<tbody>
188188
<tr>
189189
<td><span class="label label-info">@silence_jira=PROJECT-123</span></td>
190-
<td>Match status alerts where detected JIRA issue id is equal to <em>PROJECT-123</em>.</td>
190+
<td>Match silenced alerts where detected JIRA issue id is equal to <em>PROJECT-123</em>.</td>
191191
</tr>
192192
<tr>
193193
<td><span class="label label-info">@silence_jira!=PROJECT-123</span></td>
194-
<td>Match status alerts where there was no JIRA issue id detected or it was not equal to <em>PROJECT-123</em>.</td>
194+
<td>Match silenced alerts where there was no JIRA issue id detected or it was not equal to <em>PROJECT-123</em>.</td>
195195
</tr>
196196
<tr>
197197
<td><span class="label label-info">@silence_jira=~PROJECT</span></td>
198-
<td>Match status alerts where dectected JIRA issue id matches regular expression <code>/.*PROJECT.*/</code>.</td>
198+
<td>Match silenced alerts where dectected JIRA issue id matches regular expression <code>/.*PROJECT.*/</code>.</td>
199199
</tr>
200200
</tbody>
201201
</table>

bindata_assetfs.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

filters/filter_status.go renamed to filters/filter_state.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"github.com/cloudflare/unsee/models"
88
)
99

10-
type statusFilter struct {
10+
type stateFilter struct {
1111
alertFilter
1212
}
1313

14-
func (filter *statusFilter) init(name string, matcher *matcherT, rawText string, isValid bool, value string) {
14+
func (filter *stateFilter) init(name string, matcher *matcherT, rawText string, isValid bool, value string) {
1515
filter.Matched = name
1616
if matcher != nil {
1717
filter.Matcher = *matcher
@@ -24,9 +24,9 @@ func (filter *statusFilter) init(name string, matcher *matcherT, rawText string,
2424
}
2525
}
2626

27-
func (filter *statusFilter) Match(alert *models.Alert, matches int) bool {
27+
func (filter *stateFilter) Match(alert *models.Alert, matches int) bool {
2828
if filter.IsValid {
29-
isMatch := filter.Matcher.Compare(alert.Status, filter.Value)
29+
isMatch := filter.Matcher.Compare(alert.State, filter.Value)
3030
if isMatch {
3131
filter.Hits++
3232
}
@@ -36,17 +36,17 @@ func (filter *statusFilter) Match(alert *models.Alert, matches int) bool {
3636
panic(e)
3737
}
3838

39-
func newstatusFilter() FilterT {
40-
f := statusFilter{}
39+
func newstateFilter() FilterT {
40+
f := stateFilter{}
4141
return &f
4242
}
4343

44-
func statusAutocomplete(name string, operators []string, alerts []models.Alert) []models.Autocomplete {
44+
func stateAutocomplete(name string, operators []string, alerts []models.Alert) []models.Autocomplete {
4545
tokens := []models.Autocomplete{}
4646
for _, operator := range operators {
4747
for _, alert := range alerts {
4848
tokens = append(tokens, makeAC(
49-
name+operator+alert.Status,
49+
name+operator+alert.State,
5050
[]string{
5151
name,
5252
strings.TrimPrefix(name, "@"),

0 commit comments

Comments
 (0)