From 9904e54c51f7f47012856f71cd4f8da78b023425 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Thu, 15 Dec 2022 09:53:19 +0100 Subject: [PATCH] Add dashboard2 --- app/main/routes.py | 6 + app/models.py | 16 ++- app/templates/main/dashboard2.html.j2 | 178 ++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 6 deletions(-) create mode 100644 app/templates/main/dashboard2.html.j2 diff --git a/app/main/routes.py b/app/main/routes.py index 1e7665a3..7e42d60b 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -30,6 +30,12 @@ def dashboard(): return render_template('main/dashboard.html.j2', title='Dashboard') +@bp.route('/dashboard2') +@login_required +def dashboard2(): + return render_template('main/dashboard2.html.j2', title='Dashboard') + + @bp.route('/user_manual') def user_manual(): return render_template('main/user_manual.html.j2', title='User manual') diff --git a/app/models.py b/app/models.py index d28331a0..aa5b2faa 100644 --- a/app/models.py +++ b/app/models.py @@ -226,6 +226,7 @@ class Role(HashidMixin, db.Model): db.session.add(role) db.session.commit() + class Token(db.Model): __tablename__ = 'tokens' # Primary key @@ -249,31 +250,33 @@ class Token(db.Model): yesterday = datetime.utcnow() - timedelta(days=1) Token.query.filter(Token.refresh_expiration < yesterday).delete() + class Avatar(HashidMixin, FileMixin, db.Model): __tablename__ = 'avatars' # Primary key id = db.Column(db.Integer, primary_key=True) # Foreign keys user_id = db.Column(db.Integer, db.ForeignKey('users.id')) + # Backrefs: user: User @property def path(self): return os.path.join(self.user.path, 'avatar') - + def delete(self): try: os.remove(self.path) except OSError as e: current_app.logger.error(e) db.session.delete(self) - + + class User(HashidMixin, UserMixin, db.Model): __tablename__ = 'users' # Primary key id = db.Column(db.Integer, primary_key=True) # Foreign keys role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) - # privacy_id = db.Column(db.Integer, db.ForeignKey('privacies.id')) # Fields email = db.Column(db.String(254), index=True, unique=True) username = db.Column(db.String(64), index=True, unique=True) @@ -555,7 +558,6 @@ class User(HashidMixin, UserMixin, db.Model): 'show_email': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_EMAIL), 'show_last_seen': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_LAST_SEEN), 'show_member_since': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_MEMBER_SINCE) - } if backrefs: json_serializeable['role'] = \ @@ -579,6 +581,7 @@ class User(HashidMixin, UserMixin, db.Model): } return json_serializeable + class TesseractOCRPipelineModel(FileMixin, HashidMixin, db.Model): __tablename__ = 'tesseract_ocr_pipeline_models' # Primary key @@ -869,7 +872,7 @@ class JobInput(FileMixin, HashidMixin, db.Model): @property def user_id(self): - return self.job.user_id + return self.job.user.id def to_json_serializeable(self, backrefs=False, relationships=False): json_serializeable = { @@ -925,7 +928,7 @@ class JobResult(FileMixin, HashidMixin, db.Model): @property def user_id(self): - return self.job.user_id + return self.job.user.id def to_json_serializeable(self, backrefs=False, relationships=False): json_serializeable = { @@ -1166,6 +1169,7 @@ class CorpusFile(FileMixin, HashidMixin, db.Model): self.corpus.to_json_serializeable(backrefs=True) return json_serializeable + class Corpus(HashidMixin, db.Model): ''' Class to define a corpus. diff --git a/app/templates/main/dashboard2.html.j2 b/app/templates/main/dashboard2.html.j2 new file mode 100644 index 00000000..47a7e236 --- /dev/null +++ b/app/templates/main/dashboard2.html.j2 @@ -0,0 +1,178 @@ +{% extends "base.html.j2" %} +{% from "main/_breadcrumbs.html.j2" import breadcrumbs with context %} + +{% block page_content %} +
+
+
+
+
+
+
+ search + + +
+
+
+
+
+ +
+
+
+
+

My Corpora

+

Create a corpus to interactively perform linguistic analysis.

+

Or browse our users public corpora.

+
+
+
+
+
+ + + + + + + + + + +
Title and DescriptionStatus
+
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + search + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    My Jobs

    +

    + A job is the execution of a service provided by nopaque. You can + create any number of jobs and let them be processed simultaneously. We + strongly recommend that you create a folder on your computer where you + save the various files that nopaque provides you with after each + pre-processing step. You will need the result of each step for the + next step. +

    +

    Where is my Job data? Don't worry, please read this news entry

    +
    +
    +
    +
    +
    + + + + + + + + + + +
    Title and DescriptionStatus
    +
      +
      +
      + +
      +
      +
      +
      +
      +{% endblock page_content %} + +{% block modals %} +{{ super() }} + +{% endblock modals %} + + +{% block scripts %} +{{ super() }} + +{% endblock scripts %}