mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 02:47:59 +08:00
fix: Improve Read File and Write File storage location UX (#11589)
* advanced mode for storage * add tests * hide storage location * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -718,3 +718,17 @@ class TestFileComponentCloudEnvironment:
|
||||
# Even if pipeline is set to "standard", OCR engine should be disabled in cloud
|
||||
assert result["ocr_engine"]["show"] is False
|
||||
assert result["ocr_engine"]["value"] == "None"
|
||||
|
||||
|
||||
class TestFileComponentStorageLocation:
|
||||
"""Tests for default Local storage and Storage Location in advanced controls."""
|
||||
|
||||
def test_storage_location_defaults_to_local(self):
|
||||
"""Test that storage_location input defaults to Local when component is dropped."""
|
||||
storage_input = next(i for i in FileComponent.inputs if i.name == "storage_location")
|
||||
assert storage_input.value == [{"name": "Local", "icon": "hard-drive"}]
|
||||
|
||||
def test_storage_location_is_advanced(self):
|
||||
"""Test that storage_location is in advanced controls."""
|
||||
storage_input = next(i for i in FileComponent.inputs if i.name == "storage_location")
|
||||
assert storage_input.advanced is True
|
||||
|
||||
@ -462,3 +462,13 @@ class TestSaveToFileComponent(ComponentTestBaseWithoutClient):
|
||||
assert result["append_mode"]["show"] is False, "append_mode should be hidden for Google Drive storage"
|
||||
assert result["file_name"]["show"] is True
|
||||
assert result["gdrive_format"]["show"] is True
|
||||
|
||||
def test_storage_location_defaults_to_local(self, component_class):
|
||||
"""Test that storage_location input defaults to Local when component is dropped."""
|
||||
storage_input = next(i for i in component_class.inputs if i.name == "storage_location")
|
||||
assert storage_input.value == [{"name": "Local", "icon": "hard-drive"}]
|
||||
|
||||
def test_storage_location_is_advanced(self, component_class):
|
||||
"""Test that storage_location is in advanced controls."""
|
||||
storage_input = next(i for i in component_class.inputs if i.name == "storage_location")
|
||||
assert storage_input.advanced is True
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -766,7 +766,7 @@
|
||||
},
|
||||
"File": {
|
||||
"versions": {
|
||||
"0.3.0": "fccb3ab047f1"
|
||||
"0.3.0": "12a5841f1a03"
|
||||
}
|
||||
},
|
||||
"KnowledgeIngestion": {
|
||||
@ -781,7 +781,7 @@
|
||||
},
|
||||
"SaveToFile": {
|
||||
"versions": {
|
||||
"0.3.0": "6657b458359b"
|
||||
"0.3.0": "6d0e4842271e"
|
||||
}
|
||||
},
|
||||
"FirecrawlCrawlApi": {
|
||||
|
||||
@ -109,6 +109,8 @@ class FileComponent(BaseFileComponent):
|
||||
options=_get_storage_location_options(),
|
||||
real_time_refresh=True,
|
||||
limit=1,
|
||||
value=[{"name": "Local", "icon": "hard-drive"}],
|
||||
advanced=True,
|
||||
),
|
||||
*_base_inputs,
|
||||
StrInput(
|
||||
|
||||
@ -53,7 +53,6 @@ class SaveToFileComponent(Component):
|
||||
GDRIVE_FORMAT_CHOICES = ["txt", "json", "csv", "xlsx", "slides", "docs", "jpg", "mp3"]
|
||||
|
||||
inputs = [
|
||||
# Storage location selection
|
||||
SortableListInput(
|
||||
name="storage_location",
|
||||
display_name="Storage Location",
|
||||
@ -62,6 +61,8 @@ class SaveToFileComponent(Component):
|
||||
options=_get_storage_location_options(),
|
||||
real_time_refresh=True,
|
||||
limit=1,
|
||||
value=[{"name": "Local", "icon": "hard-drive"}],
|
||||
advanced=True,
|
||||
),
|
||||
# Common inputs
|
||||
HandleInput(
|
||||
|
||||
Reference in New Issue
Block a user