added active link for all pages to navbar

added dropdowns
removed starter files
removed sentry completely
This commit is contained in:
Navan Chauhan 2020-09-16 23:51:21 +05:30
parent 1b530ca5d1
commit d20017680b
18 changed files with 45 additions and 106 deletions

View File

@ -1,16 +1,5 @@
from flask import Flask from flask import Flask
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
"""
sentry_sdk.init(
dsn="https://7bc9916920c041479b69db97bdb279fa@o126149.ingest.sentry.io/5424142",
integrations=[FlaskIntegration()],
traces_sample_rate=1.0
)
"""
import configparser import configparser
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('config.ini') config.read('config.ini')

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "about" %}
{% block main %} {% block main %}
<h1>About Curie Web</h1> <h1>About Curie Web</h1>
<p>Curie Web is a web interface for my private Python Library called "Curie", with some aditional superpowers.</p> <p>Curie Web is a web interface for my private Python Library called "Curie", with some aditional superpowers.</p>

View File

@ -23,30 +23,47 @@
</button> </button>
<div class="collapse navbar-collapse" id="navbarNav"> <div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item active"> <li class="{{ 'nav-item active' if active_page == 'home' else 'nav-item' }}">
<a class="nav-link" href="{{ url_for('home') }}">Home <span class="sr-only">(current)</span></a> <a class="nav-link" href="{{ url_for('home') }}">Home <span class="sr-only">(current)</span></a>
</li> </li>
<li class="nav-item"> <li class="{{ 'nav-item active' if active_page == 'about' else 'nav-item' }}">
<a class="nav-link" href="{{ url_for('about') }}">About</a> <a class="nav-link" href="{{ url_for('about') }}">About</a>
</li> </li>
<!-- <li class="{{ 'nav-item dropdown active' if active_page == 'dock' else 'nav-item dropdown' }}">
<li class="nav-item"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="nav-link" href="{{ url_for('basic_form') }}">Basic Form</a> Dock and Report
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ url_for('dock_upload') }}">Automatic</a>
<a class="dropdown-item" href="{{ url_for('dock_upload_single') }}">Manual</a>
</div>
</li> </li>
<li class="nav-item"> <li class="{{ 'nav-item active' if active_page == 'generate' else 'nav-item' }}">
<a class="nav-link" href="{{ url_for('wtform') }}">WTForms</a>
</li> -->
<li class="nav-item">
<a class="nav-link" href="{{ url_for('dock_upload') }}">Dock and Report</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('generate') }}">Generate</a> <a class="nav-link" href="{{ url_for('generate') }}">Generate</a>
</li> </li>
<li class="nav-item"> <li class="{{ 'nav-item dropdown active' if active_page == 'search' else 'nav-item dropdown' }}">
<a class="nav-link" href="{{ url_for('status') }}">Job Status</a> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Research
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{url_for('pubmed')}}">PubMed</a>
<a class="dropdown-item" href="{{url_for('pubchem')}}">PubChem</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item disabled" href="#">Qrious</a>
</div>
</li> </li>
<li class="nav-item"> <li class="{{ 'nav-item dropdown active' if active_page == 'tool' else 'nav-item dropdown' }}">
<a class="nav-link" href="{{url_for('pubmed')}}">Search</a> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Other Tools
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{url_for('generate_pdbqts')}}">Generate PDBQTs</a>
<a class="dropdown-item" href="{{url_for('editor')}}">Molecule Editor</a>
<a class="dropdown-item" href="{{url_for('visualise')}}">Molecule Visualiser</a>
</div>
</li>
<li class="{{ 'nav-item active' if active_page == 'job_status' else 'nav-item' }}">
<a class="nav-link" href="{{ url_for('status') }}">Job Status</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% block main %}
<h2>Description: {{ description }}</h2>
<p>Succesfuly Submitted</p>
<!-- <img src="{{ url_for('static', filename="uploads/" + filename) }}" /> -->
{% endblock %}

View File

@ -1,8 +0,0 @@
{% extends 'base.html' %}
{% block main %}
<h2>Job ID: {{ job }}</h2>
<p>Succesfuly Submitted</p>
<b>Description: </b>{{description}}
<!-- <img src="{{ url_for('static', filename="uploads/" + filename) }}" /> -->
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "dock" %}
{% block main %} {% block main %}
<h2>Enter Your Configuration</h2> <h2>Enter Your Configuration</h2>
<form action="{{ url_for('dock_upload') }}" method="post" enctype="multipart/form-data"> <form action="{{ url_for('dock_upload') }}" method="post" enctype="multipart/form-data">

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "dock" %}
{% block main %} {% block main %}
<h2>Enter Your Configuration</h2> <h2>Enter Your Configuration</h2>
<form action="{{ url_for('dock_upload_single') }}" method="post" enctype="multipart/form-data"> <form action="{{ url_for('dock_upload_single') }}" method="post" enctype="multipart/form-data">

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "generate" %}
{% block main %} {% block main %}
<h1>Curie Generate</h1> <h1>Curie Generate</h1>
<p>The model {{expName}} has been trained for {{epochs}} epochs using the {{optimizer}} optimization algorithm. Option for finetuning coming soon.</p> <p>The model {{expName}} has been trained for {{epochs}} epochs using the {{optimizer}} optimization algorithm. Option for finetuning coming soon.</p>

View File

@ -1,4 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "home" %}
{% block main %} {% block main %}
<h2>Curie Web Demo</h2> <h2>Curie Web Demo</h2>

View File

@ -1,5 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "job_status" %}
{% block main %} {% block main %}
<h2>Job ID: {{ ID }}</h2> <h2>Job ID: {{ ID }}</h2>
<b>Submitted On: </b>{{subDate}}<br> <b>Submitted On: </b>{{subDate}}<br>

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "tool" %}
{% block main %} {% block main %}
<h2>Molecule Editor</h2> <h2>Molecule Editor</h2>

View File

@ -1,6 +1,6 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "tool" %}
{% block main %} {% block main %}
<h2>Generate PDBQTs</h2> <h2>Generate PDBQTs</h2>

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "search" %}
{% block main %} {% block main %}
<h1>SMILES Search</h1> <h1>SMILES Search</h1>
<p>Get Compound SMILES through PubChem.</p> <p>Get Compound SMILES through PubChem.</p>

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "search" %}
{% block main %} {% block main %}
<h1>Curie Search</h1> <h1>Curie Search</h1>
<p>Search PubMed articles.</p> <p>Search PubMed articles.</p>

View File

@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% set active_page = "tool" %}
{% block main %} {% block main %}
<h1>Curie Visualise</h1> <h1>Curie Visualise</h1>
<p>placeholder uwu</p> <p>placeholder uwu</p>

View File

@ -1,20 +0,0 @@
{% extends 'base.html' %}
{% block main %}
<h2>WTForms in Flask</h2>
<p>Here we are using the Flask-WTF library to create and process a form. Flask-WTF also comes with CSRF protection and validation classes.</p>
<form method="post" action="{{ url_for('wtform') }}">
{% include 'flash_messages.html' %}
{{ form.csrf_token }}
<div class="form-group">
{{ form.firstname.label }} {{ form.firstname(class="form-control") }}
</div>
<div class="form-group">
{{ form.lastname.label }} {{ form.lastname(class="form-control") }}
</div>
<div class="form-group">
{{ form.email.label }} {{ form.email(class="form-control", placeholder="jdoe@example.com") }}
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
{% endblock %}

View File

@ -152,37 +152,6 @@ def status():
flash_errors(taskStatusForm) flash_errors(taskStatusForm)
return render_template('job_status_form.html',form=taskStatusForm) return render_template('job_status_form.html',form=taskStatusForm)
@app.route('/basic-form', methods=['GET', 'POST'])
def basic_form():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
return render_template('result.html',
firstname=firstname,
lastname=lastname,
email=email)
return render_template('form.html')
@app.route('/wtform', methods=['GET', 'POST'])
def wtform():
myform = MyForm()
if request.method == 'POST':
if myform.validate_on_submit():
# Note the difference when retrieving form data using Flask-WTF
# Here we use myform.firstname.data instead of request.form['firstname']
firstname = myform.firstname.data
lastname = myform.lastname.data
email = myform.email.data
flash('You have successfully filled out the form', 'success')
return render_template('result.html', firstname=firstname, lastname=lastname, email=email)
flash_errors(myform)
return render_template('wtform.html', form=myform)
@app.route('/PDBQTs',methods=['GET','POST']) @app.route('/PDBQTs',methods=['GET','POST'])
def generate_pdbqts(): def generate_pdbqts():
@ -406,9 +375,6 @@ def send_text_file(file_name):
file_dot_text = file_name + '.txt' file_dot_text = file_name + '.txt'
return app.send_static_file(file_dot_text) return app.send_static_file(file_dot_text)
@app.route('/debug-sentry')
def trigger_error():
division_by_zero = 1 / 0
@app.after_request @app.after_request
def add_header(response): def add_header(response):

View File

@ -25,5 +25,4 @@ wget
lifelines lifelines
scikit-plot scikit-plot
pymed pymed
sentry-sdk[flask]
logzero logzero