Skip to content

Commit

Permalink
Modify the filter and graph function of k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
yongsikgi committed Dec 10, 2021
1 parent 80d59c6 commit a17c0c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
3 changes: 0 additions & 3 deletions frontend/src/hosts/components/KubernetesContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {Source, TimeRange, Cell, Template, RemoteDataState} from 'src/types'

interface Props {
handleOnSetActiveEditorTab: (tab: string) => void
handleOnClickPodName: () => void
handleOnClickVisualizePod: (data: any) => void
handleDBClick: (data: any) => void
handleResize: (proportions: number[]) => void
Expand Down Expand Up @@ -118,7 +117,6 @@ class KubernetesContents extends PureComponent<Props, State> {
kubernetesObject,
kubernetesD3Data,
handleDBClick,
handleOnClickPodName,
handleOnClickVisualizePod,
handleResize,
handleOpenTooltip,
Expand All @@ -134,7 +132,6 @@ class KubernetesContents extends PureComponent<Props, State> {
focuseNode={focuseNode}
pinNode={pinNode}
handleDBClick={handleDBClick}
handleOnClickPodName={handleOnClickPodName}
handleOnClickVisualizePod={handleOnClickVisualizePod}
handleResize={handleResize}
handleOpenTooltip={handleOpenTooltip}
Expand Down
18 changes: 11 additions & 7 deletions frontend/src/hosts/components/KubernetesHexagon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {D3K8sData, FocuseNode, KubernetesObject} from 'src/hosts/types'
import {RemoteDataState} from 'src/types'

interface Props {
handleOnClickPodName: () => void
handleOnClickVisualizePod: (data: any) => void
handleDBClick: (data: any) => void
handleResize: (proportions: number[]) => void
Expand Down Expand Up @@ -202,7 +201,6 @@ class KubernetesHexagon extends PureComponent<Props, State> {
.attr('r', d => d.r)
.attr('fill', d => clusterTypeColorset[d.data.type])
.attr('stroke', 'black')
.attr('pointer-events', d => (d.children ? 'all' : 'none'))
.on('mouseover', function () {
onMouseOver(this)
})
Expand Down Expand Up @@ -280,7 +278,13 @@ class KubernetesHexagon extends PureComponent<Props, State> {
.attr('transform', d => `translate(${d.x},${d.y})`)

textNode
.filter(d => d.height > 0)
.filter(
d =>
!(
d.depth === 3 ||
(d.depth === 2 && (d.data.type === 'CR' || d.data.type === 'CRB'))
)
)
.append('text')
.attr('fill', 'white')
.append('textPath')
Expand Down Expand Up @@ -430,16 +434,16 @@ class KubernetesHexagon extends PureComponent<Props, State> {
this.clickedTarget = null
}

private runOnDBClick = (target: SVGSVGElement, data: any) => {
private runOnDBClick = (data: any) => {
this.clickedOnce = false
this.clickedTarget = null
clearTimeout(this.timeout)
this.onMouseDBClick(target, data)
this.onMouseDBClick(data)
}

private onMouseClick = (target: SVGSVGElement, data: D3K8sData) => {
if (this.clickedTarget === target && this.clickedOnce) {
this.runOnDBClick(target, data)
this.runOnDBClick(data)
} else if (
(this.clickedTarget === null && !this.clickedOnce) ||
(this.clickedTarget !== target && this.clickedOnce)
Expand All @@ -453,7 +457,7 @@ class KubernetesHexagon extends PureComponent<Props, State> {
}
}

private onMouseDBClick = (target: SVGSVGElement, data: any) => {
private onMouseDBClick = (data: any) => {
this.props.handleDBClick(data)
this.props.handleOnClickVisualizePod(data)
}
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/hosts/containers/KubernetesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,7 @@ class KubernetesPage extends PureComponent<Props, State> {
selectMinion,
proportions,
selectedAutoRefresh,
remoteDataState: RemoteDataState.Loading,
})
}

Expand Down Expand Up @@ -2964,7 +2965,6 @@ class KubernetesPage extends PureComponent<Props, State> {
proportions={proportions}
activeTab={activeEditorTab}
handleOnSetActiveEditorTab={this.onSetActiveEditorTab}
handleOnClickPodName={this.onClickPodName}
handleOnClickVisualizePod={this.onClickVisualizePod}
handleResize={this.handleResize}
focuseNode={focuseNode}
Expand Down Expand Up @@ -3193,10 +3193,6 @@ class KubernetesPage extends PureComponent<Props, State> {
})
}

private onClickPodName = (): void => {
console.log('onClick Pod Name')
}

private onClickVisualizePod = async (data: any) => {
const {selectMinion} = this.state
const focuseNodeName = _.get(data, 'data.name')
Expand Down

0 comments on commit a17c0c6

Please sign in to comment.