diff --git a/dashboard/src/app/(authenticated)/layout.tsx b/dashboard/src/app/(authenticated)/layout.tsx deleted file mode 100644 index c4ce3aab7..000000000 --- a/dashboard/src/app/(authenticated)/layout.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { WhoAmIContext } from '@/contexts/WhoAmIContext' -import type { Metadata } from 'next' -import { cookies } from 'next/headers' -import getWhoAmI from '../getWhoami' -import { Header } from './components/Header' -import { QueryProvider } from './components/QueryProvider' - -export const metadata: Metadata = { - title: 'LittleHorse | Dashboard', -} - -export default async function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode -}>) { - const { tenants, user } = await getWhoAmI() - const tenantId = cookies().get('tenantId')?.value - - return ( - -
- -
{children}
-
- - ) -} diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Diagram.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Diagram.tsx similarity index 97% rename from dashboard/src/app/(authenticated)/(diagram)/components/Diagram.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Diagram.tsx index fb775fa9a..030511815 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Diagram.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Diagram.tsx @@ -1,5 +1,5 @@ 'use client' -import { ThreadRunWithNodeRuns } from '@/app/(authenticated)/(diagram)/wfRun/[...ids]/getWfRun' +import { ThreadRunWithNodeRuns } from '@/app/[tenantId]/(diagram)/wfRun/[...ids]/getWfRun' import { NodeRun, WfRun, WfSpec } from 'littlehorse-client/proto' import { ReadonlyURLSearchParams, useSearchParams } from 'next/navigation' import { FC, useCallback, useEffect, useMemo, useState } from 'react' diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/Default.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/Default.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/Default.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/Default.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/EdgeDetails.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/EdgeDetails.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/EdgeDetails.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/EdgeDetails.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/extractEdges.ts b/dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/extractEdges.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/extractEdges.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/extractEdges.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/extractEdges.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/extractEdges.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/extractEdges.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/extractEdges.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/EdgeTypes/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/EdgeTypes/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/WfRunForm.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/WfRunForm.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/WfRunForm.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/WfRunForm.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/BaseFormField.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/BaseFormField.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/BaseFormField.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/BaseFormField.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormFields.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormFields.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormFields.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormFields.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormInput.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormInput.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormInput.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormInput.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormSelect.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormSelect.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormSelect.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormSelect.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormTextarea.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormTextarea.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/FormTextarea.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/FormTextarea.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/formType.ts b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/formType.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/formType.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/formType.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/index.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/index.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/index.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/index.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/validation.ts b/dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/validation.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Forms/components/validation.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/Forms/components/validation.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Layouter.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Layouter.tsx similarity index 97% rename from dashboard/src/app/(authenticated)/(diagram)/components/Layouter.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Layouter.tsx index 50eed49ba..b020a5e83 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Layouter.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Layouter.tsx @@ -52,7 +52,7 @@ export const Layouter: FC<{ nodeRuns?: NodeRun[]; nodeRunNameToBeHighlighted?: s setNodes(layoutedNodes) fitView() }, - [fitView, nodeRuns, setNodes] + [fitView, nodeRuns, setNodes, nodeRunNameToBeHighlighted] ) useEffect(() => { diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/Edge.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/Edge.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/Edge.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/Edge.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/ExecuteWorkflowRun.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/ExecuteWorkflowRun.tsx similarity index 93% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/ExecuteWorkflowRun.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/ExecuteWorkflowRun.tsx index c99705106..6ee63587a 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/ExecuteWorkflowRun.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/ExecuteWorkflowRun.tsx @@ -1,4 +1,3 @@ -import { FormValues, WfRunForm } from '@/app/(authenticated)/(diagram)/components/Forms/WfRunForm' import { Button } from '@/components/ui/button' import { Dialog, @@ -9,18 +8,19 @@ import { DialogHeader, DialogTitle, } from '@/components/ui/dialog' -import { useWhoAmI } from '@/contexts/WhoAmIContext' import { ThreadVarDef, VariableType, WfSpec } from 'littlehorse-client/proto' -import { useRouter } from 'next/navigation' +import { useParams, useRouter } from 'next/navigation' import { FC, useRef } from 'react' import { toast } from 'sonner' import { Modal } from '../../context' import { useModal } from '../../hooks/useModal' import { runWfSpec } from '../../wfSpec/[...props]/actions/runWfSpec' +import { FormValues, WfRunForm } from '../Forms/WfRunForm' + export const ExecuteWorkflowRun: FC = ({ data }) => { const { showModal, setShowModal } = useModal() const lhWorkflowSpec = data as WfSpec - const { tenantId } = useWhoAmI() + const tenantId = useParams().tenantId as string const router = useRouter() const formRef = useRef(null) const wfSpecVariables = lhWorkflowSpec.threadSpecs?.entrypoint?.variableDefs @@ -62,7 +62,6 @@ export const ExecuteWorkflowRun: FC = ({ data }) => { wfSpecName: lhWorkflowSpec.id.name, majorVersion: lhWorkflowSpec.id.majorVersion, revision: lhWorkflowSpec.id.revision, - id: customWfRunId || undefined, variables: formatVariablesPayload(values), }) diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/Modals.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/Modals.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/Modals.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/Modals.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionContent.ts b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionContent.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionContent.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionContent.ts index 028240d51..57c3c5a04 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionContent.ts +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionContent.ts @@ -1,4 +1,5 @@ import { NodeRun, UserTaskNode } from 'littlehorse-client/proto' +import { FC } from 'react' import { NodeType } from '../../NodeTypes/extractNodes' import { ExternalEventDefDetail, @@ -9,7 +10,6 @@ import { WaitForThreadDefDetail, WorkflowEventDefDetail, } from './' -import { FC } from 'react' export type AccordionNode = { nodeRun: NodeRun; userTaskNode?: UserTaskNode } type AccordionNodes = { diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionItem.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionItem.tsx similarity index 98% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionItem.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionItem.tsx index 5f590889d..5fb7d1051 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/AccordionItem.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/AccordionItem.tsx @@ -1,10 +1,10 @@ -import React, { FC } from 'react' -import { AccordionComponents } from './AccordionContent' -import { NodeRun, UserTaskNode } from 'littlehorse-client/proto' import * as AccordionRedux from '@radix-ui/react-accordion' +import { NodeRun, UserTaskNode } from 'littlehorse-client/proto' import { ChevronDownIcon } from 'lucide-react' +import { FC } from 'react' import { statusColors } from '../../../wfRun/[...ids]/components/Details' import { getNodeType } from '../../NodeTypes/extractNodes' +import { AccordionComponents } from './AccordionContent' export const AccordionItem: FC<{ node: NodeRun; userTaskNode?: UserTaskNode }> = ({ node, userTaskNode }) => { const nodeType = getNodeType(node) diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/ExternalEventDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/ExternalEventDefDetail.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/ExternalEventDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/ExternalEventDefDetail.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/NodeRun.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/NodeRun.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/NodeRun.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/NodeRun.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/SleepDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/SleepDefDetail.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/SleepDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/SleepDefDetail.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/StartThreadDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/StartThreadDefDetail.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/StartThreadDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/StartThreadDefDetail.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/TaskDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/TaskDefDetail.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/TaskDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/TaskDefDetail.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx similarity index 96% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx index c93e17998..04c94db98 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/UserTaskDefDetail.tsx @@ -1,10 +1,10 @@ -import { FC } from 'react' -import { RefreshCwIcon, ClipboardIcon } from 'lucide-react' +import { getVariable, getVariableValue, utcToLocalDateTime } from '@/app/utils' import { useQuery } from '@tanstack/react-query' -import { UserTaskRunStatus, UserTaskRun as LHUserTaskRun } from 'littlehorse-client/proto' +import { UserTaskRun as LHUserTaskRun, UserTaskRunStatus } from 'littlehorse-client/proto' +import { ClipboardIcon, RefreshCwIcon } from 'lucide-react' +import { FC } from 'react' +import { getUserTaskRun } from '../../NodeTypes/UserTask/getUserTaskRun' import { AccordionNode } from './AccordionContent' -import { getVariableValue, getVariable, utcToLocalDateTime } from '@/app/utils' -import { getUserTaskRun } from '@/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/getUserTaskRun' export const UserTaskDefDetail: FC = ({ nodeRun, userTaskNode }) => { const taskId = nodeRun?.userTask?.userTaskRunId?.userTaskGuid diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/WaitForThreadDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/WaitForThreadDefDetail.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/WaitForThreadDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/WaitForThreadDefDetail.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx similarity index 86% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx index 762b42351..559287923 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/WorkflowEventDefDetail.tsx @@ -1,19 +1,18 @@ -import { FC } from 'react' -import { useWhoAmI } from '@/contexts/WhoAmIContext' -import { RefreshCwIcon, ClipboardIcon } from 'lucide-react' -import { NodeRun } from 'littlehorse-client/proto' -import { useQuery } from '@tanstack/react-query' - -import { cn } from '@/components/utils' import { getVariableValue, utcToLocalDateTime } from '@/app/utils' -import { getWorkflowEvent } from '@/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/getWorkflowEvent' +import { cn } from '@/components/utils' +import { useQuery } from '@tanstack/react-query' +import { NodeRun } from 'littlehorse-client/proto' +import { ClipboardIcon, RefreshCwIcon } from 'lucide-react' +import { useParams } from 'next/navigation' +import { FC } from 'react' +import { getWorkflowEvent } from '../../NodeTypes/ThrowEvent/getWorkflowEvent' export const WorkflowEventDefDetail: FC<{ nodeRun: NodeRun }> = ({ nodeRun }) => { - const { tenantId } = useWhoAmI() + const tenantId = useParams().tenantId as string const wfRunId = nodeRun?.throwEvent?.workflowEventId?.wfRunId?.id const workflowEventDefId = nodeRun?.throwEvent?.workflowEventId const { data, isLoading } = useQuery({ - queryKey: ['taskRun', wfRunId, workflowEventDefId], + queryKey: ['taskRun', wfRunId, workflowEventDefId, tenantId], queryFn: async () => { if (!wfRunId) return if (!workflowEventDefId) return diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/NodeRun/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/NodeRun/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/Modals/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/Modals/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/Modals/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/Modals/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeRunsList.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeRunsList.tsx similarity index 87% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeRunsList.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeRunsList.tsx index 14aec0be6..e4ec2102b 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeRunsList.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeRunsList.tsx @@ -1,7 +1,7 @@ import { NodeRun, TaskNode, UserTaskNode } from 'littlehorse-client/proto' -import { FC, useCallback } from 'react' import { EyeIcon } from 'lucide-react' -import { useModal } from '@/app/(authenticated)/(diagram)/hooks/useModal' +import { FC, useCallback } from 'react' +import { useModal } from '../hooks/useModal' type Prop = { nodeRuns: [NodeRun] @@ -14,7 +14,7 @@ export const NodeRunsList: FC = ({ nodeRuns, taskNode, userTaskNode, nodeR const showNodeRuns = useCallback(() => { setModal({ type: 'nodeRunList', data: { nodeRunsList: nodeRuns, taskNode, nodeRun, userTaskNode } }) setShowModal(true) - }, [nodeRuns, setModal, setShowModal, taskNode]) + }, [nodeRun, nodeRuns, setModal, setShowModal, taskNode, userTaskNode]) if (!nodeRuns?.length) return diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Entrypoint.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Entrypoint.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Entrypoint.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Entrypoint.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Exit.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Exit.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Exit.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Exit.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx similarity index 95% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx index 789bfa486..5cdc6897d 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ExternalEvent/ExternalEvent.tsx @@ -1,7 +1,6 @@ import { formatTime, getVariableValue } from '@/app/utils' import { Node as NodeProto } from 'littlehorse-client/proto' import { ExternalLinkIcon, MailOpenIcon } from 'lucide-react' -import Link from 'next/link' import { FC, memo } from 'react' import { Handle, Position } from 'reactflow' import { NodeProps } from '..' @@ -10,6 +9,7 @@ import { Fade } from '../Fade' import { NodeDetails } from '../NodeDetails' import { NodeRunsList } from '../../NodeRunsList' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' const Node: FC> = ({ data }) => { if (!data.externalEvent) return null @@ -22,13 +22,13 @@ const Node: FC> = ({ data }) => {

ExternalEventDef

- {externalEventNode.externalEventDefId?.name} - +
{
diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ExternalEvent/getExternalEvent.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ExternalEvent/getExternalEvent.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ExternalEvent/getExternalEvent.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ExternalEvent/getExternalEvent.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Fade.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Fade.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Fade.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Fade.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/NodeDetails.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/NodeDetails.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/NodeDetails.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/NodeDetails.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/Nop.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/Nop.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/Nop.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/Nop.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/index.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/index.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/index.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/index.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/nopHandles.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/nopHandles.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Nop/nopHandles.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Nop/nopHandles.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/Sleep.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/Sleep.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/Sleep.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/Sleep.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx similarity index 95% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx index 42be469bf..22d8e6b0b 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/SleepDetails.tsx @@ -1,8 +1,8 @@ +import { formatTime, getVariable } from '@/app/utils' import { NodeRun, SleepNode } from 'littlehorse-client/proto' import { FC } from 'react' -import { NodeDetails } from '../NodeDetails' -import { getVariable, formatTime } from '@/app/utils' import { NodeRunsList } from '../../NodeRunsList' +import { NodeDetails } from '../NodeDetails' export const SleepDetails: FC<{ sleepNode?: SleepNode; nodeRunsList: [NodeRun] }> = ({ sleepNode, nodeRunsList }) => { if (!sleepNode) return diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Sleep/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Sleep/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StartMultipleThreads.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StartMultipleThreads.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StartMultipleThreads.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StartMultipleThreads.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StartThread.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StartThread.tsx similarity index 95% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StartThread.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StartThread.tsx index f6ed7b5c5..3439037ea 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StartThread.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StartThread.tsx @@ -4,9 +4,10 @@ import { FC, memo } from 'react' import { Handle, Position } from 'reactflow' import { NodeProps } from '.' import { useThread } from '../../hooks/useThread' +import { NodeRunsList } from '../NodeRunsList' import { Fade } from './Fade' import { NodeDetails } from './NodeDetails' -import { NodeRunsList } from '@/app/(authenticated)/(diagram)/components/NodeRunsList' + const Node: FC = ({ data }) => { const { fade, nodeRunsList } = data const { setThread } = useThread() diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StatusPin.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StatusPin.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/StatusPin.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/StatusPin.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/Task.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/Task.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/Task.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/Task.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/TaskDetails.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/TaskDetails.tsx similarity index 91% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/TaskDetails.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/TaskDetails.tsx index 1120b1d22..2f9bde41a 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/TaskDetails.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/TaskDetails.tsx @@ -1,10 +1,10 @@ -import { getTaskDef } from '@/app/(authenticated)/taskDef/[name]/getTaskDef' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' +import { getTaskDef } from '@/app/[tenantId]/taskDef/[name]/getTaskDef' import { getVariable, getVariableValue } from '@/app/utils' -import { useWhoAmI } from '@/contexts/WhoAmIContext' import { useQuery } from '@tanstack/react-query' import { NodeRun, TaskNode } from 'littlehorse-client/proto' import { ExternalLinkIcon } from 'lucide-react' -import Link from 'next/link' +import { useParams } from 'next/navigation' import { FC } from 'react' import { NodeRunsList } from '../../NodeRunsList' import { NodeDetails } from '../NodeDetails' @@ -16,7 +16,7 @@ export const TaskDetails: FC<{ selected: boolean nodeRunsList: [NodeRun] }> = ({ taskNode, nodeRun, selected, nodeRunsList }) => { - const { tenantId } = useWhoAmI() + const tenantId = useParams().tenantId as string const { data } = useQuery({ queryKey: ['taskRun', nodeRun, tenantId], queryFn: async () => { @@ -31,7 +31,7 @@ export const TaskDetails: FC<{ if (!taskNode?.taskDefId?.name) return null if (nodeRun?.task?.taskRunId) return null if (!selected) return null - const taskDef = await getTaskDef({ + const taskDef = await getTaskDef(tenantId, { name: taskNode?.taskDefId?.name, }) return taskDef @@ -95,12 +95,12 @@ export const TaskDetails: FC<{ export const TaskLink: FC<{ taskName?: string }> = ({ taskName }) => { return ( - {taskName} - + ) } diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/getTaskRun.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/getTaskRun.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/getTaskRun.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/getTaskRun.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/Task/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/Task/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx similarity index 94% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx index 9cae9ee49..5d14c9de6 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/ThrowEvent.tsx @@ -1,10 +1,10 @@ import { Node as NodeProto } from 'littlehorse-client/proto' import { CircleArrowOutUpRightIcon, ExternalLinkIcon } from 'lucide-react' -import Link from 'next/link' import { FC, memo } from 'react' import { Handle, Position } from 'reactflow' import { NodeProps } from '..' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' import { Fade } from '../Fade' import { NodeDetails } from '../NodeDetails' @@ -21,13 +21,13 @@ const Node: FC> = ({ data }) => {

WorkflowEventDef

- {throwEventNode.eventDefId?.name} - +
diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/getWorkflowEvent.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/getWorkflowEvent.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/getWorkflowEvent.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/getWorkflowEvent.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/ThrowEvent/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/ThrowEvent/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTask.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTask.tsx similarity index 88% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTask.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTask.tsx index 3abf045c3..4f502cdc4 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTask.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTask.tsx @@ -1,12 +1,12 @@ -import { UserTaskDefDetails } from '@/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails' +import { UserTaskDefDetails } from '@/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' import { ExternalLinkIcon, UserIcon } from 'lucide-react' -import Link from 'next/link' import { FC, memo } from 'react' import { Handle, Position } from 'reactflow' +import { NodeRunsList } from '../../NodeRunsList' import { Fade } from '../Fade' import { NodeProps } from '../index' import { NodeDetails } from '../NodeDetails' -import { NodeRunsList } from '../../NodeRunsList' const Node: FC = ({ data, selected }) => { if (!data.userTask) return null @@ -18,13 +18,13 @@ const Node: FC = ({ data, selected }) => {

UserTask

- {userTask.userTaskDefName} - +
{nodeRun ? ( diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx similarity index 80% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx index 6b4674417..dfa7ef909 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskDefDetails.tsx @@ -1,4 +1,4 @@ -import { UserAndGroupAssignmentInfo } from '@/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo' +import { UserAndGroupAssignmentInfo } from '@/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserAndGroupAssignmentInfo' import { getVariable } from '@/app/utils' import { UserTaskNode } from 'littlehorse-client/proto' import { FC } from 'react' diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskNotes.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskNotes.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/UserTaskNotes.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/UserTaskNotes.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/getUserTaskRun.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/getUserTaskRun.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/getUserTaskRun.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/getUserTaskRun.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/UserTask/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/UserTask/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/WaitForThreads.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/WaitForThreads.tsx similarity index 95% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/WaitForThreads.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/WaitForThreads.tsx index 3946134d1..4fe407968 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/WaitForThreads.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/WaitForThreads.tsx @@ -3,9 +3,9 @@ import { PlusIcon } from 'lucide-react' import { FC, memo } from 'react' import { Handle, Position } from 'reactflow' import { NodeProps } from '.' +import { NodeRunsList } from '../NodeRunsList' import { Fade } from './Fade' import { NodeDetails } from './NodeDetails' -import { NodeRunsList } from '@/app/(authenticated)/(diagram)/components/NodeRunsList' const Node: FC = ({ data }) => { const { fade, nodeRunsList } = data diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/extractNodes.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/extractNodes.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/extractNodes.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/extractNodes.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/index.ts b/dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/NodeTypes/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/components/NodeTypes/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/components/ThreadPanel.tsx b/dashboard/src/app/[tenantId]/(diagram)/components/ThreadPanel.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/components/ThreadPanel.tsx rename to dashboard/src/app/[tenantId]/(diagram)/components/ThreadPanel.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/context/ModalContext.tsx b/dashboard/src/app/[tenantId]/(diagram)/context/ModalContext.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/context/ModalContext.tsx rename to dashboard/src/app/[tenantId]/(diagram)/context/ModalContext.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/context/ThreadContext.tsx b/dashboard/src/app/[tenantId]/(diagram)/context/ThreadContext.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/context/ThreadContext.tsx rename to dashboard/src/app/[tenantId]/(diagram)/context/ThreadContext.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/context/index.ts b/dashboard/src/app/[tenantId]/(diagram)/context/index.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/context/index.ts rename to dashboard/src/app/[tenantId]/(diagram)/context/index.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/hooks/useModal.tsx b/dashboard/src/app/[tenantId]/(diagram)/hooks/useModal.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/hooks/useModal.tsx rename to dashboard/src/app/[tenantId]/(diagram)/hooks/useModal.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/hooks/useReplaceQueryValue.tsx b/dashboard/src/app/[tenantId]/(diagram)/hooks/useReplaceQueryValue.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/hooks/useReplaceQueryValue.tsx rename to dashboard/src/app/[tenantId]/(diagram)/hooks/useReplaceQueryValue.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/hooks/useScrollbar.tsx b/dashboard/src/app/[tenantId]/(diagram)/hooks/useScrollbar.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/hooks/useScrollbar.tsx rename to dashboard/src/app/[tenantId]/(diagram)/hooks/useScrollbar.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/hooks/useThread.tsx b/dashboard/src/app/[tenantId]/(diagram)/hooks/useThread.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/hooks/useThread.tsx rename to dashboard/src/app/[tenantId]/(diagram)/hooks/useThread.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/layout.tsx b/dashboard/src/app/[tenantId]/(diagram)/layout.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/layout.tsx rename to dashboard/src/app/[tenantId]/(diagram)/layout.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/Details.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/Details.tsx similarity index 86% rename from dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/Details.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/Details.tsx index 83ee05701..b573821f3 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/Details.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/Details.tsx @@ -1,7 +1,7 @@ 'use client' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' import { concatWfRunIds, formatDate } from '@/app/utils' import { WfRun } from 'littlehorse-client/proto' -import Link from 'next/link' import { FC } from 'react' type DetailsProps = WfRun @@ -25,20 +25,18 @@ export const Details: FC = ({ id, status, wfSpecId, startTime }) = {id?.parentWfRunId && (
Parent WfRun: - - {id?.parentWfRunId?.id} - + {id?.parentWfRunId?.id}
)}
WfSpec: - {`${wfSpecId?.name} ${wfSpecId?.majorVersion}.${wfSpecId?.revision}`} - +
Status: {`${status}`} diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/Variables.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/Variables.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/Variables.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/Variables.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/WfRun.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/WfRun.tsx similarity index 87% rename from dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/WfRun.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/WfRun.tsx index 68c8b783d..04e666bf6 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/components/WfRun.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/components/WfRun.tsx @@ -1,6 +1,6 @@ 'use client' -import { Diagram } from '@/app/(authenticated)/(diagram)/components/Diagram' -import { Navigation } from '@/app/(authenticated)/components/Navigation' +import { Diagram } from '@/app/[tenantId]/(diagram)/components/Diagram' +import { Navigation } from '@/app/[tenantId]/components/Navigation' import { useSearchParams } from 'next/navigation' import { FC } from 'react' import { Modals } from '../../../components/Modals' diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/getWfRun.ts b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/getWfRun.ts similarity index 89% rename from dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/getWfRun.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/getWfRun.ts index 8d153b702..921900794 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/getWfRun.ts +++ b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/getWfRun.ts @@ -2,10 +2,10 @@ import { lhClient } from '@/app/lhClient' import { NodeRun, ThreadRun, Variable, WfRun, WfRunId, WfSpec } from 'littlehorse-client/proto' -import { cookies } from 'next/headers' type Props = { ids: string[] + tenantId: string } export type ThreadRunWithNodeRuns = ThreadRun & { nodeRuns: NodeRun[] } @@ -16,8 +16,7 @@ export type WfRunResponse = { nodeRuns: NodeRun[] variables: Variable[] } -export const getWfRun = async ({ ids }: Props): Promise => { - const tenantId = cookies().get('tenantId')?.value +export const getWfRun = async ({ ids, tenantId }: Props): Promise => { const client = await lhClient({ tenantId }) const wfRunId = ids .reverse() diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/page.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/page.tsx similarity index 72% rename from dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/page.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/page.tsx index 84970f6b9..7041e9dbc 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfRun/[...ids]/page.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfRun/[...ids]/page.tsx @@ -4,11 +4,11 @@ import { ClientError, Status } from 'nice-grpc-common' import { WfRun } from './components/WfRun' import { getWfRun } from './getWfRun' -type Props = { params: { ids: string[] } } +type Props = { params: { ids: string[]; tenantId: string } } -export default async function Page({ params: { ids } }: Props) { +export default async function Page({ params: { ids, tenantId } }: Props) { try { - return + return } catch (error) { if (error instanceof ClientError && error.code === Status.NOT_FOUND) return notFound() throw error diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/ScheduleWfRun.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/ScheduleWfRun.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/ScheduleWfRun.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/ScheduleWfRun.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getScheduleWfSpec.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getScheduleWfSpec.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getScheduleWfSpec.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getScheduleWfSpec.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getVersions.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getVersions.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getVersions.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getVersions.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getWfSpec.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getWfSpec.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/getWfSpec.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/getWfSpec.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/runWfSpec.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/runWfSpec.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/runWfSpec.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/runWfSpec.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/searchVariables.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/searchVariables.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/searchVariables.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/searchVariables.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/searchWfRun.ts b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/searchWfRun.ts similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/actions/searchWfRun.ts rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/actions/searchWfRun.ts diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Details.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Details.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Details.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Details.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Mutations.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Mutations.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Mutations.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Mutations.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx similarity index 93% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx index 52747649c..77448b88c 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/SearchVariableDialog.tsx @@ -1,4 +1,5 @@ -import { SearchFooter } from '@/app/(authenticated)/components/SearchFooter' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' +import { SearchFooter } from '@/app/[tenantId]/components/SearchFooter' import { Button } from '@/components/ui/button' import { Dialog, @@ -10,12 +11,11 @@ import { } from '@/components/ui/dialog' import { Input } from '@/components/ui/input' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' -import { useWhoAmI } from '@/contexts/WhoAmIContext' import { WithBookmark } from '@/types' import { useInfiniteQuery } from '@tanstack/react-query' import { VariableDef, VariableValue, WfSpec } from 'littlehorse-client/proto' import { RefreshCwIcon } from 'lucide-react' -import Link from 'next/link' +import { useParams } from 'next/navigation' import { FC, Fragment, useState } from 'react' import { useDebounce } from 'use-debounce' import { searchVariables } from '../actions/searchVariables' @@ -38,7 +38,7 @@ export const SearchVariableDialog: FC = ({ spec }) => { const [variableValue, setVariableValue] = useState('') const [variableValueDebounced] = useDebounce(variableValue, 250) const [limit, setLimit] = useState(LIMIT) - const { tenantId } = useWhoAmI() + const tenantId = useParams().tenantId as string const { isPending, data, hasNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['searchVariables', tenantId, limit, variable, variableValueDebounced], @@ -102,12 +102,12 @@ export const SearchVariableDialog: FC = ({ spec }) => { {page.results.map(variableId => (
- {variableId.wfRunId?.id} - +
))}
diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Thread.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Thread.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Thread.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Thread.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Variables.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Variables.tsx similarity index 100% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Variables.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Variables.tsx diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Versions.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Versions.tsx similarity index 82% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Versions.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Versions.tsx index 470e3819f..78a119e6d 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/Versions.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/Versions.tsx @@ -1,5 +1,4 @@ -import { VersionSelector } from '@/app/(authenticated)/components/VersionSelector' -import { useWhoAmI } from '@/contexts/WhoAmIContext' +import { VersionSelector } from '@/app/[tenantId]/components/VersionSelector' import { WfSpecId } from 'littlehorse-client/proto' import { useParams } from 'next/navigation' import { FC, useCallback, useState } from 'react' @@ -7,9 +6,9 @@ import { getWfSpecVersions } from '../actions/getVersions' export const Versions: FC<{ wfSpecId?: WfSpecId }> = ({ wfSpecId }) => { const [versions, setVersions] = useState([]) - const { tenantId } = useWhoAmI() const { name, majorVersion, revision } = wfSpecId! const { props } = useParams() + const tenantId = useParams().tenantId as string const loadVersions = useCallback(async () => { const { versions } = await getWfSpecVersions({ name, tenantId }) diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRuns.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRuns.tsx similarity index 85% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRuns.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRuns.tsx index fbd3bec3d..2099bd7b0 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRuns.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRuns.tsx @@ -1,13 +1,12 @@ 'use client' -import { SearchFooter } from '@/app/(authenticated)/components/SearchFooter' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' +import { SearchFooter } from '@/app/[tenantId]/components/SearchFooter' import { SEARCH_DEFAULT_LIMIT, TIME_RANGES, TimeRange } from '@/app/constants' import { concatWfRunIds } from '@/app/utils' -import { useWhoAmI } from '@/contexts/WhoAmIContext' import { useInfiniteQuery } from '@tanstack/react-query' import { WfSpec, lHStatusFromJSON } from 'littlehorse-client/proto' import { RefreshCwIcon } from 'lucide-react' -import Link from 'next/link' -import { useSearchParams } from 'next/navigation' +import { useParams, useSearchParams } from 'next/navigation' import { FC, Fragment, useMemo, useState } from 'react' import { PaginatedWfRunIdList, searchWfRun } from '../actions/searchWfRun' import { WfRunsHeader } from './WfRunsHeader' @@ -17,7 +16,7 @@ export const WfRuns: FC = spec => { const status = searchParams.get('status') ? getStatus(searchParams.get('status')) || 'ALL' : 'ALL' const [limit, setLimit] = useState(SEARCH_DEFAULT_LIMIT) const [window, setWindow] = useState(TIME_RANGES[0]) - const { tenantId } = useWhoAmI() + const tenantId = useParams().tenantId as string const startTime = useMemo(() => { if (window === -1) return undefined @@ -63,9 +62,12 @@ export const WfRuns: FC = spec => { {page.results.map(wfRunId => (
- + {wfRunId.id} - +
))}
diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx similarity index 87% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx index 207c98e67..dba18d8eb 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfRunsHeader.tsx @@ -2,9 +2,10 @@ import { TIME_RANGES, TIME_RANGES_NAMES, TimeRange, WF_RUN_STATUSES } from '@/ap import { Listbox, ListboxButton, ListboxOptions } from '@headlessui/react' import { LHStatus, WfSpec } from 'littlehorse-client/proto' import { ClockIcon } from 'lucide-react' -import Link from 'next/link' +import LinkWithTenant from '@/app/[tenantId]/components/LinkWithTenant' import { FC } from 'react' import { SearchVariableDialog } from './SearchVariableDialog' +import { usePathname } from 'next/navigation' type Props = { spec: WfSpec @@ -14,6 +15,9 @@ type Props = { } export const WfRunsHeader: FC = ({ spec, currentStatus, currentWindow, setWindow }) => { + const pathname = usePathname() + const pathWithoutTenant = pathname.replace(/^\/[^/]+/, '') + return (

WfRun Search

@@ -44,15 +48,15 @@ export const WfRunsHeader: FC = ({ spec, currentStatus, currentWindow, se
{['ALL', ...WF_RUN_STATUSES].map(status => ( - {status} - + ))}
{Object.keys(spec.threadSpecs).flatMap(threadSpec => diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfSpec.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfSpec.tsx similarity index 94% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfSpec.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfSpec.tsx index 49320a127..96c492d86 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/components/WfSpec.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/components/WfSpec.tsx @@ -1,13 +1,13 @@ 'use client' -import { Navigation } from '@/app/(authenticated)/components/Navigation' +import { Navigation } from '@/app/[tenantId]/components/Navigation' import { ScheduledWfRunIdList, WfSpec as Spec } from 'littlehorse-client/proto' +import { LucidePlayCircle } from 'lucide-react' import { FC, useCallback } from 'react' import { Diagram } from '../../../components/Diagram' +import { useModal } from '../../../hooks/useModal' import { Details } from './Details' import { Thread } from './Thread' import { WfRuns } from './WfRuns' -import { useModal } from '../../../hooks/useModal' -import { LucidePlayCircle } from 'lucide-react' type WfSpecProps = { spec: Spec diff --git a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/page.tsx b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/page.tsx similarity index 81% rename from dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/page.tsx rename to dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/page.tsx index 10e1480cf..b37d2bde8 100644 --- a/dashboard/src/app/(authenticated)/(diagram)/wfSpec/[...props]/page.tsx +++ b/dashboard/src/app/[tenantId]/(diagram)/wfSpec/[...props]/page.tsx @@ -1,19 +1,18 @@ import { Metadata } from 'next' -import { cookies } from 'next/headers' import { notFound } from 'next/navigation' import { ClientError, Status } from 'nice-grpc-common' import { getWfSpec } from './actions/getWfSpec' import { getScheduleWfSpec } from './actions/getScheduleWfSpec' import { WfSpec } from './components/WfSpec' -type Props = { params: { props: string[] } } +type Props = { params: { props: string[]; tenantId: string } } export const dynamic = 'force-dynamic' -export default async function Page({ params: { props } }: Props) { +export default async function Page({ params: { props, tenantId } }: Props) { const name = props[0] const version = props[1] - const tenantId = cookies().get('tenantId')?.value + try { const wfSpec = await getWfSpec({ tenantId, name, version }) const scheduleWfSpec = await getScheduleWfSpec({ tenantId, name, version }) diff --git a/dashboard/src/app/(authenticated)/components/Header.tsx b/dashboard/src/app/[tenantId]/components/Header.tsx similarity index 82% rename from dashboard/src/app/(authenticated)/components/Header.tsx rename to dashboard/src/app/[tenantId]/components/Header.tsx index ce66ac9a2..994a5403e 100644 --- a/dashboard/src/app/(authenticated)/components/Header.tsx +++ b/dashboard/src/app/[tenantId]/components/Header.tsx @@ -1,8 +1,9 @@ 'use client' -import { FC } from 'react' import LhLogo from '@/littlehorse.svg' +import { FC } from 'react' +import LinkWithTenant from './LinkWithTenant' import { Principal } from './Principal' import { TenantSelector } from './TenantSelector' @@ -10,13 +11,13 @@ export const Header: FC = () => { return (