Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 66 additions & 24 deletions frontend/plugins/mce/console-extensions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
/* Copyright Contributors to the Open Cluster Management project */

import { ContextProvider, Perspective, NavSection, HrefNavItem, RoutePage } from '@openshift-console/dynamic-plugin-sdk'
import {
ContextProvider,
Perspective,
NavSection,
HrefNavItem,
RoutePage,
ResourceDetailsPage,
ResourceNSNavItem,
CreateResource,
} from '@openshift-console/dynamic-plugin-sdk'
import { SharedContext } from '../../src/lib/SharedContext'
import { EncodedExtension } from '@openshift/dynamic-plugin-sdk-webpack'

Expand Down Expand Up @@ -92,27 +101,6 @@ const automationsRoute: EncodedExtension<RoutePage> = {
},
}

// Host Inventory Navigation Item - type: 'console.navigation/href'
const hostInventoryNavItem: EncodedExtension<HrefNavItem> = {
type: 'console.navigation/href',
properties: {
perspective: 'acm',
section: 'mce-infrastructure',
id: 'mce-host-inventory',
name: '%plugin__mce~Host inventory%',
href: '/multicloud/infrastructure/environments',
},
}

// Host Inventory Route - type: 'console.page/route'
const hostInventoryRoute: EncodedExtension<RoutePage> = {
type: 'console.page/route',
properties: {
path: '/multicloud/infrastructure/environments',
component: { $codeRef: 'environments.default' },
},
}

// Virtual Machines Navigation Item - type: 'console.navigation/href'
const virtualMachinesNavItem: EncodedExtension<HrefNavItem> = {
type: 'console.navigation/href',
Expand Down Expand Up @@ -154,6 +142,58 @@ const credentialsRoute: EncodedExtension<RoutePage> = {
},
}

const infraEnvDetails: EncodedExtension<ResourceDetailsPage> = {
type: 'console.page/resource/details',
properties: {
model: {
group: 'agent-install.openshift.io',
version: 'v1beta1',
kind: 'InfraEnv',
},
component: { $codeRef: 'cim.InfraEnvDetails' },
},
}

const infraEnvRoute: EncodedExtension<RoutePage> = {
type: 'console.page/route',
properties: {
path: [
'k8s/all-namespaces/agent-install.openshift.io~v1beta1~InfraEnv',
'k8s/ns/:ns/agent-install.openshift.io~v1beta1~InfraEnv',
],
component: { $codeRef: 'environments.default' },
exact: true,
},
}

const infraEnvNavItem: EncodedExtension<ResourceNSNavItem> = {
type: 'console.navigation/resource-ns',
properties: {
id: 'mce-host-inventory',
perspective: 'acm',
model: {
group: 'agent-install.openshift.io',
version: 'v1beta1',
kind: 'InfraEnv',
},
section: 'mce-infrastructure',
name: '%plugin__mce~Host inventory%',
insertAfter: 'mce-automations',
},
}

const infraEnvCreate: EncodedExtension<CreateResource> = {
type: 'console.resource/create',
properties: {
model: {
group: 'agent-install.openshift.io',
version: 'v1beta1',
kind: 'InfraEnv',
},
component: { $codeRef: 'cim.CreateInfraEnvPage' },
},
}

export const extensions: EncodedExtension[] = [
contextProvider,
sharedContext,
Expand All @@ -163,10 +203,12 @@ export const extensions: EncodedExtension[] = [
clustersRoute,
automationsNavItem,
automationsRoute,
hostInventoryNavItem,
hostInventoryRoute,
virtualMachinesNavItem,
virtualMachinesRoute,
credentialsNavItem,
credentialsRoute,
infraEnvDetails,
infraEnvRoute,
infraEnvNavItem,
infraEnvCreate,
]
1 change: 1 addition & 0 deletions frontend/plugins/mce/console-plugin-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const pluginMetadata: ConsolePluginBuildMetadata = {
environments: '../../src/routes/Infrastructure/InfraEnvironments/InfraEnvironmentsPlugin.tsx',
virtualmachines: '../../src/routes/Infrastructure/VirtualMachines/VirtualMachinesPlugin.tsx',
credentials: '../../src/routes/Credentials/CredentialsPlugin.tsx',
cim: "../../src/cim/index.ts",
},
dependencies: {
'@console/pluginAPI': '>=4.15.0',
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const Search = lazy(() => import('./routes/Search/Search'))
// INFRASTRUCTURE
const Clusters = lazy(() => import('./routes/Infrastructure/Clusters/Clusters'))
const Automations = lazy(() => import('./routes/Infrastructure/Automations/Automations'))
const InfraEnvironments = lazy(() => import('./routes/Infrastructure/InfraEnvironments/InfraEnvironments'))
const VirtualMachines = lazy(() => import('./routes/Infrastructure/VirtualMachines/VirtualMachines'))

// GOVERNANCE
Expand Down Expand Up @@ -191,13 +190,6 @@ const routes: (IRoute | IRouteGroup)[] = [
match: MatchType.SubRoutes,
element: <Automations />,
},
{
title: 'Host inventory',
type: 'route',
path: NavigationPath.infraEnvironments,
match: MatchType.SubRoutes,
element: <InfraEnvironments />,
},
{
title: 'Virtual machines',
type: 'route',
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/NavigationPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ export enum NavigationPath {
configureDiscovery = '/multicloud/infrastructure/clusters/discovered/configure',
createDiscovery = '/multicloud/infrastructure/clusters/discovered/create',

// Infrastructure - Environments
infraEnvironments = '/multicloud/infrastructure/environments',
createInfraEnv = '/multicloud/infrastructure/environments/create',
infraEnvironmentDetails = '/multicloud/infrastructure/environments/details/:namespace/:name',
infraEnvironmentHosts = '/multicloud/infrastructure/environments/details/:namespace/:name/hosts',
infraEnvironmentOverview = '/multicloud/infrastructure/environments/details/:namespace/:name/overview',

// Infrastructure - Automations
ansibleAutomations = '/multicloud/infrastructure/automations',
addAnsibleAutomation = '/multicloud/infrastructure/automations/add',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/cim/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { CreateInfraEnvPage, InfraEnvDetails } from '@openshift-assisted/ui-lib/cim'
7 changes: 3 additions & 4 deletions frontend/src/hooks/use-available-hosts-alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getAgentsForSelection } from '@openshift-assisted/ui-lib/cim'

import { useRecoilValue, useSharedAtoms } from '../shared-recoil'
import { Trans, useTranslation } from '../lib/acm-i18next'
import { NavigationPath } from '../NavigationPath'

const useNoAvailableHostsAlert = (
controlPlaneType: 'hosted' | 'standalone'
Expand All @@ -25,12 +24,12 @@ const useNoAvailableHostsAlert = (
controlPlaneType === 'standalone' ? (
<Trans
i18nKey={'createCluster.card.noInfraEnvsOrHosts.alert'}
components={{ a: <a href={NavigationPath.infraEnvironments}>{}</a> }}
components={{ a: <a href={`/k8s/all-namespaces/agent-install.openshift.io~v1beta1~InfraEnv`}>{}</a> }}
/>
) : (
<Trans
i18nKey={'createCluster.card.noInfraEnvs.alert'}
components={{ a: <a href={NavigationPath.infraEnvironments}>{}</a> }}
components={{ a: <a href={`/k8s/all-namespaces/agent-install.openshift.io~v1beta1~InfraEnv`}>{}</a> }}
/>
),
}
Expand All @@ -41,7 +40,7 @@ const useNoAvailableHostsAlert = (
<Trans
values={{ controlPlaneTypeTxt: controlPlaneTypeTxt }}
i18nKey="createCluster.card.noHosts.alert"
components={{ a: <a href={NavigationPath.infraEnvironments}>{}</a> }}
components={{ a: <a href={`/k8s/all-namespaces/agent-install.openshift.io~v1beta1~InfraEnv`}>{}</a> }}
/>
),
}
Expand Down
89 changes: 0 additions & 89 deletions frontend/src/logos/OnPremiseBannerIcon.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export default function CreateCluster(props: { infrastructureType: ClusterInfras
title: t('cim.infra.missing.warning.title'),
text: t('cim.infra.missing.warning.text'),
linkText: t('cim.infra.manage.link'),
linkTo: NavigationPath.infraEnvironments,
linkTo: '/k8s/all-namespaces/agent-install.openshift.io~v1beta1~InfraEnv',
})
} else {
setWarning(undefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FormikProps } from 'formik'
import isEqual from 'lodash/isEqual'

import { HypershiftAgentContext } from './HypershiftAgentContext'
import { isBMPlatform } from '../../../../../../InfraEnvironments/utils'
import { useSharedAtoms, useRecoilValue } from '../../../../../../../../shared-recoil'
import { getTemplateValue } from '../utils'
import { defaultHostPrefix, defaultPodCIDR, defaultServiceCIDR } from './constants'
Expand Down Expand Up @@ -141,7 +140,7 @@ const NetworkForm: React.FC<NetworkFormProps> = ({ control, handleChange, templa

const initialValues: NetworkFormValues = React.useMemo(
() =>
getDefaultNetworkFormValues(templateYAML, isBMPlatform(infrastructures[0]), isAdvancedNetworking, sshPublicKey),
getDefaultNetworkFormValues(templateYAML, ['BareMetal', 'None', 'OpenStack', 'VSphere'].includes(infrastructures[0]?.status?.platform || ''), isAdvancedNetworking, sshPublicKey),
[templateYAML, infrastructures, isAdvancedNetworking, sshPublicKey]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AgentK8sResource,
BareMetalHostK8sResource,
ClusterDeploymentK8sResource,
InfraEnvK8sResource,
} from '@openshift-assisted/ui-lib/cim'
import {
getDefault,
Expand All @@ -14,7 +13,6 @@ import {
getDeleteHostAction,
setProvisionRequirements,
onHostsNext,
onEditProxy,
useProvisioningConfiguration,
onEditFinish,
} from './utils'
Expand Down Expand Up @@ -185,25 +183,6 @@ describe('onHostsNext', () => {
})
})

describe('onEditProxy', () => {
it('enables proxy', () => {
const infraEnv: InfraEnvK8sResource = {
metadata: {
name: 'foo',
namespace: 'bar',
},
}
onEditProxy(
{
httpProxy: 'foo',
httpsProxy: 'bar',
noProxy: 'baz',
},
infraEnv
)
})
})

describe('onEditFinish', () => {
afterEach(() => {
jest.clearAllMocks()
Expand Down
Loading