mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 22:59:52 +03:00
feat: ultrafast tests (#1511)
* feat: ultrafast tests * fix: lint * fix: misc fixes and remove this dense perf code * fix: update server.yml appropriately * fix: nice one * fix: improve our luck
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import useSetSubheader from "#components/layout/header/useSetSubheader";
|
||||
import useApiQuery from "#components/util/query/useApiQuery";
|
||||
import { ADMIN_PAGE_SIZE } from "#lib/adminConstants";
|
||||
import { ADMIN_RECENT_HOURS } from "#lib/adminConstants";
|
||||
import { MillisToSince } from "#util/time";
|
||||
import React from "react";
|
||||
import { Badge, Button, Form, Table } from "react-bootstrap";
|
||||
@@ -92,7 +92,8 @@ export default function AdminActionsPage() {
|
||||
}
|
||||
|
||||
const { actions, filters } = data;
|
||||
const totalPages = Math.ceil(actions.total / ADMIN_PAGE_SIZE);
|
||||
const pageSize = actions.pageSize;
|
||||
const totalPages = Math.ceil(actions.total / pageSize);
|
||||
const currentPage = actions.page;
|
||||
|
||||
function buildPageUrl(p: number) {
|
||||
@@ -122,6 +123,9 @@ export default function AdminActionsPage() {
|
||||
<h2 className="h5">
|
||||
Actions <span className="badge bg-secondary">{actions.total.toLocaleString()}</span>
|
||||
</h2>
|
||||
<p className="small text-body-secondary mb-0">
|
||||
Actions from the last {ADMIN_RECENT_HOURS} hours (up to {pageSize} per page).
|
||||
</p>
|
||||
|
||||
<Form className="d-flex flex-wrap align-items-end gap-3" onSubmit={onFilterSubmit}>
|
||||
<Form.Group>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import useSetSubheader from "#components/layout/header/useSetSubheader";
|
||||
import useApiQuery from "#components/util/query/useApiQuery";
|
||||
import { ADMIN_PAGE_SIZE, JOB_STATUS } from "#lib/adminConstants";
|
||||
import { ADMIN_PAGE_SIZE, ADMIN_RECENT_HOURS, JOB_STATUS } from "#lib/adminConstants";
|
||||
import { MillisToSince } from "#util/time";
|
||||
import React from "react";
|
||||
import { Button, Form, Table } from "react-bootstrap";
|
||||
@@ -84,8 +84,10 @@ export default function AdminJobQueuePage() {
|
||||
}
|
||||
|
||||
const { activeJobs, filters, jobQueue } = data;
|
||||
const totalPages = Math.ceil(jobQueue.total / ADMIN_PAGE_SIZE);
|
||||
const pageSize = jobQueue.pageSize;
|
||||
const totalPages = Math.ceil(jobQueue.total / pageSize);
|
||||
const currentPage = jobQueue.page;
|
||||
const activeJobsTruncated = activeJobs.length >= ADMIN_PAGE_SIZE;
|
||||
|
||||
function buildPageUrl(p: number) {
|
||||
const sp = new URLSearchParams(location.search);
|
||||
@@ -120,6 +122,12 @@ export default function AdminJobQueuePage() {
|
||||
<h2 className="h5">
|
||||
Active jobs <span className="badge bg-primary">{activeJobs.length}</span>
|
||||
</h2>
|
||||
{activeJobsTruncated && (
|
||||
<p className="small text-body-secondary mb-2">
|
||||
Showing the first {ADMIN_PAGE_SIZE} running jobs (oldest scheduled
|
||||
first).
|
||||
</p>
|
||||
)}
|
||||
<div className="table-responsive">
|
||||
<Table hover size="sm" striped>
|
||||
<thead>
|
||||
@@ -146,9 +154,12 @@ export default function AdminJobQueuePage() {
|
||||
|
||||
<section>
|
||||
<h2 className="h5">
|
||||
All jobs{" "}
|
||||
Recent jobs{" "}
|
||||
<span className="badge bg-secondary">{jobQueue.total.toLocaleString()}</span>
|
||||
</h2>
|
||||
<p className="small text-body-secondary mb-3">
|
||||
Jobs created in the last {ADMIN_RECENT_HOURS} hours (up to {pageSize} per page).
|
||||
</p>
|
||||
|
||||
<Form
|
||||
className="d-flex flex-wrap align-items-end gap-3 mb-3"
|
||||
|
||||
@@ -6,4 +6,8 @@ export const JOB_STATUS: Record<number, string> = {
|
||||
3: "Failed",
|
||||
};
|
||||
|
||||
/** Matches server `ADMIN_PAGE_SIZE` in admin-queries.ts */
|
||||
export const ADMIN_PAGE_SIZE = 50;
|
||||
|
||||
/** Matches server `ADMIN_RECENT_HOURS` in admin-queries.ts */
|
||||
export const ADMIN_RECENT_HOURS = 12;
|
||||
|
||||
Reference in New Issue
Block a user