22
33from forestadmin .agent_toolkit .utils .forest_schema .action_values import ForestValueConverter
44from forestadmin .agent_toolkit .utils .forest_schema .generator_action_field_widget import GeneratorActionFieldWidget
5+ from forestadmin .agent_toolkit .utils .forest_schema .generator_field import SchemaFieldGenerator
56from forestadmin .agent_toolkit .utils .forest_schema .generator_field_v2 import SchemaFieldGeneratorV2
7+ from forestadmin .agent_toolkit .utils .forest_schema .type import ForestServerActionField
68from forestadmin .agent_toolkit .utils .forest_schema .type_v2 import SchemaV2Action , SchemaV2ActionField
79from forestadmin .datasource_toolkit .collections import Collection
810from forestadmin .datasource_toolkit .datasource_customizer .collection_customizer import CollectionCustomizer
1315
1416
1517class SchemaActionGeneratorV2 :
18+ DUMMY_FIELDS = [
19+ ForestServerActionField (
20+ field = "Loading..." ,
21+ type = SchemaFieldGenerator .build_column_type (PrimitiveType .STRING ),
22+ isReadOnly = True ,
23+ defaultValue = "Form is loading" ,
24+ value = None ,
25+ description = "" ,
26+ enums = None ,
27+ hook = None ,
28+ isRequired = False ,
29+ reference = None ,
30+ widget = None ,
31+ )
32+ ]
1633
1734 @classmethod
1835 async def build (cls , prefix : str , collection : Union [Collection , CollectionCustomizer ], name : str ) -> SchemaV2Action :
@@ -25,7 +42,11 @@ async def build(cls, prefix: str, collection: Union[Collection, CollectionCustom
2542 type = schema .scope .value .lower (), # type:ignore
2643 endpoint = f"/forest/_actions/{ collection .name } /{ idx } /{ slug } " , # type:ignore
2744 download = bool (schema .generate_file ),
28- fields = await cls .build_fields (collection , schema , name ),
45+ fields = (
46+ await cls .build_fields (collection , schema , name )
47+ if schema .static_form
48+ else SchemaActionGeneratorV2 .DUMMY_FIELDS
49+ ),
2950 isDynamicForm = not schema .static_form ,
3051 )
3152
0 commit comments