コード例 #1
0
def create_hydrograph_app(server):
    hydrograph_app = dash.Dash(
        name="hydrograph",
        server=server,
        url_base_pathname="/hydrograph/",
        external_stylesheets=[FONT_AWESOME, BOOTSTRAP_CSS, MAIN_CSS],
        external_scripts=[JQUERY_JS, POPPER_JS, BOOTSTRAP_JS],
        title='Hydrograph Analysis')

    hydrograph_app.layout = MAIN_LAYOUT

    hydrograph_callback(app=hydrograph_app)

    for view_function in hydrograph_app.server.view_functions:
        if view_function.startswith(hydrograph_app.config.url_base_pathname):
            hydrograph_app.server.view_functions[
                view_function] = login_required(
                    hydrograph_app.server.view_functions[view_function])

    return hydrograph_app
コード例 #2
0
def create_precipitation_app(server):
    precipitation_app = dash.Dash(
        name="precipitation",
        server=server,
        url_base_pathname="/precipitation/",
        external_stylesheets=[FONT_AWESOME, BOOTSTRAP_CSS, MAIN_CSS],
        external_scripts=[JQUERY_JS, POPPER_JS, BOOTSTRAP_JS],
        title='Precipitation Analysis')

    precipitation_app.layout = SERVER_MAIN_LAYOUT

    precipitation_callback(app=precipitation_app)

    for view_function in precipitation_app.server.view_functions:
        if view_function.startswith(
                precipitation_app.config.url_base_pathname):
            precipitation_app.server.view_functions[
                view_function] = login_required(
                    precipitation_app.server.view_functions[view_function])

    return precipitation_app
コード例 #3
0
def create_isotope_analysis_app(server):
    isotope_analysis_app = dash.Dash(
        name="isotope_analysis",
        server=server,
        url_base_pathname="/isotope_analysis/",
        external_stylesheets=[MAIN_CSS, BOOTSTRAP_CSS],
        external_scripts=[JQUERY_JS, POPPER_JS, BOOTSTRAP_JS],
        title='Isotope Analysis')

    isotope_analysis_app.layout = MAIN_LAYOUT

    isotope_analysis_callback(app=isotope_analysis_app)

    for view_function in isotope_analysis_app.server.view_functions:
        if view_function.startswith(
                isotope_analysis_app.config.url_base_pathname):
            isotope_analysis_app.server.view_functions[
                view_function] = login_required(
                    isotope_analysis_app.server.view_functions[view_function])

    return isotope_analysis_app
コード例 #4
0
# -*- coding : utf-8 -*-
from flask import Response, jsonify, request, Blueprint, flash, redirect

from app import db, render_template, send_from_directory
from app.rtm.views import *
from app.rtm.views.real_time_view import RM_REAL_TIME_VIEW
from app.obm.services.device_service import MD_KEEP_ALIVE
from flask_login.utils import current_user, login_required

rtm = Blueprint('rtm', __name__, url_prefix='/rtm')

rtm.add_url_rule('/realtime',
                 view_func=login_required(
                     RM_REAL_TIME_VIEW().as_view('rm_real_time_view')))


@rtm.route('/keep_alive', methods=['GET', 'POST'])
@login_required
def keep_alive():
    if request.method == 'POST':
        email = current_user.id
        service = MD_KEEP_ALIVE()
        return service.get_status(email)

    return render_template('rtm/keep_alive.html')