|
1 | 1 | """Main Dash application for Torc workflow management.""" |
2 | 2 |
|
3 | 3 | import os |
4 | | -from dash import Dash, html, dcc |
| 4 | +from dash import Dash, html, dcc, Input, Output, State, clientside_callback |
5 | 5 | import dash_bootstrap_components as dbc |
6 | 6 |
|
7 | 7 | # Initialize the Dash app with Bootstrap theme |
|
29 | 29 | dcc.Store(id="dag-workflow-id-store"), |
30 | 30 | dcc.Store(id="delete-workflow-id-store"), |
31 | 31 |
|
| 32 | + # Hidden elements for backward compatibility with old callbacks |
| 33 | + html.Div(id="selected-workflow-badge", style={"display": "none"}), |
| 34 | + html.Div(id="global-workflows-table-container", style={"display": "none"}), |
| 35 | + dcc.Interval(id="global-refresh-interval", interval=30000, disabled=True), |
| 36 | + dbc.Collapse(id="workflow-selection-collapse", is_open=False), |
| 37 | + dcc.Checklist(id="global-auto-refresh-toggle", options=[], value=[], style={"display": "none"}), |
| 38 | + html.Button(id="global-refresh-workflows-button", style={"display": "none"}), |
| 39 | + html.Button(id="workflow-selection-collapse-button", style={"display": "none"}), |
| 40 | + |
32 | 41 | # Confirmation modal for workflow deletion |
33 | 42 | dbc.Modal( |
34 | 43 | [ |
|
163 | 172 | ) |
164 | 173 | ), |
165 | 174 |
|
166 | | - # Workflow Selection panel (collapsible) |
167 | | - dbc.Row( |
168 | | - dbc.Col( |
169 | | - dbc.Card( |
170 | | - [ |
171 | | - dbc.CardHeader( |
172 | | - dbc.Button( |
173 | | - [ |
174 | | - html.I(className="fas fa-list me-2"), |
175 | | - "Workflow Selection", |
176 | | - html.Span(id="selected-workflow-badge", className="badge bg-primary ms-2"), |
177 | | - ], |
178 | | - id="workflow-selection-collapse-button", |
179 | | - className="w-100 text-start", |
180 | | - color="light", |
181 | | - n_clicks=0, |
182 | | - ) |
183 | | - ), |
184 | | - dbc.Collapse( |
185 | | - dbc.CardBody( |
186 | | - [ |
187 | | - dbc.Row( |
188 | | - [ |
189 | | - dbc.Col( |
190 | | - [ |
191 | | - dbc.Button( |
192 | | - [html.I(className="fas fa-sync me-2"), "Refresh Workflows"], |
193 | | - id="global-refresh-workflows-button", |
194 | | - color="primary", |
195 | | - size="sm", |
196 | | - className="me-2", |
197 | | - ), |
198 | | - dbc.Checklist( |
199 | | - id="global-auto-refresh-toggle", |
200 | | - options=[ |
201 | | - {"label": " Auto-refresh (every 30s)", "value": "auto"}, |
202 | | - ], |
203 | | - value=[], |
204 | | - inline=True, |
205 | | - switch=True, |
206 | | - ), |
207 | | - ], |
208 | | - className="mb-3", |
209 | | - ), |
210 | | - ] |
211 | | - ), |
212 | | - dbc.Row( |
213 | | - dbc.Col( |
214 | | - html.Div(id="global-workflows-table-container"), |
215 | | - ) |
216 | | - ), |
217 | | - ] |
218 | | - ), |
219 | | - id="workflow-selection-collapse", |
220 | | - is_open=True, |
221 | | - ), |
222 | | - ], |
223 | | - className="mb-4" |
224 | | - ) |
225 | | - ) |
226 | | - ), |
227 | | - |
228 | | - # Hidden interval component for auto-refresh |
229 | | - dcc.Interval(id="global-refresh-interval", interval=30000, disabled=True), |
230 | | - |
231 | 175 | # Main tabs |
232 | 176 | dbc.Row( |
233 | 177 | dbc.Col( |
234 | 178 | dbc.Tabs( |
235 | 179 | [ |
236 | 180 | dbc.Tab( |
237 | | - label="View Workflows", |
238 | | - tab_id="view-tab", |
| 181 | + label="Manage Workflows", |
| 182 | + tab_id="run-tab", |
239 | 183 | label_style={"cursor": "pointer"}, |
240 | 184 | active_label_class_name="fw-bold", |
241 | 185 | ), |
242 | 186 | dbc.Tab( |
243 | | - label="Manage Workflows", |
244 | | - tab_id="run-tab", |
| 187 | + label="Workflow Details", |
| 188 | + tab_id="view-tab", |
245 | 189 | label_style={"cursor": "pointer"}, |
246 | 190 | active_label_class_name="fw-bold", |
247 | 191 | ), |
|
271 | 215 | ), |
272 | 216 | ], |
273 | 217 | id="main-tabs", |
274 | | - active_tab="view-tab", |
| 218 | + active_tab="run-tab", |
275 | 219 | ) |
276 | 220 | ) |
277 | 221 | ), |
|
297 | 241 | # Import callbacks after layout is defined to avoid circular imports |
298 | 242 | from . import callbacks # noqa: F401 |
299 | 243 |
|
| 244 | + |
300 | 245 | if __name__ == "__main__": |
301 | 246 | app.run_server(debug=True, host="0.0.0.0", port=8050) |
0 commit comments