-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add topology sidebar to Operator Backed Service
- Loading branch information
1 parent
ca7021b
commit 7ce03d7
Showing
8 changed files
with
123 additions
and
28 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
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
58 changes: 58 additions & 0 deletions
58
...nd/packages/dev-console/src/components/topology/operators/TopologyOperatorBackedPanel.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,58 @@ | ||
import * as React from 'react'; | ||
import { | ||
ResourceIcon, | ||
ResourceLink, | ||
SimpleTabNav, | ||
ResourceSummary, | ||
SectionHeading, | ||
} from '@console/internal/components/utils'; | ||
import { referenceFor } from '@console/internal/module/k8s'; | ||
import TopologyOperatorBackedResources from './TopologyOperatorBackedResources'; | ||
import { TopologyDataObject } from '../topology-types'; | ||
|
||
export type TopologyOperatorBackedPanelProps = { | ||
item: TopologyDataObject<string>; | ||
}; | ||
|
||
const TopologyOperatorBackedPanel: React.FC<TopologyOperatorBackedPanelProps> = ({ item }) => { | ||
const { | ||
name, | ||
resources: { obj }, | ||
} = item; | ||
|
||
const ResourcesSection = () => <TopologyOperatorBackedResources item={item} />; | ||
const DetailsSection = () => ( | ||
<div className="overview__sidebar-pane-body"> | ||
<SectionHeading text="Operator Details" /> | ||
<ResourceSummary resource={obj} /> | ||
</div> | ||
); | ||
|
||
return ( | ||
<div className="overview__sidebar-pane resource-overview"> | ||
<div className="overview__sidebar-pane-head resource-overview__heading"> | ||
<h1 className="co-m-pane__heading"> | ||
<div className="co-m-pane__name co-resource-item"> | ||
<ResourceIcon kind="Operator" /> | ||
<ResourceLink | ||
kind={referenceFor(obj)} | ||
name={name} | ||
namespace={obj.metadata.namespace} | ||
hideIcon | ||
/> | ||
</div> | ||
</h1> | ||
</div> | ||
<SimpleTabNav | ||
tabs={[ | ||
{ name: 'Details', component: DetailsSection }, | ||
{ name: 'Resources', component: ResourcesSection }, | ||
]} | ||
tabProps={null} | ||
additionalClassNames="co-m-horizontal-nav__menu--within-sidebar co-m-horizontal-nav__menu--within-overview-sidebar" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TopologyOperatorBackedPanel; |
35 changes: 35 additions & 0 deletions
35
...ackages/dev-console/src/components/topology/operators/TopologyOperatorBackedResources.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,35 @@ | ||
import * as React from 'react'; | ||
import OperatorBackedOwnerReferences from '@console/internal/components/utils'; | ||
import { TopologyDataObject } from '../topology-types'; | ||
import TopologyGroupResourcesPanel from '../components/TopologyGroupResourcesPanel'; | ||
import { OverviewItem } from '@console/shared'; | ||
|
||
type TopologyOperatorBackedResourcesProps = { | ||
item: TopologyDataObject; | ||
}; | ||
|
||
const TopologyOperatorBackedResources: React.FC<TopologyOperatorBackedResourcesProps> = ({ | ||
item, | ||
}) => { | ||
const { groupResources = [] } = item; | ||
const finalRes = groupResources.map((val) => val.resources.obj); | ||
const ownerReferencedResources = groupResources.reduce( | ||
(acc, val) => { | ||
acc.obj = { ...val.resources.obj, ...acc.obj }; | ||
return acc; | ||
}, | ||
{ obj: {}, isOperatorBackedService: true }, | ||
); | ||
|
||
return ( | ||
<div className="overview__sidebar-pane-body"> | ||
<OperatorBackedOwnerReferences item={ownerReferencedResources as OverviewItem} /> | ||
<TopologyGroupResourcesPanel | ||
manifestResources={finalRes} | ||
releaseNamespace={item.resources.obj.metadata.namespace} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TopologyOperatorBackedResources; |