diff --git a/python/ccdb/provider.py b/python/ccdb/provider.py index a52772f..c170a1f 100644 --- a/python/ccdb/provider.py +++ b/python/ccdb/provider.py @@ -297,6 +297,12 @@ def create_directory(self, new_dir_name, parent_dir_or_path, comment=""): return directory + def get_directory_by_id(self, dir_id): + return self.session.query(Directory).filter(Directory.id == dir_id).one() + + def get_type_table_by_id(self, table_id): + return self.session.query(TypeTable).filter(TypeTable.id == table_id).one() + # @brief Updates directory # # @warning in current realization, if operation succeeded diff --git a/python/ccdb/webgui/__init__.py b/python/ccdb/webgui/__init__.py index e89ffd2..b9efa03 100644 --- a/python/ccdb/webgui/__init__.py +++ b/python/ccdb/webgui/__init__.py @@ -1,7 +1,7 @@ import ccdb from ccdb.model import User from ccdb.path_utils import parse_request, ParseRequestResult -from flask import Flask, g, render_template, url_for +from flask import Flask, g, render_template, url_for, jsonify from python.ccdb.errors import ObjectIsNotFoundInDbError @@ -128,6 +128,25 @@ def directory_tree(): return render_template("simple_tree.html", html_tree=html_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: + return jsonify({"error": "Directory not found"}), 404 + + + @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: + return jsonify({"error": "Table not found"}), 404 + @app.route('/vars') def variations(): # Get ccdb Alchemy provider from flask global state 'g' @@ -288,6 +307,9 @@ 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 new file mode 100644 index 0000000..5cb8699 --- /dev/null +++ b/python/ccdb/webgui/templates/objects_dir_info.html @@ -0,0 +1,45 @@ +{% macro modal_directory_info(directory) %} + +{% endmacro %} diff --git a/python/ccdb/webgui/templates/objects_table_info.html b/python/ccdb/webgui/templates/objects_table_info.html new file mode 100644 index 0000000..c9e5852 --- /dev/null +++ b/python/ccdb/webgui/templates/objects_table_info.html @@ -0,0 +1,13 @@ +@require(id, name, path, created, modified, author, comment) + +@name  ? +
+ + + + + + + +
DB ID::   @id
Full path :    @path
Created :    @created
Modified :    @modified
Author :    @author
Comment :    @comment
+
\ No newline at end of file diff --git a/python/ccdb/webgui/templates/simple_tree.html b/python/ccdb/webgui/templates/simple_tree.html index 1dadbe2..646e1f8 100644 --- a/python/ccdb/webgui/templates/simple_tree.html +++ b/python/ccdb/webgui/templates/simple_tree.html @@ -126,44 +126,53 @@

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

-