fix: script not found
This commit is contained in:
@@ -222,7 +222,6 @@ export function useApi(): WorkspaceBoundApi {
|
||||
rawApi.createJupyterAccessTicket(workspaceId, session),
|
||||
getLatestScriptVersion: (scriptId) =>
|
||||
rawApi.getLatestScriptVersion(workspaceId, scriptId),
|
||||
listScriptVersions: (scriptId) => rawApi.listScriptVersions(workspaceId, scriptId),
|
||||
publishScriptVersion: (input) => rawApi.publishScriptVersion(workspaceId, input),
|
||||
listSchedules: () => rawApi.listSchedules(workspaceId),
|
||||
getSchedule: (scheduleId) => rawApi.getSchedule(workspaceId, scheduleId),
|
||||
|
||||
@@ -162,8 +162,6 @@ function AuthenticatedModelPlatformApp() {
|
||||
scriptId: string;
|
||||
message: string;
|
||||
} | null>(null);
|
||||
const [versions, setVersions] = useState<StableVersion[]>([]);
|
||||
const [versionsLoading, setVersionsLoading] = useState(false);
|
||||
const [latestVersion, setLatestVersion] = useState<LatestVersion | null>(
|
||||
null,
|
||||
);
|
||||
@@ -248,12 +246,10 @@ function AuthenticatedModelPlatformApp() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedId) {
|
||||
setVersions([]);
|
||||
setLatestVersion(null);
|
||||
return;
|
||||
}
|
||||
let ignore = false;
|
||||
setVersionsLoading(true);
|
||||
setLatestVersionLoading(true);
|
||||
void api.getLatestScriptVersion(selectedId)
|
||||
.then((item) => {
|
||||
@@ -273,21 +269,6 @@ function AuthenticatedModelPlatformApp() {
|
||||
.finally(() => {
|
||||
if (!ignore) setLatestVersionLoading(false);
|
||||
});
|
||||
void api.listScriptVersions(selectedId)
|
||||
.then((items) => {
|
||||
if (!ignore) setVersions(items);
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!ignore) {
|
||||
setToast({
|
||||
tone: "error",
|
||||
message: error instanceof Error ? error.message : "版本列表加载失败",
|
||||
});
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (!ignore) setVersionsLoading(false);
|
||||
});
|
||||
return () => {
|
||||
ignore = true;
|
||||
};
|
||||
@@ -595,10 +576,6 @@ function AuthenticatedModelPlatformApp() {
|
||||
releaseNote,
|
||||
visibility: publishVisibility,
|
||||
});
|
||||
setVersions((items) => [
|
||||
version,
|
||||
...items.filter((item) => item.versions_id !== version.versions_id),
|
||||
]);
|
||||
setPublishTarget(null);
|
||||
setPublishedVersion(version);
|
||||
setToast({
|
||||
|
||||
@@ -574,17 +574,6 @@ export async function getLatestScriptVersion(
|
||||
);
|
||||
}
|
||||
|
||||
export async function listScriptVersions(
|
||||
workspaceId: string,
|
||||
scriptId: string,
|
||||
): Promise<StableVersion[]> {
|
||||
return apiRequest<StableVersion[]>(
|
||||
`/api/v1/scripts/${scriptId}/versions`,
|
||||
{},
|
||||
workspaceId,
|
||||
);
|
||||
}
|
||||
|
||||
export async function publishScriptVersion(
|
||||
workspaceId: string,
|
||||
input: {
|
||||
@@ -1119,7 +1108,6 @@ export type WorkspaceBoundApi = {
|
||||
session: ActiveEditSession,
|
||||
) => Promise<JupyterAccessTicket>;
|
||||
getLatestScriptVersion: (scriptId: string) => Promise<LatestVersion | null>;
|
||||
listScriptVersions: (scriptId: string) => Promise<StableVersion[]>;
|
||||
publishScriptVersion: (
|
||||
input: Parameters<typeof publishScriptVersion>[1],
|
||||
) => Promise<StableVersion>;
|
||||
|
||||
Reference in New Issue
Block a user