调整:核心服务崩溃时处于连接状态的会话,修复其终止时间,在会话历史列表中能够显示大约的运行时长。
parent
71bd6817c2
commit
333c244379
|
@ -185,9 +185,9 @@ $app.on_table_host_cell_created = function (tbl, row_id, col_key, cell_obj) {
|
||||||
|
|
||||||
if (action === 'replay') {
|
if (action === 'replay') {
|
||||||
//$app.dlg_edit_host.show_edit(row_id);
|
//$app.dlg_edit_host.show_edit(row_id);
|
||||||
if(row_data.protocol_type === TP_PROTOCOL_TYPE_RDP) {
|
if (row_data.protocol_type === TP_PROTOCOL_TYPE_RDP) {
|
||||||
$tp.notify_error('sorry, not impl.');
|
$tp.notify_error('sorry, not impl.');
|
||||||
} else if(row_data.protocol_type === TP_PROTOCOL_TYPE_SSH) {
|
} else if (row_data.protocol_type === TP_PROTOCOL_TYPE_SSH) {
|
||||||
window.open('/audit/replay/' + row_data.protocol_type + '/' + row_data.id);
|
window.open('/audit/replay/' + row_data.protocol_type + '/' + row_data.id);
|
||||||
}
|
}
|
||||||
} else if (action === 'cmd') {
|
} else if (action === 'cmd') {
|
||||||
|
@ -282,10 +282,16 @@ $app.on_table_host_render_created = function (render) {
|
||||||
_style = 'primary';
|
_style = 'primary';
|
||||||
return '<span class="label label-' + _style + '"><i class="fa fa-cog fa-spin"></i> ' + tp_second2str(tp_local2utc() - fields.time_begin) + '</span>';
|
return '<span class="label label-' + _style + '"><i class="fa fa-cog fa-spin"></i> ' + tp_second2str(tp_local2utc() - fields.time_begin) + '</span>';
|
||||||
} else {
|
} else {
|
||||||
if (fields.time_end === 0)
|
if (fields.time_end === 0) {
|
||||||
return '<span class="label label-danger"><i class="fa fa-clock-o fa-fw"></i> 未知</span>';
|
return '<span class="label label-danger"><i class="fa fa-clock-o fa-fw"></i> 未知</span>';
|
||||||
else
|
}
|
||||||
return tp_second2str(fields.time_end - fields.time_begin);
|
else {
|
||||||
|
if (fields.state === TP_SESS_STAT_ERR_START_RESET) {
|
||||||
|
return '<span class="label label-info"><i class="fa fa-exclamation-circle fa-fw"></i> ' + tp_second2str(fields.time_end - fields.time_begin) + '</span>';
|
||||||
|
} else {
|
||||||
|
return tp_second2str(fields.time_end - fields.time_begin);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (fields.time_end === 0) {
|
// if (fields.time_end === 0) {
|
||||||
|
|
|
@ -254,16 +254,24 @@ def delete_log(log_list):
|
||||||
|
|
||||||
def session_fix():
|
def session_fix():
|
||||||
try:
|
try:
|
||||||
ret = True
|
|
||||||
db = get_db()
|
db = get_db()
|
||||||
sql = 'UPDATE `{}record` SET state={} WHERE state={};'.format(db.table_prefix, TP_SESS_STAT_ERR_RESET, TP_SESS_STAT_RUNNING)
|
|
||||||
if not db.exec(sql):
|
sql_list = []
|
||||||
ret = False
|
|
||||||
sql = 'UPDATE `{}record` SET state={} WHERE state={};'.format(db.table_prefix, TP_SESS_STAT_ERR_START_RESET, TP_SESS_STAT_STARTED)
|
sql = 'UPDATE `{dbtp}record` SET state={new_state}, time_end={time_end} WHERE state={old_state};' \
|
||||||
if not db.exec(sql):
|
''.format(dbtp=db.table_prefix, new_state=TP_SESS_STAT_ERR_RESET, old_state=TP_SESS_STAT_RUNNING, time_end=tp_timestamp_utc_now())
|
||||||
ret = False
|
sql_list.append(sql)
|
||||||
return ret
|
# if not db.exec(sql):
|
||||||
|
# ret = False
|
||||||
|
sql = 'UPDATE `{dbtp}record` SET state={new_state},time_end={time_end} WHERE state={old_state};' \
|
||||||
|
''.format(dbtp=db.table_prefix, new_state=TP_SESS_STAT_ERR_START_RESET, old_state=TP_SESS_STAT_STARTED, time_end=tp_timestamp_utc_now())
|
||||||
|
sql_list.append(sql)
|
||||||
|
return db.transaction(sql_list)
|
||||||
|
# if not db.exec(sql):
|
||||||
|
# ret = False
|
||||||
|
# return ret
|
||||||
except:
|
except:
|
||||||
|
log.e('\n')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue