diff --git a/python/ccdb/webgui/__init__.py b/python/ccdb/webgui/__init__.py index b9efa03..ff2798e 100644 --- a/python/ccdb/webgui/__init__.py +++ b/python/ccdb/webgui/__init__.py @@ -16,27 +16,6 @@ def print_app_functions(app): print() -def render_dir_info(directory): - """ - Render HTML for directory information using Flask and Jinja2. - - :param directory: Directory object - :type directory: ccdb.model.Directory - """ - - return render_template('objects_dir_info.html', dir=directory) - - -def render_table_info(table): - """ - Render HTML for table information using Flask and Jinja2. - - :param table: Table object - :type table: ccdb.TypeTable - """ - return render_template('objects_table_info.html', table=table) - - def dir_to_ul(directory, level=0): """ :param directory: Directory @@ -51,13 +30,13 @@ def dir_to_ul(directory, level=0): result = '\n' return result @@ -131,21 +110,22 @@ def directory_tree(): @app.route('/get-dir-info/') def get_dir_info(dir_id): db: ccdb.AlchemyProvider = g.db - try: - directory = db.get_directory_by_id(dir_id) - return render_template('objects_dir_info.html', directory=directory) - except ObjectIsNotFoundInDbError: + directory = db.get_directory_by_id(dir_id) + if not directory: return jsonify({"error": "Directory not found"}), 404 + return render_template('objects_dir_info.html', directory=directory) + @app.route('/get-table-info/') def get_table_info(table_id): db: ccdb.AlchemyProvider = g.db - try: - table = db.get_type_table_by_id(table_id) - return render_template('objects_table_info.html', table=table) - except ObjectIsNotFoundInDbError: + table = db.get_type_table_by_id(table_id) + if not table: return jsonify({"error": "Table not found"}), 404 + return render_template('objects_table_info.html', table=table) + + @app.route('/vars') def variations(): @@ -219,7 +199,7 @@ def show_request(): # get request from web form - # str_request = "/test/test_vars/test_table:0:default:2012-10-30_23-48-41" + #str_request = "/test/test_vars/test_table:0:default:2012-10-30_23-48-41" # parse request and prepare time request = parse_request(str_request) @@ -307,9 +287,6 @@ def download_request(): return result - - - # THIS IS FOR FUTURE # ==================================================================== # from ccdb.webgui.data_timeline import bp as time_line_bp diff --git a/python/ccdb/webgui/templates/objects_dir_info.html b/python/ccdb/webgui/templates/objects_dir_info.html index 5cb8699..152b511 100644 --- a/python/ccdb/webgui/templates/objects_dir_info.html +++ b/python/ccdb/webgui/templates/objects_dir_info.html @@ -1,45 +1,37 @@ -{% macro modal_directory_info(directory) %} - + diff --git a/python/ccdb/webgui/templates/simple_tree.html b/python/ccdb/webgui/templates/simple_tree.html index 646e1f8..66d47f5 100644 --- a/python/ccdb/webgui/templates/simple_tree.html +++ b/python/ccdb/webgui/templates/simple_tree.html @@ -1,10 +1,10 @@ {% extends 'dash_base.html' %} {% block header %} - - + + -

{% block title %}Tables{% endblock %}

{% endblock %} {% block content %} @@ -126,107 +101,111 @@

{% block title %}Tables{% endblock %}

+ - + $.fn.dataTable.ext.search.push( + function(settings, data, dataIndex) { + var min = parseInt($('#minRun').val(), 10); + var max = parseInt($('#maxRun').val(), 10); + var runMin = parseFloat(data[0]) || 0; + var runMax = parseFloat(data[1]) || 0; + + if ((isNaN(min) && isNaN(max)) || + (isNaN(min) && runMax <= max) || + (min <= runMin && isNaN(max)) || + (min <= runMin && runMax <= max)) { + return true; + } + return false; + } + ); + + $('#minRun, #maxRun').keyup(function() { + table.draw(); + }); +}); + + {% endblock %} diff --git a/python/ccdb/webgui/templates/test_request.html b/python/ccdb/webgui/templates/test_request.html index 37bcbd7..3619411 100644 --- a/python/ccdb/webgui/templates/test_request.html +++ b/python/ccdb/webgui/templates/test_request.html @@ -67,35 +67,26 @@

{% block title %}CCDB - Test Request{% endblock %}

{ console.log(event); //type table - let type_table = document.getElementsByTagName('input')[0]; - type_table = type_table.value; - //event.preventDefault(); - - console.log(type_table); + let type_table = document.getElementById('tableName').value; if(!type_table) { alert("Please specify type table"); return false; } //run number - let run = document.getElementsByTagName('input')[1]; - run = run.value; - console.log(run) + let run = document.getElementById('runNumber').value if(!run){ alert("Please specify run number"); return false; } //variation - let variation = document.getElementsByTagName('input')[2]; - variation= variation.value - console.log(variation) + let variation = document.getElementById('variationSelect').value; //now we have everything to build request let request = type_table+":"+run +":"+ variation; //is there a date? - let date = document.getElementsByTagName('input')[3]; - date= date.value; + let date = document.getElementById('dateText').value; if(date) request = request + ":" +date; console.log(request)