Skip to content
Snippets Groups Projects
Commit 667dbdb5 authored by Tomasz Wolniewicz's avatar Tomasz Wolniewicz
Browse files

The new issues page

(cherry picked from commit 3fa588b4)
parent e84df4c1
No related branches found
No related tags found
1 merge request!25The new issues page
......@@ -44,9 +44,12 @@ define('BACK_TIME_ENTITIES', '14 days');
// the log level use 3 or less for normal production
define('LOG_LEVEL',5);
// number of seconds to the expire time that causes the warning icon being shown
define('VALIDITY_WARNING_THRESHOLD', 388800);
define('VALIDITY_WARNING_THRESHOLD', 388800); // 108h - 4.5days
// number of seconds to the expire time that causes the alert icon being shown
define('VALIDITY_ALERT_THRESHOLD', 10800);
define('VALIDITY_ALERT_THRESHOLD', 10800); // 3h
// number of seconds to the expire that the federation will be shown in red
define('ISSUES_ALERT_THRESHOLD', 129600); // 36h
// The settings below can probably stay as they are
//
......@@ -68,6 +71,7 @@ define('WHATS_NEW_URL', ROOT_URL.'/whatsnew');
define('SYSTEM_UPDATES', 'https://wiki.geant.org/display/eduGAIN/eduGAIN+Services+Status');
define('V2_AUDIT', ROOT_URL.'/compliance_audit');
define('LINK_TESTS', ROOT_URL.'/link_tests');
define('ISSUES_URL', ROOT_URL.'/issues');
// contacts
define('EDUGAIN_EMAIL', 'edugain@geant.org');
......
<?php
require_once(eduGAIN_config . 'database_ro.php');
function formatSec($inSeconds) {
$inSec = abs($inSeconds);
$inMin = floor($inSec / 60);
$sec = $inSec - 60 * $inMin;
$inHours = floor ($inMin / 60);
$min = $inMin - 60 * $inHours;
$days = floor ($inHours / 24);
$hours = $inHours - 24 * $days;
return $days."d ".$hours."h ".$min."min ".$sec."s";
}
function prepareFederationFields($federation) {
$out = [
'fed' => $federation['code'],
'name' => $federation['name'],
'countries' => $federation['countries'],
'color' => $federation['valid_sec'] < ISSUES_ALERT_THRESHOLD ? "red" : "#F1893B",
'creationinstant' => [
'value' => $federation['creationinstant'],
'display_title' => 'Metadata creation time',
],
'valid_until' => [
'value' => $federation['valid_until'],
'display_title' => 'Metadata valid until',
],
'feed_pull_time' => [
'value' => $federation['feed_pull_time'],
'display_title' => 'Last metadata pull',
],
'last_validation' => [
'value' => $federation['last_validation'],
'display_title' => 'Last successful validation',
],
'feed_problem_desc' => [
'value' => $federation['feed_problem_desc'] ?? $federation['feed_problem_desc'] ?? "The feed is close to expiry",
'display_title' => 'Issue',
],
'still_valid' => [
'value' => formatSec($federation['valid_sec']),
],
'valid_timestamp' => [
'value' => $federation['valid_timestamp']
],
'contact_email' => [
'value' => $federation['contact_email'],
'display_title' => 'Federation contact',
],
'valid_sec' => [
'value' => $federation['valid_sec'],
],
];
return($out);
}
$edugain = new eduGAIN(5);
$edugain->load_federations_state();
$edugain->load_federation_map_codes();
$edugain->load_federation_country_names();
$out = [];
$tmp = [];
$times = [];
$now = time();
foreach ($edugain->FEDS as $fed) {
if ($fed['valid_sec'] < VALIDITY_WARNING_THRESHOLD || $fed['feed_problem'] > 0 ) {
$fields = prepareFederationFields($fed);
$tmp[$fed['code']] = $fields;
$times[$fed['code']] = $fields['valid_timestamp'];
}
}
asort($times);
foreach ($times as $fed => $tm) {
$out[$fed] = $tmp[$fed];
}
$data['feds'] = $out;
echo $twig->render('issues.html', $data);
\ No newline at end of file
{% extends 'common/master.html' %}
{% import 'status/status-members-field-macros.html' as display %}
{% set breadcrumb = ['Members', 'Current issues'] %}
{% block title %}Federation issues{% endblock title %}
{% block main_body %}
<div class="central-section">
This page shows federations with potential issues. The list is ordered putting federations closest to expiry on top.<br/>
{% if feds|length > 0 %}
<strong>All times are in UTC.</strong>.
<p>
<table id="issues">
{% for federation in feds %}
<tr>
<td colspan="2" class="issues-title" style="background-color: {{ federation.color }}">{{ federation.name }} {% if federation.countries is defined %} ({{federation.countries|join(', ')}}){% endif %}
{% if federation.valid_sec.value < 0 %}
- expired {{ federation.still_valid.value }} ago
{% else %}
- still valid {{ federation.still_valid.value }}
{% endif %}</td>
</tr>
<tr>
<th>{{ federation.feed_problem_desc.display_title }}</th><!-- comment -->
<td>{{ federation.feed_problem_desc.value }}</td><!-- comment -->
</tr>
<tr>
<th>{{ federation.creationinstant.display_title }}</th><!-- comment -->
<td>{{ federation.creationinstant.value | date("Y-m-d H:i:s") }}</td><!-- comment -->
</tr>
<tr>
<th>{{ federation.valid_until.display_title }}</th><!-- comment -->
<td>{{ federation.valid_until.value | date("Y-m-d H:i:s") }}</td><!-- comment -->
</tr>
<tr>
<th>{{ federation.feed_pull_time.display_title }}</th><!-- comment -->
<td>{{ federation.feed_pull_time.value | date("Y-m-d H:i:s") }}</td><!-- comment -->
</tr>
<tr>
<th>{{ federation.last_validation.display_title }}</th><!-- comment -->
<td>{{ federation.last_validation.value | date("Y-m-d H:i:s") }}</td><!-- comment -->
</tr>
<tr>
<th>{{ federation.contact_email.display_title }}</th><!-- comment -->
<td><a href="mailto:{{ federation.contact_email.value }}">{{ federation.contact_email.value }}</a></td><!-- comment -->
</tr>
{% endfor %}
</table>
{% else %}
<h1>Currently there are no issues</h1><!-- comment -->
{% endif %}
</div>
{% endblock main_body %}
......@@ -400,3 +400,24 @@ div.api-help dt {
top: 50%;
display: none;
}
#issues {
font-size: 14px;
}
#issues td.issues-title {
font-size: 1.2em;
background-color: #F1893B;
color: #FFF;
padding-left: 0.5em;
padding-right: 1em;
}
#issues td {
}
#issues th {
text-align: left;
padding-left: 2em;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment