Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions qiita_core/configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(self):
self._get_ebi(config)
self._get_vamps(config)
self._get_portal(config)
self._iframe(config)

def _get_main(self, config):
"""Get the configuration of the main section"""
Expand Down Expand Up @@ -286,3 +287,6 @@ def _get_portal(self, config):
self.portal_dir = self.portal_dir[:-1]
else:
self.portal_dir = ""

def _iframe(self, config):
self.iframe_qiimp = config.get('iframe', 'QIIMP')
7 changes: 7 additions & 0 deletions qiita_core/support_files/config_test.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,10 @@ PORTAL_DIR =

# Full path to portal styling config file
PORTAL_FP =


# ----------------------------- iframes settings ---------------------------
[iframe]
# The real world QIIMP will always need to be accessed with https because Qiita
# runs on https too
QIIMP = https://localhost:8898/
7 changes: 7 additions & 0 deletions qiita_core/tests/test_configuration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def test_init(self):
self.assertEqual(obs.portal, "QIITA")
self.assertEqual(obs.portal_dir, "/portal")

# iframe section
self.assertEqual(obs.iframe_qiimp, "https://localhost:8898/")

def test_init_error(self):
with open(self.conf_fp, 'w') as f:
f.write("\n")
Expand Down Expand Up @@ -347,6 +350,10 @@ def test_get_portal(self):

# Full path to portal styling config file
PORTAL_FP = /tmp/portal.cfg

# ----------------------------- iframes settings ---------------------------
[iframe]
QIIMP = https://localhost:8898/
"""

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion qiita_pet/handlers/auth_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def post(self):
"click the following link to verify email address: "
"%s/auth/verify/%s?email=%s\n\nBy clicking you are "
"accepting our term and conditions: "
"%s/static/qiita_data_terms_of_use.html"
"%s/iframe/?iframe=qiita-terms"
% (url, info['user_verify_code'],
url_escape(username), url))
except Exception:
Expand Down
11 changes: 11 additions & 0 deletions qiita_pet/handlers/base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# -----------------------------------------------------------------------------

from tornado.web import RequestHandler

from qiita_db.logger import LogEntry
from qiita_db.user import User
from qiita_pet.util import convert_text_html
Expand Down Expand Up @@ -78,6 +79,16 @@ def get(self):
self.render("index.html", message=msg, level=lvl)


class IFrame(BaseHandler):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this handler?

'''Open one of the IFrame pages'''
def get(self):
msg = self.get_argument('message', '')
msg = convert_text_html(msg)
lvl = self.get_argument('level', '')
iframe = self.get_argument('iframe', '')
self.render("iframe.html", iframe=iframe, message=msg, level=lvl)


class MockupHandler(BaseHandler):
def get(self):
self.render("mockup.html")
Expand Down
16 changes: 8 additions & 8 deletions qiita_pet/static/qiita_data_terms_of_use.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
<h1>Qiita Data - Terms of Use</h1>

<p>
Please read these terms of use (Terms) carefully before using Qiita,
Please read these terms of use ("Terms") carefully before using Qiita,
directly or through our web services. By using Qiita, you signify that
you have read, understood and are in agreement with these Terms and with
the University of Californias Terms and Conditions of Use posted at
the University of California's Terms and Conditions of Use posted at
<a href="http://www.ucop.edu/terms">http://www.ucop.edu/terms</a>, which
are incorporated by reference into these Terms as if set forth fully
herein. You also represent that you are the representative of any entity
for which you are using Qiita and that you are authorized by such entity
to enter into a legal agreement on that entitys behalf. If you do not
to enter into a legal agreement on that entity's behalf. If you do not
agree with any of these Terms, you are not permitted to use Qiita.
</p>

Expand All @@ -32,13 +32,13 @@ <h1>Qiita Data - Terms of Use</h1>
</li>
<li>
Qiita allows users to keep track of multiple studies with multiple
"'omics" data and Qiitas main site provides database and compute
"'omics" data and Qiita's main site provides database and compute
resources to the global community, alleviating the technical
burdens, such as familiarity with the command line or access to
compute power, that are typically limiting for researchers
studying microbial ecology. Qiitas platform allows for quick
studying microbial ecology. Qiita's platform allows for quick
reanalysis of the datasets that have been deposited using the
latests analytical technologies. This means that Qiitas
latests analytical technologies. This means that Qiita's
internal datasets are living data that is periodically re-annotated
according to current best practices.
</li>
Expand All @@ -50,7 +50,7 @@ <h1>Qiita Data - Terms of Use</h1>
Knight Lab at the University of California, San Diego, including
any service, application, data, information, technical assistance,
software, algorithms or analytical tools accessible through the
Qiita website, related web properties, or Qiitas GitHub page.
Qiita website, related web properties, or Qiita's GitHub page.
</li>
<li>
"Data" means any and all information, in whatever form, that you
Expand All @@ -75,7 +75,7 @@ <h1>Qiita Data - Terms of Use</h1>
Data you transfer to or from Qiita.
</li>
</ol>
<li><u>Qiitas Data Rights.</u></li>
<li><u>Qiita's Data Rights.</u></li>
<ol type="a">
<li>
You hereby grant to Qiita a non-exclusive, perpetual, global,
Expand Down
12 changes: 12 additions & 0 deletions qiita_pet/templates/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends sitebase.html %}
{% block content %}

{% if iframe == 'qiita-terms' %}
<iframe style="margin: 0; padding: 0; width: 100%; height: 400px;" src="{% raw qiita_config.portal_dir %}/static/qiita_data_terms_of_use.html"></iframe>
{% elif iframe == 'qiimp' %}
<iframe style="margin: 0; padding: 0; width: 100%; height: 400px;" src="{{qiita_config.iframe_qiimp}}"></iframe>
{% else %}
<b>No content</b>
{% end %}

{% end %}
9 changes: 7 additions & 2 deletions qiita_pet/templates/sitebase.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,12 @@ <h6>
</ul>
<ul class="nav navbar-nav">
<li>
<a href="{% raw qiita_config.portal_dir %}/redbiom/">Redbiom</a>
<a href="{% raw qiita_config.portal_dir %}/redbiom/">redbiom</a>
</li>
</ul>
<ul class="nav navbar-nav">
<li>
<a href="{% raw qiita_config.portal_dir %}/iframe/?iframe=qiimp">Qiimp</a>
</li>
</ul>
<ul class="nav navbar-nav">
Expand Down Expand Up @@ -549,7 +554,7 @@ <h4 class="modal-title">File really big.</h4>
<br/>
Questions? <a href="mailto:qiita.help@gmail.com">qiita.help@gmail.com</a>
<br/>
Read our <a href="{% raw qiita_config.portal_dir %}/static/qiita_data_terms_of_use.html">terms and conditions</a>.
Read our <a href="{% raw qiita_config.portal_dir %}/iframe/?iframe=qiita-terms">terms and conditions</a>.
</div>
<div id="overlay" class="navbar-brand" style="visibility: hidden; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; font-size: 13px; text-align: center; z-index: 1000; background-color: #333333; color: #FFFFFF;">
<img src="{% raw qiita_config.portal_dir %}{{portal_styling.logo}}" alt="Qiita logo" id="small-logo"/>
Expand Down
12 changes: 12 additions & 0 deletions qiita_pet/test/test_base_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ def test_get(self):
self.assertEqual(response.code, 404)


class TestIFrame(TestHandlerBase):
def test_get(self):
response = self.get('/iframe/')
self.assertEqual(response.code, 200)
self.assertIn("<b>No content</b>", response.body)

response = self.get('/iframe/?iframe=qiita-terms')
self.assertEqual(response.code, 200)
self.assertIn('src="/static/qiita_data_terms_of_use.html"',
response.body)


if __name__ == "__main__":
main()
4 changes: 3 additions & 1 deletion qiita_pet/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from qiita_core.qiita_settings import qiita_config
from qiita_core.util import is_test_environment
from qiita_pet.handlers.base_handlers import (MainHandler, NoPageHandler)
from qiita_pet.handlers.base_handlers import (
MainHandler, NoPageHandler, IFrame)
from qiita_pet.handlers.auth_handlers import (
AuthCreateHandler, AuthLoginHandler, AuthLogoutHandler, AuthVerifyHandler)
from qiita_pet.handlers.user_handlers import (
Expand Down Expand Up @@ -178,6 +179,7 @@ def __init__(self):
(r"/release/download/(.*)", DownloadRelease),
(r"/vamps/(.*)", VAMPSHandler),
(r"/redbiom/(.*)", RedbiomPublicSearch),
(r"/iframe/", IFrame),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be /iframe/(.*) since the URI is /iframe/?iframe=qiita-terms?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it depends on how we want to handle the parameters. /iframe/(.*) implies that the values are part of the url (like /vamps/artifact-id/), while the current are sent as parameters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, I misunderstood this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to ensure I understand: in deploy, QIIMP will be accessed with https, but for testing (config_test.cfg, test_configuration_manager.py) it should be accessed with http?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! In the tests we are not actually testing that QIIMP is installed or running, we are just testing that the iframes are created as expected based on the server. IMOO this is out of the scope of Qiita and the way that redbiom also works: if the service is down, Qiita simply displays an error. However, I see the source of the confusion as the config_test.cfg is to http vs https; can change if you think is worth it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmandaBirmingham, could you let us know if this looks OK or if we need some changes?

Copy link
Contributor

@AmandaBirmingham AmandaBirmingham May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd be happy if we could just add a comment, at least in config_test.cfg, indicating that in the real world QIIMP will need to be accessed with https. I often look at tests to see examples of how I should use a tool, so a comment to explicitly point out where the test needs to do something that won't work in production would help people like me keep ourselves out of trouble :) I have no other comments/requests on this PR besides that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Adding ...

# Plugin handlers - the order matters here so do not change
# qiita_db/jobs/(.*) should go after any of the
# qiita_db/jobs/(.*)/XXXX because otherwise it will match the
Expand Down