mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
Added a restart button to domain server settings page
This commit is contained in:
parent
f160034bf0
commit
0c7f1cda0f
5 changed files with 51 additions and 39 deletions
|
@ -10,7 +10,6 @@
|
||||||
<link href="/css/sweetalert.css" rel="stylesheet" media="screen">
|
<link href="/css/sweetalert.css" rel="stylesheet" media="screen">
|
||||||
<link href="/css/bootstrap-switch.min.css" rel="stylesheet" media="screen">
|
<link href="/css/bootstrap-switch.min.css" rel="stylesheet" media="screen">
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-default" role="navigation">
|
<nav class="navbar navbar-default" role="navigation">
|
||||||
|
@ -38,8 +37,23 @@
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/content/">Content</a></li>
|
<li><a href="/content/">Content</a></li>
|
||||||
<li><a href="/settings/">Settings</a></li>
|
<li><a href="/settings/">Settings</a></li>
|
||||||
|
<li><a href="#" id="restart-server"><span class="glyphicon glyphicon-refresh"></span> Restart</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.container-fluid -->
|
</div><!-- /.container-fluid -->
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<div class="modal fade" id="restart-modal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">domain-server is restarting</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h5>This page will automatically refresh in <span id="refresh-time">3 seconds</span>.</h5>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
|
@ -1,3 +1,28 @@
|
||||||
|
function showRestartModal() {
|
||||||
|
$('#restart-modal').modal({
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var secondsElapsed = 0;
|
||||||
|
var numberOfSecondsToWait = 3;
|
||||||
|
|
||||||
|
var refreshSpan = $('span#refresh-time')
|
||||||
|
refreshSpan.html(numberOfSecondsToWait + " seconds");
|
||||||
|
|
||||||
|
// call ourselves every 1 second to countdown
|
||||||
|
var refreshCountdown = setInterval(function(){
|
||||||
|
secondsElapsed++;
|
||||||
|
secondsLeft = numberOfSecondsToWait - secondsElapsed
|
||||||
|
refreshSpan.html(secondsLeft + (secondsLeft == 1 ? " second" : " seconds"))
|
||||||
|
|
||||||
|
if (secondsElapsed == numberOfSecondsToWait) {
|
||||||
|
location.reload(true);
|
||||||
|
clearInterval(refreshCountdown);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var url = window.location;
|
var url = window.location;
|
||||||
// Will only work if string in href matches with location
|
// Will only work if string in href matches with location
|
||||||
|
@ -7,4 +32,10 @@ $(document).ready(function(){
|
||||||
$('ul.nav a').filter(function() {
|
$('ul.nav a').filter(function() {
|
||||||
return this.href == url;
|
return this.href == url;
|
||||||
}).parent().addClass('active');
|
}).parent().addClass('active');
|
||||||
|
|
||||||
|
$('body').on('click', '#restart-server', function(e){
|
||||||
|
$.get("/restart");
|
||||||
|
showRestartModal();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
});
|
});
|
|
@ -81,19 +81,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="restart-modal">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h4 class="modal-title">domain-server is restarting</h4>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<h5>This page will automatically refresh in <span id="refresh-time">3 seconds</span>.</h5>
|
|
||||||
</div>
|
|
||||||
</div><!-- /.modal-content -->
|
|
||||||
</div><!-- /.modal-dialog -->
|
|
||||||
</div><!-- /.modal -->
|
|
||||||
|
|
||||||
<!--#include virtual="footer.html"-->
|
<!--#include virtual="footer.html"-->
|
||||||
<script src='/js/underscore-min.js'></script>
|
<script src='/js/underscore-min.js'></script>
|
||||||
<script src='/js/underscore-keypath.min.js'></script>
|
<script src='/js/underscore-keypath.min.js'></script>
|
||||||
|
|
|
@ -1656,31 +1656,6 @@ function updateDataChangedForSiblingRows(row, forceTrue) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRestartModal() {
|
|
||||||
$('#restart-modal').modal({
|
|
||||||
backdrop: 'static',
|
|
||||||
keyboard: false
|
|
||||||
});
|
|
||||||
|
|
||||||
var secondsElapsed = 0;
|
|
||||||
var numberOfSecondsToWait = 3;
|
|
||||||
|
|
||||||
var refreshSpan = $('span#refresh-time')
|
|
||||||
refreshSpan.html(numberOfSecondsToWait + " seconds");
|
|
||||||
|
|
||||||
// call ourselves every 1 second to countdown
|
|
||||||
var refreshCountdown = setInterval(function(){
|
|
||||||
secondsElapsed++;
|
|
||||||
secondsLeft = numberOfSecondsToWait - secondsElapsed
|
|
||||||
refreshSpan.html(secondsLeft + (secondsLeft == 1 ? " second" : " seconds"))
|
|
||||||
|
|
||||||
if (secondsElapsed == numberOfSecondsToWait) {
|
|
||||||
location.reload(true);
|
|
||||||
clearInterval(refreshCountdown);
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanupFormValues(node) {
|
function cleanupFormValues(node) {
|
||||||
if (node.type && node.type === 'checkbox') {
|
if (node.type && node.type === 'checkbox') {
|
||||||
return { name: node.name, value: node.checked ? true : false };
|
return { name: node.name, value: node.checked ? true : false };
|
||||||
|
|
|
@ -1650,6 +1650,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
const QString URI_NODES = "/nodes";
|
const QString URI_NODES = "/nodes";
|
||||||
const QString URI_SETTINGS = "/settings";
|
const QString URI_SETTINGS = "/settings";
|
||||||
const QString URI_ENTITY_FILE_UPLOAD = "/content/upload";
|
const QString URI_ENTITY_FILE_UPLOAD = "/content/upload";
|
||||||
|
const QString URI_RESTART = "/restart";
|
||||||
|
|
||||||
const QString UUID_REGEX_STRING = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
const QString UUID_REGEX_STRING = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
||||||
|
|
||||||
|
@ -1804,6 +1805,10 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
// send the response
|
// send the response
|
||||||
connection->respond(HTTPConnection::StatusCode200, nodesDocument.toJson(), qPrintable(JSON_MIME_TYPE));
|
connection->respond(HTTPConnection::StatusCode200, nodesDocument.toJson(), qPrintable(JSON_MIME_TYPE));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else if (url.path() == URI_RESTART) {
|
||||||
|
connection->respond(HTTPConnection::StatusCode200);
|
||||||
|
restart();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// check if this is for json stats for a node
|
// check if this is for json stats for a node
|
||||||
|
|
Loading…
Reference in a new issue