Enable parallel job execution.
Add UI element to specify parallel job count and utilize the `parallel` field in `indjob` to divide runtime accordingly.
This commit is contained in:
@@ -23,7 +23,8 @@ const JobForm: React.FC<JobFormProps> = ({ job, onSubmit, onCancel }) => {
|
||||
status: job?.status || IndJobStatusOptions.Planned,
|
||||
projectedCost: job?.projectedCost || 0,
|
||||
projectedRevenue: job?.projectedRevenue || 0,
|
||||
runtime: job?.runtime || 0
|
||||
runtime: job?.runtime || 0,
|
||||
parallel: job?.parallel || 1
|
||||
});
|
||||
|
||||
const [jobDump, setJobDump] = useState('');
|
||||
@@ -102,7 +103,8 @@ const JobForm: React.FC<JobFormProps> = ({ job, onSubmit, onCancel }) => {
|
||||
status: formData.status,
|
||||
projectedCost: formData.projectedCost,
|
||||
projectedRevenue: formData.projectedRevenue,
|
||||
runtime: formData.runtime
|
||||
runtime: formData.runtime,
|
||||
parallel: formData.parallel
|
||||
}, parsedBillOfMaterials.length > 0 ? parsedBillOfMaterials : undefined);
|
||||
};
|
||||
|
||||
@@ -166,7 +168,7 @@ const JobForm: React.FC<JobFormProps> = ({ job, onSubmit, onCancel }) => {
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-3 gap-4">
|
||||
<div className="grid grid-cols-4 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="runtime" className="text-gray-300">Runtime (seconds)</Label>
|
||||
<Input
|
||||
@@ -180,6 +182,20 @@ const JobForm: React.FC<JobFormProps> = ({ job, onSubmit, onCancel }) => {
|
||||
className="bg-gray-800 border-gray-600 text-white"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="parallel" className="text-gray-300">Parallel Jobs</Label>
|
||||
<Input
|
||||
id="parallel"
|
||||
type="number"
|
||||
min="1"
|
||||
value={formData.parallel}
|
||||
onChange={(e) => setFormData({
|
||||
...formData,
|
||||
parallel: Math.max(1, parseInt(e.target.value) || 1)
|
||||
})}
|
||||
className="bg-gray-800 border-gray-600 text-white"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="projectedCost" className="text-gray-300">Projected Cost</Label>
|
||||
<Input
|
||||
|
@@ -14,6 +14,7 @@ export type IndJob = {
|
||||
jobStart?: IsoDateString
|
||||
outputItem: string
|
||||
outputQuantity: number
|
||||
parallel?: number
|
||||
produced?: number
|
||||
saleEnd?: IsoDateString
|
||||
saleStart?: IsoDateString
|
||||
|
@@ -1,30 +0,0 @@
|
||||
import type { IndFacilityRecord, IndFacilityResponse } from '../lib/pbtypes';
|
||||
import { pb } from '../lib/pocketbase';
|
||||
|
||||
export type { IndFacilityRecord as Facility } from '../lib/pbtypes';
|
||||
|
||||
export async function getFacilities(): Promise<IndFacilityResponse[]> {
|
||||
const result = await pb.collection('ind_facility').getFullList();
|
||||
return result as IndFacilityResponse[];
|
||||
}
|
||||
|
||||
export async function getFacility(id: string): Promise<IndFacilityResponse | null> {
|
||||
try {
|
||||
return await pb.collection('ind_facility').getOne(id) as IndFacilityResponse;
|
||||
} catch (e) {
|
||||
if (e.status === 404) return null;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
export async function createFacility(facility: Omit<IndFacilityRecord, 'id' | 'created' | 'updated'>): Promise<IndFacilityResponse> {
|
||||
return await pb.collection('ind_facility').create(facility) as IndFacilityResponse;
|
||||
}
|
||||
|
||||
export async function updateFacility(id: string, updates: Partial<IndFacilityRecord>): Promise<IndFacilityResponse> {
|
||||
return await pb.collection('ind_facility').update(id, updates) as IndFacilityResponse;
|
||||
}
|
||||
|
||||
export async function deleteFacility(id: string): Promise<void> {
|
||||
await pb.collection('ind_facility').delete(id);
|
||||
}
|
Reference in New Issue
Block a user