-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MultiNetworkPolicy in a separate nav item
- Loading branch information
1 parent
7f87bd3
commit b0c59c9
Showing
16 changed files
with
93 additions
and
330 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
27 changes: 27 additions & 0 deletions
27
...e-app/src/components/network-policies/multi-network-policy/MultiNetworkPolicyListPage.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,27 @@ | ||
import * as React from 'react'; | ||
import { useParams } from 'react-router-dom-v5-compat'; | ||
import { ListPage } from '@console/internal/components/factory'; | ||
import { NetworkPoliciesList } from '@console/internal/components/network-policy'; | ||
import { multiNetworkPolicyRef } from './constants'; | ||
|
||
export type MultiNetworkPolicyPageNavProps = { | ||
namespace: string; | ||
kind: string; | ||
}; | ||
|
||
export const MultiNetworkPolicyListPage: React.FC<MultiNetworkPolicyPageNavProps> = (props) => { | ||
const params = useParams(); | ||
|
||
const namespace = React.useMemo(() => params.ns || 'default', [params.ns]); | ||
|
||
return ( | ||
<ListPage | ||
ListComponent={NetworkPoliciesList} | ||
canCreate | ||
createProps={{ | ||
to: `/k8s/ns/${namespace}/${multiNetworkPolicyRef}/~new/form`, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; |
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
22 changes: 22 additions & 0 deletions
22
...ages/console-app/src/components/network-policies/multi-network-policy/multiNetworkFlag.ts
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,22 @@ | ||
import { SetFeatureFlag, K8sResourceCommon } from '@console/dynamic-plugin-sdk'; | ||
import { k8sGetResource } from '@console/dynamic-plugin-sdk/src/utils/k8s'; | ||
import { FLAG_MULTI_NETWORK_POLICY, NetworkConfigModel } from './constants'; | ||
|
||
export const enableMultiNetworkPolicy = (setFeatureFlag: SetFeatureFlag) => { | ||
k8sGetResource({ model: NetworkConfigModel, name: 'cluster' }) | ||
.then((networkClusterConfig: K8sResourceCommon & { spec: any }) => { | ||
if (networkClusterConfig?.spec?.disableMultiNetwork) { | ||
setFeatureFlag(FLAG_MULTI_NETWORK_POLICY, !networkClusterConfig.spec.disableMultiNetwork); | ||
return; | ||
} | ||
|
||
if (networkClusterConfig?.spec?.useMultiNetworkPolicy) { | ||
setFeatureFlag(FLAG_MULTI_NETWORK_POLICY, networkClusterConfig?.spec?.disableMultiNetwork); | ||
return; | ||
} | ||
|
||
setFeatureFlag(FLAG_MULTI_NETWORK_POLICY, false); | ||
}) | ||
// eslint-disable-next-line no-console | ||
.catch(console.error); | ||
}; |
102 changes: 0 additions & 102 deletions
102
...kages/console-app/src/components/network-policies/network-policy-list/EnableMultiPage.tsx
This file was deleted.
Oops, something went wrong.
109 changes: 0 additions & 109 deletions
109
...console-app/src/components/network-policies/network-policy-list/NetworkPolicyListPage.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.