Skip to content

Commit 7135968

Browse files
authored
Merge branch 'main' into bug/fix-users-context
2 parents 595d9f1 + de3d1ae commit 7135968

18 files changed

+1393
-938
lines changed

package-lock.json

Lines changed: 983 additions & 898 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@platform-mesh/portal-ui-lib",
3-
"version": "0.21.11",
3+
"version": "0.21.16",
44
"repository": {
55
"url": "git+https://github.com/platform-mesh/portal-ui-lib.git"
66
},
@@ -26,16 +26,16 @@
2626
"tslib": "2.8.1"
2727
},
2828
"devDependencies": {
29-
"@angular-builders/jest": "20.0.0",
30-
"@angular-devkit/build-angular": "20.3.8",
31-
"@angular-eslint/builder": "20.5.1",
32-
"@angular/build": "20.3.8",
33-
"@angular/cli": "20.3.8",
34-
"@angular/compiler-cli": "20.3.9",
35-
"@angular/localize": "20.3.9",
29+
"@angular-builders/jest": "^20.0.0",
30+
"@angular-devkit/build-angular": "^20.3.13",
31+
"@angular-eslint/builder": "^20.5.2",
32+
"@angular/build": "^20.3.13",
33+
"@angular/cli": "^20.3.13",
34+
"@angular/compiler-cli": "^20.3.15",
35+
"@angular/localize": "^20.3.15",
3636
"@briebug/jest-schematic": "6.0.0",
3737
"@openmfp/config-prettier": "0.9.2",
38-
"@openmfp/portal-ui-lib": "0.184.11",
38+
"@openmfp/portal-ui-lib": "0.184.15",
3939
"@types/jest": "30.0.0",
4040
"@types/jmespath": "0.15.2",
4141
"@types/jsonpath": "0.2.4",

projects/lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"prettier": "@openmfp/config-prettier",
1414
"peerDependencies": {
15-
"@openmfp/portal-ui-lib": "0.184.11"
15+
"@openmfp/portal-ui-lib": "0.184.15"
1616
}
1717
}

projects/lib/portal-options/services/custom-global-nodes.service.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { kcpRootOrgsPath } from '../models/constants';
22
import { PortalNodeContext } from '../models/luigi-context';
33
import { PortalLuigiNode } from '../models/luigi-node';
44
import { inject } from '@angular/core';
5-
import { CustomGlobalNodesService, I18nService } from '@openmfp/portal-ui-lib';
5+
import {
6+
CustomGlobalNodesService,
7+
EntityType,
8+
I18nService,
9+
NodeContext,
10+
} from '@openmfp/portal-ui-lib';
611

712
export class CustomGlobalNodesServiceImpl implements CustomGlobalNodesService {
813
private i18nService = inject(I18nService);
@@ -25,6 +30,28 @@ export class CustomGlobalNodesServiceImpl implements CustomGlobalNodesService {
2530
kcpPath: kcpRootOrgsPath,
2631
} as PortalNodeContext,
2732
},
33+
{
34+
pathSegment: 'error',
35+
order: '1000',
36+
hideFromNav: true,
37+
context: {} as PortalNodeContext,
38+
children: [
39+
{
40+
pathSegment: ':id',
41+
entityType: EntityType.ENTITY_ERROR,
42+
hideFromNav: true,
43+
hideSideNav: true,
44+
viewUrl: '/assets/platform-mesh-portal-ui-wc.js#error-component',
45+
context: {
46+
id: ':id',
47+
translationTable: this.i18nService.translationTable,
48+
} as any as NodeContext,
49+
webcomponent: {
50+
selfRegistered: true,
51+
},
52+
},
53+
],
54+
},
2855
{
2956
pathSegment: 'users',
3057
showBreadcrumbs: false,

projects/lib/portal-options/services/router-config.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe('CustomRoutingConfigServiceImpl', () => {
9292
const result = await config.pageNotFoundHandler();
9393

9494
expect(result).toEqual({
95-
redirectTo: 'welcome',
95+
redirectTo: 'error/404',
9696
keepURL: true,
9797
});
9898
});
@@ -111,7 +111,7 @@ describe('CustomRoutingConfigServiceImpl', () => {
111111
const result = await config.pageNotFoundHandler();
112112

113113
expect(result).toEqual({
114-
redirectTo: 'error/404',
114+
redirectTo: 'welcome',
115115
keepURL: true,
116116
});
117117
});
@@ -171,7 +171,7 @@ describe('CustomRoutingConfigServiceImpl', () => {
171171
const result = await config.pageNotFoundHandler();
172172

173173
expect(result).toEqual({
174-
redirectTo: 'error/404',
174+
redirectTo: 'welcome',
175175
keepURL: true,
176176
});
177177
});
@@ -190,7 +190,7 @@ describe('CustomRoutingConfigServiceImpl', () => {
190190
const result = await config.pageNotFoundHandler();
191191

192192
expect(result).toEqual({
193-
redirectTo: 'welcome',
193+
redirectTo: 'error/404',
194194
keepURL: true,
195195
});
196196
});
@@ -215,7 +215,7 @@ describe('CustomRoutingConfigServiceImpl', () => {
215215
const result = await config.pageNotFoundHandler();
216216

217217
expect(result).toEqual({
218-
redirectTo: 'error/404',
218+
redirectTo: 'welcome',
219219
keepURL: true,
220220
});
221221
});

projects/lib/portal-options/services/router-config.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export class CustomRoutingConfigServiceImpl implements RoutingConfigService {
2020

2121
getRoutingConfig(): any {
2222
return {
23-
pageNotFoundHandler: async () => {
23+
pageNotFoundHandler: () => {
2424
if (!this.envConfig?.baseDomain) {
2525
return this.redirectTo('error/404');
2626
}
2727

28-
if (window.location.hostname !== this.envConfig.baseDomain) {
28+
if (window.location.hostname === this.envConfig.baseDomain) {
2929
return this.redirectTo('welcome');
3030
}
3131

projects/lib/utils/utils/resource-field-by-path.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ describe('getResourceValueByJsonPath', () => {
4747
expect(result).toBe('test-result');
4848
});
4949

50+
it('should query resource using jsonPathExpression', () => {
51+
(jsonpath.query as jest.Mock).mockReturnValue(['test-result']);
52+
53+
const result = getResourceValueByJsonPath(mockResource, {
54+
jsonPathExpression: '$.spec.value',
55+
});
56+
57+
expect(jsonpath.query).toHaveBeenCalledWith(mockResource, '$.spec.value');
58+
expect(result).toBe('test-result');
59+
});
60+
5061
it('should query resource using property', () => {
5162
(jsonpath.query as jest.Mock).mockReturnValue(['property-result']);
5263

projects/lib/utils/utils/resource-field-by-path.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const getResourceValueByJsonPath = (
2525
return undefined;
2626
}
2727

28-
const queryResult = jsonpath.query(resource, `$.${property}`);
28+
const prefix = property.startsWith('$.') ? '' : '$.';
29+
const queryResult = jsonpath.query(resource, `${prefix}${property}`);
2930
const value = queryResult.length ? queryResult[0] : undefined;
3031

3132
if (value && field.propertyField) {

projects/wc/_mocks_/ui5-mock.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,26 @@ jest.mock('@ui5/webcomponents-icons/dist/hide.js', () => ({}), {
4040
});
4141
jest.mock('@ui5/webcomponents-icons/dist/show.js', () => ({}), {
4242
virtual: true,
43-
});
43+
});
44+
45+
jest.mock(
46+
'@ui5/webcomponents-fiori/dist/illustrations/NoEntries.js',
47+
() => ({}),
48+
{
49+
virtual: true,
50+
},
51+
);
52+
jest.mock(
53+
'@ui5/webcomponents-fiori/dist/illustrations/UnableToLoad.js',
54+
() => ({}),
55+
{
56+
virtual: true,
57+
},
58+
);
59+
jest.mock(
60+
'@ui5/webcomponents-fiori/dist/illustrations/tnt/UnsuccessfulAuth.js',
61+
() => ({}),
62+
{
63+
virtual: true,
64+
},
65+
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@let configVM = config();
2+
@if (configVM.scene) {
3+
<div class="page">
4+
<div class="container">
5+
<ui5-illustrated-message [name]="configVM.scene">
6+
<ui5-title slot="title" level="H1">{{configVM.illustratedMessageTitle}}</ui5-title>
7+
<div slot="subtitle">
8+
<p>{{configVM.illustratedMessageText}}</p>
9+
</div>
10+
<div>
11+
@for (button of configVM.buttons; track button.url) {
12+
<ui5-button
13+
design="Transparent"
14+
(click)="goTo(button)"
15+
>
16+
{{ button.label }}
17+
</ui5-button>
18+
}
19+
</div>
20+
</ui5-illustrated-message>
21+
</div>
22+
</div>
23+
}

0 commit comments

Comments
 (0)