mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 00:28:22 +00:00
chg: [UI DOC] add dynamic update message + add bootstrap 4 migration message + add update doc (DB)
This commit is contained in:
parent
7a5fac9a43
commit
de285ed64c
5 changed files with 46 additions and 8 deletions
22
OVERVIEW.md
22
OVERVIEW.md
|
@ -30,6 +30,28 @@ Redis and ARDB overview
|
|||
|
||||
# Database Map:
|
||||
|
||||
## DB0 - Core:
|
||||
|
||||
##### Update keys:
|
||||
| Key | Value |
|
||||
| ------ | ------ |
|
||||
| | |
|
||||
| ail:version | **current version** |
|
||||
| | |
|
||||
| ail:update_**update_version** | **background update name** |
|
||||
| | **background update name** |
|
||||
| | **...** |
|
||||
| | |
|
||||
| ail:update_date_v1.5 | **update date** |
|
||||
| | |
|
||||
| ail:update_error | **update message error** |
|
||||
| | |
|
||||
| ail:update_in_progress | **update version in progress** |
|
||||
| ail:current_background_update | **current update version** |
|
||||
| | |
|
||||
| ail:current_background_script | **name of the background script currently executed** |
|
||||
| ail:current_background_script_stat | **progress in % of the background script** |
|
||||
|
||||
## DB2 - TermFreq:
|
||||
|
||||
##### Set:
|
||||
|
|
|
@ -160,6 +160,10 @@ DiffMaxLineLength = int(cfg.get("Flask", "DiffMaxLineLength"))#Use to display t
|
|||
|
||||
bootstrap_label = ['primary', 'success', 'danger', 'warning', 'info']
|
||||
|
||||
dict_update_description = {'v1.5':{'nb_background_update': 4, 'update_warning_message': 'An Update is running on the background. Some informations like Tags, screenshot can be',
|
||||
'update_warning_message_notice_me': 'missing from the UI.'}
|
||||
}
|
||||
|
||||
UPLOAD_FOLDER = os.path.join(os.environ['AIL_FLASK'], 'submitted')
|
||||
|
||||
PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes")) + '/'
|
||||
|
|
|
@ -25,6 +25,7 @@ r_serv_log = Flask_config.r_serv_log
|
|||
r_serv_db = Flask_config.r_serv_db
|
||||
|
||||
max_dashboard_logs = Flask_config.max_dashboard_logs
|
||||
dict_update_description = Flask_config.dict_update_description
|
||||
|
||||
dashboard = Blueprint('dashboard', __name__, template_folder='templates')
|
||||
|
||||
|
@ -165,13 +166,20 @@ def index():
|
|||
log_select.add(max_dashboard_logs)
|
||||
log_select = list(log_select)
|
||||
log_select.sort()
|
||||
|
||||
# Check if update in progress
|
||||
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'):
|
||||
current_update = r_serv_db.get('ail:current_background_update')
|
||||
if current_update:
|
||||
if r_serv_db.scard('ail:update_{}'.format(current_update)) != dict_update_description[current_update]['nb_background_update']:
|
||||
update_in_progress = True
|
||||
update_warning_message = dict_update_description[current_update]['update_warning_message']
|
||||
update_warning_message_notice_me = dict_update_description[current_update]['update_warning_message_notice_me']
|
||||
|
||||
return render_template("index.html", default_minute = default_minute, threshold_stucked_module=threshold_stucked_module,
|
||||
log_select=log_select, selected=max_dashboard_logs, update_in_progress=update_in_progress)
|
||||
log_select=log_select, selected=max_dashboard_logs,
|
||||
update_warning_message=update_warning_message, update_in_progress=update_in_progress,
|
||||
update_warning_message_notice_me=update_warning_message_notice_me)
|
||||
|
||||
# ========= REGISTRATION =========
|
||||
app.register_blueprint(dashboard, url_prefix=baseUrl)
|
||||
|
|
|
@ -102,11 +102,16 @@
|
|||
{%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>.
|
||||
<strong>Warning!</strong> {{update_warning_message}} <strong>{{update_warning_message_notice_me}}</strong>
|
||||
(<a href="{{ url_for('settings.settings_page') }}">Check Update Status</a>)
|
||||
</div>
|
||||
{%endif%}
|
||||
|
||||
<div class="alert alert-info alert-dismissible fade in">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<strong>Bootstrap 4 migration!</strong> Some pages are still in bootstrap 3. You can check the migration progress <strong><a href="https://github.com/CIRCL/AIL-framework/issues/330" target="_blank">Here</a></strong>.
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="panel panel-default">
|
||||
|
|
|
@ -21,8 +21,7 @@ r_serv_db = Flask_config.r_serv_db
|
|||
max_preview_char = Flask_config.max_preview_char
|
||||
max_preview_modal = Flask_config.max_preview_modal
|
||||
REPO_ORIGIN = Flask_config.REPO_ORIGIN
|
||||
|
||||
dict_update_stat = {'v1.5':{'nb_background_update': 4}}
|
||||
dict_update_description = Flask_config.dict_update_description
|
||||
|
||||
settings = Blueprint('settings', __name__, template_folder='templates')
|
||||
|
||||
|
@ -70,7 +69,7 @@ def get_update_metadata():
|
|||
|
||||
if dict_update['update_in_progress']:
|
||||
dict_update['update_progression'] = r_serv_db.scard('ail:update_{}'.format(dict_update['update_in_progress']))
|
||||
dict_update['update_nb'] = dict_update_stat[dict_update['update_in_progress']]['nb_background_update']
|
||||
dict_update['update_nb'] = dict_update_description[dict_update['update_in_progress']]['nb_background_update']
|
||||
dict_update['update_stat'] = int(dict_update['update_progression']*100/dict_update['update_nb'])
|
||||
dict_update['current_background_script'] = r_serv_db.get('ail:current_background_script')
|
||||
dict_update['current_background_script_stat'] = r_serv_db.get('ail:current_background_script_stat')
|
||||
|
@ -107,7 +106,7 @@ def get_background_update_stats_json():
|
|||
update_stats['background_stats'] = int(update_stats['background_stats'])
|
||||
|
||||
update_progression = r_serv_db.scard('ail:update_{}'.format(current_update))
|
||||
update_nb_scripts = dict_update_stat[current_update]['nb_background_update']
|
||||
update_nb_scripts = dict_update_description[current_update]['nb_background_update']
|
||||
update_stats['update_stat'] = int(update_progression*100/update_nb_scripts)
|
||||
update_stats['update_stat_label'] = '{}/{}'.format(update_progression, update_nb_scripts)
|
||||
|
||||
|
|
Loading…
Reference in a new issue