feat(webapp): add priority to task test and replay options (#2936)
Closes #2934 ## ✅ Checklist - [x] I have followed every step in the [contributing guide](https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md) - [x] The PR title follows the convention. - [x] I ran and tested the code works --- ## Testing _[Describe the steps you took to test this change]_ 1. make sure there are no worker connected or the queue is paused. 2. run hello world tasks and assign priority 3. notice the priority value in task context. 4. try running a replay for task with priority 5. notice the context priority --- ## Changelog _[Short description of what has changed]_ Added option to set priority on task test and replay dialog --- ## Screenshots _[Screenshots]_ <img width="953" height="804" alt="image" src="https://github.com/user-attachments/assets/d452b872-6c05-4a9e-a1e3-f6a283bb363d" /> <img width="958" height="886" alt="image" src="https://github.com/user-attachments/assets/8f9f3096-da99-4d81-a9c5-2f3004b89ceb" /> <img width="1022" height="736" alt="image" src="https://github.com/user-attachments/assets/233e01ac-a42b-4b4f-ac3e-e9b18638b971" /> 💯 <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/triggerdotdev/trigger.dev/pull/2936"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
This commit is contained in:
@@ -201,6 +201,7 @@ function ReplayForm({
|
||||
tags,
|
||||
version,
|
||||
machine,
|
||||
prioritySeconds,
|
||||
},
|
||||
] = useForm({
|
||||
id: "replay-task",
|
||||
@@ -499,6 +500,12 @@ function ReplayForm({
|
||||
<Hint>Delays run by a specific duration.</Hint>
|
||||
<FormError id={delaySeconds.errorId}>{delaySeconds.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label variant="small">Priority</Label>
|
||||
<DurationPicker name={prioritySeconds.name} id={prioritySeconds.id} />
|
||||
<Hint>Sets the priority of the run. Higher values mean higher priority.</Hint>
|
||||
<FormError id={prioritySeconds.errorId}>{prioritySeconds.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label variant="small">TTL</Label>
|
||||
<DurationPicker
|
||||
|
||||
+16
@@ -409,6 +409,7 @@ function StandardTaskForm({
|
||||
tags,
|
||||
version,
|
||||
machine,
|
||||
prioritySeconds,
|
||||
},
|
||||
] = useForm({
|
||||
id: "test-task",
|
||||
@@ -730,6 +731,12 @@ function StandardTaskForm({
|
||||
<Hint>Delays run by a specific duration.</Hint>
|
||||
<FormError id={delaySeconds.errorId}>{delaySeconds.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label variant="small">Priority</Label>
|
||||
<DurationPicker name={prioritySeconds.name} id={prioritySeconds.id} />
|
||||
<Hint>Sets the priority of the run. Higher values mean higher priority.</Hint>
|
||||
<FormError id={prioritySeconds.errorId}>{prioritySeconds.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label variant="small">TTL</Label>
|
||||
<DurationPicker
|
||||
@@ -872,6 +879,7 @@ function ScheduledTaskForm({
|
||||
tags,
|
||||
version,
|
||||
machine,
|
||||
prioritySeconds,
|
||||
},
|
||||
] = useForm({
|
||||
id: "test-task-scheduled",
|
||||
@@ -1237,6 +1245,14 @@ function ScheduledTaskForm({
|
||||
<Hint>Limits concurrency by creating a separate queue for each value of the key.</Hint>
|
||||
<FormError id={concurrencyKey.errorId}>{concurrencyKey.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label htmlFor={prioritySeconds.id} variant="small">
|
||||
Priority
|
||||
</Label>
|
||||
<DurationPicker name={prioritySeconds.name} id={prioritySeconds.id} />
|
||||
<Hint>Sets the priority of the run. Higher values mean higher priority.</Hint>
|
||||
<FormError id={prioritySeconds.errorId}>{prioritySeconds.error}</FormError>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<Label htmlFor={ttlSeconds.id} variant="small">
|
||||
TTL
|
||||
|
||||
@@ -199,6 +199,7 @@ export const action: ActionFunction = async ({ request, params }) => {
|
||||
idempotencyKeyTTLSeconds: submission.value.idempotencyKeyTTLSeconds,
|
||||
ttlSeconds: submission.value.ttlSeconds,
|
||||
version: submission.value.version,
|
||||
prioritySeconds: submission.value.prioritySeconds,
|
||||
});
|
||||
|
||||
if (!newRun) {
|
||||
|
||||
@@ -110,6 +110,7 @@ export class ReplayTaskRunService extends BaseService {
|
||||
overrideOptions.version === "latest" ? undefined : overrideOptions.version,
|
||||
bulkActionId: overrideOptions?.bulkActionId,
|
||||
region,
|
||||
priority: overrideOptions.prioritySeconds,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ export class TestTaskService extends BaseService {
|
||||
tags: data.tags,
|
||||
machine: data.machine,
|
||||
lockToVersion: data.version === "latest" ? undefined : data.version,
|
||||
priority: data.prioritySeconds,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -66,6 +67,7 @@ export class TestTaskService extends BaseService {
|
||||
tags: data.tags,
|
||||
machine: data.machine,
|
||||
lockToVersion: data.version === "latest" ? undefined : data.version,
|
||||
priority: data.prioritySeconds,
|
||||
},
|
||||
},
|
||||
{ customIcon: "scheduled" }
|
||||
|
||||
@@ -46,6 +46,11 @@ export const RunOptionsData = z.object({
|
||||
message: "Each tag must be at most 128 characters long",
|
||||
}),
|
||||
version: z.string().optional(),
|
||||
prioritySeconds: z
|
||||
.number()
|
||||
.min(0)
|
||||
.optional()
|
||||
.transform((val) => (val === 0 ? undefined : val)),
|
||||
});
|
||||
|
||||
export type RunOptionsData = z.infer<typeof RunOptionsData>;
|
||||
|
||||
Reference in New Issue
Block a user