-
Notifications
You must be signed in to change notification settings - Fork 675
CONSOLE-4978: Add Installed Software page with OLMv0 and OLMv1 tabs #16064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TheRealJon
wants to merge
2
commits into
openshift:main
Choose a base branch
from
TheRealJon:CONSOLE-4978
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+388
−49
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
.../packages/operator-lifecycle-manager-v1/src/actions/providers/default-actions-provider.ts
This file contains hidden or 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 @@ | ||
| export { useDefaultActionsProvider } from '@console/app/src/actions/providers/default-provider'; |
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
frontend/packages/operator-lifecycle-manager-v1/src/components/OLMv1TechPreviewBadge.tsx
This file contains hidden or 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,38 @@ | ||
| import type { FC } from 'react'; | ||
| import { Button, Label, Popover } from '@patternfly/react-core'; | ||
| import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon'; | ||
| import { useTranslation } from 'react-i18next'; | ||
|
|
||
| /** | ||
| * Shared tech preview badge with info popover for OLMv1 features. | ||
| * Displays a yellow outline label with "Tech Preview" and an info icon that shows | ||
| * a popover with details about OLMv1 when clicked. | ||
| * Renders inline for use in tabs or toolbars. | ||
| */ | ||
| export const OLMv1TechPreviewBadge: FC = () => { | ||
| const { t } = useTranslation(); | ||
|
|
||
| const popoverContent = ( | ||
| <div> | ||
| {t( | ||
| 'olm-v1~Lets you use OLMv1 (Tech Preview), a streamlined redesign of OLMv0. OLMv1 simplifies operator management with declarative APIs, enhanced security, and direct, GitOps-friendly control over upgrades.', | ||
| )} | ||
| </div> | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| <Label color="yellow" isCompact variant="outline"> | ||
| {t('olm-v1~Tech Preview')} | ||
| </Label>{' '} | ||
| <Popover aria-label={t('olm-v1~OLMv1 information')} bodyContent={popoverContent}> | ||
| <Button | ||
| icon={<OutlinedQuestionCircleIcon aria-hidden="true" />} | ||
| aria-label={t('olm-v1~OLMv1 information')} | ||
| variant="link" | ||
| isInline | ||
| /> | ||
| </Popover> | ||
| </> | ||
| ); | ||
| }; |
184 changes: 184 additions & 0 deletions
184
...erator-lifecycle-manager-v1/src/components/cluster-extension/ClusterExtensionListPage.tsx
This file contains hidden or 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,184 @@ | ||
| import type { FC } from 'react'; | ||
| import { useMemo } from 'react'; | ||
| import { Label } from '@patternfly/react-core'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { | ||
| actionsCellProps, | ||
| cellIsStickyProps, | ||
| getNameCellProps, | ||
| ConsoleDataView, | ||
| } from '@console/app/src/components/data-view/ConsoleDataView'; | ||
| import type { GetDataViewRows } from '@console/app/src/components/data-view/types'; | ||
| import Status from '@console/dynamic-plugin-sdk/src/app/components/status/Status'; | ||
| import type { TableColumn } from '@console/dynamic-plugin-sdk/src/extensions/console-types'; | ||
| import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook'; | ||
| import { ResourceLink } from '@console/internal/components/utils/resource-link'; | ||
| import { referenceForModel } from '@console/internal/module/k8s'; | ||
| import LazyActionMenu from '@console/shared/src/components/actions/LazyActionMenu'; | ||
| import PaneBody from '@console/shared/src/components/layout/PaneBody'; | ||
| import { DASH } from '@console/shared/src/constants/ui'; | ||
| import { ClusterExtensionModel } from '../../models'; | ||
| import type { ClusterExtensionKind } from '../../types'; | ||
|
|
||
| export const tableColumnInfo = [ | ||
| { id: 'name' }, | ||
| { id: 'status' }, | ||
| { id: 'version' }, | ||
| { id: 'channel' }, | ||
| { id: 'namespace' }, | ||
| { id: 'package' }, | ||
| { id: '' }, | ||
| ]; | ||
|
|
||
| const getDataViewRows: GetDataViewRows<ClusterExtensionKind> = (data, columns) => { | ||
| return data.map(({ obj }) => { | ||
| const name = obj.metadata?.name ?? ''; | ||
| const namespace = obj.spec?.namespace ?? ''; | ||
| const packageName = obj.spec?.source?.catalog?.packageName ?? ''; | ||
| const version = obj.spec?.source?.catalog?.version ?? ''; | ||
| const channels = obj.spec?.source?.catalog?.channels; | ||
| const status = | ||
| obj.status?.conditions?.find((condition) => condition.type === 'Installed')?.reason || ''; | ||
|
|
||
| const resourceKind = referenceForModel(ClusterExtensionModel); | ||
| const context = { [resourceKind]: obj }; | ||
|
|
||
| const rowCells = { | ||
| [tableColumnInfo[0].id]: { | ||
| cell: <ResourceLink kind={resourceKind} name={name} />, | ||
| props: getNameCellProps(name), | ||
| }, | ||
| [tableColumnInfo[1].id]: { | ||
| cell: status ? <Status status={status} /> : DASH, | ||
| }, | ||
| [tableColumnInfo[2].id]: { | ||
| cell: version || DASH, | ||
| }, | ||
| [tableColumnInfo[3].id]: { | ||
| cell: | ||
| channels && channels.length > 0 ? ( | ||
| <> | ||
| {channels.map((ch) => ( | ||
| <Label key={ch} color="grey" isCompact> | ||
| {ch} | ||
| </Label> | ||
| ))} | ||
| </> | ||
| ) : ( | ||
| DASH | ||
| ), | ||
| }, | ||
| [tableColumnInfo[4].id]: { | ||
| cell: namespace ? <ResourceLink kind="Namespace" name={namespace} /> : DASH, | ||
| }, | ||
| [tableColumnInfo[5].id]: { | ||
| cell: packageName || DASH, | ||
| }, | ||
| [tableColumnInfo[6].id]: { | ||
| cell: <LazyActionMenu context={context} />, | ||
| props: actionsCellProps, | ||
| }, | ||
| }; | ||
|
|
||
| return columns.map(({ id }) => { | ||
| const cell = rowCells[id]?.cell || DASH; | ||
| return { | ||
| id, | ||
| props: rowCells[id]?.props, | ||
| cell, | ||
| }; | ||
| }); | ||
| }); | ||
| }; | ||
|
|
||
| const useClusterExtensionColumns = (): TableColumn<ClusterExtensionKind>[] => { | ||
| const { t } = useTranslation(); | ||
| const columns = useMemo<TableColumn<ClusterExtensionKind>[]>( | ||
| () => [ | ||
| { | ||
| title: t('olm-v1~Name'), | ||
| id: tableColumnInfo[0].id, | ||
| sort: 'metadata.name', | ||
| props: { | ||
| ...cellIsStickyProps, | ||
| modifier: 'nowrap', | ||
| }, | ||
| }, | ||
| { | ||
| title: t('olm-v1~Status'), | ||
| id: tableColumnInfo[1].id, | ||
| props: { | ||
| modifier: 'nowrap', | ||
| }, | ||
| }, | ||
| { | ||
| title: t('olm-v1~Version'), | ||
| id: tableColumnInfo[2].id, | ||
| props: { | ||
| modifier: 'nowrap', | ||
| }, | ||
| }, | ||
| { | ||
| title: t('olm-v1~Channels'), | ||
| id: tableColumnInfo[3].id, | ||
| }, | ||
| { | ||
| title: t('olm-v1~Namespace'), | ||
| id: tableColumnInfo[4].id, | ||
| sort: 'spec.namespace', | ||
| props: { | ||
| modifier: 'nowrap', | ||
| }, | ||
| }, | ||
| { | ||
| title: t('olm-v1~Package'), | ||
| id: tableColumnInfo[5].id, | ||
| props: { | ||
| modifier: 'nowrap', | ||
| }, | ||
| }, | ||
| { | ||
| title: '', | ||
| id: tableColumnInfo[6].id, | ||
| props: { | ||
| ...cellIsStickyProps, | ||
| }, | ||
| }, | ||
| ], | ||
| [t], | ||
| ); | ||
|
|
||
| return columns; | ||
| }; | ||
|
|
||
| interface ClusterExtensionListPageProps { | ||
| namespace?: string; | ||
| } | ||
|
|
||
| const ClusterExtensionListPage: FC<ClusterExtensionListPageProps> = () => { | ||
| const { t } = useTranslation(); | ||
| const [clusterExtensions, loaded, loadError] = useK8sWatchResource<ClusterExtensionKind[]>({ | ||
| kind: referenceForModel(ClusterExtensionModel), | ||
| isList: true, | ||
| namespaced: false, | ||
| }); | ||
|
|
||
| const columns = useClusterExtensionColumns(); | ||
|
|
||
| return ( | ||
| <PaneBody> | ||
| <ConsoleDataView<ClusterExtensionKind> | ||
| label={t('olm-v1~ClusterExtensions')} | ||
| data={clusterExtensions ?? []} | ||
| loaded={loaded} | ||
| loadError={loadError} | ||
| columns={columns} | ||
| getDataViewRows={getDataViewRows} | ||
| hideColumnManagement | ||
| showNamespaceOverride | ||
| /> | ||
| </PaneBody> | ||
| ); | ||
| }; | ||
|
|
||
| export default ClusterExtensionListPage; | ||
5 changes: 5 additions & 0 deletions
5
frontend/packages/operator-lifecycle-manager-v1/src/components/cluster-extension/index.ts
This file contains hidden or 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,5 @@ | ||
| export { default as ClusterExtensionListPage } from './ClusterExtensionListPage'; | ||
| export { default as CreateClusterExtension } from './CreateClusterExtension'; | ||
| export { default as ClusterExtensionForm } from './ClusterExtensionForm'; | ||
| export { ClusterExtensionYAMLEditor } from './ClusterExtensionYAMLEditor'; | ||
| export { ServiceAccountDropdown } from './ServiceAccountDropdown'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Status column may show
—for resources not yet in theInstalledcondition.Only the
'Installed'condition'sreasonis used. A freshly created or progressing ClusterExtension that hasn't reached that condition yet will silently renderDASH, giving users no feedback about its current state (e.g.,Progressing,Failed, etc.).Consider falling back to other notable condition types (e.g., the first non-
Truecondition or a generalReady-equivalent), or at minimum the first available condition reason, so the status column is never vacuously empty for a live resource.🤖 Prompt for AI Agents