Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/applicationsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The editor includes a **Schema** side panel that describes ApplicationSet fields

The **Generators** tab shows the ApplicationSet generator configuration in a structured view.

Supported generator presentations include **List**, **Cluster**, **git**, **Matrix**, **Merge**, and **Union**. Other generator types use a generic view that shows the configuration as JSON.
Supported generator presentations include **List**, **Cluster**, **git**, **OCI**, **Matrix**, **Merge**, and **Union**. Other generator types use a generic view that shows the configuration as JSON.

If no generators are configured, the tab shows an empty state.

Expand Down
3 changes: 3 additions & 0 deletions src/gitops/components/appset/Generators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import ClusterGenerator from './generators/ClusterGenerator';
import GenericGenerator from './generators/GenericGenerator';
import GitGenerator from './generators/GitGenerator';
import OCIGenerator from './generators/OCIGenerator';
import ListGenerator from './generators/ListGenerator';
import MatrixGenerator from './generators/MatrixGenerator';
import MergeGenerator from './generators/MergeGenerator';
Expand All @@ -22,6 +23,8 @@ const Generators: React.FC<GeneratorsProps> = ({ generators }) => {
return <ClusterGenerator key={index} generator={generatorData} />;
case 'git':
return <GitGenerator key={index} generator={generatorData} />;
case 'oci':
return <OCIGenerator key={index} generator={generatorData} />;
case 'list':
return <ListGenerator key={index} generator={generatorData} />;
case 'merge':
Expand Down
2 changes: 1 addition & 1 deletion src/gitops/components/appset/generators/GitGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface GitGeneratorProps {
}

const GitGenerator: React.FC<GitGeneratorProps> = ({ generator }) => {
const generatorType = generator.files ? 'File' : 'Directory';
const generatorType = generator.files?.length ? 'File' : 'Directory';

return (
<GeneratorView icon={<GitAltIcon />} title={`git (${generatorType})`}>
Expand Down
56 changes: 56 additions & 0 deletions src/gitops/components/appset/generators/OCIGenerator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from 'react';

import {
DescriptionList,
DescriptionListDescription,
DescriptionListGroup,
DescriptionListTerm,
} from '@patternfly/react-core';
import { ContainerNodeIcon } from '@patternfly/react-icons';
import { OCIAppSetGenerator } from "@gitops/models/ApplicationSetModel";
import GeneratorView from './GeneratorView';

interface OCIGeneratorProps {
generator: OCIAppSetGenerator;
}

const OCIGenerator: React.FC<OCIGeneratorProps> = ({ generator }) => {
const generatorType = generator.files?.length ? 'File' : 'Directory';

return (
<GeneratorView icon={<ContainerNodeIcon />} title={`OCI (${generatorType})`}>
<DescriptionList isHorizontal isCompact>
{generator.repoURL && (
<DescriptionListGroup>
<DescriptionListTerm>Repository</DescriptionListTerm>
<DescriptionListDescription>{generator.repoURL}</DescriptionListDescription>
</DescriptionListGroup>
)}
{generator.revision && (
<DescriptionListGroup>
<DescriptionListTerm>Revision</DescriptionListTerm>
<DescriptionListDescription>{generator.revision}</DescriptionListDescription>
</DescriptionListGroup>
)}
{generator.directories && (
<DescriptionListGroup>
<DescriptionListTerm>Directories</DescriptionListTerm>
<DescriptionListDescription>
{generator.directories.length} directory(ies)
</DescriptionListDescription>
</DescriptionListGroup>
)}
{generator.files && (
<DescriptionListGroup>
<DescriptionListTerm>Files</DescriptionListTerm>
<DescriptionListDescription>
{generator.files.length} file(s)
</DescriptionListDescription>
</DescriptionListGroup>
)}
</DescriptionList>
</GeneratorView>
);
};

export default OCIGenerator;
1 change: 1 addition & 0 deletions src/gitops/components/appset/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { default as GeneratorsTab } from './GeneratorsTab';
export { default as ClusterGenerator } from './generators/ClusterGenerator';
export { default as GenericGenerator } from './generators/GenericGenerator';
export { default as GitGenerator } from './generators/GitGenerator';
export { default as OCIGenerator } from './generators/OCIGenerator';
export { default as ListGenerator } from './generators/ListGenerator';
export { default as MatrixGenerator } from './generators/MatrixGenerator';
export { default as MergeGenerator } from './generators/MergeGenerator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ type UseShowOperandsInAllNamespaces = () => [boolean, (value: boolean) => void];
export const useShowOperandsInAllNamespaces: UseShowOperandsInAllNamespaces = () => {
const dispatch = useDispatch();
const showOperandsInAllNamespaces = useSelector((state: RootStateOrAny) =>
state.UI.get('showOperandsInAllNamespaces'),
typeof state.UI?.get === 'function'
? state.UI.get('showOperandsInAllNamespaces')
: state.UI?.showOperandsInAllNamespaces,
);
const setShowOperandsInAllNamespaces = useCallback(
(value: boolean) => dispatch(uiActionsSetShowOperandsInAllNamespaces(value)),
Expand Down
13 changes: 13 additions & 0 deletions src/gitops/models/ApplicationSetModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ export type GitAppSetGenerator = {
}[];
};

export type OCIAppSetGenerator = {
repoURL: string;
revision?: string;
files?: {
path: string;
}[];
directories?: {
exclude: boolean;
path: string;
}[];
};

export type SCMProviderAppSetGenerator = {
awsCodeCommit?: object;
azureDevOps?: object;
Expand Down Expand Up @@ -89,6 +101,7 @@ export type ClusterDecisionresource = {
export type AppSetGenerator = {
clusters?: ClusterAppSetGenerator;
git?: GitAppSetGenerator;
oci?: OCIAppSetGenerator;
list?: ListAppSetGenerator;
matrix?: MatrixAppSetGenerator;
merge?: MergeAppSetGenerator;
Expand Down
3 changes: 2 additions & 1 deletion src/plugin/utils/useClusterVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export type FlagsObject = { [key: string]: boolean };

export const getFlagsObject = ({
[featureReducerName]: featureState,
}: RootStateOrAny): FlagsObject => featureState.toObject();
}: RootStateOrAny): FlagsObject =>
typeof featureState?.toObject === 'function' ? featureState.toObject() : featureState;

const getClusterVersionFlag = (state: RootStateOrAny) => getFlagsObject(state)?.['CLUSTER_VERSION'];

Expand Down
Loading