mirror of
https://github.com/getredash/redash.git
synced 2026-05-12 03:03:29 -04:00
Inject variables with app context and ability to change the logo
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="{{base_href}}"><img src="/images/redash_icon_small.png"/></a>
|
||||
<a class="navbar-brand" href="{{base_href}}"><img src="{{logoUrl}}"/></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
templateUrl: '/views/app_header.html',
|
||||
link: function ($scope) {
|
||||
$scope.dashboards = [];
|
||||
$scope.logoUrl = clientConfig.logoUrl;
|
||||
$scope.reloadDashboards = function () {
|
||||
Dashboard.query(function (dashboards) {
|
||||
$scope.dashboards = _.sortBy(dashboards, "name");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{base_href}}"><img src="/images/redash_icon_small.png"/></a>
|
||||
<a class="navbar-brand" href="{{base_href}}"><img src="{{logoUrl}}"/></a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
@@ -32,6 +32,14 @@ def status_api():
|
||||
return jsonify(status)
|
||||
|
||||
|
||||
@routes.app_context_processor
|
||||
def inject_variables():
|
||||
return dict(
|
||||
name=settings.NAME,
|
||||
logoUrl=settings.LOGO_URL,
|
||||
base_href=base_href())
|
||||
|
||||
|
||||
def init_app(app):
|
||||
from redash.handlers import embed, queries, static, authentication
|
||||
app.register_blueprint(routes)
|
||||
|
||||
@@ -111,7 +111,6 @@ def login(org_slug=None):
|
||||
google_auth_url = get_google_auth_url(next_path)
|
||||
|
||||
return render_template("login.html",
|
||||
name=settings.NAME,
|
||||
org_slug=org_slug,
|
||||
next=next_path,
|
||||
username=request.form.get('username', ''),
|
||||
|
||||
@@ -8,7 +8,7 @@ from flask_restful import abort
|
||||
from redash import models, settings
|
||||
from redash import serializers
|
||||
from redash.utils import json_dumps
|
||||
from redash.handlers import base_href, routes
|
||||
from redash.handlers import routes
|
||||
from redash.handlers.base import org_scoped_rule
|
||||
from redash.permissions import require_access, view_only
|
||||
from authentication import current_org
|
||||
@@ -41,8 +41,7 @@ def embed(query_id, visualization_id, org_slug=None):
|
||||
vis['query'] = project(vis, ('created_at', 'description', 'name', 'id', 'latest_query_data_id', 'name', 'updated_at'))
|
||||
|
||||
return render_template("embed.html",
|
||||
name=settings.NAME,
|
||||
base_href=base_href(),
|
||||
|
||||
client_config=json_dumps(client_config),
|
||||
visualization=json_dumps(vis),
|
||||
query_result=json_dumps(qr))
|
||||
@@ -73,8 +72,6 @@ def public_dashboard(token, org_slug=None):
|
||||
seed_data=json_dumps({
|
||||
'dashboard': serializers.public_dashboard(dashboard)
|
||||
}),
|
||||
base_href=base_href(),
|
||||
name=settings.NAME,
|
||||
client_config=json.dumps(settings.COMMON_CLIENT_CONFIG))
|
||||
|
||||
return response, 200, headers
|
||||
|
||||
@@ -7,7 +7,7 @@ from flask_login import current_user, login_required
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from redash import settings, __version__
|
||||
from redash.handlers import base_href, routes
|
||||
from redash.handlers import routes
|
||||
from redash.handlers.base import org_scoped_rule
|
||||
from redash.version_check import get_latest_version
|
||||
from authentication import current_org
|
||||
@@ -57,8 +57,6 @@ def index(**kwargs):
|
||||
|
||||
response = render_template("index.html",
|
||||
user=json.dumps(user),
|
||||
base_href=base_href(),
|
||||
name=settings.NAME,
|
||||
org_slug=current_org.slug,
|
||||
client_config=json.dumps(client_config))
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ def all_settings():
|
||||
|
||||
|
||||
NAME = os.environ.get('REDASH_NAME', 're:dash')
|
||||
LOGO_URL = os.environ.get('REDASH_LOGO_URL', '/images/redash_icon_small.png')
|
||||
|
||||
REDIS_URL = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379/0")
|
||||
PROXIES_COUNT = int(os.environ.get('REDASH_PROXIES_COUNT', "1"))
|
||||
@@ -206,5 +207,6 @@ COMMON_CLIENT_CONFIG = {
|
||||
'dateFormat': DATE_FORMAT,
|
||||
'dateTimeFormat': "{0} HH:mm".format(DATE_FORMAT),
|
||||
'allowAllToEditQueries': FEATURE_ALLOW_ALL_TO_EDIT_QUERIES,
|
||||
'mailSettingsMissing': MAIL_DEFAULT_SENDER is None
|
||||
'mailSettingsMissing': MAIL_DEFAULT_SENDER is None,
|
||||
'logoUrl': LOGO_URL
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<nav class="navbar navbar-default navbar-trans navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="/"><img src="/images/logo_white.png"/></a>
|
||||
<a class="navbar-brand" href="/"><img src="{{logoUrl}}"/></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user