Skip to content

Commit

Permalink
minor workflow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Jul 24, 2024
1 parent dc49b16 commit 0a0c98c
Show file tree
Hide file tree
Showing 10 changed files with 408 additions and 33 deletions.
2 changes: 2 additions & 0 deletions graphql/fluss-next/fragments/run.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fragment DetailRun on Run {
}
t
}
status
flow {
...Flow
}
Expand All @@ -57,6 +58,7 @@ fragment ListRun on Run {
id
assignation
createdAt
status
flow {
workspace {
title
Expand Down
28 changes: 23 additions & 5 deletions src/reaktion/api/graphql.ts

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions src/reaktion/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,34 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "CloseRunInput",
"description": null,
"isOneOf": false,
"fields": null,
"inputFields": [
{
"name": "run",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "INPUT_OBJECT",
"name": "CreateRunInput",
Expand Down Expand Up @@ -3837,6 +3865,39 @@
"description": null,
"isOneOf": null,
"fields": [
{
"name": "closeRun",
"description": null,
"args": [
{
"name": "input",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "CloseRunInput",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Run",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "createRun",
"description": null,
Expand Down Expand Up @@ -7596,6 +7657,22 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "status",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "RunStatus",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -7867,6 +7944,30 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "RunStatus",
"description": null,
"isOneOf": null,
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "COMPLETED",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "RUNNING",
"description": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "SearchAssignWidget",
Expand Down
4 changes: 3 additions & 1 deletion src/reaktion/track/TrackFlow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
DetailRunFragment,
GraphInput,
RunStatus,
useRunForAssignationQuery,
} from "@/reaktion/api/graphql";
import { AnimatePresence } from "framer-motion";
Expand Down Expand Up @@ -95,7 +96,8 @@ export const TrackFlow: React.FC<Props> = ({ run, assignation, onSave }) => {
</div>
<AnimatePresence>
<div className=" w-full flex-initial ">
{assignation?.status != AssignationEventKind.Done ? (
{run.status}
{run?.status != RunStatus.Completed ? (
<LiveTracker run={run} startT={run?.latestSnapshot?.t || 0} />
) : (
<RangeTracker run={run} />
Expand Down
94 changes: 94 additions & 0 deletions src/reaktion/track/components/node/NodeShow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { Card } from "@/components/ui/card";
import {
ContextMenu,
ContextMenuContent,
ContextMenuTrigger,
} from "@/components/ui/context-menu";
import { cn } from "@/lib/utils";
import { motion } from "framer-motion";
import React from "react";
import { NodeResizeControl } from "reactflow";
import { useLatestNodeEvent } from "../../hooks/useLatestNodeEvent";

type NodeProps = {
children: React.ReactNode;
className?: string;
id: string;
selected?: boolean;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
contextMenu?: React.ReactNode;
};

const controlStyle = {
background: "transparent",
border: "none",
};

export const NodeTrackLayout: React.FC<NodeProps> = ({
id,
children,
className,
selected,
contextMenu,
minWidth = 100,
minHeight = 30,
maxWidth = 400,
maxHeight = 700,
}) => {
const latestEvent = useLatestNodeEvent(id);

return (
<>
<ContextMenu>
<ContextMenuTrigger>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
key={id}
className={cn(
"rounded-xl border bg-card text-card-foreground shadow dark:border-gray-700 border-gray-400 max-w-[300px] w-full",
"custom-drag-handle h-full z-10 group shadow relative border bg-sidebar ",
className,
)}
>
{children}
</motion.div>
</ContextMenuTrigger>
<ContextMenuContent>{contextMenu}</ContextMenuContent>
</ContextMenu>
<NodeResizeControl
style={controlStyle}
minWidth={100}
minHeight={70}
maxHeight={maxHeight}
maxWidth={maxWidth}
className=""
>
<div
className={`${
!selected && "hidden"
} absolute bottom-0 right-0 w-3 h-3 z-10 translate-x-[-1/2] translate-y-[-1/2] bg-white rounded-full shadow-md border-2 border-white dark:border-gray-800 dark:bg-gray-800 dark:shadow-none/0`}
>
<svg
width="15"
height="15"
viewBox="0 0 15 15"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M11.3536 11.3536C11.5488 11.1583 11.5488 10.8417 11.3536 10.6465L4.70711 4L9 4C9.27614 4 9.5 3.77614 9.5 3.5C9.5 3.22386 9.27614 3 9 3L3.5 3C3.36739 3 3.24021 3.05268 3.14645 3.14645C3.05268 3.24022 3 3.36739 3 3.5L3 9.00001C3 9.27615 3.22386 9.50001 3.5 9.50001C3.77614 9.50001 4 9.27615 4 9.00001V4.70711L10.6464 11.3536C10.8417 11.5488 11.1583 11.5488 11.3536 11.3536Z"
fill="currentColor"
fill-rule="evenodd"
clip-rule="evenodd"
></path>
</svg>
</div>
</NodeResizeControl>
</>
);
};
14 changes: 9 additions & 5 deletions src/reaktion/track/nodes/RekuestMapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export const RekuestMapWidget: React.FC<RekuestMapNodeProps> = ({
id={id}
className={cn(
"border-blue-400/40 shadow-blue-400/10 dark:border-blue-300 dark:shadow-blue/20 shadow-xl",
latestEvent?.kind === RunEventKind.Error &&
"border-red-400 dark:border-red-300 dark:shadow-red/20 shadow-red-400/10",
latestEvent?.kind === RunEventKind.Complete &&
"border-green-400 dark:border-green-300 dark:shadow-green/20 shadow-green-400/10",
)}
selected={selected}
contextMenu={
Expand Down Expand Up @@ -65,10 +69,12 @@ export const RekuestMapWidget: React.FC<RekuestMapNodeProps> = ({
/>
)}
{latestEvent && latestEvent.kind === RunEventKind.Complete && (
<div className="text-center font-light p-5">Node is complete</div>
<div className="text-center font-light p-5 ">
Node is complete
</div>
)}
{latestEvent && latestEvent.kind === RunEventKind.Error && (
<div className="text-center font-light p-5">
<div className="text-center font-light p-5 text-red-300">
{latestEvent.value}
</div>
)}
Expand All @@ -77,9 +83,7 @@ export const RekuestMapWidget: React.FC<RekuestMapNodeProps> = ({
)}
</div>
</CardTitle>
<CardDescription>
<NodeDescription description={description} />
</CardDescription>
<CardDescription></CardDescription>
{expanded && <div>Not implemented yet</div>}
</CardHeader>
{outs.map((s, index) => (
Expand Down
9 changes: 8 additions & 1 deletion src/reaktion/track/nodes/generic/ArgShowNodeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { OutStream } from "@/reaktion/base/Outstream";
import { portToLabel } from "@/rekuest/widgets/utils";
import React, { useState } from "react";
import { ArgNodeProps } from "../../../types";
import { useLatestNodeEvent } from "../../hooks/useLatestNodeEvent";
import { RunEventKind } from "@/reaktion/api/graphql";

export const ArgTrackNodeWidget: React.FC<ArgNodeProps> = ({
data: { outs, ins },
id,
selected,
}) => {
const latestEvent = useLatestNodeEvent(id);
const [show, setShow] = useState(false);
const [isSmall, setIsSmall] = useState(true);

Expand All @@ -19,13 +22,17 @@ export const ArgTrackNodeWidget: React.FC<ArgNodeProps> = ({
<NodeShowLayout
className={cn(
"border-blue-400/40 shadow-blue-400/10 dark:border-blue-300 dark:shadow-blue/20 shadow-xl",
latestEvent?.kind === RunEventKind.Error &&
"border-red-400 dark:border-red-300 dark:shadow-red/20 shadow-red-400/10",
latestEvent?.kind === RunEventKind.Complete &&
"border-green-400 dark:border-green-300 dark:shadow-green/20 shadow-green-400/10",
)}
id={id}
selected={selected}
>
<CardHeader className="p-4">
<CardTitle onDoubleClick={() => setIsSmall(!isSmall)}>
Inputs{" "}
Inputs {latestEvent?.kind === RunEventKind.Complete && "✅"}
</CardTitle>
<CardDescription>
{outs
Expand Down
7 changes: 7 additions & 0 deletions src/reaktion/track/nodes/generic/ReturnShowNodeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import { NodeShowLayout } from "@/reaktion/base/NodeShow";
import { portToLabel } from "@/rekuest/widgets/utils";
import React, { useState } from "react";
import { ReturnNodeProps } from "../../../types";
import { useLatestNodeEvent } from "../../hooks/useLatestNodeEvent";
import { RunEventKind } from "@/reaktion/api/graphql";

export const ReturnTrackNodeWidget: React.FC<ReturnNodeProps> = ({
data: { ins },
id,
selected,
}) => {
const latestEvent = useLatestNodeEvent(id);
const [show, setShow] = useState(false);
const [isSmall, setIsSmall] = useState(true);

Expand All @@ -19,6 +22,10 @@ export const ReturnTrackNodeWidget: React.FC<ReturnNodeProps> = ({
<NodeShowLayout
className={cn(
"border-blue-400/40 shadow-blue-400/10 dark:border-blue-300 dark:shadow-blue/20 shadow-xl",
latestEvent?.kind === RunEventKind.Error &&
"border-red-400 dark:border-red-300 dark:shadow-red/20 shadow-red-400/10",
latestEvent?.kind === RunEventKind.Complete &&
"border-green-400 dark:border-green-300 dark:shadow-green/20 shadow-green-400/10",
)}
id={id}
selected={selected}
Expand Down
Loading

0 comments on commit 0a0c98c

Please sign in to comment.