Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
gluonfield committed Jul 11, 2024
2 parents d493e00 + ceef363 commit efd5a01
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

*.env
*.env
.env
8 changes: 4 additions & 4 deletions src/app/components/SlideOver/SlideOver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export const SlideOver = ({ children, open, setOpen }: SlideOverProps) => {
<Dialog as="div" className="relative z-10" onClose={setOpen}>
<Transition.Child
as={Fragment}
enter="ease-in-out duration-500"
enter="ease-in-out duration-200"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in-out duration-500"
leave="ease-in-out duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
Expand All @@ -31,10 +31,10 @@ export const SlideOver = ({ children, open, setOpen }: SlideOverProps) => {
<div className="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10">
<Transition.Child
as={Fragment}
enter="transform transition ease-in-out duration-500 sm:duration-700"
enter="transform transition ease-in-out duration-200 sm:duration-200"
enterFrom="translate-x-full"
enterTo="translate-x-0"
leave="transform transition ease-in-out duration-500 sm:duration-700"
leave="transform transition ease-in-out duration-200 sm:duration-200"
leaveFrom="translate-x-0"
leaveTo="translate-x-full"
>
Expand Down
4 changes: 3 additions & 1 deletion src/app/runs/[id]/components/General/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import { Workflow, Workspace } from "@prisma/client"
import { fullDateTime } from "@common/index"
import { Container } from "@/app/components"
import Link from "next/link"
import { extractExecutor } from "@/common/utils/workflow"

type GeneralProps = {
workflow: Workflow
workspace?: Workspace | null
}

export const General: React.FC<GeneralProps> = ({ workflow, workspace }: GeneralProps) => {
const executor = extractExecutor(workflow.configText)
return (
<Container sectionName="General">
<div className="flex w-full flex-none gap-x-4 border-gray-900/5">
Expand Down Expand Up @@ -78,7 +80,7 @@ export const General: React.FC<GeneralProps> = ({ workflow, workspace }: General
<dt className="flex-none">
<PiEngineLight className="h-6 w-5 text-gray-400" aria-hidden="true" />
</dt>
<dd className="text-sm leading-6 text-gray-500">{workflow.profile}</dd>
<dd className="text-sm leading-6 text-gray-500">{executor}</dd>
</div>
<div className="mt-4 flex w-full flex-none gap-x-4">
<dt className="flex-none">
Expand Down
17 changes: 17 additions & 0 deletions src/app/runs/[id]/components/TaskDetails/TaskDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,31 @@ import React from "react"
import { CodeText } from ".."
import { formatDuration, fullDateTime } from "@/common"
import bytes from "bytes"
import Link from "next/link"

type TaskDetailsProps = {
task: Task
}

export const TaskDetails = ({ task }: TaskDetailsProps) => {
console.log(task.id)
return (
<div className="text-black">
{task.data.executor === "float" && (
<div className="mb-4">
<Link
target="_blank"
href={`${process.env.NEXT_PUBLIC_MMC_CLOUD_BASE_URL}/#/opcenter/jobs/${task.data.nativeId}`}
>
<button
type="button"
className="rounded-md bg-indigo-50 px-2.5 py-1.5 text-sm text-indigo-600 shadow-sm hover:bg-indigo-100"
>
Open in MMCloud
</button>
</Link>
</div>
)}
<div>
<div className="text-lg">Name</div>
<CodeText code={`${task.data.process} ${task.data.name}`} />
Expand Down
27 changes: 27 additions & 0 deletions src/app/runs/[id]/components/TasksTable/TasksTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,27 @@ const columns = [
id: "duration",
header: "Duration",
cell: (info) => formatDuration(info.getValue(), "ms"),
footer: ({ table }) => {
let rows = table.getFilteredRowModel().rows
let msSum = 0.0
for (let i = 0; i < rows.length; i++) {
msSum += (rows[i].getValue("duration") as number) ?? 0
}
return formatDuration(msSum, "ms")
},
}),
columnHelper.accessor((row) => row.data.realtime, {
id: "realtime",
header: "Realtime",
cell: (info) => formatDuration(info.getValue(), "ms"),
footer: ({ table }) => {
let rows = table.getFilteredRowModel().rows
let msSum = 0.0
for (let i = 0; i < rows.length; i++) {
msSum += (rows[i].getValue("realtime") as number) ?? 0
}
return formatDuration(msSum, "ms")
},
}),
columnHelper.accessor((row) => row.data.pcpu, {
id: "pcpu",
Expand Down Expand Up @@ -194,6 +210,17 @@ export const TasksTable = ({ tasks, className, onTaskClick }: TasksTableProps) =
</tr>
))}
</tbody>
<tfoot className="border-solid border-t-[1px] border-gray-100">
{table.getFooterGroups().map((footerEl) => (
<tr key={footerEl.id}>
{footerEl.headers.map((columnEl) => (
<th className="text-sm" key={columnEl.id} colSpan={columnEl.colSpan}>
{flexRender(columnEl.column.columnDef.footer, columnEl.getContext())}
</th>
))}
</tr>
))}
</tfoot>
</table>
</div>
</Container>
Expand Down
12 changes: 12 additions & 0 deletions src/common/utils/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ export const workflowStatus = (workflow: Workflow): WorkflowStatus => {

return WorkflowStatus.RUNNING
}

export const extractExecutor = (configText: string) => {
const executorRegex = /^\s*executor\s*=\s*['"]?(\w+)['"]?/m

const match = configText.match(executorRegex)

if (match) {
return match[1]
}

return null
}

0 comments on commit efd5a01

Please sign in to comment.