This commit introduces several improvements to the dashboard: - Refactored the component structure for consistency, defining callbacks within the `render` function. - Added robust error handling to data loading and callbacks to prevent crashes. - Implemented linking for SO and AIR columns in the source table. - Added and improved filtering and display options for tables. - Left-aligned columns in tables for better readability. - Cleaned up unused component files.
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from dash import Dash
|
|
import dash_bootstrap_components as dbc
|
|
|
|
from src.components.layout import create_layout
|
|
from src.data.loader_gz import load_mtbf_data
|
|
#from src.data.loader_gz import load_transition_data
|
|
from json import load
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
config_file = "./config.json"
|
|
BS = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css"
|
|
|
|
with open(config_file) as config_f:
|
|
config=load(config_f)
|
|
|
|
def main() -> None:
|
|
print(os.getenv("MY_ENV_VAR"))
|
|
print(config["Startup"])
|
|
# load the data and create the data manager
|
|
try:
|
|
data = load_mtbf_data(config["DATA_PATH"])
|
|
except FileNotFoundError:
|
|
print(f"Error: Data file not found at {config['DATA_PATH']}")
|
|
return
|
|
except Exception as e:
|
|
print(f"Error loading data: {e}")
|
|
return
|
|
|
|
app = Dash(external_stylesheets=[BS])
|
|
app.title = "Reliability Dashboard"
|
|
app.layout = create_layout(app, data)
|
|
app.run()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|