Skip to content

Conversation

@Magol28
Copy link
Contributor

@Magol28 Magol28 commented Nov 14, 2025

The task node information is available on the sidebard
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how cool is to use this magic classes to process colors for each state, although there's something you are missing handling it in this way.

You won't be able to catch when a new status is added in build time. I would suggest to change this to a typed data and not use css

export const NodeStatus = ({ status }: { status: LHStatus }) => {

export const NodeStatus = ({ status, type }: { status: LHStatus | TaskStatus; type?: string }) => {
const statusType = type === 'task' ? `task-status--${status.toUpperCase()}` : `node-status--${status.toLowerCase()}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why some are lowercase and others uppercase?

This is where if you don't use a typed data structure, you won't catch when a new status is added during build time. Use typed data instead of classNames as strings.

Comment on lines +28 to +49
export const getAttemptOutput = (output: VariableValue | undefined): string => {
if (!output?.value?.value) return 'No Output'
return String(getVariableValue(output))
}

export const getAttemptResult = (
result:
| { $case: 'output'; value: VariableValue }
| { $case: 'error'; value: any }
| { $case: 'exception'; value: any }
| undefined
): string => {
if (!result) return 'No Output'

if (result.$case === 'output') {
return getAttemptOutput(result.value)
}

// For error/exception, prefer a message property if present, otherwise fallback to JSON
const val = result.value
return (val && (val.message ?? val.msg ?? val.toString())) || JSON.stringify(val) || 'No Output'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? you should use the types from the littlehorse-client library. Also avoid using any

const { tenantId } = useWhoAmI()
const [nodeTask, setNodeTask] = useState<TaskRun>()
const [attemptIndex, setAttemptIndex] = useState(0)
useLayoutEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't use useLayoutEffect this must be handled by SWR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants