Open task in new tab when cmd or ctrl (#514)
Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
@@ -60,6 +60,18 @@ function TaskHistory() {
|
|||||||
return <div>Error: {error?.message}</div>;
|
return <div>Error: {error?.message}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleNavigate(event: React.MouseEvent, id: string) {
|
||||||
|
if (event.ctrlKey || event.metaKey) {
|
||||||
|
window.open(
|
||||||
|
window.location.origin + `/tasks/${id}/actions`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
navigate(`${id}/actions`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border">
|
||||||
@@ -86,33 +98,25 @@ function TaskHistory() {
|
|||||||
<TableRow key={task.task_id}>
|
<TableRow key={task.task_id}>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="w-1/4 cursor-pointer"
|
className="w-1/4 cursor-pointer"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{task.task_id}
|
{task.task_id}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="w-1/4 cursor-pointer max-w-64 overflow-hidden whitespace-nowrap overflow-ellipsis"
|
className="w-1/4 cursor-pointer max-w-64 overflow-hidden whitespace-nowrap overflow-ellipsis"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{task.request.url}
|
{task.request.url}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="w-1/6 cursor-pointer"
|
className="w-1/6 cursor-pointer"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<StatusBadge status={task.status} />
|
<StatusBadge status={task.status} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="w-1/4 cursor-pointer"
|
className="w-1/4 cursor-pointer"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{basicTimeFormat(task.created_at)}
|
{basicTimeFormat(task.created_at)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -32,6 +32,18 @@ function QueuedTasks() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleNavigate(event: React.MouseEvent, id: string) {
|
||||||
|
if (event.ctrlKey || event.metaKey) {
|
||||||
|
window.open(
|
||||||
|
window.location.origin + `/tasks/${id}/actions`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
navigate(`${id}/actions`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border">
|
||||||
<Table>
|
<Table>
|
||||||
@@ -54,9 +66,7 @@ function QueuedTasks() {
|
|||||||
<TableRow
|
<TableRow
|
||||||
key={task.task_id}
|
key={task.task_id}
|
||||||
className="w-4"
|
className="w-4"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<TableCell className="w-1/4">{task.task_id}</TableCell>
|
<TableCell className="w-1/4">{task.task_id}</TableCell>
|
||||||
<TableCell className="w-1/4 max-w-64 overflow-hidden whitespace-nowrap overflow-ellipsis">
|
<TableCell className="w-1/4 max-w-64 overflow-hidden whitespace-nowrap overflow-ellipsis">
|
||||||
|
|||||||
@@ -36,14 +36,24 @@ function RunningTasks() {
|
|||||||
return <div>No running tasks</div>;
|
return <div>No running tasks</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleNavigate(event: React.MouseEvent, id: string) {
|
||||||
|
if (event.ctrlKey || event.metaKey) {
|
||||||
|
window.open(
|
||||||
|
window.location.origin + `/tasks/${id}/actions`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
navigate(`/tasks/${id}/actions`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return runningTasks?.map((task) => {
|
return runningTasks?.map((task) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
key={task.task_id}
|
key={task.task_id}
|
||||||
className="hover:bg-muted/50 cursor-pointer"
|
className="hover:bg-muted/50 cursor-pointer"
|
||||||
onClick={() => {
|
onClick={(event) => handleNavigate(event, task.task_id)}
|
||||||
navigate(`/tasks/${task.task_id}/actions`);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="overflow-hidden text-ellipsis whitespace-nowrap">
|
<CardTitle className="overflow-hidden text-ellipsis whitespace-nowrap">
|
||||||
|
|||||||
Reference in New Issue
Block a user