Files
gommi/lib/system/templates/system_home.html
2022-04-21 19:23:01 +09:00

153 lines
4.7 KiB
HTML
Executable File

{% extends "base.html" %}
{% block content %}
<script type="text/javascript">
document.getElementById("plugin_first_menu").innerHTML = '';
</script>
<div>
<h3>시스템</h3>
<hr>
{{ macros.info_text('python_version', 'Python 버전') }}
{{ macros.info_text('platform', 'Platform') }}
{{ macros.info_text('processor', 'Processor') }}
{{ macros.info_text_and_buttons('version', 'SJVA 버전', [['changelog_btn', '업데이트 내역'], ['recent_version_btn', '최신버전 확인']]) }}
{{ macros.info_text('path_app_root', 'SJVA 폴더') }}
{{ macros.info_text('running_type', '실행타입') }}
{{ macros.info_text('auth', '인증') }}
<div class="d-inline-block"></div>
<h3>모니터링</h3>
<hr>
{{ macros.info_text('time', '시간') }}
{{ macros.info_text('cpu_percent', 'CPU 사용량') }}
{{ macros.info_text('memory', '메모리') }}
{{ macros.info_text('disk', '디스크') }}
<div class="d-inline-block"></div>
<h3>스케쥴러</h3>
<hr>
<div id="scheduler_list_div"></div>
</div> <!--전체-->
<script type="text/javascript">
function make_scheduler_list(data) {
str = m_row_start(p='0');
str += m_col(1, '<strong>NO</strong>');
str += m_col(2, '<strong>플러그인 & ID</strong>');
//str += m_col(2, '<strong>생성 & 다음 실행</strong>');
str += m_col(2, '<strong>다음 실행 (남은시간)</strong>');
str += m_col(1, '<strong>이전소요/횟수</strong>');
str += m_col(2, '<strong>Interval & Cron</strong>');
str += m_col(1, '<strong>상태</strong>');
str += m_col(3, '<strong>설 명</strong>');
str += m_row_end();
str += m_hr();
for(var i in data) {
if (data[i].is_running) {
str += m_row_start_color2(0);
} else {
str += m_row_start(p='0');
}
str += m_col(1, data[i].no);
tmp = '<strong>'+data[i].plugin+'</strong><br>' + data[i].id;
str += m_col(2, tmp);
//tmp = ''+''+'' + data[i].make_time + '<br>';
//tmp += ''+''+'' + data[i].next_run_time + '<br>';
tmp = ''+''+'' + data[i].next_run_time + '<br>';
if (data[i].remain_time != '') {
tmp += '('+data[i].remain_time+')';
}
str += m_col(2, tmp);
tmp = ''+''+'' + data[i].running_timedelta + '초 / ';
tmp += ''+''+'' + data[i].count + '회';
str += m_col(1, tmp);
tmp = ''+''+'' + data[i].interval + ' <br>';
str += m_col(2, tmp);
tmp = ''+''+'' + ((data[i].is_running) ?'실행중':'대기중') + '';
if (data[i].run == false) {
tmp += '(F)'
}
str += m_col(1, tmp);
str += m_col(3, data[i].description);
str += m_row_end();
str += m_hr();
}
document.getElementById("scheduler_list_div").innerHTML = str;
}
$(document).ready(function(){
$.ajax({
url: '/system/ajax/info',
type: "POST",
cache: false,
data:{},
dataType: "json",
success: function (data) {
make_system(data);
}
});
var protocol = window.location.protocol;
var socket = io.connect(protocol + "//" + document.domain + ":" + location.port + "/system")
socket.on('status', function(data) {
make_system(data);
make_scheduler_list(data.scheduler);
});
});
$("body").on('click', '#changelog_btn', function(e){
e.preventDefault();
//window.location.href='/system/information';
window.open('https://sjva.me/wiki/public/changelog', "_blank");
});
$("body").on('click', '#recent_version_btn', function(e){
e.preventDefault();
$.ajax({
url: '/system/ajax/recent_version',
type: "POST",
cache: false,
data:{},
dataType: "json",
success: function (data) {
if (data.ret)
$.notify('<strong>최신버전 : '+data.version+'</strong>', {type: 'success'});
else
$.notify('<strong>확인 실패</strong>', {type: 'warning'});
}
});
});
function make_system(data) {
for(var key in data.system) {
if (key == 'auth' && data.system[key].startsWith('인증')==false)
document.getElementById(key).innerHTML = '<span style="color:red;font-weight: bold;font-size: xx-large ;">' + data.system[key]+ '</span>';
else {
if (document.getElementById(key) != null)
document.getElementById(key).innerHTML = data.system[key];
}
tmp = data.system['version']
if (data.system['version'] == data.system['recent_version']) {
tmp += ' <span style="color:red;font-weight: bold;">(최신버전)</span>';
} else {
tmp += ' <span style="color:red;font-weight: bold;">(최신버전이 아닙니다. 최신:'+data.system['recent_version']+')</span>';
}
document.getElementById('version').innerHTML = tmp;
}
//console.log(document.getElementById('version'))
//document.getElementById('version').innerHTML = data.system.version + data.system.recent_version;
}
</script>
{% endblock %}