mirror of https://github.com/CIRCL/AIL-framework
fix: [Update tags + UI] use srandmember + display update warning
parent
3f1e68f638
commit
346e26433a
|
@ -56,7 +56,7 @@ if __name__ == '__main__':
|
||||||
nb_updated = 0
|
nb_updated = 0
|
||||||
if total_to_update > 0:
|
if total_to_update > 0:
|
||||||
while tag_not_updated:
|
while tag_not_updated:
|
||||||
item_path = r_serv_tag.spop('maj:v1.5:absolute_path_to_rename')
|
item_path = r_serv_tag.srandmember('maj:v1.5:absolute_path_to_rename')
|
||||||
old_tag_item_key = 'tag:{}'.format(item_path)
|
old_tag_item_key = 'tag:{}'.format(item_path)
|
||||||
new_item_path = item_path.replace(PASTES_FOLDER, '', 1)
|
new_item_path = item_path.replace(PASTES_FOLDER, '', 1)
|
||||||
new_tag_item_key = 'tag:{}'.format(new_item_path)
|
new_tag_item_key = 'tag:{}'.format(new_item_path)
|
||||||
|
@ -69,6 +69,7 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
progress = int((nb_updated * 100) /total_to_update)
|
progress = int((nb_updated * 100) /total_to_update)
|
||||||
print('{}/{} Tags updated {}%'.format(nb_updated, total_to_update, progress))
|
print('{}/{} Tags updated {}%'.format(nb_updated, total_to_update, progress))
|
||||||
|
r_serv_tag.srem('maj:v1.5:absolute_path_to_rename', item_path)
|
||||||
|
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ cfg = Flask_config.cfg
|
||||||
baseUrl = Flask_config.baseUrl
|
baseUrl = Flask_config.baseUrl
|
||||||
r_serv = Flask_config.r_serv
|
r_serv = Flask_config.r_serv
|
||||||
r_serv_log = Flask_config.r_serv_log
|
r_serv_log = Flask_config.r_serv_log
|
||||||
|
r_serv_db = Flask_config.r_serv_db
|
||||||
|
|
||||||
max_dashboard_logs = Flask_config.max_dashboard_logs
|
max_dashboard_logs = Flask_config.max_dashboard_logs
|
||||||
|
|
||||||
|
@ -164,8 +165,13 @@ def index():
|
||||||
log_select.add(max_dashboard_logs)
|
log_select.add(max_dashboard_logs)
|
||||||
log_select = list(log_select)
|
log_select = list(log_select)
|
||||||
log_select.sort()
|
log_select.sort()
|
||||||
|
update_in_progress = False
|
||||||
|
if r_serv_db.exists('ail:update_v1.5'):
|
||||||
|
if not r_serv_db.exists('v1.5:onions') or not r_serv_db.exists('v1.5:metadata') or not r_serv_db.exists('v1.5:tags') or not r_serv_db.exists('v1.5:tags_background'):
|
||||||
|
update_in_progress = True
|
||||||
|
|
||||||
return render_template("index.html", default_minute = default_minute, threshold_stucked_module=threshold_stucked_module,
|
return render_template("index.html", default_minute = default_minute, threshold_stucked_module=threshold_stucked_module,
|
||||||
log_select=log_select, selected=max_dashboard_logs)
|
log_select=log_select, selected=max_dashboard_logs, update_in_progress=update_in_progress)
|
||||||
|
|
||||||
# ========= REGISTRATION =========
|
# ========= REGISTRATION =========
|
||||||
app.register_blueprint(dashboard, url_prefix=baseUrl)
|
app.register_blueprint(dashboard, url_prefix=baseUrl)
|
||||||
|
|
|
@ -99,6 +99,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{%if update_in_progress%}
|
||||||
|
<div class="alert alert-warning alert-dismissible fade in">
|
||||||
|
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||||
|
<strong>Warning!</strong> An Update is running on the background. Some informations like Tags, screenshot can be <strong>missing from the UI</strong>.
|
||||||
|
(<a href="#">Check Update Status</a>)
|
||||||
|
</div>
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
@ -187,6 +195,7 @@
|
||||||
<!-- /#page-wrapper -->
|
<!-- /#page-wrapper -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script> var url_showSavedPath = "{{ url_for('showsavedpastes.showsavedpaste') }}"; </script>
|
<script> var url_showSavedPath = "{{ url_for('showsavedpastes.showsavedpaste') }}"; </script>
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='js/indexjavascript.js')}}"
|
<script type="text/javascript" src="{{ url_for('static', filename='js/indexjavascript.js')}}"
|
||||||
data-urlstuff="{{ url_for('dashboard.stuff') }}" data-urllog="{{ url_for('dashboard.logs') }}">
|
data-urlstuff="{{ url_for('dashboard.stuff') }}" data-urllog="{{ url_for('dashboard.logs') }}">
|
||||||
|
|
Loading…
Reference in New Issue