This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
forked from etsy/opsweekly
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_oncall_survey.php
70 lines (63 loc) · 2.57 KB
/
generate_oncall_survey.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
// Handle a time period requested other than now
$time_requested = (isset($_GET['date'])) ? $_GET['date'] : "now";
include_once('phplib/base.php');
$my_username = getUsername();
$start_end = getOnCallWeekRange($time_requested);
$start_ts = $start_end[0];
$end_ts = $start_end[1];
// Get the alerts with timezone data so it matches the users expectations
$oncall_start_end = getOnCallWeekRangeWithTZ($time_requested);
$oncall_start_ts = $oncall_start_end[0];
$oncall_end_ts = $oncall_start_end[1];
?>
<form action="<?php echo $ROOT_URL; ?>/add_oncall_weekly.php" method="POST" class="form-horizontal">
<h3>Alerts received this week (<?php echo date("l jS F Y", $start_ts) . " - " . date("l jS F Y", $end_ts) ?>)</h3>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Date/Time</th><th>Host</th><th>Service</th><th>Output</th><th>State</th>
</tr>
</thead>
<tbody>
<?php echo printOnCallNotifications($my_username, $start_ts, $end_ts, $oncall_start_ts, $oncall_end_ts); ?>
</tbody>
</table>
<p><span class="label label-warning">Warning!</span> Please submit this section using the button below before saving or emailing your weekly report</p>
<button class="btn btn-primary" type="submit">Save On-Call Report</button>
</form>
<div id='bulk-change-navbar' class='navbar navbar-fixed-bottom' style='display: none'>
<div class="navbar-inner">
<form class="navbar-form pull-right">
<select id='bulk-edit' class='input-xlarge'>
<option>Bulk Change Tags</option>
<?php
foreach ($nagios_alert_tags as $tag => $tag_name) {
echo "<option value='{$tag}'{$selected}>{$tag_name}</option>";
}
?>
</select>
</div>
<script>
$('.bulk-check').change(function () {
if ( $(".bulk-check:checked").length > 0 ) {
$("#bulk-change-navbar").fadeIn('fast').effect("highlight");
$("#bulk-edit").effect("highlight", {}, 1000);
} else {
$("#bulk-change-navbar").fadeOut('fast');
}
});
$('#bulk-edit').change(function () {
$(".bulk-check:checked").each(function () {
field_num = ($(this).data("num"));
new_value = $('#bulk-edit').val();
$('select[name="oncall[notifications][not_' + field_num + '][tag]"]').val(new_value);
$(this).attr('checked', false);
});
$(this).val(0);
$("#bulk-change-navbar").fadeOut('fast');
});
</script>
</form>
</div>
</div>