Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -64,19 +64,26 @@ def update_url_list(_):
|
|
64 |
|
65 |
@callback(
|
66 |
Output('content-iframe', 'src'),
|
67 |
-
Input({'type': 'url-button', 'index': dash.ALL}, 'n_clicks')
|
|
|
68 |
)
|
69 |
-
def update_iframe(n_clicks):
|
70 |
ctx = dash.callback_context
|
71 |
if not ctx.triggered:
|
|
|
72 |
return dash.no_update
|
|
|
73 |
button_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
74 |
clicked_id = eval(button_id)['index']
|
|
|
|
|
75 |
links = load_links()
|
76 |
for link in links:
|
77 |
if link['id'] == clicked_id:
|
78 |
-
print(f"Loading URL: {link['url']}")
|
79 |
return link['url']
|
|
|
|
|
80 |
return dash.no_update
|
81 |
|
82 |
if __name__ == '__main__':
|
|
|
64 |
|
65 |
@callback(
|
66 |
Output('content-iframe', 'src'),
|
67 |
+
Input({'type': 'url-button', 'index': dash.ALL}, 'n_clicks'),
|
68 |
+
prevent_initial_call=True
|
69 |
)
|
70 |
+
def update_iframe(*n_clicks):
|
71 |
ctx = dash.callback_context
|
72 |
if not ctx.triggered:
|
73 |
+
print("No button clicked")
|
74 |
return dash.no_update
|
75 |
+
|
76 |
button_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
77 |
clicked_id = eval(button_id)['index']
|
78 |
+
print(f"Button clicked: {clicked_id}")
|
79 |
+
|
80 |
links = load_links()
|
81 |
for link in links:
|
82 |
if link['id'] == clicked_id:
|
83 |
+
print(f"Loading URL: {link['url']}")
|
84 |
return link['url']
|
85 |
+
|
86 |
+
print("No matching URL found")
|
87 |
return dash.no_update
|
88 |
|
89 |
if __name__ == '__main__':
|