Skip to content

Commit

Permalink
Merge pull request #8 from sot/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
javierggt authored Jul 19, 2022
2 parents 19e9a9c + cf5a894 commit 545e0ad
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 491 deletions.
23 changes: 20 additions & 3 deletions kadi_apps/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,23 @@ def internal_error(e):
return render_template('500.html'), 500


def index():
"""Return main page"""
return render_template(
'index.html',
)


def api_index():
"""Return main API page"""
return render_template(
'api_index.html',
)


def get_app(name=__name__, settings='devel'):
import kadi_apps
from kadi_apps.blueprints import auth, test, astromon, ska_api as api, kadi, find_attitude
from kadi_apps.blueprints import auth, test, ska_api as api, kadi, find_attitude
from kadi_apps.blueprints import mica, star_hist, pcad_acq

logger = pyyaks.logger.get_logger(name='kadi_apps', level='INFO')
Expand Down Expand Up @@ -53,7 +67,10 @@ def get_app(name=__name__, settings='devel'):
app.register_error_handler(404, page_not_found)
app.register_error_handler(500, internal_error)

app.register_blueprint(kadi.blueprint, url_prefix='/')
app.add_url_rule("/", view_func=index)
app.add_url_rule("/api", view_func=api_index)

app.register_blueprint(kadi.blueprint, url_prefix='/kadi')
app.register_blueprint(find_attitude.blueprint, url_prefix='/find_attitude')
app.register_blueprint(mica.blueprint, url_prefix='/mica')
app.register_blueprint(star_hist.blueprint, url_prefix='/star_hist')
Expand All @@ -62,7 +79,7 @@ def get_app(name=__name__, settings='devel'):
app.register_blueprint(auth.blueprint, url_prefix='/api/auth')
app.register_blueprint(test.blueprint, url_prefix='/api/test')
app.register_blueprint(api.blueprint, url_prefix='/api/ska_api')
app.register_blueprint(astromon.blueprint, url_prefix='/api/astromon')
# app.register_blueprint(astromon.blueprint, url_prefix='/api/astromon')

return app

Expand Down
10 changes: 1 addition & 9 deletions kadi_apps/blueprints/kadi/kadi.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ def filter_events(
return queryset


@blueprint.route("/")
def index():
"""Return help page for web-kadi API access"""
return render_template(
'index.html',
)


@blueprint.route("/events/")
def events():
"""Return help page for web-kadi API access"""
Expand Down Expand Up @@ -182,7 +174,7 @@ def event_detail(model_name, primary_key):
)


@blueprint.route("/events/<string:model_name>/list")
@blueprint.route("/events/<string:model_name>/list/")
def event_list(model_name):
"""Return a list of kadi events"""

Expand Down
10 changes: 8 additions & 2 deletions kadi_apps/blueprints/kadi/templates/events/event_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ <h2> {{ model_description }} list </h2>
{% endif %}
</td>
<td>
<form action="/kadi/events/{{ model_name }}/list" method="get">
<span data-tooltip data-max-width="600" data-width="600" class="has-tip" title="{{filter_help|safe}}">Filter: ?</span>
<form action="{{ url_for('kadi.event_list', model_name=model_name) }}" method="get">
<span
data-bs-toggle="tooltip"
data-bs-html="true"
data-bs-placement="bottom"
title="{{ filter_help | safe }}">
Filter: ?
</span>
<input type="text" name="filter" value="{{filter}}" size="70">
</form>
</td>
Expand Down
8 changes: 1 addition & 7 deletions kadi_apps/blueprints/ska_api/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Blueprint, render_template
from flask import Blueprint
from flask import request

import logging
Expand All @@ -20,12 +20,6 @@
blueprint = Blueprint('ska_api', __name__, template_folder='templates')


@blueprint.route("/")
def show_help():
"""Return help page for web-kadi API access"""
return render_template('help.html')


class NotFound(Exception):
pass

Expand Down
Loading

0 comments on commit 545e0ad

Please sign in to comment.