Update app.py
Browse files
app.py
CHANGED
|
@@ -390,7 +390,7 @@ def fetch_database_records(standard, version, selection, table_type):
|
|
| 390 |
traceback.print_exc()
|
| 391 |
return pd.DataFrame({"Error": [str(e)]}), []
|
| 392 |
|
| 393 |
-
def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, comp_cat, diff_only):
|
| 394 |
try:
|
| 395 |
def get_type_by_cat(cat):
|
| 396 |
if not cat or cat == "ALL": return "Main"
|
|
@@ -535,6 +535,9 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
|
|
| 535 |
row_dict = {}
|
| 536 |
has_b = not pd.isna(row.get('base_idx')) and row.get('base_idx') != float('inf')
|
| 537 |
has_c = not pd.isna(row.get('comp_idx')) and row.get('comp_idx') != float('inf')
|
|
|
|
|
|
|
|
|
|
| 538 |
|
| 539 |
for c in rename_b.values(): row_dict[c] = str(row[c]) if has_b and not pd.isna(row[c]) else ""
|
| 540 |
for c in rename_c.values(): row_dict[c] = str(row[c]) if has_c and not pd.isna(row[c]) else ""
|
|
@@ -599,6 +602,8 @@ with gr.Blocks() as demo:
|
|
| 599 |
|
| 600 |
with gr.Row(elem_id="search_row"):
|
| 601 |
search_btn = gr.Button("🔍 조회", variant="primary", scale=10)
|
|
|
|
|
|
|
| 602 |
diff_filter_cb = gr.Checkbox(label="💡 변경된 내용만 보기", value=False, elem_id="diff_cb_item", container=False, scale=1)
|
| 603 |
|
| 604 |
output_df = gr.Dataframe(wrap=True, interactive=False, datatype="html", max_height=800)
|
|
@@ -618,13 +623,19 @@ with gr.Blocks() as demo:
|
|
| 618 |
|
| 619 |
search_btn.click(
|
| 620 |
fn=execute_unified_search,
|
| 621 |
-
inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, diff_filter_cb],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
outputs=[output_df]
|
| 623 |
)
|
| 624 |
|
| 625 |
diff_filter_cb.change(
|
| 626 |
fn=execute_unified_search,
|
| 627 |
-
inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, diff_filter_cb],
|
| 628 |
outputs=[output_df]
|
| 629 |
)
|
| 630 |
|
|
@@ -724,7 +735,7 @@ td img {
|
|
| 724 |
margin-bottom: 5px !important;
|
| 725 |
}
|
| 726 |
|
| 727 |
-
#diff_cb_item {
|
| 728 |
margin-top: 0 !important;
|
| 729 |
padding-left: 15px !important;
|
| 730 |
width: max-content !important;
|
|
|
|
| 390 |
traceback.print_exc()
|
| 391 |
return pd.DataFrame({"Error": [str(e)]}), []
|
| 392 |
|
| 393 |
+
def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, comp_cat, mapped_only, diff_only):
|
| 394 |
try:
|
| 395 |
def get_type_by_cat(cat):
|
| 396 |
if not cat or cat == "ALL": return "Main"
|
|
|
|
| 535 |
row_dict = {}
|
| 536 |
has_b = not pd.isna(row.get('base_idx')) and row.get('base_idx') != float('inf')
|
| 537 |
has_c = not pd.isna(row.get('comp_idx')) and row.get('comp_idx') != float('inf')
|
| 538 |
+
|
| 539 |
+
if mapped_only and not (has_b and has_c):
|
| 540 |
+
continue
|
| 541 |
|
| 542 |
for c in rename_b.values(): row_dict[c] = str(row[c]) if has_b and not pd.isna(row[c]) else ""
|
| 543 |
for c in rename_c.values(): row_dict[c] = str(row[c]) if has_c and not pd.isna(row[c]) else ""
|
|
|
|
| 602 |
|
| 603 |
with gr.Row(elem_id="search_row"):
|
| 604 |
search_btn = gr.Button("🔍 조회", variant="primary", scale=10)
|
| 605 |
+
# ⬇️ [추가] 매핑 체크박스 추가!
|
| 606 |
+
mapped_only_cb = gr.Checkbox(label="🔗 매핑된 항목만 보기", value=False, elem_id="mapped_cb_item", container=False, scale=1)
|
| 607 |
diff_filter_cb = gr.Checkbox(label="💡 변경된 내용만 보기", value=False, elem_id="diff_cb_item", container=False, scale=1)
|
| 608 |
|
| 609 |
output_df = gr.Dataframe(wrap=True, interactive=False, datatype="html", max_height=800)
|
|
|
|
| 623 |
|
| 624 |
search_btn.click(
|
| 625 |
fn=execute_unified_search,
|
| 626 |
+
inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, mapped_only_cb, diff_filter_cb],
|
| 627 |
+
outputs=[output_df]
|
| 628 |
+
)
|
| 629 |
+
|
| 630 |
+
mapped_only_cb.change(
|
| 631 |
+
fn=execute_unified_search,
|
| 632 |
+
inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, mapped_only_cb, diff_filter_cb],
|
| 633 |
outputs=[output_df]
|
| 634 |
)
|
| 635 |
|
| 636 |
diff_filter_cb.change(
|
| 637 |
fn=execute_unified_search,
|
| 638 |
+
inputs=[base_standard, base_version, base_category, comp_standard, comp_version, comp_category, mapped_only_cb, diff_filter_cb],
|
| 639 |
outputs=[output_df]
|
| 640 |
)
|
| 641 |
|
|
|
|
| 735 |
margin-bottom: 5px !important;
|
| 736 |
}
|
| 737 |
|
| 738 |
+
#diff_cb_item, #mapped_cb_item {
|
| 739 |
margin-top: 0 !important;
|
| 740 |
padding-left: 15px !important;
|
| 741 |
width: max-content !important;
|