-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: force node executions to pull their status (#737)
* fix: force node executions to pull their status Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: nodes not loading fix Signed-off-by: Carina Ursu <[email protected]> * chore: fix Signed-off-by: Carina Ursu <[email protected]> * chore: fixes Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: some refactoring Signed-off-by: Carina Ursu <[email protected]> * chore: cleanup Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: progress Signed-off-by: Carina Ursu <[email protected]> * chore: fixes Signed-off-by: Carina Ursu <[email protected]> * chore: fix map tasks Signed-off-by: Carina Ursu <[email protected]> * chore: dynamic execution fixes Signed-off-by: Carina Ursu <[email protected]> * chore: fixes Signed-off-by: Carina Ursu <[email protected]> * chore: cleanup Signed-off-by: Carina Ursu <[email protected]> * chore: append task executions Signed-off-by: Carina Ursu <[email protected]> * chore: fix ExecutionTabContent.test.tsx Signed-off-by: Carina Ursu <[email protected]> * chore: fix WorkflowGraph.test.tsx Signed-off-by: Carina Ursu <[email protected]> * chore: test fixes Signed-off-by: Carina Ursu <[email protected]> * chore: more tests Signed-off-by: Carina Ursu <[email protected]> * chore: test fixes Signed-off-by: Carina Ursu <[email protected]> * chore: more tests Signed-off-by: Carina Ursu <[email protected]> * chore: bump version Signed-off-by: Carina Ursu <[email protected]> --------- Signed-off-by: Carina Ursu <[email protected]>
- Loading branch information
1 parent
33ee52a
commit 27238ce
Showing
95 changed files
with
3,110 additions
and
1,908 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
13 changes: 0 additions & 13 deletions
13
packages/console/src/components/Executions/ExecutionDetails/DetailsPanelContext.ts
This file was deleted.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
packages/console/src/components/Executions/ExecutionDetails/DetailsPanelContext.tsx
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,126 @@ | ||
import React, { | ||
PropsWithChildren, | ||
useContext, | ||
useEffect, | ||
createContext, | ||
useState, | ||
} from 'react'; | ||
import { NodeExecutionIdentifier } from 'models/Execution/types'; | ||
import { DetailsPanel } from 'components/common/DetailsPanel'; | ||
import { TaskExecutionPhase } from 'models'; | ||
import { Core } from '@flyteorg/flyteidl-types'; | ||
import { isStartOrEndNode } from 'models/Node/utils'; | ||
import { NodeExecutionDetailsPanelContent } from './NodeExecutionDetailsPanelContent'; | ||
import { useNodeExecutionsById } from '../contextProvider/NodeExecutionDetails'; | ||
|
||
export interface DetailsPanelContextData { | ||
selectedExecution?: NodeExecutionIdentifier | null; | ||
setSelectedExecution: ( | ||
selectedExecutionId: NodeExecutionIdentifier | null, | ||
) => void; | ||
onNodeSelectionChanged: (newSelection: string[]) => void; | ||
selectedPhase: Core.TaskExecution.Phase | undefined; | ||
setSelectedPhase: ( | ||
value: React.SetStateAction<Core.TaskExecution.Phase | undefined>, | ||
) => void; | ||
isDetailsTabClosed: boolean; | ||
setIsDetailsTabClosed: (boolean) => void; | ||
} | ||
|
||
export const DetailsPanelContext = createContext<DetailsPanelContextData>( | ||
{} as DetailsPanelContextData, | ||
); | ||
|
||
export interface DetailsPanelContextProviderProps { | ||
selectedPhase?: TaskExecutionPhase; | ||
} | ||
export const DetailsPanelContextProvider = ({ | ||
children, | ||
}: PropsWithChildren<DetailsPanelContextProviderProps>) => { | ||
const [selectedNodes, setSelectedNodes] = useState<string[]>([]); | ||
const { nodeExecutionsById } = useNodeExecutionsById(); | ||
|
||
const [selectedPhase, setSelectedPhase] = useState< | ||
TaskExecutionPhase | undefined | ||
>(undefined); | ||
|
||
// Note: flytegraph allows multiple selection, but we only support showing | ||
// a single item in the details panel | ||
const [selectedExecution, setSelectedExecution] = | ||
useState<NodeExecutionIdentifier | null>( | ||
selectedNodes.length | ||
? nodeExecutionsById[selectedNodes[0]] | ||
? nodeExecutionsById[selectedNodes[0]].id | ||
: { | ||
nodeId: selectedNodes[0], | ||
executionId: | ||
nodeExecutionsById[Object.keys(nodeExecutionsById)[0]].id | ||
.executionId, | ||
} | ||
: null, | ||
); | ||
|
||
const [isDetailsTabClosed, setIsDetailsTabClosed] = useState<boolean>( | ||
!selectedExecution, | ||
); | ||
|
||
useEffect(() => { | ||
setIsDetailsTabClosed(!selectedExecution); | ||
}, [selectedExecution]); | ||
|
||
const onNodeSelectionChanged = (newSelection: string[]) => { | ||
const validSelection = newSelection.filter(nodeId => { | ||
if (isStartOrEndNode(nodeId)) { | ||
return false; | ||
} | ||
return true; | ||
}); | ||
setSelectedNodes(validSelection); | ||
const newSelectedExecution = validSelection.length | ||
? nodeExecutionsById[validSelection[0]] | ||
? nodeExecutionsById[validSelection[0]].id | ||
: { | ||
nodeId: validSelection[0], | ||
executionId: | ||
nodeExecutionsById[Object.keys(nodeExecutionsById)[0]].id | ||
.executionId, | ||
} | ||
: null; | ||
setSelectedExecution(newSelectedExecution); | ||
}; | ||
|
||
const onCloseDetailsPanel = () => { | ||
setSelectedExecution(null); | ||
setSelectedPhase(undefined); | ||
setSelectedNodes([]); | ||
}; | ||
|
||
return ( | ||
<DetailsPanelContext.Provider | ||
value={{ | ||
selectedExecution, | ||
setSelectedExecution, | ||
onNodeSelectionChanged, | ||
selectedPhase, | ||
setSelectedPhase, | ||
isDetailsTabClosed, | ||
setIsDetailsTabClosed, | ||
}} | ||
> | ||
{children} | ||
<DetailsPanel open={!isDetailsTabClosed} onClose={onCloseDetailsPanel}> | ||
{!isDetailsTabClosed && selectedExecution && ( | ||
<NodeExecutionDetailsPanelContent | ||
onClose={onCloseDetailsPanel} | ||
taskPhase={selectedPhase ?? TaskExecutionPhase.UNDEFINED} | ||
nodeExecutionId={selectedExecution} | ||
/> | ||
)} | ||
</DetailsPanel> | ||
</DetailsPanelContext.Provider> | ||
); | ||
}; | ||
|
||
export const useDetailsPanel = () => { | ||
return useContext(DetailsPanelContext); | ||
}; |
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
Oops, something went wrong.