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

View File

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

View File

@ -80,7 +80,7 @@
Source: {{ source }} Source: {{ source }}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -188,4 +188,4 @@
{% block extra_javascripts %} {% block extra_javascripts %}
{% endblock %} {% endblock %}

View File

@ -6,11 +6,12 @@
<a href="{{ url_for('editsys') }}">System Tags</a>&nbsp;&nbsp;&nbsp; <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=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('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> <a href="{{ url_for('about') }}">About</a>
<br> <br>
Server time: {{ t_loc() }} <br> Server time: {{ t_loc() }} <br>
07.23.2021 08.29.2021
</div> </div>
</div> </div>
</div> </div>

View File

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