From fa43a6ed5eac43206926953fd4f122f5c63cece6 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 8 Dec 2025 11:30:03 -0600 Subject: Improve the streamlined UI for the index page. --- uploader/__init__.py | 1 + uploader/base_routes.py | 37 ++++++++++-- uploader/static/css/layout-large.css | 3 +- uploader/static/css/layout-small.css | 10 ++-- uploader/static/css/theme.css | 6 +- uploader/static/js/species.js | 2 +- uploader/templates/base2.html | 111 ----------------------------------- uploader/templates/index2.html | 48 --------------- uploader/templates/sui-base.html | 111 +++++++++++++++++++++++++++++++++++ uploader/templates/sui-index.html | 111 +++++++++++++++++++++++++++++++++++ 10 files changed, 263 insertions(+), 177 deletions(-) delete mode 100644 uploader/templates/base2.html delete mode 100644 uploader/templates/index2.html create mode 100644 uploader/templates/sui-base.html create mode 100644 uploader/templates/sui-index.html (limited to 'uploader') diff --git a/uploader/__init__.py b/uploader/__init__.py index 98e8141..b7f0ab9 100644 --- a/uploader/__init__.py +++ b/uploader/__init__.py @@ -108,6 +108,7 @@ def create_app(config: Optional[dict] = None): setup_logging(app) setup_modules_logging(app.logger, ( + "uploader.base_routes", "uploader.publications.models", "uploader.publications.datatables", "uploader.phenotypes.models")) diff --git a/uploader/base_routes.py b/uploader/base_routes.py index 74a3b90..3d0e1b2 100644 --- a/uploader/base_routes.py +++ b/uploader/base_routes.py @@ -1,15 +1,23 @@ """Basic routes required for all pages""" import os +import logging from urllib.parse import urljoin -from flask import (Blueprint, +from gn_libs.mysqldb import database_connection +from flask import (flash, + request, + url_for, + redirect, + Blueprint, current_app as app, send_from_directory) from uploader.ui import make_template_renderer from uploader.oauth2.client import user_logged_in +from uploader.species.models import all_species, species_by_id base = Blueprint("base", __name__) +logger = logging.getLogger(__name__) render_template = make_template_renderer("home") @@ -24,9 +32,30 @@ def favicon(): @base.route("/", methods=["GET"]) def index(): """Load the landing page""" - return render_template("index.html" if user_logged_in() else "login.html", - gn2server_intro=urljoin(app.config["GN2_SERVER_URL"], - "/intro")) + streamlined_ui = request.args.get("streamlined_ui") + if not bool(streamlined_ui):# TODO: Remove this section + return render_template( + "index.html" if user_logged_in() else "login.html", + gn2server_intro=urljoin(app.config["GN2_SERVER_URL"], "/intro")) + + with database_connection(app.config["SQL_URI"]) as conn: + print("We found a species ID. Processing...") + if not bool(request.args.get("species_id")): + return render_template( + "sui-index.html",# TODO: Rename: sui-index.html, sui_base.html + gn2server_intro=urljoin(app.config["GN2_SERVER_URL"], "/intro"), + species=all_species(conn), + streamlined_ui=streamlined_ui) + + species = species_by_id(conn, request.args.get("species_id")) + if not bool(species): + flash("Selected species was not found!", "alert alert-danger") + return redirect(url_for("base.index", streamlined_ui=streamlined_ui)) + + return redirect(url_for("species.view_species", + species_id=species["SpeciesId"], + streamlined_ui=streamlined_ui)) + def appenv(): """Get app's guix environment path.""" diff --git a/uploader/static/css/layout-large.css b/uploader/static/css/layout-large.css index d1b3aa1..f1740de 100644 --- a/uploader/static/css/layout-large.css +++ b/uploader/static/css/layout-large.css @@ -52,8 +52,7 @@ } #main #main-content { - /*background: #FFFFFF;*/ - /*max-width: 80%;*/ + max-width: 950px; grid-column-start: 1; grid-column-end: 2; diff --git a/uploader/static/css/layout-small.css b/uploader/static/css/layout-small.css index cd32a71..3a7d18f 100644 --- a/uploader/static/css/layout-small.css +++ b/uploader/static/css/layout-small.css @@ -53,14 +53,12 @@ } #main #main-content { - grid-row-start: 2; - grid-row-end: 3; - } - - #main #sidebar-content { grid-row-start: 3; grid-row-end: 4; + } - background: #E5E5FF; + #main #sidebar-content { + grid-row-start: 2; + grid-row-end: 3; } } diff --git a/uploader/static/css/theme.css b/uploader/static/css/theme.css index 09e5a52..184999d 100644 --- a/uploader/static/css/theme.css +++ b/uploader/static/css/theme.css @@ -3,7 +3,6 @@ body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; - background: black; } #header { @@ -25,20 +24,17 @@ body { } #main #breadcrumbs { - background: #eaeaea; border-radius:3px; text-align: center; } #main #main-content { - background: #e5e5ff; - border-radius: 5px; padding: 0 5px; } #main #sidebar-content { - background: red; + background: #E5E5FF; border-radius: 5px; padding: 0 5px; diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js index d42e081..fb0d2d2 100644 --- a/uploader/static/js/species.js +++ b/uploader/static/js/species.js @@ -20,7 +20,7 @@ $(() => { { select: "single", paging: true, - scrollY: 700, + scrollY: 500, deferRender: true, scroller: true, scrollCollapse: true, diff --git a/uploader/templates/base2.html b/uploader/templates/base2.html deleted file mode 100644 index 4c5d613..0000000 --- a/uploader/templates/base2.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - {%block extrameta%}{%endblock%} - - Data Upload and Quality Control: {%block title%}{%endblock%} - - - - - - - - - - {%block css%}{%endblock%} - - - - - - - -
- - -
- {%block contents%}{%endblock%} -
- - -
- - - - - - - - - - - - - - - - - - {%block javascript%}{%endblock%} - - diff --git a/uploader/templates/index2.html b/uploader/templates/index2.html deleted file mode 100644 index 72fea2f..0000000 --- a/uploader/templates/index2.html +++ /dev/null @@ -1,48 +0,0 @@ -{%extends "base2.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Home{%endblock%} - -{%block pagetitle%}Home{%endblock%} - -{%block extra_breadcrumbs%}{%endblock%} - -{%block contents%} - -
{{flash_all_messages()}}
- -{%if user_logged_in()%} -
-

Select from:

- -
-{%else%} -
-

- Sign in - to continue.

-
-{%endif%} - -{%endblock%} - - - -{%block sidebarcontents%} -
-
- Quick Navigation -
- - -
-
-
-{%endblock%} diff --git a/uploader/templates/sui-base.html b/uploader/templates/sui-base.html new file mode 100644 index 0000000..4c5d613 --- /dev/null +++ b/uploader/templates/sui-base.html @@ -0,0 +1,111 @@ + + + + + + + + + {%block extrameta%}{%endblock%} + + Data Upload and Quality Control: {%block title%}{%endblock%} + + + + + + + + + + {%block css%}{%endblock%} + + + + + + + +
+ + +
+ {%block contents%}{%endblock%} +
+ + +
+ + + + + + + + + + + + + + + + + + {%block javascript%}{%endblock%} + + diff --git a/uploader/templates/sui-index.html b/uploader/templates/sui-index.html new file mode 100644 index 0000000..a589148 --- /dev/null +++ b/uploader/templates/sui-index.html @@ -0,0 +1,111 @@ +{%extends "sui-base.html"%} +{%from "flash_messages.html" import flash_all_messages%} +{%from "macro-step-indicator.html" import step_indicator%} + +{%block title%}Home{%endblock%} + +{%block pagetitle%}Home{%endblock%} + +{%block extra_breadcrumbs%}{%endblock%} + +{%block contents%} + +
{{flash_all_messages()}}
+ +{%if user_logged_in()%} + +
+
+

{{step_indicator("1 - a")}} Select the Species

+ +

The data in Genenetwork is related to one species or another. To get + started, please select the species you want to work with.

+
+
+ +
+
+ + + {%if species | length != 0%} +
+ + + + + + + + + +
Species Name
+
+ + {%else%} + + + +
+ +
+ + {%endif%} + +
+
+ +
+
OR
+ +
+ +
+
+ +{%else%} + +
+

The Genenetwork Uploader (gn-uploader) enables upload of new data + into the Genenetwork System. It provides Quality Control over data, and + guidance in case you data does not meet the standards for acceptance.

+

+ Sign in + to get started.

+
+{%endif%} + +{%endblock%} + + + +{%block sidebarcontents%} +
+
+ Quick Navigation +
+ + +
+
+
+{%endblock%} + + +{%block javascript%} + +{%endblock%} -- cgit 1.4.1