feat: 评估页改成页面内提交,任务列表放在下面,去掉两个弹窗
- 单个提交直接在页面上填:左边评估对象(按小区或按站点),右边拆除信息 - 导入清单在页面上传:左边选文件和地市,右边是填写说明或预览 - 提交后不再弹出详情,新任务排到列表最前面并短暂标亮;单个提交后保留拆除信息 - 从表格粘贴 CGI 和小区名两列时名称一起带上,表头行和重复的 CGI 跳过 - 列表里下载按钮带文字;只有一个站点的任务显示正在做哪一步(接口新增 stage) - 窗口不够宽时提交时间并到评估对象下面,再窄换成卡片,表格不再横向滚动
This commit is contained in:
@@ -364,6 +364,24 @@ def client(monkeypatch):
|
||||
shutil.rmtree(data)
|
||||
|
||||
|
||||
def test_job_stage_shows_only_for_a_single_site_still_running():
|
||||
from types import SimpleNamespace
|
||||
|
||||
from app.api.evaluate import _public_job
|
||||
|
||||
def job(total: int, status: str) -> SimpleNamespace:
|
||||
return SimpleNamespace(
|
||||
id=1, mode="single", title="站A", city="江门", source_name="", status=status, total=total, finished=0, failed=0,
|
||||
results=[], warnings=[], error="", created_at=None, finished_at=None,
|
||||
)
|
||||
|
||||
assert _public_job(job(1, "running"), None, "查询停闭前后指标")["stage"] == "查询停闭前后指标"
|
||||
# 多个站点同时在跑,说不清是哪一步,列表里只看完成数。
|
||||
assert _public_job(job(3, "running"), None, "查询停闭前后指标")["stage"] == ""
|
||||
assert _public_job(job(1, "done"), None, "完成")["stage"] == ""
|
||||
assert _public_job(job(1, "queued"))["stage"] == ""
|
||||
|
||||
|
||||
def wait_job(client: TestClient, headers: dict, job_id: int) -> dict:
|
||||
for _ in range(100):
|
||||
detail = client.get(f"/api/eval/jobs/{job_id}", headers=headers).json()
|
||||
@@ -428,5 +446,6 @@ def test_eval_api_end_to_end(client: TestClient):
|
||||
listing = client.get("/api/eval/jobs", headers=user).json()["jobs"]
|
||||
assert [job["id"] for job in listing][:3] == [by_site["id"], single["id"], created["id"]]
|
||||
assert listing[-1]["kinds"] == {"pinduan": 1, "dixiao": 1}
|
||||
assert all(job["stage"] == "" for job in listing) and site_detail["job"]["stage"] == ""
|
||||
assert client.delete(f"/api/eval/jobs/{created['id']}", headers=user).json() == {"ok": True}
|
||||
assert client.get(f"/api/eval/jobs/{created['id']}", headers=user).status_code == 404
|
||||
|
||||
Reference in New Issue
Block a user