Skip to content
Merged
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
89 changes: 55 additions & 34 deletions libs/i18n/locales/en/translation.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions libs/types/alpha/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type { CatalogItemArtifact } from './models/CatalogItemArtifact';
export { CatalogItemArtifactType } from './models/CatalogItemArtifactType';
export { CatalogItemCategory } from './models/CatalogItemCategory';
export type { CatalogItemConfigurable } from './models/CatalogItemConfigurable';
export type { CatalogItemDeployment } from './models/CatalogItemDeployment';
export type { CatalogItemDeploymentList } from './models/CatalogItemDeploymentList';
export type { CatalogItemDeprecation } from './models/CatalogItemDeprecation';
export type { CatalogItemList } from './models/CatalogItemList';
export type { CatalogItemMeta } from './models/CatalogItemMeta';
Expand Down
49 changes: 49 additions & 0 deletions libs/types/alpha/models/CatalogItemDeployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiVersion } from './ApiVersion';
/**
* CatalogItemDeployment represents a specific deployment of a catalog item to a fleet or device. A catalog item associated to a fleet that has no devices is still considered a deployment. A deployment is only associated with the fleet and not the individual devices in cases where a device is using a catalog item deployment that came from a device spec template on a fleet.
*/
export type CatalogItemDeployment = {
apiVersion: ApiVersion;
/**
* Kind is a string value representing the REST resource this object represents.
*/
kind: string;
/**
* The device or fleet that this deployment pertains to.
*/
deployedTo?: {
/**
* Either a Device or Fleet.
*/
resourceKind?: string;
/**
* The name of the device or fleet.
*/
resourceName?: string;
};
/**
* The catalog of the catalogItem.
*/
catalog: string;
/**
* The catalogItem that this deployment corresponds to.
*/
catalogItem: string;
/**
* The version of the catalog item that is deployed.
*/
version: string;
/**
* The channel, if any, that is intended to be tracked for the catalog item.
*/
channel?: string;
/**
* For catalog items in the 'application' category, the name of the application on the device that the deployment is associated with. Required for application catalog items.
*/
applicationName?: string;
};

23 changes: 23 additions & 0 deletions libs/types/alpha/models/CatalogItemDeploymentList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiVersion } from './ApiVersion';
import type { CatalogItemDeployment } from './CatalogItemDeployment';
import type { ListMeta } from '../../models/ListMeta';
/**
* CatalogItemDeploymentList is a list of CatalogItemDeployments.
*/
export type CatalogItemDeploymentList = {
apiVersion: ApiVersion;
/**
* Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds.
*/
kind: string;
metadata: ListMeta;
/**
* List of CatalogItemDeployments.
*/
items: Array<CatalogItemDeployment>;
};

4 changes: 4 additions & 0 deletions libs/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export type { AuthStaticRoleAssignment } from './models/AuthStaticRoleAssignment
export type { BaseImageEntry } from './models/BaseImageEntry';
export type { Batch } from './models/Batch';
export type { BatchSequence } from './models/BatchSequence';
export type { CatalogItemRefApplicationProviderSpec } from './models/CatalogItemRefApplicationProviderSpec';
export type { CatalogItemRefSpec } from './models/CatalogItemRefSpec';
export type { CertificateSigningRequest } from './models/CertificateSigningRequest';
export type { CertificateSigningRequestList } from './models/CertificateSigningRequestList';
export type { CertificateSigningRequestSpec } from './models/CertificateSigningRequestSpec';
Expand Down Expand Up @@ -144,7 +146,9 @@ export type { HttpConfigProviderSpec } from './models/HttpConfigProviderSpec';
export type { HttpRepoSpec } from './models/HttpRepoSpec';
export type { ImageApplicationProviderSpec } from './models/ImageApplicationProviderSpec';
export type { ImageMountVolumeProviderSpec } from './models/ImageMountVolumeProviderSpec';
export type { ImageOrCatalogItemRefSpec } from './models/ImageOrCatalogItemRefSpec';
export { ImagePullPolicy } from './models/ImagePullPolicy';
export type { ImageSpec } from './models/ImageSpec';
export type { ImageVolumeProviderSpec } from './models/ImageVolumeProviderSpec';
export type { ImageVolumeSource } from './models/ImageVolumeSource';
export type { InlineApplicationProviderSpec } from './models/InlineApplicationProviderSpec';
Expand Down
9 changes: 9 additions & 0 deletions libs/types/models/CatalogItemRefApplicationProviderSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CatalogItemRefSpec } from './CatalogItemRefSpec';
export type CatalogItemRefApplicationProviderSpec = {
catalogItemRef: CatalogItemRefSpec;
};

26 changes: 26 additions & 0 deletions libs/types/models/CatalogItemRefSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* A reference to a catalog item, along with its configuration.
*/
export type CatalogItemRefSpec = {
/**
* The catalog name that the item is part of.
*/
catalog: string;
/**
* The name of the catalog item itself.
*/
item: string;
/**
* A valid version that currently exists in the catalog item.
*/
version: string;
/**
* An optional update channel which will be used to provide update cues when available.
*/
channel?: string;
};

3 changes: 2 additions & 1 deletion libs/types/models/ComposeApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import type { ApplicationEnvVars } from './ApplicationEnvVars';
import type { ApplicationProviderBase } from './ApplicationProviderBase';
import type { ApplicationVolumeProviderSpec } from './ApplicationVolumeProviderSpec';
import type { CatalogItemRefApplicationProviderSpec } from './CatalogItemRefApplicationProviderSpec';
import type { ImageApplicationProviderSpec } from './ImageApplicationProviderSpec';
import type { InlineApplicationProviderSpec } from './InlineApplicationProviderSpec';
export type ComposeApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationVolumeProviderSpec & (ImageApplicationProviderSpec | InlineApplicationProviderSpec));
export type ComposeApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationVolumeProviderSpec & (ImageApplicationProviderSpec | CatalogItemRefApplicationProviderSpec | InlineApplicationProviderSpec));

8 changes: 3 additions & 5 deletions libs/types/models/ContainerApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import type { ApplicationProviderBase } from './ApplicationProviderBase';
import type { ApplicationResources } from './ApplicationResources';
import type { ApplicationUser } from './ApplicationUser';
import type { ApplicationVolumeProviderSpec } from './ApplicationVolumeProviderSpec';
export type ContainerApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationUser & ApplicationVolumeProviderSpec & {
/**
* Reference to the image for this container.
*/
image: string;
import type { CatalogItemRefApplicationProviderSpec } from './CatalogItemRefApplicationProviderSpec';
import type { ImageApplicationProviderSpec } from './ImageApplicationProviderSpec';
export type ContainerApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationUser & ApplicationVolumeProviderSpec & (ImageApplicationProviderSpec | CatalogItemRefApplicationProviderSpec) & {
/**
* Port mappings.
*/
Expand Down
12 changes: 2 additions & 10 deletions libs/types/models/DeviceOsSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* DeviceOsSpec describes the target OS for the device.
*/
export type DeviceOsSpec = {
/**
* The target OS image name or URL.
*/
image: string;
};

import type { ImageOrCatalogItemRefSpec } from './ImageOrCatalogItemRefSpec';
export type DeviceOsSpec = ImageOrCatalogItemRefSpec;
2 changes: 2 additions & 0 deletions libs/types/models/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export namespace Event {
DEPENDENCY_CHANGE_DETECTED = 'DependencyChangeDetected',
DEPENDENCY_SYNC_PROBE_FAILED = 'DependencySyncProbeFailed',
SYSTEM_RESTORED = 'SystemRestored',
ENCRYPTION_MIGRATION_STARTED = 'EncryptionMigrationStarted',
ENCRYPTION_MIGRATION_COMPLETED = 'EncryptionMigrationCompleted',
APPLICATION_LIFECYCLE_CHANGED = 'ApplicationLifecycleChanged',
}
/**
Expand Down
8 changes: 3 additions & 5 deletions libs/types/models/HelmApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
/* tslint:disable */
/* eslint-disable */
import type { ApplicationProviderBase } from './ApplicationProviderBase';
export type HelmApplication = (ApplicationProviderBase & {
/**
* Reference to the chart for this helm application.
*/
image: string;
import type { CatalogItemRefApplicationProviderSpec } from './CatalogItemRefApplicationProviderSpec';
import type { ImageApplicationProviderSpec } from './ImageApplicationProviderSpec';
export type HelmApplication = (ApplicationProviderBase & (ImageApplicationProviderSpec | CatalogItemRefApplicationProviderSpec) & {
/**
* The target namespace for the application deployment.
*/
Expand Down
9 changes: 2 additions & 7 deletions libs/types/models/ImageApplicationProviderSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ImageApplicationProviderSpec = {
/**
* Reference to the OCI image or artifact for the application package.
*/
image: string;
};

import type { ImageSpec } from './ImageSpec';
export type ImageApplicationProviderSpec = ImageSpec;
17 changes: 17 additions & 0 deletions libs/types/models/ImageOrCatalogItemRefSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CatalogItemRefSpec } from './CatalogItemRefSpec';
/**
* Either a specific OCI image reference, or a reference to a catalog item version that can be resolved to an OCI image ref.
*/
export type ImageOrCatalogItemRefSpec = ({
/**
* Reference to an OCI image or artifact with tag.
*/
image?: string;
} & {
catalogItemRef?: CatalogItemRefSpec;
});

14 changes: 14 additions & 0 deletions libs/types/models/ImageSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Reference to an OCI image or artifact with tag.
*/
export type ImageSpec = {
/**
* Reference to an OCI image or artifact with tag.
*/
image: string;
};

6 changes: 4 additions & 2 deletions libs/types/models/ImageVolumeSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CatalogItemRefSpec } from './CatalogItemRefSpec';
import type { ImagePullPolicy } from './ImagePullPolicy';
/**
* Describes the source of an OCI-compliant image or artifact.
* Describes the source of an OCI-compliant image or artifact. Exactly one of 'reference' or 'catalogItemRef' must be specified.
*/
export type ImageVolumeSource = {
/**
* Reference to an OCI-compliant image or artifact in a registry. This may be a container image or another type of OCI artifact, as long as it conforms to the OCI image specification.
*/
reference: string;
reference?: string;
catalogItemRef?: CatalogItemRefSpec;
pullPolicy?: ImagePullPolicy;
};

3 changes: 2 additions & 1 deletion libs/types/models/QuadletApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import type { ApplicationEnvVars } from './ApplicationEnvVars';
import type { ApplicationProviderBase } from './ApplicationProviderBase';
import type { ApplicationUser } from './ApplicationUser';
import type { ApplicationVolumeProviderSpec } from './ApplicationVolumeProviderSpec';
import type { CatalogItemRefApplicationProviderSpec } from './CatalogItemRefApplicationProviderSpec';
import type { ImageApplicationProviderSpec } from './ImageApplicationProviderSpec';
import type { InlineApplicationProviderSpec } from './InlineApplicationProviderSpec';
export type QuadletApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationUser & ApplicationVolumeProviderSpec & (ImageApplicationProviderSpec | InlineApplicationProviderSpec));
export type QuadletApplication = (ApplicationProviderBase & ApplicationEnvVars & ApplicationUser & ApplicationVolumeProviderSpec & (ImageApplicationProviderSpec | CatalogItemRefApplicationProviderSpec | InlineApplicationProviderSpec));

Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import {
} from '@patternfly/react-core';
import { useFormikContext } from 'formik';

import type { AddCatalogItemFormValues } from '../types';
import { useTranslation } from '../../../../hooks/useTranslation';
import { getErrorMessage } from '../../../../utils/error';
import { AddCatalogItemFormValues } from '../types';
import { appTypeIds } from '../../useCatalogs';
import { getArtifactLabel } from '../../utils';
import { CatalogItemArtifactType } from '@flightctl/types/alpha';
import { appTypeIds } from '../../useCatalogItems';
import { getArtifactLabel } from '../../../../utils/catalog';

export const reviewStepId = 'review';

Expand Down Expand Up @@ -74,11 +73,7 @@ const ReviewStep = ({ error, isEdit, isReadOnly }: { error: unknown; isEdit?: bo
<DescriptionListDescription>
<List isPlain>
{values.artifacts.map((a) => {
return (
<ListItem
key={a.type}
>{`${getArtifactLabel(t, a.type as CatalogItemArtifactType, a.name)} - ${a.uri}`}</ListItem>
);
return <ListItem key={a.type}>{`${getArtifactLabel(t, a)} - ${a.uri}`}</ListItem>;
})}
</List>
</DescriptionListDescription>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import FormSelect from '../../../form/FormSelect';
import FlightCtlForm from '../../../form/FlightCtlForm';
import ExpandableFormSection from '../../../form/ExpandableFormSection';
import UploadField from '../../../form/UploadField';
import { getArtifactLabel, getCatalogItemBadge } from '../../utils';
import { getArtifactLabel, getCatalogItemBadge } from '../../../../utils/catalog';

export const typeConfigStepId = 'type-config';

Expand All @@ -24,6 +24,12 @@ export const isTypeConfigStepValid = (errors: FormikErrors<AddCatalogItemFormVal
);
};

const artifactTypes = Object.values(CatalogItemArtifactType).map((artifactType) => ({
type: artifactType,
name: '',
uri: '',
}));

const catalogItemTypeLabels = (
t: TFunction,
): Record<
Expand All @@ -38,8 +44,8 @@ const catalogItemTypeLabels = (
[CatalogItemType.CatalogItemTypeData]: getCatalogItemBadge(CatalogItemType.CatalogItemTypeData, t),
});

const getArtifactTitle = (artifact: ArtifactFormValue, index: number, t: ReturnType<typeof useTranslation>['t']) => {
const typeLabel = artifact.type ? getArtifactLabel(t, artifact.type, artifact.name) : artifact.name;
const getArtifactTitle = (artifact: ArtifactFormValue, index: number, t: TFunction) => {
const typeLabel = getArtifactLabel(t, artifact);
return typeLabel || t('Artifact {{ num }}', { num: index + 1 });
};

Expand Down Expand Up @@ -118,8 +124,8 @@ const TypeConfigStep = ({ isEdit, isReadOnly }: { isEdit?: boolean; isReadOnly?:
<FormGroup label={t('Type')} isRequired>
<FormSelect
name={`artifacts.${index}.type`}
items={Object.values(CatalogItemArtifactType).reduce((acc, curr) => {
acc[curr] = getArtifactLabel(t, curr);
items={artifactTypes.reduce((acc, artifact) => {
acc[artifact.type] = getArtifactLabel(t, artifact);
return acc;
}, {})}
Comment thread
celdrake marked this conversation as resolved.
placeholderText={t('Select a type')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { FieldArray, FormikErrors, useField, useFormikContext } from 'formik';
import { CatalogItemArtifactType } from '@flightctl/types/alpha';

import { useTranslation } from '../../../../hooks/useTranslation';
import { AddCatalogItemFormValues, VersionFormValues, configurableAppTypes } from '../types';
import { type AddCatalogItemFormValues, type VersionFormValues, configurableAppTypes } from '../types';
import { getEmptyVersion } from '../utils';
import { appTypeIds } from '../../useCatalogs';
import { appTypeIds } from '../../useCatalogItems';
import TextField from '../../../form/TextField';
import TextAreaField from '../../../form/TextAreaField';
import CheckboxField from '../../../form/CheckboxField';
Expand All @@ -18,7 +18,7 @@ import ExpandableFormSection from '../../../form/ExpandableFormSection';
import ChannelsSelect from '../ChannelsSelect';
import UploadField from '../../../form/UploadField';
import ErrorHelperText from '../../../form/FieldHelperText';
import { getArtifactLabel } from '../../utils';
import { getArtifactLabel } from '../../../../utils/catalog';

export const versionStepId = 'version';

Expand Down Expand Up @@ -153,10 +153,7 @@ const ReferencesField = ({ index, isReadOnly }: { index: number; isReadOnly?: bo
<FormSection title={t('References')}>
{artifactsWithType.map((artifact) => {
return (
<FormGroup
key={artifact.type}
label={getArtifactLabel(t, artifact.type as CatalogItemArtifactType, artifact.name)}
>
<FormGroup key={artifact.type} label={getArtifactLabel(t, artifact)}>
<TextField
name={`${prefix}.references.${artifact.type}`}
aria-label={t('{{type}} reference', { type: artifact.type })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
VersionFormValues,
configurableAppTypes,
} from './types';
import { appTypeIds } from '../useCatalogs';
import { appTypeIds } from '../useCatalogItems';
import { getKubernetesDnsSubdomainErrors, validKubernetesDnsSubdomain, validURLSchema } from '../../form/validations';
import { appendJSONPatch } from '../../../utils/patch';

Expand Down
Loading
Loading