Skip to content

Commit

Permalink
Web UI - project logo from API settings
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavsulc committed Jul 2, 2024
1 parent 951a42b commit 203b2cf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mupifDB/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
{
"name": "Additional",
},
{
"name": "Settings",
},
{
"name": "User Interface",
},
Expand Down
13 changes: 12 additions & 1 deletion mupifDB/restApiControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,18 @@ def updateStatScheduler(runningTasks=None, scheduledTasks=None, load=None, proce


# --------------------------------------------------
# Ontology
# Settings
# --------------------------------------------------

def getSettings():
if api_type == 'granta':
return {}
response = rGet(url=RESTserver + "settings")
return response.json()


# --------------------------------------------------
# EDM
# --------------------------------------------------

def getEDMDataArray(DBName, Type):
Expand Down
6 changes: 5 additions & 1 deletion webapi/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def update_user_name(user_id: str, val):
import mupifDB


settings = mupifDB.restApiControl.getSettings()
PROJECT_NAME = settings.get('projectName', '')
PROJECT_LOGO_URL = settings.get('projectLogoUrl', '/static/images/project-logo.png')

app = Flask(__name__)
app.secret_key = AUTH_APP_SECRET_KEY
CORS(app, resources={r"/static/*": {"origins": "*"}})
Expand Down Expand Up @@ -175,7 +179,7 @@ def getUserHasAdminRights():

def my_render_template(*args,**kw):
'Wraps render_template and ads a few common keywords'
return render_template(*args,title='MuPIFDB web interface',server=request.host_url,RESTserver=RESTserver,**kw)
return render_template(*args, title='MuPIFDB web interface', server=request.host_url, RESTserver=RESTserver, projectLogoUrl=PROJECT_LOGO_URL, **kw)


def login_header_html():
Expand Down
1 change: 1 addition & 0 deletions webapi/templates/basic.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "layout.html" %}
{% block title %} {{ title }} {% endblock %}
{% block login %} {{ login }} {% endblock %}
{% block projectLogoUrl %} {{ projectLogoUrl }} {% endblock %}
{% block content %} {{ body }}{% endblock %}
2 changes: 1 addition & 1 deletion webapi/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div style="display: flex;flex-direction: row;gap: 10px;">
<img src="/static/images/mupif-logo.png" height="60px" align="right">
<img src="/static/images/ctu-logo.png" height="60px" align="right">
<img src="/static/images/project-logo.png" height="60px" align="left">
<img src="{% block projectLogoUrl %}{% endblock %}" height="60px" align="left">
<div><p>MuPIFDB web interface</p></div>
</div>
<div class="block_login">{% block login %}{% endblock %}</div>
Expand Down

0 comments on commit 203b2cf

Please sign in to comment.