Skip to content

Commit 48f3b83

Browse files
committed
Update streamlit.py
1 parent 9c13133 commit 48f3b83

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

bin/streamlit.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ def update_name():
165165
last_modified = st.date_input("Last Modified Date", value=last_modified_date, key="last_modified")
166166

167167
st.write(f"Debug: Template description: {template.get('Description', '')}")
168-
description = st.text_area("Description", value=template.get('Description', ''), key="description", height=150)
168+
description = st.text_area(
169+
"Description",
170+
value=template.get('Description', ''),
171+
key="description",
172+
height=150
173+
)
169174
st.write(f"Debug: Input description value: {description}")
170175

171176
with tab2:
@@ -292,10 +297,18 @@ def update_name():
292297
if not st.session_state.name or st.session_state.name.strip() == "":
293298
st.error("A name for the RMM Tool is required. Please enter a name in the 'Basic Info' tab.")
294299
else:
300+
# Get the description from the form
301+
description_value = st.session_state.description # Get description from session state
302+
st.write(f"Debug: Description from session: {description_value}")
303+
304+
if not description_value or description_value.strip() == "":
305+
st.error("A description is required. Please enter a description in the 'Basic Info' tab.")
306+
return
307+
295308
yaml_data = {
296309
'Name': st.session_state.name,
297310
'Category': category,
298-
'Description': description,
311+
'Description': description_value, # Use the description from session state
299312
'Author': author,
300313
'Created': created.strftime("%Y-%m-%d"),
301314
'LastModified': last_modified.strftime("%Y-%m-%d"),
@@ -326,15 +339,12 @@ def update_name():
326339
'Acknowledgement': acknowledgements
327340
}
328341

329-
st.write(f"Debug: Description value: {description}")
330-
331-
yaml_data = {k: v for k, v in yaml_data.items() if v or k == 'Description'}
332-
for key in yaml_data.get('Details', {}):
333-
if isinstance(yaml_data['Details'][key], list):
334-
yaml_data['Details'][key] = [item for item in yaml_data['Details'][key] if item]
335-
elif isinstance(yaml_data['Details'][key], dict):
336-
yaml_data['Details'][key] = {k: v for k, v in yaml_data['Details'][key].items() if v}
342+
# Debug output
343+
st.write(f"Debug: Final description in yaml_data: {yaml_data.get('Description', '')}")
337344

345+
# Don't filter out Description even if empty
346+
yaml_data = {k: v for k, v in yaml_data.items()} # Remove the filtering entirely
347+
338348
schema = load_schema()
339349
if schema:
340350
validation_errors = validate_yaml_data(yaml_data, schema)

0 commit comments

Comments
 (0)