-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/user-attachments/assets/865f3be3-e963-4f27-97aa-419a66d04d73 Fixes #12001 - Component color reflects pending status - Edges from component reflect pending/selected status
- Loading branch information
Showing
6 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { type NodeId } from '@/stores/graph' | ||
import { type GraphDb } from '@/stores/graph/graphDatabase' | ||
import { type ToValue } from '@/util/reactivity' | ||
import { computed, toValue } from 'vue' | ||
|
||
/** Returns the component's base color, and information about state that may modify it. */ | ||
export function useComponentColors( | ||
graphDb: GraphDb, | ||
nodeSelection: { isSelected: (nodeId: NodeId) => boolean } | undefined, | ||
nodeId: ToValue<NodeId | undefined>, | ||
) { | ||
const nodeIdValue = computed(() => toValue(nodeId)) | ||
const node = computed(() => nodeIdValue.value && graphDb.nodeIdToNode.get(nodeIdValue.value)) | ||
const expressionInfo = computed( | ||
() => node.value && graphDb.getExpressionInfo(node.value.innerExpr.externalId), | ||
) | ||
const executionState = computed(() => expressionInfo.value?.payload.type ?? 'Unknown') | ||
return { | ||
baseColor: computed(() => nodeIdValue.value && graphDb.getNodeColorStyle(nodeIdValue.value)), | ||
selected: computed( | ||
() => (nodeIdValue.value && nodeSelection?.isSelected(nodeIdValue.value)) ?? false, | ||
), | ||
pending: computed( | ||
() => executionState.value === 'Unknown' || executionState.value === 'Pending', | ||
), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters