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
20 changes: 18 additions & 2 deletions docs/readme-generic-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ Each field definition supports the following properties:

- `"label"`: Display name for the field
- `"property"`: JSON path to the resource property (string or array of strings for fallback values)
- `"propertyField"`: In case the property is a scalar value that represents an object, this property can be used to specify the field to be used for display within that object
Copy link
Collaborator Author

@gkrajniak gkrajniak Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc

- `"key"`: The name of the field to be used for display
- `"transform"`: An array of text manipulations to be applied to the value, the available are:
| 'uppercase'
| 'lowercase'
| 'capitalize'
| 'decode'
| 'encode'
- `"jsonPathExpression"`: Alternative JSONPath expression for complex data access (takes precedence over `property`)
- `"required"`: Boolean flag indicating if the field is mandatory (for create views)
- `"values"`: Array of predefined values for selection
Expand Down Expand Up @@ -106,7 +114,7 @@ Below is an example content-configuration for an accounts node using the generic
"namespace": null,
"readyCondition": {
"jsonPathExpression": "status.conditions[?(@.type=='Ready' && @.status=='True')]",
"property": ["status.conditions.status", "status.conditions.type"],
"property": ["status.conditions.status", "status.conditions.type"]
},
"ui": {
"logoUrl": "https://www.kcp.io/icons/logo.svg",
Expand All @@ -120,6 +128,14 @@ Below is an example content-configuration for an accounts node using the generic
"label": "Display Name",
"property": "spec.displayName"
},
{
"label": "Key",
"property": "data",
"propertyField": {
"key": "OPENAI_API_KEY",
"transform": ["uppercase", "encode"]
}
},
{
"label": "Type",
"property": "spec.type",
Expand Down Expand Up @@ -213,7 +229,7 @@ Below is an example content-configuration for an accounts node using the generic
"operation": "cities",
"gqlQuery": "subscription { cities { data { id name } } }",
"value": "data.id",
"key": "data.name",
"key": "data.name"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"@types/jmespath": "0.15.2",
"@types/jsonpath": "0.2.4",
"@ui5/webcomponents-ngx": "0.5.6",
"kubernetes-types": "1.30.0",
"cpx2": "8.0.0",
"jest": "29.7.0",
"jest-jasmine2": "29.7.0",
"jest-junit": "16.0.0",
"jest-mock-extended": "3.0.7",
"jmespath": "0.16.0",
"kubernetes-types": "1.30.0",
"mkdirp": "3.0.1",
"move-cli": "2.0.0",
"ng-packagr": "20.3.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/lib/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
branches: 90,
functions: 95,
lines: 95,
statements: -3,
statements: -4,
},
},
moduleNameMapper: {
Expand Down
17 changes: 15 additions & 2 deletions projects/lib/models/models/resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Condition, ObjectMeta } from 'kubernetes-types/meta/v1';


export interface LabelDisplay {
backgroundColor?: string;
color?: string;
Expand All @@ -10,9 +9,22 @@ export interface LabelDisplay {
textTransform?: string;
}

export type TransformType =
| 'uppercase'
| 'lowercase'
| 'capitalize'
| 'decode'
| 'encode';

export interface PropertyField {
key: string;
transform?: TransformType[];
}

export interface FieldDefinition {
label?: string;
property: string | string[];
propertyField?: PropertyField;
jsonPathExpression?: string;
required?: boolean;
values?: string[];
Expand Down Expand Up @@ -56,6 +68,7 @@ export interface Resource extends Record<string, any> {
status?: ResourceStatus;
__typename?: string;
ready?: boolean;
data?: Record<string, any>;
}

export interface ResourceDefinition {
Expand Down Expand Up @@ -83,4 +96,4 @@ export interface UIDefinition {
detailView?: UiView;
}

export type KubernetesScope = 'Cluster' | 'Namespaced';
export type KubernetesScope = 'Cluster' | 'Namespaced';
1 change: 0 additions & 1 deletion projects/lib/utils/utils/get-value-by-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ export const getValueByPath = <T extends object, R = unknown>(
): R | undefined => {
return getResourceValueByJsonPath(obj as Resource, {
jsonPathExpression: path,
property: '',
});
};
Loading