Skip to content

Commit

Permalink
fix(dashboard): missed some tenantId from url
Browse files Browse the repository at this point in the history
  • Loading branch information
hazimoarafa committed Nov 26, 2024
1 parent 596f40e commit e047bdc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FormValues, WfRunForm } from '@/app/(authenticated)/(diagram)/components/Forms/WfRunForm'
import { Button } from '@/components/ui/button'
import {
Dialog,
Expand All @@ -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<Modal> = ({ 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<HTMLFormElement | null>(null)
const wfSpecVariables = lhWorkflowSpec.threadSpecs?.entrypoint?.variableDefs
Expand Down Expand Up @@ -62,7 +62,6 @@ export const ExecuteWorkflowRun: FC<Modal> = ({ data }) => {
wfSpecName: lhWorkflowSpec.id.name,
majorVersion: lhWorkflowSpec.id.majorVersion,
revision: lhWorkflowSpec.id.revision,

id: customWfRunId || undefined,
variables: formatVariablesPayload(values),
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { getLatestWfSpecs } from '@/app/actions/getLatestWfSpec'
import { Separator } from '@/components/ui/separator'
import { useWhoAmI } from '@/contexts/WhoAmIContext'
import { WfSpecData } from '@/types'
import { UserTaskDefId } from 'littlehorse-client/proto'
import { TagIcon } from 'lucide-react'
import { useRouter } from 'next/navigation'
import { FC, Fragment, useEffect, useState } from 'react'
import { FC, Fragment } from 'react'
import { SearchResultProps } from '.'
import LinkWithTenant from '../LinkWithTenant'

export const UserTaskDefTable: FC<SearchResultProps> = ({ pages = [] }) => {
const router = useRouter()
const [wfSpecs, setWfSpecs] = useState<WfSpecData[]>([])
const { tenantId } = useWhoAmI()

useEffect(() => {
if (!tenantId) return
const wfSpecNames = pages.flatMap(page => page.results).map(wfSpec => wfSpec.name)
getLatestWfSpecs(tenantId, wfSpecNames).then(setWfSpecs)
}, [pages, tenantId])

if (pages.length === 0) {
return <div className="flex min-h-[360px] items-center justify-center text-center italic">No UserTaskDefs</div>
}
Expand All @@ -38,7 +24,6 @@ export const UserTaskDefTable: FC<SearchResultProps> = ({ pages = [] }) => {
<TagIcon className="h-4 w-4 fill-none stroke-gray-500 stroke-1" />v{version}
</div>
</div>
<Separator />
</Fragment>
))}
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { getLatestWfSpecs } from '@/app/actions/getLatestWfSpec'
import { Separator } from '@/components/ui/separator'
import { useWhoAmI } from '@/contexts/WhoAmIContext'
import { WfSpecData } from '@/types'
import { TagIcon } from 'lucide-react'
import { useRouter } from 'next/navigation'
import { useParams, useRouter } from 'next/navigation'
import { FC, Fragment, useEffect, useState } from 'react'
import { SearchResultProps } from '.'

export const WfSpecTable: FC<SearchResultProps> = ({ pages = [] }) => {
const router = useRouter()
const tenantId = useParams().tenantId as string
const [wfSpecs, setWfSpecs] = useState<WfSpecData[]>([])
const { tenantId } = useWhoAmI()

useEffect(() => {
if (!tenantId) return
const wfSpecNames = pages.flatMap(page => page.results).map(wfSpec => wfSpec.name)
getLatestWfSpecs(tenantId, wfSpecNames).then(setWfSpecs)
}, [pages, tenantId])
Expand Down

0 comments on commit e047bdc

Please sign in to comment.