Skip to content
Open
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
15 changes: 0 additions & 15 deletions .flaskenv

This file was deleted.

9 changes: 8 additions & 1 deletion .flaskenv_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ FLASK_ENV=development
DATABASE_URI=mysql+pymysql://root:@localhost/openml
SMTP_SERVER=smtp.mailtrap.io
SMTP_PORT=2525
EMAIL_SENDER=
SMTP_LOGIN=
SMTP_PASS=
APP_SECRET_KEY=
APP_SECRET_KEY=abcd
JWT_SECRET_KEY=abcd
EMAIL_SERVER=localhost:5000
SERVER_URL=https://localhost:5000
REDIRECT_URL=https://localhost:5000
BACKEND_SERVER=http://website/api/v1/xml/
SEND_EMAIL=False
TESTING=True
BACKEND_BASE_URL=http://website/
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
.env.test.local
.env.production.local
.env
.reactenv
.reactenv_aws
.flaskenv

npm-debug.log*
yarn-debug.log*
Expand Down Expand Up @@ -55,4 +58,4 @@ temp_data/

users.sql
node_modules
node_modules.nosync
node_modules.nosync
7 changes: 7 additions & 0 deletions TEMPLATE.reactenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# URL that tells React where to find the Flask app.
# When running on a remote server, change it to the server URL
REACT_APP_SERVER_URL=http://localhost:5000/
# URL used to connect to the PHP website for downloading data
REACT_APP_OLD_SERVER_URL=http://localhost/
# Elastic Search URL
REACT_APP_ES_URL=http://localhost:9200/
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Flask-Compress==1.4.0
Flask-Cors==3.0.9
Flask-Dance==3.0.0
Flask-DebugToolbar==0.10.1
Flask-JWT-Extended==3.24.1
Flask-JWT-Extended==3.25.1
Flask-Login==0.4.1
Flask-Mail==0.9.1
Flask-Migrate==2.5.2
Expand Down Expand Up @@ -69,7 +69,7 @@ pluggy==0.13.1
poyo==0.5.0
py==1.10.0
pycparser==2.19
PyJWT==2.4.0
PyJWT
PyMySQL==0.9.3
pyOpenSSL==19.0.0
pyparsing==2.4.6
Expand Down
13 changes: 10 additions & 3 deletions server/data/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def data_edit():
current_user = get_jwt_identity()
user = User.query.filter_by(email=current_user).first()
openml.config.apikey = user.session_hash
testing = os.environ.get("TESTING")
openml.config.server = os.getenv('BACKEND_SERVER')
testing = os.environ.get("TESTING", "False") == "True"
if testing:
openml.config.start_using_configuration_for_example()
url = request.args.get("url")
Expand Down Expand Up @@ -155,10 +156,15 @@ def data_upload():
user = User.query.filter_by(email=current_user).first()
user_api_key = user.session_hash
openml.config.apikey = user.session_hash
testing = os.environ.get("TESTING")
openml.config.server = os.getenv('BACKEND_SERVER')
testing = os.environ.get("TESTING", "False") == "True"
print(testing)
if testing:
print("Set testing server")
openml.config.start_using_configuration_for_example()
# openml.config.start_using_configuration_for_example()
# else:
# openml.config.stop_using_configuration_for_example()

print(request)
data_file = request.files["dataset"]
Expand Down Expand Up @@ -244,7 +250,8 @@ def data_tag():
current_user = get_jwt_identity()
user = User.query.filter_by(email=current_user).first()
openml.config.apikey = user.session_hash
testing = os.environ.get("TESTING")
openml.config.server = os.getenv('BACKEND_SERVER')
testing = os.environ.get("TESTING", "False") == "True"
if testing:
openml.config.start_using_configuration_for_example()
url = request.args.get("url")
Expand Down
17 changes: 12 additions & 5 deletions server/public/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import hashlib
import os

from flask_cors import CORS
from server.extensions import db
Expand All @@ -16,7 +17,7 @@
blueprint = Blueprint("public", __name__)

CORS(blueprint)

do_send_email = os.environ.get("SEND_EMAIL", "True") == "True"

@blueprint.route("/signup", methods=["POST"])
def signupfunc():
Expand All @@ -37,7 +38,10 @@ def signupfunc():
user.remember_code = "0000"
user.created_on = "0000"
user.last_login = "0000"
user.active = "0"
if do_send_email:
user.active = "0"
else:
user.active = "1"
user.first_name = register_obj["first_name"]
user.last_name = register_obj["last_name"]
user.company = "0000"
Expand All @@ -53,7 +57,8 @@ def signupfunc():
timestamp = timestamp.strftime("%d %H:%M:%S")
md5_digest = hashlib.md5(timestamp.encode()).hexdigest()
user.update_activation_code(md5_digest)
confirmation_email(user.email, md5_digest)
if do_send_email:
confirmation_email(user.email, md5_digest)
db.session.add(user)
# db.session.commit()
# user_ = User.query.filter_by(email=register_obj["email"]).first()
Expand All @@ -74,7 +79,8 @@ def password():
user = User.query.filter_by(email=jobj["email"]).first()
user.update_forgotten_code(md5_digest)
# user.update_forgotten_time(timestamp)
forgot_password_email(user.email, md5_digest)
if do_send_email:
forgot_password_email(user.email, md5_digest)
db.session.merge(user)
db.session.commit()
return jsonify({"msg": "Token sent"}), 200
Expand All @@ -89,7 +95,8 @@ def confirmation_token():
md5_digest = hashlib.md5(timestamp.encode()).hexdigest()
user = User.query.filter_by(email=jobj["email"]).first()
user.update_activation_code(md5_digest)
confirmation_email(user.email, md5_digest)
if do_send_email:
confirmation_email(user.email, md5_digest)
# updating user groups here
user_ = UserGroups(user_id=user.id, group_id=2)
db.session.merge(user)
Expand Down
56 changes: 30 additions & 26 deletions server/src/client/app/src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ const Brand = styled(ListItem)`
props.searchcolor && props.currenttheme === 1
? props.searchcolor
: props.searchcolor
? props.theme.sidebar.background
: props.theme.sidebar.header.background};
? props.theme.sidebar.background
: props.theme.sidebar.header.background};
padding-left: ${props => props.theme.spacing(3)};
font-size: 13pt;
height: 56px;
Expand Down Expand Up @@ -290,12 +290,16 @@ class Sidebar extends React.Component {
axiosCancelToken = axios.CancelToken.source();

countUpdate = async () => {
const ELASTICSEARCH_SERVER = "https://www.openml.org/es/";
const ELASTICSEARCH_SERVER = process.env.REACT_APP_ES_URL || "https://www.openml.org/es/";

const data = {
size: 0,
query: { bool: { should: [ { term: { status: "active" } },
{ bool: { must_not: { exists: { field: "status" } } } } ] } },
query: {
bool: {
should: [{ term: { status: "active" } },
{ bool: { must_not: { exists: { field: "status" } } } }]
}
},
aggs: { count_by_type: { terms: { field: "_type", size: 100 } } }
};

Expand All @@ -318,11 +322,11 @@ class Sidebar extends React.Component {
.catch(error => {
console.log(error);
});

// second query for benchmark counts
const bench_data = {
size: 0,
query: { bool : { filter : { bool: { should: [ {"wildcard": { "name": "*benchmark*" }}, {"wildcard": { "name": "*suite*" }}] } }}}
query: { bool: { filter: { bool: { should: [{ "wildcard": { "name": "*benchmark*" } }, { "wildcard": { "name": "*suite*" } }] } } } }
};
axios
.post(ELASTICSEARCH_SERVER + "study/study/_search", bench_data, headers)
Expand Down Expand Up @@ -428,7 +432,7 @@ class Sidebar extends React.Component {
currentcolor={context.getColor()}
badge={
context.type === undefined &&
this.state.counts[category.entity_type]
this.state.counts[category.entity_type]
? this.state.counts[category.entity_type]
: 0
}
Expand Down Expand Up @@ -467,24 +471,24 @@ class Sidebar extends React.Component {
component={NavLink}
searchExpand={
category.entity_type === context.type &&
context.searchCollapsed
context.searchCollapsed
? () => context.collapseSearch(false)
: undefined
}
badge={
category.entity_type === context.type
? (context.filters.measure_type &&
route.subtype.split("_")[1] ===
context.filters.measure_type
.value) ||
route.subtype.split("_")[1] ===
context.filters.measure_type
.value) ||
(context.filters.study_type &&
route.subtype ===
context.filters.study_type.value) // Only show subtype counts if a subtype is selected
context.filters.study_type.value) // Only show subtype counts if a subtype is selected
? context.counts
: 0
: this.state.counts[category.entity_type]
? this.state.counts[category.entity_type]
: 0
: this.state.counts[category.entity_type]
? this.state.counts[category.entity_type]
: 0
}
/>
))}
Expand Down Expand Up @@ -513,20 +517,20 @@ class Sidebar extends React.Component {
: this.state.counts[category.entity_type]
: context.type === undefined &&
this.state.counts[category.entity_type]
? this.state.counts[category.entity_type]
: 0
? this.state.counts[category.entity_type]
: 0
}
activecategory={
(location.pathname !== "/search" &&
location.pathname === category.path) ||
(category.entity_type === context.type &&
context.type !== undefined)
(category.entity_type === context.type &&
context.type !== undefined)
? "true"
: "false"
}
searchExpand={
category.entity_type === context.type &&
context.searchCollapsed
context.searchCollapsed
? () => context.collapseSearch(false)
: undefined
}
Expand Down Expand Up @@ -557,7 +561,7 @@ class Sidebar extends React.Component {
}
searchExpand={
category.entity_type === context.type &&
context.searchCollapsed
context.searchCollapsed
? context.collapseSearch
: undefined
}
Expand All @@ -579,7 +583,7 @@ class Sidebar extends React.Component {
<Tooltip title="Expand menu" placement="top-start">
<Button
color="secondary"
onClick={() => context.miniDrawerToggle()}
onClick={() => context.miniDrawerToggle()}
theme={context.currentTheme}>
<FontAwesomeIcon
icon="chevron-right"
Expand All @@ -589,7 +593,7 @@ class Sidebar extends React.Component {
</Tooltip>
) : (
<Tooltip title="Minify menu" placement="top-start">
<Button
<Button
onClick={() => context.miniDrawerToggle()}
color="secondary"
theme={context.currentTheme}>
Expand All @@ -613,9 +617,9 @@ class Sidebar extends React.Component {
title="Switch to Light theme"
placement="top-start"
>
<Button
<Button
color="secondary"
onClick={() => context.setTheme(1)}
onClick={() => context.setTheme(1)}
theme={context.currentTheme}>
<FontAwesomeIcon
icon="moon"
Expand Down
Loading