Debug info
@@ -61,4 +61,58 @@ const DebugInfo = ({
);
};
-export default React.memo(DebugInfo);
+const ConditionalDebugInfo = ({
+ id,
+ isValid,
+ TargetConnections,
+ SourceConnections,
+}: {
+ id: string;
+ isValid: boolean;
+ TargetConnections: any;
+ SourceConnections: any;
+}) => {
+ const [isDebugVisible, setDebugVisible] = useState(false);
+
+ const toggleDebugInfo = () => {
+ setDebugVisible(!isDebugVisible);
+ };
+
+ if (env.NEXT_PUBLIC_ENV !== "development") {
+ return null;
+ }
+
+ if (isDebugVisible) {
+ return (
+
+
+
+
+ );
+ }
+
+ return (
+
+ );
+};
+
+export default React.memo(ConditionalDebugInfo);
diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx
index 3230be6..a286623 100644
--- a/src/components/ui/badge.tsx
+++ b/src/components/ui/badge.tsx
@@ -4,7 +4,7 @@ import * as React from "react";
import { cn } from "src/lib/utils";
const badgeVariants = cva(
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
diff --git a/src/lib/workflow/Workflow.ts b/src/lib/workflow/Workflow.ts
index 19eb508..2d0a1ac 100644
--- a/src/lib/workflow/Workflow.ts
+++ b/src/lib/workflow/Workflow.ts
@@ -534,7 +534,7 @@ export class Runner extends Base {
controller: AbortController,
operationCallback?: (operationId: string, data: any) => Promise
,
) {
- const sortedOperations = await this.sortOperations(workflow);
+ const sortedOperations = this.sortOperations(workflow);
log.info(
"sortedOperations",
sortedOperations.map((op) => op.id),
diff --git a/src/lib/workflow/utils/workflowQueue.ts b/src/lib/workflow/utils/workflowQueue.ts
index 1804502..8706c10 100644
--- a/src/lib/workflow/utils/workflowQueue.ts
+++ b/src/lib/workflow/utils/workflowQueue.ts
@@ -6,7 +6,11 @@ import Redis from "ioredis";
import { v4 as uuidv4 } from "uuid";
import { env } from "~/env";
import { db } from "~/server/db";
-import { workflowJobs, workflowRuns, workflowRunOperations } from "~/server/db/schema";
+import {
+ workflowJobs,
+ workflowRunOperations,
+ workflowRuns,
+} from "~/server/db/schema";
const log = new Logger("workflowQueue");
@@ -314,7 +318,7 @@ function compressReturnValues(returnValues: any[]) {
);
}
- if (compressedItem.track) {
+ if (compressedItem.track?.artists) {
compressedItem.track.artists = compressedItem.track.artists.map(
(artist: SpotifyApi.ArtistObjectSimplified) => ({
...artist,
diff --git a/src/server/db/index.ts b/src/server/db/index.ts
index 2e9950d..2a8ebde 100644
--- a/src/server/db/index.ts
+++ b/src/server/db/index.ts
@@ -2,7 +2,7 @@ import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import { env } from "~/env.js";
-import * as schema from "./schema";
+import * as schema from "./schema";
import { type PostgresJsDatabase } from "drizzle-orm/postgres-js";
@@ -23,4 +23,4 @@ if (env.NODE_ENV === "production") {
db = global.db;
}
-export { db };
\ No newline at end of file
+export { db };
diff --git a/src/server/db/schema.ts b/src/server/db/schema.ts
index ee25453..7e14272 100644
--- a/src/server/db/schema.ts
+++ b/src/server/db/schema.ts
@@ -137,17 +137,20 @@ export const workflowRuns = pgTable(
workflowIdIdx: index("workflowRuns_workflowId_idx").on(workflowRun.id),
}),
);
-export const workflowRunsRelations = relations(workflowRuns, ({ one, many }) => ({
- workflow: one(workflowJobs, {
- fields: [workflowRuns.workflowId],
- references: [workflowJobs.id],
- }),
- operations: many(workflowRunOperations),
- worker: one(workerPool, {
- fields: [workflowRuns.workerId],
- references: [workerPool.deviceHash],
+export const workflowRunsRelations = relations(
+ workflowRuns,
+ ({ one, many }) => ({
+ workflow: one(workflowJobs, {
+ fields: [workflowRuns.workflowId],
+ references: [workflowJobs.id],
+ }),
+ operations: many(workflowRunOperations),
+ worker: one(workerPool, {
+ fields: [workflowRuns.workerId],
+ references: [workerPool.deviceHash],
+ }),
}),
-}));
+);
export const workflowRunOperations = pgTable(
"workflowRunOperation",
@@ -165,7 +168,6 @@ export const workflowRunOperations = pgTable(
}),
);
-
export const workflowRunOperationsRelations = relations(
workflowRunOperations,
({ one }) => ({
diff --git a/src/styles/globals.css b/src/styles/globals.css
index fa73670..841fb6f 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -151,4 +151,151 @@ html{
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: var(--primary-foreground);
+}
+
+.sonner-loading-wrapper {
+ --size: 16px;
+ height: var(--size);
+ width: var(--size);
+ position: absolute;
+ inset: 0;
+ z-index: 10;
+}
+
+.sonner-loading-wrapper[data-visible='false'] {
+ transform-origin: center;
+ animation: sonner-fade-out 0.2s ease forwards;
+}
+
+.sonner-spinner {
+ position: relative;
+ top: 50%;
+ left: 50%;
+ height: var(--size);
+ width: var(--size);
+}
+
+.sonner-loading-bar {
+ animation: sonner-spin 1.2s linear infinite;
+ background: var(--gray11);
+ border-radius: 6px;
+ height: 8%;
+ left: -10%;
+ position: absolute;
+ top: -3.9%;
+ width: 24%;
+}
+
+.sonner-loading-bar:nth-child(1) {
+ animation-delay: -1.2s;
+ transform: rotate(0.0001deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(2) {
+ animation-delay: -1.1s;
+ transform: rotate(30deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(3) {
+ animation-delay: -1s;
+ transform: rotate(60deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(4) {
+ animation-delay: -0.9s;
+ transform: rotate(90deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(5) {
+ animation-delay: -0.8s;
+ transform: rotate(120deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(6) {
+ animation-delay: -0.7s;
+ transform: rotate(150deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(7) {
+ animation-delay: -0.6s;
+ transform: rotate(180deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(8) {
+ animation-delay: -0.5s;
+ transform: rotate(210deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(9) {
+ animation-delay: -0.4s;
+ transform: rotate(240deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(10) {
+ animation-delay: -0.3s;
+ transform: rotate(270deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(11) {
+ animation-delay: -0.2s;
+ transform: rotate(300deg) translate(146%);
+}
+
+.sonner-loading-bar:nth-child(12) {
+ animation-delay: -0.1s;
+ transform: rotate(330deg) translate(146%);
+}
+
+@keyframes sonner-fade-in {
+ 0% {
+ opacity: 0;
+ transform: scale(0.8);
+ }
+ 100% {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
+@keyframes sonner-fade-out {
+ 0% {
+ opacity: 1;
+ transform: scale(1);
+ }
+ 100% {
+ opacity: 0;
+ transform: scale(0.8);
+ }
+}
+
+@keyframes sonner-spin {
+ 0% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0.15;
+ }
+}
+
+@media (prefers-reduced-motion) {
+ [data-sonner-toast],
+ [data-sonner-toast] > *,
+ .sonner-loading-bar {
+ transition: none !important;
+ animation: none !important;
+ }
+}
+
+.sonner-loader {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ transform-origin: center;
+ transition: opacity 200ms, transform 200ms;
+}
+
+.sonner-loader[data-visible='false'] {
+ opacity: 0;
+ transform: scale(0.8) translate(-50%, -50%);
}
\ No newline at end of file
diff --git a/src/types.d.ts b/src/types.d.ts
index 99fdd54..4a32f0a 100644
--- a/src/types.d.ts
+++ b/src/types.d.ts
@@ -97,6 +97,14 @@ interface WorkflowResponse {
modifiedAt?: number;
}
+type WorkflowRunOperation = {
+ id: string;
+ workflowRunId: string;
+ completedAt: string;
+ data: string;
+ startedAt: string;
+};
+
interface QueueResponse {
id: string;
workflowId: string;
@@ -107,6 +115,7 @@ interface QueueResponse {
workerId: string;
returnValues?: any;
workflow?: WorkflowObject;
+ operations?: WorkflowRunOperation[];
}
interface SystemInfo {