X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=csit.infra.dash%2Fapp%2Fcdash%2F__init__.py;h=77722c78bd973d7faafd0207849e27f3cde89665;hb=c31372861134f29ae6eec8d98874e030e57ab5f1;hp=20023ec157abcadd89f1750edc7acfd917fd15d1;hpb=af8e703eb180e46ca65ff0c165a21f2261896548;p=csit.git diff --git a/csit.infra.dash/app/cdash/__init__.py b/csit.infra.dash/app/cdash/__init__.py index 20023ec157..77722c78bd 100644 --- a/csit.infra.dash/app/cdash/__init__.py +++ b/csit.infra.dash/app/cdash/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -15,11 +15,13 @@ """ import logging +import pandas as pd from flask import Flask from flask_assets import Environment, Bundle from .utils.constants import Constants as C +from .data.data import Data def init_app(): @@ -31,9 +33,8 @@ def init_app(): level=C.LOG_LEVEL ) - logging.info("Application started.") - app = Flask(__name__, instance_relative_config=False) + app.logger.info("Application started.") app.config.from_object("config.Config") with app.app_context(): @@ -56,24 +57,41 @@ def init_app(): assets.register("sass_all", sass_bundle) sass_bundle.build() - # Set the time period for Trending if C.TIME_PERIOD is None or C.TIME_PERIOD > C.MAX_TIME_PERIOD: time_period = C.MAX_TIME_PERIOD else: time_period = C.TIME_PERIOD + data = Data( + data_spec_file=C.DATA_SPEC_FILE, + ).read_all_data(days=time_period) + # Import Dash applications. from .news.news import init_news - app = init_news(app) + app = init_news( + app, + data_stats=data["statistics"], + data_trending=data["trending"] + ) from .stats.stats import init_stats - app = init_stats(app, time_period=time_period) + app = init_stats( + app, + data_stats=data["statistics"], + data_trending=data["trending"] + ) from .trending.trending import init_trending - app = init_trending(app, time_period=time_period) + app = init_trending( + app, + data_trending=data["trending"] + ) from .report.report import init_report - app = init_report(app, releases=C.RELEASES) + app = init_report( + app, + data_iterative=data["iterative"] + ) return app