Spaces:
Running
Running
Maharshi Gor
commited on
Commit
·
3808ead
1
Parent(s):
c225678
Bugfix: auto scroll to bottom on pipeline change.
Browse files
src/components/model_pipeline/model_pipeline.py
CHANGED
@@ -294,12 +294,15 @@ class PipelineInterface:
|
|
294 |
)
|
295 |
|
296 |
# Connect the export button to show the workflow JSON
|
297 |
-
self.add_triggers_for_pipeline_export([export_btn.click], self.pipeline_state)
|
298 |
export_btn.click(self.validate_workflow, inputs=[self.pipeline_state], outputs=[]).success(
|
299 |
fn=lambda: gr.update(visible=True, open=True), outputs=[self.config_accordion]
|
300 |
)
|
301 |
|
302 |
-
def add_triggers_for_pipeline_export(self, triggers: list, input_pipeline_state: gr.State):
|
|
|
|
|
|
|
303 |
gr.on(
|
304 |
triggers,
|
305 |
self.validate_workflow,
|
@@ -309,5 +312,5 @@ class PipelineInterface:
|
|
309 |
fn=self.sm.get_formatted_config,
|
310 |
inputs=[self.pipeline_state, gr.State("yaml")],
|
311 |
outputs=[self.config_output],
|
312 |
-
js=
|
313 |
)
|
|
|
294 |
)
|
295 |
|
296 |
# Connect the export button to show the workflow JSON
|
297 |
+
self.add_triggers_for_pipeline_export([export_btn.click], self.pipeline_state, scroll=True)
|
298 |
export_btn.click(self.validate_workflow, inputs=[self.pipeline_state], outputs=[]).success(
|
299 |
fn=lambda: gr.update(visible=True, open=True), outputs=[self.config_accordion]
|
300 |
)
|
301 |
|
302 |
+
def add_triggers_for_pipeline_export(self, triggers: list, input_pipeline_state: gr.State, scroll: bool = False):
|
303 |
+
js = None
|
304 |
+
if scroll:
|
305 |
+
js = "() => {document.querySelector('.pipeline-preview').scrollIntoView({behavior: 'smooth'})}"
|
306 |
gr.on(
|
307 |
triggers,
|
308 |
self.validate_workflow,
|
|
|
312 |
fn=self.sm.get_formatted_config,
|
313 |
inputs=[self.pipeline_state, gr.State("yaml")],
|
314 |
outputs=[self.config_output],
|
315 |
+
js=js,
|
316 |
)
|