chg: [UI-dashboard] add logs number configuration

This commit is contained in:
Terrtia 2018-07-26 11:35:54 +02:00
parent 0a82482db4
commit b02cbee179
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
4 changed files with 18 additions and 8 deletions

View file

@ -143,3 +143,5 @@ DiffMaxLineLength = int(cfg.get("Flask", "DiffMaxLineLength"))#Use to display t
bootstrap_label = ['primary', 'success', 'danger', 'warning', 'info']
UPLOAD_FOLDER = os.path.join(os.environ['AIL_FLASK'], 'submitted')
max_dashboard_logs = int(cfg.get("Flask", "max_dashboard_logs"))

View file

@ -22,6 +22,8 @@ cfg = Flask_config.cfg
r_serv = Flask_config.r_serv
r_serv_log = Flask_config.r_serv_log
max_dashboard_logs = Flask_config.max_dashboard_logs
dashboard = Blueprint('dashboard', __name__, template_folder='templates')
# ============ FUNCTIONS ============
@ -114,7 +116,7 @@ def get_last_logs_json():
max_day_search = 6
day_search = 0
warning_found = 0
warning_to_found = 10
warning_to_found = max_dashboard_logs
last_logs = []
@ -157,7 +159,12 @@ def stuff():
def index():
default_minute = cfg.get("Flask", "minute_processed_paste")
threshold_stucked_module = cfg.getint("Module_ModuleInformation", "threshold_stucked_module")
return render_template("index.html", default_minute = default_minute, threshold_stucked_module=threshold_stucked_module)
log_select = {10, 25, 50, 100}
log_select.add(max_dashboard_logs)
log_select = list(log_select)
log_select.sort()
return render_template("index.html", default_minute = default_minute, threshold_stucked_module=threshold_stucked_module,
log_select=log_select, selected=max_dashboard_logs)
# ========= REGISTRATION =========
app.register_blueprint(dashboard)

View file

@ -144,10 +144,13 @@
<div class="pull-right">
<label style="padding-bottom:2px;">
<select class="form-control input-sm" id="log_select">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
{% for log_selection in log_select %}
{% if log_selection == selected %}
<option value="{{ log_selection }}" selected>{{ log_selection }}</option>
{% else %}
<option value="{{ log_selection }}">{{ log_selection }}</option>
{% endif %}
{% endfor %}
</select>
</label>
<input id="checkbox_log_info" type="checkbox" value="info"> INFO
@ -193,7 +196,6 @@
var tableBody = document.getElementById('tab_body')
$.getJSON('/_get_last_logs_json', function(data) {
console.log(data);
data.forEach(function (d) {
var tr = document.createElement('TR')
var time = document.createElement('TD')

View file

@ -134,7 +134,6 @@ function pad_2(number) {
}
function create_log_table(obj_json) {
console.log(obj_json);
tableBody = document.getElementById("tab_body")
var tr = document.createElement('TR')
var time = document.createElement('TD')