diff --git a/src/pages/clusters/containers/Network/Policies/index.jsx b/src/pages/clusters/containers/Network/Policies/index.jsx index b205164b659..ff739197a88 100644 --- a/src/pages/clusters/containers/Network/Policies/index.jsx +++ b/src/pages/clusters/containers/Network/Policies/index.jsx @@ -22,16 +22,17 @@ import { Link } from 'react-router-dom' import { Avatar } from 'components/Base' import Banner from 'components/Cards/Banner' import NetworkStore from 'stores/network' -import withList, { ListPage } from 'components/HOCs/withList' +import { withClusterList, ListPage } from 'components/HOCs/withList' import ResourceTable from 'clusters/components/ResourceTable' import { getLocalTime, getDisplayName } from 'utils' import { ICON_TYPES } from 'utils/constants' -@withList({ +@withClusterList({ store: new NetworkStore('networkpolicies'), name: 'Network Policy', module: 'networkpolicies', + rowKey: 'key', }) export default class NetworkPolicies extends React.Component { tips = [ @@ -170,7 +171,7 @@ export default class NetworkPolicies extends React.Component { { - data.push({ namespace, specPodSelector, ports, ...rule }) + data.push({ + namespace, + specPodSelector, + ports, + direction: this.direction, + ...rule, + }) }) }) return data @@ -188,6 +194,7 @@ export default class Viewer extends React.Component { const namespace = get(record, 'namespace', '') const ipBlock = get(record, 'ipBlock') const ipExpect = get(ipBlock, 'except') + const { direction } = record const ipBlockLabel = this.renderIpBlock(ipBlock) @@ -213,7 +220,11 @@ export default class Viewer extends React.Component {
This rule allows pods in the namespace '{namespace}' {!isEmpty(podsLabels) && with the label {podsLabels} } - to receive traffic from + + {direction === 'egress' + ? 'to connect to ' + : 'to receive traffic from '} + {!isEmpty(ipBlock) ? (