Spaces:
Sleeping
Sleeping
Sync app from GitHub Actions
Browse files- src/ui/app_factory.py +13 -18
- src/ui/theme.py +59 -5
src/ui/app_factory.py
CHANGED
|
@@ -2499,7 +2499,7 @@ def create_app() -> gr.Blocks:
|
|
| 2499 |
interactive=False,
|
| 2500 |
elem_classes=["bn-dataframe"],
|
| 2501 |
)
|
| 2502 |
-
refresh_projects_btn = gr.Button("Refresh List")
|
| 2503 |
|
| 2504 |
gr.HTML("<div class='bn-spacer'></div>")
|
| 2505 |
|
|
@@ -2538,7 +2538,6 @@ def create_app() -> gr.Blocks:
|
|
| 2538 |
outputs=[projects_table],
|
| 2539 |
)
|
| 2540 |
|
| 2541 |
-
gr.HTML(inline_hint_html("Project tokens are optional. Use them only for private datasets or datasets that require owner-level access."))
|
| 2542 |
gr.HTML(
|
| 2543 |
section_header_html(
|
| 2544 |
"Access",
|
|
@@ -2559,7 +2558,7 @@ def create_app() -> gr.Blocks:
|
|
| 2559 |
)
|
| 2560 |
token_clear_checkbox = gr.Checkbox(label="Clear token", value=False)
|
| 2561 |
token_update_message = gr.Markdown()
|
| 2562 |
-
token_update_btn = gr.Button("Update Project Token")
|
| 2563 |
|
| 2564 |
def update_project_token(session, project_slug: str, new_token: str, clear_token: bool):
|
| 2565 |
if session is None:
|
|
@@ -2597,15 +2596,15 @@ def create_app() -> gr.Blocks:
|
|
| 2597 |
)
|
| 2598 |
|
| 2599 |
gr.HTML("<div class='bn-spacer'></div>")
|
| 2600 |
-
with gr.Group(elem_classes=["bn-
|
| 2601 |
gr.Markdown("### Delete project")
|
| 2602 |
gr.HTML(inline_hint_html("Deleting a project removes assignments and pending invites. It does not delete the Hugging Face dataset.", "danger"))
|
| 2603 |
-
with gr.Row():
|
| 2604 |
delete_project_slug = gr.Dropdown(
|
| 2605 |
choices=_project_slugs(),
|
| 2606 |
label="Project to delete",
|
| 2607 |
)
|
| 2608 |
-
delete_project_btn = gr.Button("Delete Project", variant="stop")
|
| 2609 |
delete_project_message = gr.Markdown()
|
| 2610 |
|
| 2611 |
def delete_project(session, project_slug: str):
|
|
@@ -2696,7 +2695,7 @@ def create_app() -> gr.Blocks:
|
|
| 2696 |
)
|
| 2697 |
|
| 2698 |
admin_message = gr.Markdown()
|
| 2699 |
-
invite_btn = gr.Button("Send Invite")
|
| 2700 |
|
| 2701 |
def assign_user(session, username: str, project: str, role: str):
|
| 2702 |
if session is None:
|
|
@@ -2777,8 +2776,8 @@ def create_app() -> gr.Blocks:
|
|
| 2777 |
)
|
| 2778 |
pending_invites_message = gr.Markdown()
|
| 2779 |
with gr.Row():
|
| 2780 |
-
refresh_pending_invites_btn = gr.Button("Refresh pending invites")
|
| 2781 |
-
revoke_invite_btn = gr.Button("Revoke Invite")
|
| 2782 |
|
| 2783 |
def _pending_invites_rows(project_filter: str, session):
|
| 2784 |
def _remaining_from_iso(iso_value: str) -> str:
|
|
@@ -2953,7 +2952,7 @@ def create_app() -> gr.Blocks:
|
|
| 2953 |
"Project access is filtered by your role. Invitations can be accepted here before validation starts.",
|
| 2954 |
)
|
| 2955 |
)
|
| 2956 |
-
project_overview = gr.HTML(value=project_overview_html([], []))
|
| 2957 |
project_info_display = gr.Markdown(
|
| 2958 |
value="Login first in the **Login** tab"
|
| 2959 |
)
|
|
@@ -2968,10 +2967,10 @@ def create_app() -> gr.Blocks:
|
|
| 2968 |
invitations_overview = gr.HTML(value=invite_panel_html(0))
|
| 2969 |
invite_selector = gr.Dropdown(choices=[], label="Pending Invites", interactive=False)
|
| 2970 |
with gr.Row():
|
| 2971 |
-
refresh_invites_btn = gr.Button("Refresh invites")
|
| 2972 |
-
accept_invite_btn = gr.Button("Accept Invite",
|
| 2973 |
-
accept_all_invites_btn = gr.Button("Accept All")
|
| 2974 |
-
reject_invite_btn = gr.Button("Reject Invite")
|
| 2975 |
|
| 2976 |
def update_project_selector(session):
|
| 2977 |
"""Update project dropdown when user logs in."""
|
|
@@ -3800,10 +3799,6 @@ def create_app() -> gr.Blocks:
|
|
| 3800 |
outputs=[selected_index, audio_player, cache_key_state, status, spectrogram_image, spectrogram_title],
|
| 3801 |
)
|
| 3802 |
table_select_event.then(
|
| 3803 |
-
fn=lambda rows, idx: _mark_selected_row(rows, int(idx)),
|
| 3804 |
-
inputs=[table, selected_index],
|
| 3805 |
-
outputs=[table],
|
| 3806 |
-
).then(
|
| 3807 |
fn=update_favorite_button_state,
|
| 3808 |
inputs=[selected_project_state, table, selected_index, favorite_detection_state],
|
| 3809 |
outputs=[favorite_btn],
|
|
|
|
| 2499 |
interactive=False,
|
| 2500 |
elem_classes=["bn-dataframe"],
|
| 2501 |
)
|
| 2502 |
+
refresh_projects_btn = gr.Button("Refresh List", elem_classes=["bn-soft-action"])
|
| 2503 |
|
| 2504 |
gr.HTML("<div class='bn-spacer'></div>")
|
| 2505 |
|
|
|
|
| 2538 |
outputs=[projects_table],
|
| 2539 |
)
|
| 2540 |
|
|
|
|
| 2541 |
gr.HTML(
|
| 2542 |
section_header_html(
|
| 2543 |
"Access",
|
|
|
|
| 2558 |
)
|
| 2559 |
token_clear_checkbox = gr.Checkbox(label="Clear token", value=False)
|
| 2560 |
token_update_message = gr.Markdown()
|
| 2561 |
+
token_update_btn = gr.Button("Update Project Token", elem_classes=["bn-soft-action"])
|
| 2562 |
|
| 2563 |
def update_project_token(session, project_slug: str, new_token: str, clear_token: bool):
|
| 2564 |
if session is None:
|
|
|
|
| 2596 |
)
|
| 2597 |
|
| 2598 |
gr.HTML("<div class='bn-spacer'></div>")
|
| 2599 |
+
with gr.Group(elem_classes=["bn-delete-project-panel"]):
|
| 2600 |
gr.Markdown("### Delete project")
|
| 2601 |
gr.HTML(inline_hint_html("Deleting a project removes assignments and pending invites. It does not delete the Hugging Face dataset.", "danger"))
|
| 2602 |
+
with gr.Row(elem_classes=["bn-delete-project-row"]):
|
| 2603 |
delete_project_slug = gr.Dropdown(
|
| 2604 |
choices=_project_slugs(),
|
| 2605 |
label="Project to delete",
|
| 2606 |
)
|
| 2607 |
+
delete_project_btn = gr.Button("Delete Project", variant="stop", elem_classes=["bn-delete-project-action"])
|
| 2608 |
delete_project_message = gr.Markdown()
|
| 2609 |
|
| 2610 |
def delete_project(session, project_slug: str):
|
|
|
|
| 2695 |
)
|
| 2696 |
|
| 2697 |
admin_message = gr.Markdown()
|
| 2698 |
+
invite_btn = gr.Button("Send Invite", elem_classes=["bn-soft-action"])
|
| 2699 |
|
| 2700 |
def assign_user(session, username: str, project: str, role: str):
|
| 2701 |
if session is None:
|
|
|
|
| 2776 |
)
|
| 2777 |
pending_invites_message = gr.Markdown()
|
| 2778 |
with gr.Row():
|
| 2779 |
+
refresh_pending_invites_btn = gr.Button("Refresh pending invites", elem_classes=["bn-soft-action"])
|
| 2780 |
+
revoke_invite_btn = gr.Button("Revoke Invite", elem_classes=["bn-soft-action"])
|
| 2781 |
|
| 2782 |
def _pending_invites_rows(project_filter: str, session):
|
| 2783 |
def _remaining_from_iso(iso_value: str) -> str:
|
|
|
|
| 2952 |
"Project access is filtered by your role. Invitations can be accepted here before validation starts.",
|
| 2953 |
)
|
| 2954 |
)
|
| 2955 |
+
project_overview = gr.HTML(value=project_overview_html([], []), visible=False)
|
| 2956 |
project_info_display = gr.Markdown(
|
| 2957 |
value="Login first in the **Login** tab"
|
| 2958 |
)
|
|
|
|
| 2967 |
invitations_overview = gr.HTML(value=invite_panel_html(0))
|
| 2968 |
invite_selector = gr.Dropdown(choices=[], label="Pending Invites", interactive=False)
|
| 2969 |
with gr.Row():
|
| 2970 |
+
refresh_invites_btn = gr.Button("Refresh invites", elem_classes=["bn-soft-action"])
|
| 2971 |
+
accept_invite_btn = gr.Button("Accept Invite", elem_classes=["bn-soft-action"])
|
| 2972 |
+
accept_all_invites_btn = gr.Button("Accept All", elem_classes=["bn-soft-action"])
|
| 2973 |
+
reject_invite_btn = gr.Button("Reject Invite", elem_classes=["bn-soft-action"])
|
| 2974 |
|
| 2975 |
def update_project_selector(session):
|
| 2976 |
"""Update project dropdown when user logs in."""
|
|
|
|
| 3799 |
outputs=[selected_index, audio_player, cache_key_state, status, spectrogram_image, spectrogram_title],
|
| 3800 |
)
|
| 3801 |
table_select_event.then(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3802 |
fn=update_favorite_button_state,
|
| 3803 |
inputs=[selected_project_state, table, selected_index, favorite_detection_state],
|
| 3804 |
outputs=[favorite_btn],
|
src/ui/theme.py
CHANGED
|
@@ -582,13 +582,63 @@ body,
|
|
| 582 |
|
| 583 |
.bn-admin-access-panel,
|
| 584 |
.bn-admin-pending-panel {
|
| 585 |
-
|
| 586 |
-
width: calc(50% - 8px) !important;
|
| 587 |
-
vertical-align: top;
|
| 588 |
}
|
| 589 |
|
| 590 |
-
.bn-admin-pending-panel {
|
| 591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
}
|
| 593 |
|
| 594 |
.bn-media-panel .gradio-image,
|
|
@@ -777,6 +827,10 @@ select {
|
|
| 777 |
width: 100% !important;
|
| 778 |
margin-left: 0 !important;
|
| 779 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 780 |
}
|
| 781 |
|
| 782 |
@media (max-width: 560px) {
|
|
|
|
| 582 |
|
| 583 |
.bn-admin-access-panel,
|
| 584 |
.bn-admin-pending-panel {
|
| 585 |
+
width: 100% !important;
|
|
|
|
|
|
|
| 586 |
}
|
| 587 |
|
| 588 |
+
.column:has(> .bn-admin-access-panel):has(> .bn-admin-pending-panel) {
|
| 589 |
+
display: grid !important;
|
| 590 |
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
| 591 |
+
align-items: start;
|
| 592 |
+
gap: 14px !important;
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
.column:has(> .bn-admin-access-panel):has(> .bn-admin-pending-panel) > :not(.bn-admin-access-panel):not(.bn-admin-pending-panel) {
|
| 596 |
+
grid-column: 1 / -1;
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
.bn-soft-action button,
|
| 600 |
+
button.bn-soft-action {
|
| 601 |
+
min-height: 42px !important;
|
| 602 |
+
border: 1px solid #93c5fd !important;
|
| 603 |
+
border-radius: 8px !important;
|
| 604 |
+
background: #dbeafe !important;
|
| 605 |
+
color: #075985 !important;
|
| 606 |
+
font-weight: 760 !important;
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
.bn-soft-action button:hover,
|
| 610 |
+
button.bn-soft-action:hover {
|
| 611 |
+
border-color: #60a5fa !important;
|
| 612 |
+
background: #bfdbfe !important;
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
.bn-delete-project-panel {
|
| 616 |
+
padding: 14px !important;
|
| 617 |
+
border: 1px solid #fecaca !important;
|
| 618 |
+
border-radius: 8px !important;
|
| 619 |
+
background: #fffafa !important;
|
| 620 |
+
}
|
| 621 |
+
|
| 622 |
+
.bn-delete-project-panel h3 {
|
| 623 |
+
margin: 0 0 10px 0 !important;
|
| 624 |
+
color: #991b1b !important;
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
.bn-delete-project-panel .bn-inline-hint {
|
| 628 |
+
margin-bottom: 12px;
|
| 629 |
+
border-radius: 8px;
|
| 630 |
+
background: #fff1f2;
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
.bn-delete-project-row {
|
| 634 |
+
align-items: flex-end !important;
|
| 635 |
+
gap: 12px !important;
|
| 636 |
+
}
|
| 637 |
+
|
| 638 |
+
.bn-delete-project-action button {
|
| 639 |
+
min-height: 54px !important;
|
| 640 |
+
border-radius: 8px !important;
|
| 641 |
+
font-weight: 790 !important;
|
| 642 |
}
|
| 643 |
|
| 644 |
.bn-media-panel .gradio-image,
|
|
|
|
| 827 |
width: 100% !important;
|
| 828 |
margin-left: 0 !important;
|
| 829 |
}
|
| 830 |
+
|
| 831 |
+
.column:has(> .bn-admin-access-panel):has(> .bn-admin-pending-panel) {
|
| 832 |
+
grid-template-columns: 1fr;
|
| 833 |
+
}
|
| 834 |
}
|
| 835 |
|
| 836 |
@media (max-width: 560px) {
|