-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from prometheus/refactor/show-alerts
Show alerts in UI; add no-op silence dialog; cleanups.
- Loading branch information
Showing
9 changed files
with
179 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2013 Prometheus Team | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package web | ||
|
||
import ( | ||
"html/template" | ||
"time" | ||
) | ||
|
||
func timeSince(t time.Time) string { | ||
return time.Now().Round(time.Second / 10).Sub(t.Round(time.Second / 10)).String() | ||
} | ||
|
||
var webHelpers = template.FuncMap{ | ||
"timeSince": timeSince, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
body { | ||
padding-top: 60px; | ||
} | ||
|
||
#create_silence_modal th { | ||
text-align: left; | ||
} | ||
|
||
.add_silence_form { | ||
display: inline; | ||
} | ||
|
||
.del_label_button { | ||
margin-bottom: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function clearSilenceLabels() { | ||
$("#silence_label_table").empty(); | ||
} | ||
|
||
function addSilenceLabel(label, value) { | ||
if (!label) { | ||
label = ""; | ||
} | ||
if (!value) { | ||
value = ""; | ||
} | ||
$("#silence_label_table").append( | ||
'<tr>' + | ||
' <td><input class="input-large" type="text" placeholder="label regex" value="' + label + '"></td>' + | ||
' <td><input class="input-large" type="text" placeholder="value regex" value="' + value + '"></td>' + | ||
' <td><button class="btn del_label_button"><i class="icon-minus"></i></button></td>' + | ||
'</tr>'); | ||
bindDelLabel(); | ||
} | ||
|
||
function bindDelLabel() { | ||
$(".del_label_button").unbind("click"); | ||
$(".del_label_button").click(function() { | ||
$(this).parents("tr").remove(); | ||
}); | ||
} | ||
|
||
function init() { | ||
$("#new_silence_btn").click(function() { | ||
clearSilenceLabels(); | ||
}); | ||
|
||
$(".add_silence_btn").click(function() { | ||
clearSilenceLabels(); | ||
|
||
var form = $(this).parents("form"); | ||
var labels = form.children('input[name="label[]"]'); | ||
var values = form.children('input[name="value[]"]'); | ||
for (var i = 0; i < labels.length; i++) { | ||
addSilenceLabel(labels.get(i).value, values.get(i).value); | ||
} | ||
}); | ||
|
||
$("#add_label_button").click(function() { | ||
addSilenceLabel("", ""); | ||
}); | ||
} | ||
|
||
$(init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters