mirror of
https://github.com/nearai/ironclaw.git
synced 2026-09-02 23:56:24 +08:00
fix(gateway): remove v2 active-work pills from web ui (#2671)
This commit is contained in:
@@ -176,9 +176,6 @@ I18n.register('en', {
|
||||
'missions.summary.paused': 'Paused',
|
||||
'missions.summary.completed': 'Completed',
|
||||
'missions.summary.failed': 'Failed',
|
||||
'activity.empty': 'No recent jobs or missions',
|
||||
'activity.kind.job': 'Job',
|
||||
'activity.kind.mission': 'Mission',
|
||||
'activity.waitingApproval': 'Waiting for approval',
|
||||
'activity.waitingAuth': 'Waiting for auth',
|
||||
'activity.resuming': 'Resuming',
|
||||
|
||||
@@ -176,9 +176,6 @@ I18n.register('ko', {
|
||||
'missions.summary.paused': '일시정지',
|
||||
'missions.summary.completed': '완료됨',
|
||||
'missions.summary.failed': '실패',
|
||||
'activity.empty': '최근 작업 또는 미션이 없습니다',
|
||||
'activity.kind.job': '작업',
|
||||
'activity.kind.mission': '미션',
|
||||
'activity.waitingApproval': '승인 대기 중',
|
||||
'activity.waitingAuth': '인증 대기 중',
|
||||
'activity.resuming': '재개 중',
|
||||
|
||||
@@ -176,9 +176,6 @@ I18n.register('zh-CN', {
|
||||
'missions.summary.paused': '暂停',
|
||||
'missions.summary.completed': '已完成',
|
||||
'missions.summary.failed': '失败',
|
||||
'activity.empty': '暂无最近的任务或使命',
|
||||
'activity.kind.job': '任务',
|
||||
'activity.kind.mission': '使命',
|
||||
'activity.waitingApproval': '等待批准',
|
||||
'activity.waitingAuth': '等待认证',
|
||||
'activity.resuming': '恢复中',
|
||||
|
||||
@@ -226,8 +226,6 @@
|
||||
<span data-i18n="status.restart">Restart</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="active-work-strip" id="active-work-strip" hidden></div>
|
||||
|
||||
<!-- Chat Tab -->
|
||||
<div class="tab-panel active" id="tab-chat">
|
||||
<div class="thread-sidebar" id="thread-sidebar">
|
||||
|
||||
@@ -136,10 +136,15 @@ SEL = {
|
||||
"toast_success": ".toast.toast-success",
|
||||
"toast_error": ".toast.toast-error",
|
||||
"toast_info": ".toast.toast-info",
|
||||
# Jobs / routines
|
||||
# Jobs / missions / routines
|
||||
"jobs_tbody": "#jobs-tbody",
|
||||
"job_row": "#jobs-tbody .job-row",
|
||||
"jobs_empty": "#jobs-empty",
|
||||
"missions_summary": "#missions-summary",
|
||||
"missions_table": "#missions-table",
|
||||
"missions_tbody": "#missions-tbody",
|
||||
"missions_empty": "#missions-empty",
|
||||
"active_work_strip": "#active-work-strip",
|
||||
"routines_tbody": "#routines-tbody",
|
||||
"routine_row": "#routines-tbody .routine-row",
|
||||
"routines_empty": "#routines-empty",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import pytest
|
||||
from playwright.async_api import expect
|
||||
|
||||
from helpers import AUTH_TOKEN, api_post
|
||||
from helpers import AUTH_TOKEN, SEL, api_post
|
||||
|
||||
from .test_v2_engine_approval_flow import _wait_for_approval, v2_approval_server
|
||||
|
||||
@@ -14,7 +14,7 @@ async def v2_approval_page(v2_approval_server, browser):
|
||||
context = await browser.new_context(viewport={"width": 1280, "height": 720})
|
||||
page = await context.new_page()
|
||||
await page.goto(f"{v2_approval_server}/?token={AUTH_TOKEN}")
|
||||
await page.wait_for_selector("#auth-screen", state="hidden", timeout=15000)
|
||||
await page.wait_for_selector(SEL["auth_screen"], state="hidden", timeout=15000)
|
||||
await page.wait_for_function(
|
||||
"() => typeof sseHasConnectedBefore !== 'undefined' && sseHasConnectedBefore === true",
|
||||
timeout=10000,
|
||||
@@ -23,36 +23,56 @@ async def v2_approval_page(v2_approval_server, browser):
|
||||
await context.close()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_v2_hides_routines_tab(v2_approval_page):
|
||||
"""The legacy Routines tab should not be shown when ENGINE_V2 is enabled."""
|
||||
routines_tab = v2_approval_page.locator('.tab-bar button[data-tab="routines"]')
|
||||
routines_tab = v2_approval_page.locator(SEL["tab_button"].format(tab="routines"))
|
||||
missions_tab = v2_approval_page.locator(SEL["tab_button"].format(tab="missions"))
|
||||
await expect(routines_tab).to_be_hidden()
|
||||
await expect(v2_approval_page.locator('.tab-bar button[data-tab="missions"]')).to_be_visible()
|
||||
await expect(missions_tab).to_be_visible()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_active_work_strip_survives_tab_switch(
|
||||
async def test_v2_missions_tab_replaces_removed_activity_strip(
|
||||
v2_approval_server,
|
||||
v2_approval_page,
|
||||
):
|
||||
"""Background v2 work stays visible after leaving the Chat tab."""
|
||||
r = await api_post(v2_approval_server, "/api/chat/thread/new")
|
||||
r.raise_for_status()
|
||||
thread_id = r.json()["id"]
|
||||
"""Background v2 work should be accessed via the Missions tab, not a pill strip."""
|
||||
thread_r = await api_post(v2_approval_server, "/api/chat/thread/new", timeout=15)
|
||||
thread_r.raise_for_status()
|
||||
thread_id = thread_r.json()["id"]
|
||||
|
||||
r = await api_post(
|
||||
send_r = await api_post(
|
||||
v2_approval_server,
|
||||
"/api/chat/send",
|
||||
json={"content": "make approval post active-shell", "thread_id": thread_id},
|
||||
timeout=15,
|
||||
timeout=30,
|
||||
)
|
||||
r.raise_for_status()
|
||||
send_r.raise_for_status()
|
||||
await _wait_for_approval(v2_approval_server, thread_id)
|
||||
|
||||
strip = v2_approval_page.locator("#active-work-strip")
|
||||
await expect(strip).to_be_visible()
|
||||
await expect(v2_approval_page.locator(SEL["active_work_strip"])).to_have_count(0)
|
||||
|
||||
missions_tab = v2_approval_page.locator(SEL["tab_button"].format(tab="missions"))
|
||||
missions_panel = v2_approval_page.locator(SEL["tab_panel"].format(tab="missions"))
|
||||
summary = v2_approval_page.locator(SEL["missions_summary"])
|
||||
|
||||
async with v2_approval_page.expect_response(
|
||||
lambda response: response.request.method == "GET"
|
||||
and response.url.endswith("/api/engine/missions/summary")
|
||||
) as missions_summary_response:
|
||||
await missions_tab.click()
|
||||
|
||||
response = await missions_summary_response.value
|
||||
assert response.ok, f"missions summary request failed: {response.status} {response.url}"
|
||||
|
||||
await missions_panel.wait_for(state="visible", timeout=5000)
|
||||
await v2_approval_page.wait_for_function(
|
||||
"selector => {"
|
||||
" const el = document.querySelector(selector);"
|
||||
" return !!el && el.textContent.trim().length > 0;"
|
||||
"}",
|
||||
arg=SEL["missions_summary"],
|
||||
timeout=5000,
|
||||
)
|
||||
await expect(summary).to_be_visible()
|
||||
|
||||
|
||||
await v2_approval_page.locator('.tab-bar button[data-tab="settings"]').click()
|
||||
await v2_approval_page.locator("#tab-settings.active").wait_for(state="visible", timeout=5000)
|
||||
await expect(strip).to_be_visible()
|
||||
|
||||
Reference in New Issue
Block a user