调整日志和录像的最长保留时间到365日。同时在后台检查用户的设置是否超出了范围。

pull/105/head
Apex Liu 2017-12-22 00:46:05 +08:00
parent 8a818d4ce3
commit d9d4c22e61
3 changed files with 13 additions and 7 deletions

View File

@ -507,12 +507,12 @@ $app.create_config_storage = function () {
var _cleanup_hour = parseInt(_sto.dom.select_cleanup_hour.val()); var _cleanup_hour = parseInt(_sto.dom.select_cleanup_hour.val());
var _cleanup_minute = parseInt(_sto.dom.select_cleanup_minute.val()); var _cleanup_minute = parseInt(_sto.dom.select_cleanup_minute.val());
if (!(_keep_log === 0 || (_keep_log >= 30 && _keep_log <= 180))) { if (!(_keep_log === 0 || (_keep_log >= 30 && _keep_log <= 365))) {
$tp.notify_error('日志保留时间超出范围!'); $tp.notify_error('日志保留时间超出范围!');
_sto.dom.input_keep_log.focus(); _sto.dom.input_keep_log.focus();
return; return;
} }
if (!(_keep_record === 0 || (_keep_record >= 30 && _keep_record <= 180))) { if (!(_keep_record === 0 || (_keep_record >= 30 && _keep_record <= 365))) {
$tp.notify_error('会话录像保留时间超出范围!'); $tp.notify_error('会话录像保留时间超出范围!');
_sto.dom.input_keep_record.focus(); _sto.dom.input_keep_record.focus();
return; return;

View File

@ -155,7 +155,7 @@
<tr> <tr>
<td class="key">保留时间</td> <td class="key">保留时间</td>
<td class="value"> <td class="value">
<input id="storage-keep-log" type="text" value="0"/><span class="unit">天</span><span class="desc">30~180。仅保留指定天数的系统日志为0则永久保留。默认为0。</span> <input id="storage-keep-log" type="text" value="0"/><span class="unit">天</span><span class="desc">30~365。仅保留指定天数的系统日志为0则永久保留。默认为0。</span>
</td> </td>
</tr> </tr>
@ -168,7 +168,7 @@
<tr> <tr>
<td class="key">保留时间</td> <td class="key">保留时间</td>
<td class="value"> <td class="value">
<input id="storage-keep-record" type="text" value="0"/><span class="unit">天</span><span class="desc">30~180。仅保留指定天数的会话录像以会话开始时间为准为0则永久保留。默认为0。</span> <input id="storage-keep-record" type="text" value="0"/><span class="unit">天</span><span class="desc">30~365。仅保留指定天数的会话录像以会话开始时间为准为0则永久保留。默认为0。</span>
</td> </td>
</tr> </tr>
@ -181,7 +181,7 @@
<tr> <tr>
<td class="key">时间点</td> <td class="key">时间点</td>
<td class="value"> <td class="value">
<select id="select-cleanup-storage-hour"> <select id="select-cleanup-storage-hour" style="width:4rem;">
<option value="0">00</option> <option value="0">00</option>
<option value="1">01</option> <option value="1">01</option>
<option value="2">02</option> <option value="2">02</option>
@ -208,7 +208,7 @@
<option value="23">23</option> <option value="23">23</option>
</select> </select>
<select id="select-cleanup-storage-minute"> <select id="select-cleanup-storage-minute" style="width:4rem;">
<option value="0">00</option> <option value="0">00</option>
<option value="5">05</option> <option value="5">05</option>
<option value="10">10</option> <option value="10">10</option>
@ -223,7 +223,7 @@
<option value="55">55</option> <option value="55">55</option>
</select> </select>
<span class="desc">每天在指定时间点清理存储。</span> <span class="desc">每天在指定时间点清理超出保留时间的数据。</span>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -283,6 +283,12 @@ class DoSaveCfgHandler(TPBaseJsonHandler):
_keep_record = _cfg['keep_record'] _keep_record = _cfg['keep_record']
_cleanup_hour = _cfg['cleanup_hour'] _cleanup_hour = _cfg['cleanup_hour']
_cleanup_minute = _cfg['cleanup_minute'] _cleanup_minute = _cfg['cleanup_minute']
if not (30 <= _keep_log <= 365):
return self.write_json(TPE_PARAM, '系统日志保留时间超出范围!')
if not (30 <= _keep_record <= 365):
return self.write_json(TPE_PARAM, '会话录像保留时间超出范围!')
err = system_model.save_config(self, '更新存储策略设置', 'storage', _cfg) err = system_model.save_config(self, '更新存储策略设置', 'storage', _cfg)
if err == TPE_OK: if err == TPE_OK:
tp_cfg().sys.storage.keep_log = _keep_log tp_cfg().sys.storage.keep_log = _keep_log