-
Notifications
You must be signed in to change notification settings - Fork 174
ROX-13068: Use real data for deployment details #3688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| import React from 'react'; | ||
| import { | ||
| Alert, | ||
| AlertVariant, | ||
| Badge, | ||
| Bullseye, | ||
| Flex, | ||
| FlexItem, | ||
| Spinner, | ||
| Stack, | ||
| StackItem, | ||
| Tab, | ||
|
|
@@ -13,17 +17,52 @@ import { | |
| TextContent, | ||
| TextVariants, | ||
| } from '@patternfly/react-core'; | ||
| import { EdgeModel, NodeModel } from '@patternfly/react-topology'; | ||
|
|
||
| import useTabs from 'hooks/patternfly/useTabs'; | ||
| import useFetchDeployment from 'hooks/useFetchDeployment'; | ||
| import { | ||
| getListenPorts, | ||
| getNumExternalFlows, | ||
| getNumInternalFlows, | ||
| } from '../utils/networkGraphUtils'; | ||
|
|
||
| import DeploymentDetails from './DeploymentDetails'; | ||
| import DeploymentNetworkPolicies from './DeploymentNetworkPolicies'; | ||
| import DeploymentFlows from './DeploymentFlows'; | ||
|
|
||
| function DeploymentSideBar() { | ||
| type DeploymentSideBarProps = { | ||
| deploymentId: string; | ||
| nodes: NodeModel[]; | ||
| edges: EdgeModel[]; | ||
| }; | ||
|
|
||
| function DeploymentSideBar({ deploymentId, nodes, edges }: DeploymentSideBarProps) { | ||
| // component state | ||
| const { deployment, isLoading, error } = useFetchDeployment(deploymentId); | ||
| const { activeKeyTab, onSelectTab } = useTabs({ | ||
| defaultTab: 'Details', | ||
| }); | ||
|
|
||
| // derived values | ||
| const numExternalFlows = getNumExternalFlows(nodes, edges, deploymentId); | ||
| const numInternalFlows = getNumInternalFlows(nodes, edges, deploymentId); | ||
| const listenPorts = getListenPorts(nodes, deploymentId); | ||
|
|
||
| if (isLoading) { | ||
| return ( | ||
| <Bullseye> | ||
| <Spinner isSVG size="lg" /> | ||
| </Bullseye> | ||
| ); | ||
| } | ||
|
|
||
| if (error) { | ||
| return ( | ||
| <Alert isInline variant={AlertVariant.danger} title={error} className="pf-u-mb-lg" /> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <Stack> | ||
| <StackItem> | ||
|
|
@@ -34,15 +73,15 @@ function DeploymentSideBar() { | |
| <FlexItem> | ||
| <TextContent> | ||
| <Text component={TextVariants.h1} className="pf-u-font-size-xl"> | ||
| visa-processor | ||
| {deployment?.name} | ||
| </Text> | ||
| </TextContent> | ||
| <TextContent> | ||
| <Text | ||
| component={TextVariants.h2} | ||
| className="pf-u-font-size-sm pf-u-color-200" | ||
| > | ||
| in "production / naples" | ||
| in "{deployment?.clusterName} / {deployment?.namespace}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here as above |
||
| </Text> | ||
| </TextContent> | ||
| </FlexItem> | ||
|
|
@@ -74,7 +113,14 @@ function DeploymentSideBar() { | |
| </StackItem> | ||
| <StackItem isFilled style={{ overflow: 'auto' }}> | ||
| <TabContent eventKey="Details" id="Details" hidden={activeKeyTab !== 'Details'}> | ||
| <DeploymentDetails /> | ||
| {deployment && ( | ||
| <DeploymentDetails | ||
| deployment={deployment} | ||
| numExternalFlows={numExternalFlows} | ||
| numInternalFlows={numInternalFlows} | ||
| listenPorts={listenPorts} | ||
| /> | ||
| )} | ||
| </TabContent> | ||
| <TabContent eventKey="Flows" id="Flows" hidden={activeKeyTab !== 'Flows'}> | ||
| <DeploymentFlows /> | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we have this all the time via the model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
deploymentvalue actually comes from the API to get the deployment details so that's why it could be undefined until the API returns a response. You're right though, we could find the deployment name through the selected node in the model, but I thought it made sense to use thedeploymentvalue. We can get around this by having a loading state and empty stateThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see. yeah i think it makes sense to use both the graph deployment data and the deployment API response since we're using both for the side panel (at least for the flows tab) anyways