chore:调度文件拆分

This commit is contained in:
xiaozhu
2026-08-05 15:58:18 +08:00
parent 8c4d2c0517
commit 9b5de51a68
9 changed files with 771 additions and 644 deletions
@@ -0,0 +1,79 @@
import { type ScheduleArtifact } from "../../services/api";
import Icon from "../../components/common/Icon";
import { shortHash } from "./utils";
export function ArtifactList({
artifacts,
keyword,
onDrop,
onDoubleClick,
onContextMenu,
onKeywordChange,
}: {
artifacts: ScheduleArtifact[];
keyword: string;
onDrop: (artifact: ScheduleArtifact, x: number, y: number) => void;
onDoubleClick: (artifact: ScheduleArtifact) => void;
onContextMenu: (event: React.MouseEvent, artifact: ScheduleArtifact) => void;
onKeywordChange: (keyword: string) => void;
}) {
const filtered = keyword.trim()
? artifacts.filter((item) => (
item.script_name.toLowerCase().includes(keyword.trim().toLowerCase())
|| item.version_label.toLowerCase().includes(keyword.trim().toLowerCase())
))
: artifacts;
return (
<section className="schedule-panel schedule-artifacts-panel">
<div className="schedule-panel__title">
<div><strong></strong><span>{artifacts.length}</span></div>
</div>
<label className="schedule-search">
<Icon name="search" size={15} />
<input
value={keyword}
placeholder="搜索稳定版本"
onChange={(event) => onKeywordChange(event.target.value)}
/>
</label>
<p className="artifact-tip"> versions_id</p>
<div className="artifact-list">
{filtered.length ? filtered.map((artifact) => (
<div
className="artifact-card"
draggable
key={artifact.versions_id}
onDragStart={(event) => {
event.dataTransfer.effectAllowed = "copy";
event.dataTransfer.setData(
"application/x-model-platform-version",
artifact.versions_id,
);
event.dataTransfer.setData("text/plain", artifact.versions_id);
}}
onContextMenu={(event) => onContextMenu(event, artifact)}
onDoubleClick={() => onDoubleClick(artifact)}
>
<span className={`artifact-card__icon artifact-card__icon--${artifact.script_type}`}>
<Icon
name={artifact.script_type === "notebook" ? "notebook" : "python"}
size={17}
/>
</span>
<span>
<strong>{artifact.script_name}</strong>
<small>
{artifact.version_label} · {shortHash(artifact.content_hash)}
</small>
</span>
</div>
)) : (
<p className="schedule-empty">
"构建脚本"
</p>
)}
</div>
</section>
);
}