Spaces:
Sleeping
Sleeping
Commit ·
510741e
1
Parent(s): 2a1daef
Fix the empty list that was forming when uploading workbook and then blueprint
Browse filesmodified: .gitignore
modified: ui/static/app.js
modified: ui_app.py
- .gitignore +3 -0
- ui/static/app.js +3 -1
- ui_app.py +5 -1
.gitignore
CHANGED
|
@@ -4,3 +4,6 @@
|
|
| 4 |
|
| 5 |
__pycache__/
|
| 6 |
*.py[cod]
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
__pycache__/
|
| 6 |
*.py[cod]
|
| 7 |
+
|
| 8 |
+
venv/
|
| 9 |
+
docs/
|
ui/static/app.js
CHANGED
|
@@ -96,8 +96,10 @@
|
|
| 96 |
? `<div class="file-pill">${escapeHtml(data.apply_blueprint_filename)}</div>`
|
| 97 |
: "";
|
| 98 |
}
|
| 99 |
-
if (data.apply_sheets) {
|
| 100 |
setApplySheets(data.apply_sheets, data.apply_selected_sheet);
|
|
|
|
|
|
|
| 101 |
}
|
| 102 |
applyButton.disabled = !(applyWorkbookPath && applyBlueprintPath && applySheetSelect.value);
|
| 103 |
} catch (error) {
|
|
|
|
| 96 |
? `<div class="file-pill">${escapeHtml(data.apply_blueprint_filename)}</div>`
|
| 97 |
: "";
|
| 98 |
}
|
| 99 |
+
if (Array.isArray(data.apply_sheets) && data.apply_sheets.length) {
|
| 100 |
setApplySheets(data.apply_sheets, data.apply_selected_sheet);
|
| 101 |
+
} else if (applyWorkbookPath && applySheetSelect.options.length) {
|
| 102 |
+
applySheetSelect.disabled = false;
|
| 103 |
}
|
| 104 |
applyButton.disabled = !(applyWorkbookPath && applyBlueprintPath && applySheetSelect.value);
|
| 105 |
} catch (error) {
|
ui_app.py
CHANGED
|
@@ -298,9 +298,13 @@ def prepare_apply_blueprint():
|
|
| 298 |
try:
|
| 299 |
update_ui_state_from_form(request.form)
|
| 300 |
state = get_state()
|
|
|
|
| 301 |
if state["apply_workbook_path"] and Path(state["apply_workbook_path"]).is_file():
|
| 302 |
state["apply_sheets"] = read_workbook_sheets(Path(state["apply_workbook_path"]))
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
| 304 |
filename, path = save_uploaded_excel(request.files.get("file"), UPLOAD_DIR)
|
| 305 |
except Exception as exc:
|
| 306 |
if wants_json_response():
|
|
|
|
| 298 |
try:
|
| 299 |
update_ui_state_from_form(request.form)
|
| 300 |
state = get_state()
|
| 301 |
+
previous_apply_sheets = list(state["apply_sheets"] or [])
|
| 302 |
if state["apply_workbook_path"] and Path(state["apply_workbook_path"]).is_file():
|
| 303 |
state["apply_sheets"] = read_workbook_sheets(Path(state["apply_workbook_path"]))
|
| 304 |
+
elif previous_apply_sheets:
|
| 305 |
+
state["apply_sheets"] = previous_apply_sheets
|
| 306 |
+
if state["apply_sheets"]:
|
| 307 |
+
state["apply_selected_sheet"] = pick_sheet(state["apply_sheets"], request.form.get("apply_selected_sheet"), state)
|
| 308 |
filename, path = save_uploaded_excel(request.files.get("file"), UPLOAD_DIR)
|
| 309 |
except Exception as exc:
|
| 310 |
if wants_json_response():
|