feat: adds status page link
All checks were successful
ci / build_and_publish (push) Successful in 27s
All checks were successful
ci / build_and_publish (push) Successful in 27s
This commit is contained in:
parent
9707e9d29e
commit
30bf637d5f
3 changed files with 65 additions and 3 deletions
|
|
@ -51,6 +51,7 @@ NCAGE: U2G06'''
|
|||
[languages.en.params.footer.col2]
|
||||
items = [
|
||||
{title = 'Information'},
|
||||
{text = 'Service Status', href='https://status.sr2.uk/', status=true},
|
||||
{text = 'Customer Support', href = '/support'},
|
||||
{text = 'Reporting Abuse', href = '/abuse'},
|
||||
{text = 'Visiting Us', href = '/visiting'},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
{{ if eq .Name "Contact" }}
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script
|
||||
id="zammad_form_script"
|
||||
src="https://help.sr2.uk/assets/form/form.js"></script>
|
||||
|
|
@ -13,5 +13,66 @@
|
|||
noCSS: true,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
{{ end }}
|
||||
<script>
|
||||
$(function () {
|
||||
var cStateAPIRoot = 'https://status.sr2.uk/index.json'
|
||||
var cStateDotTargetElement = document.querySelector('.status-indicator');
|
||||
|
||||
// Only change this if you are hacking around! :)
|
||||
var cStateEmbedPrefix = '[cState HTML Embed v2.0] ';
|
||||
var cStateEmbedDebugging = false;
|
||||
var cStateAPIStatus = 'tryingToGetStatus';
|
||||
|
||||
fetch(cStateAPIRoot)
|
||||
.then(
|
||||
function(response) {
|
||||
if (response.status !== 200) {
|
||||
console.log(cStateEmbedPrefix + 'API not OK, it sent HTTP status code ' +
|
||||
response.status);
|
||||
return;
|
||||
}
|
||||
|
||||
// Examine the text in the response
|
||||
response.json().then(function(data) {
|
||||
cStateAPIStatus = data.summaryStatus;
|
||||
|
||||
// When debugging, this code should be run to see API response
|
||||
if (cStateEmbedDebugging) {
|
||||
console.log(cStateEmbedPrefix + 'API response: ', data);
|
||||
console.log(cStateEmbedPrefix + 'API says status page is: ' + cStateAPIStatus);
|
||||
}
|
||||
|
||||
// UI code (run even if not debugging)
|
||||
// You can change how the dot appears here
|
||||
cStateDotTargetElement.style.display = 'inline-block';
|
||||
cStateDotTargetElement.style.height = '10px';
|
||||
cStateDotTargetElement.style.width = '10px';
|
||||
cStateDotTargetElement.style.borderRadius = '50%';
|
||||
cStateDotTargetElement.setAttribute('aria-label', 'Status indicator');
|
||||
cStateDotTargetElement.style.backgroundColor = '#333';
|
||||
// Sets color and accessible label
|
||||
if (cStateAPIStatus === 'ok') {
|
||||
cStateDotTargetElement.style.backgroundColor = '#4caf50';
|
||||
cStateDotTargetElement.setAttribute('aria-label', 'Green icon indicating no issues');
|
||||
} else if (cStateAPIStatus === 'notice') {
|
||||
cStateDotTargetElement.style.backgroundColor = '#607d8b';
|
||||
cStateDotTargetElement.setAttribute('aria-label', 'Gray icon asking users to check status page');
|
||||
} else if (cStateAPIStatus === 'disrupted') {
|
||||
cStateDotTargetElement.style.backgroundColor = '#ff9800';
|
||||
cStateDotTargetElement.setAttribute('aria-label', 'Orange icon indicating disruptions');
|
||||
} else { // down
|
||||
cStateDotTargetElement.style.backgroundColor = '#82071e';
|
||||
cStateDotTargetElement.setAttribute('aria-label', 'Red icon indicating downtime');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
)
|
||||
.catch(function(err) {
|
||||
console.log('Fetch error :-S', err);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 1c9895212ec3829b7c94f8042c9d0ba060d93d81
|
||||
Subproject commit 2552bc1e9cf8c99980b83f954606b9aa12a178ff
|
||||
Loading…
Add table
Add a link
Reference in a new issue