Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW FEATURE: Alerts (Alpha) #297

Merged
merged 4 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions ALERTSview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<main>
<header class="page-header page-header-compact page-header-light border-bottom bg-white mb-4">
<div class="container-xl px-4">
<div class="page-header-content">
<div class="row align-items-center justify-content-between pt-3">
<div class="col-auto mb-3">
<h1 class="page-header-title">
<div class="page-header-icon"><i data-feather="user-plus"></i></div>
Alerts View
</h1>
</div>
</div>
</div>
</div>
</header>
<!-- Main page content-->
<div class="container-fluid px-4">
<div class="row">
<div class="col-12">
<div class="card border-start-lg border-start-info h-100">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>New Alerts</h3>
<h1 class="text-secondary" style="font-size:2rem;" id="NewAlerts"></h1>
</div>
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>In Progress Alerts</h3>
<h1 class="text-secondary" style="font-size:2rem;" id="InProgressAlerts"></h1>
</div>
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>High Severity Alerts</h3>
<h1 class="text-danger" style="font-size:2rem;" id="HighSeverityAlerts"></h1>
</div>
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>Medium Severity Alerts</h3>
<h1 class="text-warning" style="font-size:2rem;" id="MediumSeverityAlerts"></h1>
</div>
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>Low Severity Alerts</h3>
<h1 class="text-secondary" style="font-size:2rem;" id="LowSeverityAlerts"></h1>
</div>
<div class="col-2 ps-2 border-start border-primary border-5">
<h3>Informational Alerts</h3>
<h1 class="text-secondary" style="font-size:2rem;" id="InformationalSeverityAlerts"></h1>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<!-- Alerts Here -->
<div class="card border-start-lg border-start-info h-100">
<div class="card-body">
<div class="d-flex align-items-center">
<div class="flex-grow-1">
<div class="h2">Alerts</div>
</div>
<div class="ms-2"><i class="fas fa-key fa-2x text-gray-200"></i>
</div>
</div>
<div class="d-flex align-items-center">
<div class="flex-grow-1">
<table class="table table-responsive" id="Passwords">
<thead>
<tr>
<th>Tenant</th>
<th>Alert ID</th>
<th>Alert Title</th>
<th>Category</th>
<th>Event Date</th>
<th>Severity</th>
<th>Status</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="js/ALERTSList.js"></script>
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ <h6 class="dropdown-header d-flex align-items-center">
href="index.html?page=DomainAnalyserList">Domains Analyser</a>
<a class="nav-link" apilink="CheckDomain"
href="index.html?page=CheckDomain">Individual Domain Check</a>
<a class="nav-link" apilink="ALERTSview"
href="index.html?page=ALERTSview">Alerts List (Alpha)</a>
</nav>
</div>
</section>
Expand Down Expand Up @@ -586,4 +588,4 @@ <h4>New User</h4>
<script src="js/menu-loader.js"></script>
<script src="js/version-checker.js"></script>

</html>
</html>
43 changes: 43 additions & 0 deletions js/ALERTSList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
$(document).ready(function () {

//This function keeps trying to get the data until the variable 'waiting' disappears. It repeats every 5 seconds to a maximum of 300 seconds.


$.ajax({
'async': true,
'global': false,
'url': 'api/ExecAlertsList',
'dataType': "json",
'contentType': "application/json",
'success': function (GUID) {
//when succesfull, we get a GUID as a return. We use the GUID to get the actual data instead.
GetAPIData("api/ExecAlertsList", GUID.GUID).then((data) => {
console.log(data);
//here we process the actual data returned by the GetAPIData feature!
$('#loader').html(`<i class="fas fa-check-circle text-success fa-2x"></i>`)

if (data.MSResults != "") {
$("#NewAlerts").html(data.NewAlertsCount);
$("#InProgressAlerts").html(data.InProgressAlertsCount);
$("#HighSeverityAlerts").html(data.SeverityHighAlertsCount);
$("#MediumSeverityAlerts").html(data.SeverityMediumAlertsCount);
$("#LowSeverityAlerts").html(data.SeverityLowAlertsCount);
$("#InformationalSeverityAlerts").html(data.SeverityInformationalCount);

data.MSResults.forEach(function (item) {
if (item.Id !== null) {
$('#Passwords').append(`<tr><td>${item.Tenant}</td><td>${item.Id}</td><td>${item.Title}</td><td>${item.Category}</td><td>${item.EventDateTime}</td><td>${item.Severity}</td><td>${item.Status}</td></tr>`);
}

});
} else {
$('#Passwords').append(`<tr><td>Something went WRONG!</td><td></td><td></td></tr>`);

}
})
},
'error': function (xhr, ajaxOptions, thrownError) {
$("#loader").html('<i class="fas fa-times-circle text-danger fa-2x"></i>Error - could not retrieve information from API.')
}
});
})