oplog update

This commit is contained in:
Max 2021-08-29 19:13:33 -04:00
parent a4c7d3852f
commit a48ba912ea
5 changed files with 18 additions and 12 deletions

View File

@ -460,8 +460,10 @@ def purge():
params['ekeys'] = sorted(oplog_map.keys())
DataStore = column_helper('data_store')
destfile = ''
b = False
if 'bu' in params.keys():
if params['bu'] == 'true':
b = True
t = strftime("%Y%m%d_%H%M%S")
destfile = 'op25-backup-%s.db' % t
src = app.config['SQLALCHEMY_DATABASE_URI'][10:]
@ -487,6 +489,7 @@ def purge():
recCount = recCount.count()
dispQuery = delRec.compile(compile_kwargs={"literal_binds": True})
if simulate == 'false':
if b == True:
copyfile(src, dst)
db.session.execute(delRec)
db.session.commit()
@ -554,6 +557,7 @@ def data():
start_time = None if 'sdate' not in params.keys() else datetime.datetime.utcfromtimestamp(float(params['sdate']))
end_time = None if 'edate' not in params.keys() else datetime.datetime.utcfromtimestamp(float(params['edate']))
print(params)
sysid = None if 'sysid' not in params.keys() else int(params['sysid'])
stime = int(params['sdate']) #used in the queries

View File

@ -46,6 +46,7 @@
<p class="card-text">
OP25 Logs (aka Oplog) is the OP25 sqlite3 logs database viewer.
</p>
<p class="card-text">
Copyright &copy; 2020, 2021 Max H. Parke KA1RBI<br>
Copyright &copy; 2020, 2021 Michael Rose

View File

@ -6,11 +6,12 @@
<a href="{{ url_for('editsys') }}">System Tags</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('edit_tags') }}?cmd=tgid">Talkgroup Tags</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('edit_tags') }}?cmd=unit">Unit Tags</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('purge') }}">Purge Database</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('purge') }}">Purge</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('switch_db') }}">Backup & Switch</a>&nbsp;&nbsp;&nbsp;
<a href="{{ url_for('about') }}">About</a>
<br>
Server time: {{ t_loc() }} <br>
07.23.2021
08.29.2021
</div>
</div>
</div>

View File

@ -128,16 +128,16 @@
var ed = edate();
var sysid = $('#systemSelect').val();
var filter_tgid = {%+ if params['tgid'] is defined %}
var filter_tgid = {% if params['tgid'] is defined %}
{{ params['tgid'] }};
{%+ else %}
{% else %}
0;
{%+ endif %}
var filter_suid = {%+ if params['suid'] is defined %}
{% endif %}
var filter_suid = {% if params['suid'] is defined %}
{{ params['suid'] }};
{%+ else %}
{% else %}
0;
{%+ endif %}
{% endif %}
console.log('filter_tgid=' + filter_tgid);
console.log(typeof filter_tgid);
@ -186,7 +186,7 @@
null,
null,
null,
{ render: function(data){ return data / 1000000; }},
{ render: function(data){ return data / 1000000; } },
],
{% endif %}