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
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ This file orients AI tools to the flightctl-ui repo layout and conventions. The

## Generated files – do not edit by hand

- **Models / API types** (`libs/types`): Generated from the flightctl OpenAPI schema. Regenerate with **`npm run gen-types`** (from repo root). Do not modify generated files manually; changes are driven entirely from the OpenAPI spec in the flightctl repo.
- **Translations** (`libs/i18n/locales/en/translation.json`): Generated by scanning source for i18n keys. Regenerate with **`npm run i18n`** (from repo root). Do not edit `translation.json` manually; add or fix keys in the source and run the command. Translation expressions can include variables, but the text itself must be hardcoded for the extraction to work. **Good:** `t('This is OK', { someVar })` — **Bad:** `t(usingAVariableIsNotOk)` (key not extractable).
- **Models / API types** (`libs/types`): Generated from the flightctl OpenAPI schema. Regenerate with **`npm run gen-types`** (from repo root). Agents must not modify or suggest changes to these generated files; changes are driven entirely from the OpenAPI spec in the flightctl repo.
- **Translations** (`libs/i18n/locales/en/translation.json`): Generated by scanning source for i18n keys. Agents must not edit `translation.json` manually; they should add or fix keys in the source and run the **`npm run i18n`** command (from repo root). Translation expressions can include variables, but the text itself must be hardcoded for the extraction to work. **Good:** `t('This is OK', { someVar })` — **Bad:** `t(usingAVariableIsNotOk)` (key not extractable).

## Conventions and assumptions

- **`resource.metadata.name`**: In this codebase, `metadata.name` is always treated as defined for resources that have been created or returned by the API, even though the generated TypeScript types may mark it as optional. Use it without optional chaining when the resource is known to be a full resource (e.g. from list/get); handle undefined only when the type truly represents a partial or input payload.
- **`resource.metadata.name`**: In this codebase, `metadata.name` is known to be defined for all resources that have been created or returned by the API. However, TypeScript still sees the field as potentially undefined due to the type definitions. Casting the field to string or falling back to a default empty string are valid ways to make the linter pass and should not be flagged as potential issues.

## Build and development

Expand Down
3 changes: 2 additions & 1 deletion libs/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@
"Value": "Value",
"Close": "Close",
"Select {{ name }}": "Select {{ name }}",
"Provided by {{provider}}": "Provided by {{provider}}",
"Provided by: {{provider}}": "Provided by: {{provider}}",
"Deprecated": "Deprecated",
"Provided by {{provider}}": "Provided by {{provider}}",
"Resize panel": "Resize panel",
"Data catalog item can be deployed as part of an application.": "Data catalog item can be deployed as part of an application.",
"Deploy": "Deploy",
Expand Down
6 changes: 4 additions & 2 deletions libs/ui-components/src/components/Catalog/CatalogItemCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ export type CatalogItemCardProps = {

const CatalogItemCard: React.FC<CatalogItemCardProps> = ({ catalogItem, onSelect }) => {
const { t } = useTranslation();

const displayName = catalogItem.metadata.name as string;
return (
<Card isCompact isClickable>
<CardHeader
selectableActions={{
onClickAction: onSelect,
onChange: onSelect,
selectableActionAriaLabel: t('Select {{ name }}', {
name: catalogItem.spec.displayName || catalogItem.metadata.name,
name: displayName,
}),
}}
>
Expand Down Expand Up @@ -63,7 +65,7 @@ const CatalogItemCard: React.FC<CatalogItemCardProps> = ({ catalogItem, onSelect
{catalogItem.spec.provider && (
<StackItem>
<Content component={ContentVariants.small}>
{t('Provided by {{provider}}', { provider: catalogItem.spec.provider })}
{t('Provided by: {{provider}}', { provider: catalogItem.spec.provider })}
</Content>
</StackItem>
)}
Expand Down