add restart logic
This commit is contained in:
parent
709e065ed4
commit
cc4bf88335
18
data/www/js/sysinfo.js
Normal file
18
data/www/js/sysinfo.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
jQuery(document).ready(function ($) {
|
||||||
|
$(document).on('click', '.sysinfo-restart', function () {
|
||||||
|
if (confirm(l.js_sysinfo_restart_confirmation)) {
|
||||||
|
$('body').html(l.js_sysinfo_restart_loading).css({margin:200});
|
||||||
|
$.ajax({
|
||||||
|
url: '/sysinfo/restart',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
data: '',
|
||||||
|
method: 'POST',
|
||||||
|
}).catch(function () {
|
||||||
|
setTimeout(function() {
|
||||||
|
document.location.reload();
|
||||||
|
}, 3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -63,8 +63,11 @@
|
|||||||
"settings_variable_help_fleet_enabled": "Enable fleet screen management view (restart needed)",
|
"settings_variable_help_fleet_enabled": "Enable fleet screen management view (restart needed)",
|
||||||
|
|
||||||
"sysinfo_page_title": "System infos",
|
"sysinfo_page_title": "System infos",
|
||||||
|
"sysinfo_panel_button_restart": "Restart",
|
||||||
"sysinfo_panel_title": "Infos",
|
"sysinfo_panel_title": "Infos",
|
||||||
"sysinfo_panel_th_attribute": "Attribute",
|
"sysinfo_panel_th_attribute": "Attribute",
|
||||||
"sysinfo_panel_th_value": "Value",
|
"sysinfo_panel_th_value": "Value",
|
||||||
"sysinfo_panel_td_ipaddr": "IP Address"
|
"sysinfo_panel_td_ipaddr": "IP Address",
|
||||||
|
"js_sysinfo_restart_confirmation": "Are you sure?",
|
||||||
|
"js_sysinfo_restart_loading": "Restarting, please wait..."
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,8 +63,11 @@
|
|||||||
"settings_variable_help_fleet_enabled": "Activer la gestion de flotte des écrans (redémarrage nécessaire)",
|
"settings_variable_help_fleet_enabled": "Activer la gestion de flotte des écrans (redémarrage nécessaire)",
|
||||||
|
|
||||||
"sysinfo_page_title": "Système",
|
"sysinfo_page_title": "Système",
|
||||||
|
"sysinfo_panel_button_restart": "Redémarrer",
|
||||||
"sysinfo_panel_title": "Informations",
|
"sysinfo_panel_title": "Informations",
|
||||||
"sysinfo_panel_th_attribute": "Attribut",
|
"sysinfo_panel_th_attribute": "Attribut",
|
||||||
"sysinfo_panel_th_value": "Valeur",
|
"sysinfo_panel_th_value": "Valeur",
|
||||||
"sysinfo_panel_td_ipaddr": "Adresse IP"
|
"sysinfo_panel_td_ipaddr": "Adresse IP",
|
||||||
|
"js_sysinfo_restart_confirmation": "Êtes-vous sûr ?",
|
||||||
|
"js_sysinfo_restart_loading": "Redémarrage en cours, veuillez patienter..."
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
from flask import Flask, render_template
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from flask import Flask, render_template, jsonify
|
||||||
from src.utils import get_ip_address
|
from src.utils import get_ip_address
|
||||||
|
|
||||||
|
|
||||||
@ -11,6 +14,7 @@ class SysinfoController:
|
|||||||
|
|
||||||
def register(self):
|
def register(self):
|
||||||
self._app.add_url_rule('/sysinfo', 'sysinfo_attribute_list', self.sysinfo, methods=['GET'])
|
self._app.add_url_rule('/sysinfo', 'sysinfo_attribute_list', self.sysinfo, methods=['GET'])
|
||||||
|
self._app.add_url_rule('/sysinfo/restart', 'sysinfo_restart', self.sysinfo_restart, methods=['POST'])
|
||||||
|
|
||||||
def sysinfo(self):
|
def sysinfo(self):
|
||||||
return render_template(
|
return render_template(
|
||||||
@ -18,3 +22,9 @@ class SysinfoController:
|
|||||||
ipaddr=get_ip_address(),
|
ipaddr=get_ip_address(),
|
||||||
l=self._lang_dict,
|
l=self._lang_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def sysinfo_restart(self):
|
||||||
|
python = sys.executable
|
||||||
|
os.execl(python, python, *sys.argv)
|
||||||
|
return jsonify({'status': 'ok'})
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,8 @@
|
|||||||
<script>
|
<script>
|
||||||
var l = {'js_slideshow_slide_delete_confirmation': '{{ l.slideshow_slide_delete_confirmation }}'};
|
var l = {'js_slideshow_slide_delete_confirmation': '{{ l.slideshow_slide_delete_confirmation }}'};
|
||||||
var l = {'js_fleet_screen_delete_confirmation': '{{ l.js_fleet_screen_delete_confirmation }}'};
|
var l = {'js_fleet_screen_delete_confirmation': '{{ l.js_fleet_screen_delete_confirmation }}'};
|
||||||
|
var l = {'js_sysinfo_restart_confirmation': '{{ l.js_sysinfo_restart_confirmation }}'};
|
||||||
|
var l = {'js_sysinfo_restart_loading': '{{ l.js_sysinfo_restart_loading }}'};
|
||||||
</script>
|
</script>
|
||||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
|
||||||
{% block add_js %}{% endblock %}
|
{% block add_js %}{% endblock %}
|
||||||
|
|||||||
@ -6,12 +6,15 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block add_js %}
|
{% block add_js %}
|
||||||
|
<script src="{{ STATIC_PREFIX }}js/sysinfo.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<h2>{{ l.sysinfo_page_title }}</h2>
|
<h2>{{ l.sysinfo_page_title }}</h2>
|
||||||
|
<div class="toolbar-actions">
|
||||||
|
<button class="purple sysinfo-restart"><i class="fa fa-refresh icon-left"></i>{{ l.sysinfo_panel_button_restart }}</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user