Skip to content

Commit deb4dc6

Browse files
Attila Csehpsychedelicious
authored andcommitted
error nodes outlined in red
1 parent 1a11437 commit deb4dc6

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed

invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/InvocationNode.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
useInputFieldNamesConnection,
99
useInputFieldNamesMissing,
1010
} from 'features/nodes/hooks/useInputFieldNamesByStatus';
11+
import { useNodeHasErrors } from 'features/nodes/hooks/useNodeIsInvalid';
1112
import { useOutputFieldNames } from 'features/nodes/hooks/useOutputFieldNames';
1213
import { useWithFooter } from 'features/nodes/hooks/useWithFooter';
1314
import { memo } from 'react';
@@ -37,11 +38,12 @@ const sx: SystemStyleObject = {
3738
};
3839

3940
const InvocationNode = ({ nodeId, isOpen }: Props) => {
41+
const isInvalid = useNodeHasErrors();
4042
const withFooter = useWithFooter();
4143

4244
return (
4345
<>
44-
<InvocationNodeHeader nodeId={nodeId} isOpen={isOpen} />
46+
<InvocationNodeHeader nodeId={nodeId} isOpen={isOpen} isInvalid={isInvalid} />
4547
{isOpen && (
4648
<>
4749
<Flex layerStyle="nodeBody" sx={sx} data-with-footer={withFooter}>

invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/InvocationNodeHeader.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Flex } from '@invoke-ai/ui-library';
33
import NodeCollapseButton from 'features/nodes/components/flow/nodes/common/NodeCollapseButton';
44
import NodeTitle from 'features/nodes/components/flow/nodes/common/NodeTitle';
55
import InvocationNodeClassificationIcon from 'features/nodes/components/flow/nodes/Invocation/InvocationNodeClassificationIcon';
6-
import { useNodeHasErrors } from 'features/nodes/hooks/useNodeIsInvalid';
76
import { memo } from 'react';
87

98
import InvocationNodeCollapsedHandles from './InvocationNodeCollapsedHandles';
@@ -13,6 +12,7 @@ import InvocationNodeStatusIndicator from './InvocationNodeStatusIndicator';
1312
type Props = {
1413
nodeId: string;
1514
isOpen: boolean;
15+
isInvalid?: boolean;
1616
};
1717

1818
const sx: SystemStyleObject = {
@@ -28,14 +28,12 @@ const sx: SystemStyleObject = {
2828
},
2929
};
3030

31-
const InvocationNodeHeader = ({ nodeId, isOpen }: Props) => {
32-
const isInvalid = useNodeHasErrors();
33-
31+
const InvocationNodeHeader = ({ nodeId, isOpen, isInvalid }: Props) => {
3432
return (
3533
<Flex sx={sx} data-is-open={isOpen} data-is-invalid={isInvalid}>
3634
<NodeCollapseButton nodeId={nodeId} isOpen={isOpen} />
3735
<InvocationNodeClassificationIcon nodeId={nodeId} />
38-
<NodeTitle nodeId={nodeId} />
36+
<NodeTitle nodeId={nodeId} isInvalid={isInvalid} />
3937
<Flex alignItems="center">
4038
<InvocationNodeStatusIndicator nodeId={nodeId} />
4139
<InvocationNodeInfoIcon nodeId={nodeId} />

invokeai/frontend/web/src/features/nodes/components/flow/nodes/Invocation/fields/InputFieldTitle.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ const labelSx: SystemStyleObject = {
3030
_hover: {
3131
fontWeight: 'semibold !important',
3232
},
33-
'&[data-is-invalid="true"]': {
34-
color: 'error.300',
35-
},
3633
'&[data-is-added-to-form="true"]': {
3734
color: 'blue.300',
3835
},
36+
'&[data-is-invalid="true"]': {
37+
color: 'error.300',
38+
},
3939
'&[data-is-disabled="true"]': {
4040
opacity: 0.5,
4141
},

invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeTitle.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { SystemStyleObject } from '@invoke-ai/ui-library';
12
import { Flex, Input, Text } from '@invoke-ai/ui-library';
23
import { useAppDispatch } from 'app/store/storeHooks';
34
import { useEditable } from 'common/hooks/useEditable';
@@ -10,12 +11,20 @@ import { NO_FIT_ON_DOUBLE_CLICK_CLASS } from 'features/nodes/types/constants';
1011
import { memo, useCallback, useMemo, useRef } from 'react';
1112
import { useTranslation } from 'react-i18next';
1213

14+
const labelSx: SystemStyleObject = {
15+
fontWeight: 'semibold',
16+
'&[data-is-invalid="true"]': {
17+
color: 'error.300',
18+
},
19+
};
20+
1321
type Props = {
1422
nodeId: string;
1523
title?: string;
24+
isInvalid?: boolean;
1625
};
1726

18-
const NodeTitle = ({ nodeId, title }: Props) => {
27+
const NodeTitle = ({ nodeId, title, isInvalid }: Props) => {
1928
const dispatch = useAppDispatch();
2029
const label = useNodeUserTitleSafe();
2130
const batchGroupId = useBatchGroupId(nodeId);
@@ -53,10 +62,11 @@ const NodeTitle = ({ nodeId, title }: Props) => {
5362
{!editable.isEditing && (
5463
<Text
5564
className={NO_FIT_ON_DOUBLE_CLICK_CLASS}
56-
fontWeight="semibold"
65+
sx={labelSx}
66+
noOfLines={1}
5767
color={batchGroupColorToken}
68+
data-is-invalid={isInvalid}
5869
onDoubleClick={editable.startEditing}
59-
noOfLines={1}
6070
>
6171
{titleWithBatchGroupId}
6272
</Text>

invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/NodeWrapper.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useInvocationNodeContext } from 'features/nodes/components/flow/nodes/I
55
import { useIsWorkflowEditorLocked } from 'features/nodes/hooks/useIsWorkflowEditorLocked';
66
import { useMouseOverFormField, useMouseOverNode } from 'features/nodes/hooks/useMouseOverNode';
77
import { useNodeExecutionState } from 'features/nodes/hooks/useNodeExecutionState';
8+
import { useNodeHasErrors } from 'features/nodes/hooks/useNodeIsInvalid';
89
import { useZoomToNode } from 'features/nodes/hooks/useZoomToNode';
910
import { selectNodeOpacity } from 'features/nodes/store/workflowSettingsSlice';
1011
import { DRAG_HANDLE_CLASSNAME, NO_FIT_ON_DOUBLE_CLICK_CLASS, NODE_WIDTH } from 'features/nodes/types/constants';
@@ -29,6 +30,8 @@ const NodeWrapper = (props: NodeWrapperProps) => {
2930
const mouseOverFormField = useMouseOverFormField(nodeId);
3031
const zoomToNode = useZoomToNode(nodeId);
3132
const isLocked = useIsWorkflowEditorLocked();
33+
const isInvalid = useNodeHasErrors();
34+
const hasError = isMissingTemplate || isInvalid;
3235

3336
const executionState = useNodeExecutionState(nodeId);
3437
const isInProgress = executionState?.status === zNodeStatus.enum.IN_PROGRESS;
@@ -74,7 +77,7 @@ const NodeWrapper = (props: NodeWrapperProps) => {
7477
data-is-editor-locked={isLocked}
7578
data-is-selected={selected}
7679
data-is-mouse-over-form-field={mouseOverFormField.isMouseOverFormField}
77-
data-status={isMissingTemplate ? 'error' : needsUpdate ? 'warning' : undefined}
80+
data-status={hasError ? 'error' : needsUpdate ? 'warning' : undefined}
7881
>
7982
<Box sx={shadowsSx} />
8083
<Box sx={inProgressSx} data-is-in-progress={isInProgress} />

invokeai/frontend/web/src/features/nodes/components/flow/nodes/common/shared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export const containerSx: SystemStyleObject = {
5656
display: 'block',
5757
shadow: '0 0 0 2px var(--border-color-selected)',
5858
},
59+
'&[data-is-invalid="true"]': {
60+
color: 'error.300',
61+
},
5962
'&[data-is-editor-locked="true"]': {
6063
'& *': {
6164
cursor: 'not-allowed',

0 commit comments

Comments
 (0)