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
17 changes: 15 additions & 2 deletions docs/readme-generic-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ In order to use the generic list view, you need to adjust the node’s `conten

- context resource definition `"context"`

- in the `"resourceDefinition"` the given fields need to be specified: `group, plural, singular, kind, scope, namespace` describing
properties of the resource.
- in the `"resourceDefinition"` the given fields need to be specified: `group, plural, singular, kind, scope, namespace` describing properties of the resource.
- Also `"resourceDefinition"` have optional field `readyCondition` that describing when resource treated as ready
It's an object that contains two fields:
- `jsonPathExpression`: JSONPath expression used to evaluate whether the resource is ready at runtime
- `property`: JSON path(s) used to generate GraphQL fields to fetch the necessary data for readiness evaluation
```json
"readyCondition": {
"jsonPathExpression": "status.conditions[?(@.type=='Ready' && @.status=='True')]",
"property": ["status.conditions.status", "status.conditions.type"],
},
```
- in the `"ui"` part of the `"resourceDefinition"` we can specify `"logoUrl"` for the resource as well as the definitions of the
corresponding views

Expand Down Expand Up @@ -95,6 +104,10 @@ Below is an example content-configuration for an accounts node using the generic
"kind": "Account",
"scope": "Cluster",
"namespace": null,
"readyCondition": {
"jsonPathExpression": "status.conditions[?(@.type=='Ready' && @.status=='True')]",
"property": ["status.conditions.status", "status.conditions.type"],
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't understand this configuration.

the jsonPathExpression ends up in a concrete value - a particular conditions stats.
What does the property then do?

Copy link
Collaborator Author

@Sobyt483 Sobyt483 Oct 29, 2025

Choose a reason for hiding this comment

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

It's needed for graphQL. So they can be fetch from it

},
"ui": {
"logoUrl": "https://www.kcp.io/icons/logo.svg",
"listView": {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@angular/compiler-cli": "^20.2.1",
"@angular/localize": "^20.2.1",
"@briebug/jest-schematic": "6.0.0",
"@openmfp/portal-ui-lib": "0.181.8",
"@openmfp/portal-ui-lib": "0.182.0",
"@openmfp/config-prettier": "0.8.1",
"@types/jest": "^30.0.0",
"@types/jmespath": "0.15.2",
Expand All @@ -51,4 +51,4 @@
"ts-jest": "29.3.2",
"typescript": "~5.8.0"
}
}
}
6 changes: 5 additions & 1 deletion projects/lib/models/models/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export interface ResourceDefinition {
kind: string;
scope?: KubernetesScope;
namespace?: string;
readyCondition?: {
jsonPathExpression: string;
property: string | string[];
};
ui?: UIDefinition;
}

Expand All @@ -79,4 +83,4 @@ export interface UIDefinition {
detailView?: UiView;
}

export type KubernetesScope = 'Cluster' | 'Namespaced';
export type KubernetesScope = 'Cluster' | 'Namespaced';
3 changes: 2 additions & 1 deletion projects/lib/portal-options/models/luigi-context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NodeContext, Resource } from '@openmfp/portal-ui-lib';
import { NodeContext } from '@openmfp/portal-ui-lib';
import { Resource } from '@platform-mesh/portal-ui-lib/models';

export interface PortalContext extends Record<string, any> {
crdGatewayApiUrl: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import { DestroyRef, Injectable, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
AuthService,
FieldDefinition,
LuigiCoreService,
LuigiNode,
PortalConfig,
Resource,
} from '@openmfp/portal-ui-lib';
import { ResourceNodeContext, ResourceService } from '@platform-mesh/portal-ui-lib/services';
import { FieldDefinition, Resource } from '@platform-mesh/portal-ui-lib/models';
import {
ResourceNodeContext,
ResourceService,
} from '@platform-mesh/portal-ui-lib/services';
import { generateGraphQLFields } from '@platform-mesh/portal-ui-lib/utils';
import '@ui5/webcomponents/dist/ComboBox.js';
import { Observable, of } from 'rxjs';
import { shareReplay } from 'rxjs/operators';


const defaultColumns: FieldDefinition[] = [
{
label: 'Name',
Expand Down Expand Up @@ -148,4 +151,4 @@ export class NamespaceSelectionRendererService {
console.warn(`Segment "${name}" not found in path.`);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TestBed } from '@angular/core/testing';
import { Resource } from '@openmfp/portal-ui-lib';
import { ResourceService } from '@platform-mesh/portal-ui-lib/services';
import { of, throwError } from 'rxjs';
import { PortalNodeContext } from '../models/luigi-context';
import { PortalLuigiNode } from '../models/luigi-node';
import { CrdGatewayKcpPatchResolver } from './crd-gateway-kcp-patch-resolver.service';
import { NodeContextProcessingServiceImpl } from './node-context-processing.service';
import { TestBed } from '@angular/core/testing';
import { Resource } from '@platform-mesh/portal-ui-lib/models';
import { ResourceService } from '@platform-mesh/portal-ui-lib/services';
import { of, throwError } from 'rxjs';

describe('NodeContextProcessingServiceImpl', () => {
let service: NodeContextProcessingServiceImpl;
Expand Down Expand Up @@ -431,4 +431,4 @@ describe('NodeContextProcessingServiceImpl', () => {
);
});
});
});
});
4 changes: 3 additions & 1 deletion projects/lib/services/resource/resource-node-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NodeContext } from '@openmfp/portal-ui-lib';
import { ResourceDefinition } from '@platform-mesh/portal-ui-lib/models';

export interface ResourceNodeContext extends Partial<NodeContext> {
resourceDefinition?: ResourceDefinition;
organization?: string;
accountId?: string;
kcpCA?: string;
Expand All @@ -15,4 +17,4 @@ export interface ResourceNodeContext extends Partial<NodeContext> {
crdGatewayApiUrl: string;
kcpWorkspaceUrl?: string;
};
}
}
2 changes: 1 addition & 1 deletion projects/lib/utils/utils/columns-to-gql-fields.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FieldDefinition } from '@openmfp/portal-ui-lib';
import { generateGraphQLFields } from './columns-to-gql-fields';
import { FieldDefinition } from '@platform-mesh/portal-ui-lib/models';

describe('columns-to-gql-fields', () => {
describe('generateGraphQLFields', () => {
Expand Down
2 changes: 1 addition & 1 deletion projects/lib/utils/utils/columns-to-gql-fields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FieldDefinition } from '@openmfp/portal-ui-lib';
import { FieldDefinition } from '@platform-mesh/portal-ui-lib/models';

export const generateGraphQLFields = (uiFields: FieldDefinition[]): any[] => {
const graphQLFields = [];
Expand Down
2 changes: 1 addition & 1 deletion projects/lib/utils/utils/get-value-by-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Resource } from '@openmfp/portal-ui-lib';
import { getResourceValueByJsonPath } from './resource-field-by-path';
import { Resource } from '@platform-mesh/portal-ui-lib/models';

export const getValueByPath = <T extends object, R = unknown>(
obj: T,
Expand Down
2 changes: 1 addition & 1 deletion projects/lib/utils/utils/resource-field-by-path.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FieldDefinition, Resource } from '@openmfp/portal-ui-lib';
import { getResourceValueByJsonPath } from './resource-field-by-path';
import { FieldDefinition, Resource } from '@platform-mesh/portal-ui-lib/models';

describe('getResourceValueByJsonPath', () => {
it('should return undefined when property is not defined', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Component, DestroyRef, effect, inject, input, output, signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FieldDefinition } from '@openmfp/portal-ui-lib';
import { ResourceNodeContext, ResourceService } from '@platform-mesh/portal-ui-lib/services';
import { FieldDefinition } from '@platform-mesh/portal-ui-lib/models';
import {
ResourceNodeContext,
ResourceService,
} from '@platform-mesh/portal-ui-lib/services';
import { getValueByPath } from '@platform-mesh/portal-ui-lib/utils';
import { OptionComponent, SelectComponent } from '@ui5/webcomponents-ngx';
import { Observable, map } from 'rxjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CreateResourceModalComponent } from './create-resource-modal.component'
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { FieldDefinition } from '@openmfp/portal-ui-lib';
import { FieldDefinition } from '@platform-mesh/portal-ui-lib/models';

describe('CreateResourceModalComponent', () => {
let component: CreateResourceModalComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
ValidatorFn,
Validators,
} from '@angular/forms';
import { FieldDefinition, Resource } from '@openmfp/portal-ui-lib';
import { FieldDefinition, Resource } from '@platform-mesh/portal-ui-lib/models';
import { ResourceNodeContext } from '@platform-mesh/portal-ui-lib/services';
import { getValueByPath } from '@platform-mesh/portal-ui-lib/utils';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ReactiveFormsModule,
Validators,
} from '@angular/forms';
import { Resource } from '@openmfp/portal-ui-lib';
import { Resource } from '@platform-mesh/portal-ui-lib/models';
import { ResourceNodeContext } from '@platform-mesh/portal-ui-lib/services';
import {
BarComponent,
Expand Down
Loading