feat: Unify print dispatch through the scheduler (#1625)

This commit is contained in:
Ed
2026-06-26 12:31:48 +02:00
committed by GitHub
parent 0b43ac0d25
commit 4c67d8a4e1
63 changed files with 1704 additions and 5049 deletions
+5 -68
View File
@@ -1958,6 +1958,7 @@ export interface PrintQueueItem {
been_jumped?: boolean;
// Auto-print G-code injection
gcode_injection?: boolean;
cleanup_library_after_dispatch?: boolean;
}
export interface PrintBatch {
@@ -1988,6 +1989,8 @@ export interface PrintQueueItemCreate {
require_previous_success?: boolean;
auto_off_after?: boolean;
manual_start?: boolean; // Requires manual trigger to start (staged)
insert_at_top?: boolean; // Insert ahead of other pending items in the same queue scope
insert_position?: number | null; // 1-indexed insertion position for priority queueing
// PrintModal "Print Anyway" on the deficit warning — persisted so the
// scheduler doesn't immediately re-flag this item (#1698-followup).
skip_filament_check?: boolean;
@@ -2009,6 +2012,8 @@ export interface PrintQueueItemCreate {
batch_id?: number | null;
// Project to associate the resulting archive with
project_id?: number;
// Delete transient uploaded library file after scheduler creates the archive
cleanup_library_after_dispatch?: boolean;
}
export interface PrintBatchCreate {
@@ -2476,15 +2481,6 @@ export interface NotificationTestResponse {
message: string;
}
export interface BackgroundDispatchResponse {
status: 'dispatched' | string;
printer_id: number;
archive_id?: number | null;
filename: string;
dispatch_job_id: number;
dispatch_position: number;
}
// Provider-specific config types for reference
export interface CallMeBotConfig {
phone: string;
@@ -4381,30 +4377,6 @@ export const api = {
}>;
}>(`/archives/${archiveId}/filament-requirements${qs.toString() ? `?${qs}` : ''}`);
},
reprintArchive: (
archiveId: number,
printerId: number,
options?: {
plate_id?: number;
plate_name?: string;
ams_mapping?: number[];
timelapse?: boolean;
bed_levelling?: boolean;
flow_cali?: boolean;
vibration_cali?: boolean;
layer_inspect?: boolean;
use_ams?: boolean;
nozzle_offset_cali?: boolean;
}
) =>
request<BackgroundDispatchResponse>(
`/archives/${archiveId}/reprint?printer_id=${printerId}`,
{
method: 'POST',
headers: options ? { 'Content-Type': 'application/json' } : undefined,
body: options ? JSON.stringify(options) : undefined,
}
),
uploadArchive: async (file: File, printerId?: number): Promise<Archive> => {
const formData = new FormData();
formData.append('file', file);
@@ -6070,41 +6042,6 @@ export const api = {
method: 'POST',
body: JSON.stringify({ file_ids: fileIds }),
}),
printLibraryFile: (
fileId: number,
printerId: number,
options?: {
plate_id?: number;
plate_name?: string;
ams_mapping?: number[];
bed_levelling?: boolean;
flow_cali?: boolean;
vibration_cali?: boolean;
layer_inspect?: boolean;
timelapse?: boolean;
use_ams?: boolean;
nozzle_offset_cali?: boolean;
project_id?: number;
cleanup_library_after_dispatch?: boolean;
}
) =>
request<BackgroundDispatchResponse>(
`/library/files/${fileId}/print?printer_id=${printerId}`,
{
method: 'POST',
body: options ? JSON.stringify(options) : undefined,
}
),
cancelBackgroundDispatchJob: (jobId: number) =>
request<{
status: 'cancelled' | 'cancelling';
job_id: number;
source_name: string;
printer_id: number;
printer_name: string;
}>(`/background-dispatch/${jobId}`, {
method: 'DELETE',
}),
getLibraryFilePlates: (fileId: number) =>
request<LibraryFilePlatesResponse>(`/library/files/${fileId}/plates`),
getLibraryFileFilamentRequirements: (