X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fdash%2Fapp%2Fpal%2Fstats%2Fstats.py;h=5b31faca440c1660f9cc070cc965ca52ff97fbcb;hb=d2ef7bc01df66f6a27f25d061db064cf4a463267;hp=78bb6e6f88ee522fcc08332c4a233ae802d3f9e0;hpb=c01befc28450d5c2003d25876dda0201eb827735;p=csit.git diff --git a/resources/tools/dash/app/pal/stats/stats.py b/resources/tools/dash/app/pal/stats/stats.py index 78bb6e6f88..5b31faca44 100644 --- a/resources/tools/dash/app/pal/stats/stats.py +++ b/resources/tools/dash/app/pal/stats/stats.py @@ -11,15 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Instantiate the Statistics Dash applocation. +"""Instantiate the Statistics Dash application. """ import dash -import dash_bootstrap_components as dbc +from ..utils.constants import Constants as C from .layout import Layout -def init_stats(server): +def init_stats(server, time_period=None): """Create a Plotly Dash dashboard. :param server: Flask server. @@ -30,17 +30,17 @@ def init_stats(server): dash_app = dash.Dash( server=server, - routes_pathname_prefix=u"/stats/", - external_stylesheets=[dbc.themes.LUX], + routes_pathname_prefix=C.STATS_ROUTES_PATHNAME_PREFIX, + external_stylesheets=C.EXTERNAL_STYLESHEETS ) - # Custom HTML layout layout = Layout( app=dash_app, - html_layout_file="pal/templates/stats_layout.jinja2", - spec_file="pal/stats/spec_job_selection.yaml", - graph_layout_file="pal/stats/layout.yaml", - data_spec_file="pal/data/data.yaml" + html_layout_file=C.STATS_HTML_LAYOUT_FILE, + graph_layout_file=C.STATS_GRAPH_LAYOUT_FILE, + data_spec_file=C.DATA_SPEC_FILE, + tooltip_file=C.TOOLTIP_FILE, + time_period=time_period ) dash_app.index_string = layout.html_layout dash_app.layout = layout.add_content()