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
72 changes: 72 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@angular/localize": "^20.2.1",
"@briebug/jest-schematic": "^6.0.0",
"@openmfp/portal-ui-lib": "^0.177.0",
"@openmfp/config-prettier": "^0.8.1",
"@types/jest": "^30.0.0",
"@types/jmespath": "0.15.2",
"@types/jsonpath": "^0.2.4",
Expand Down
23 changes: 16 additions & 7 deletions projects/lib/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@ module.exports = {
coverageDirectory: path.resolve(__dirname, '../../coverage/lib'),
coverageThreshold: {
global: {
branches: 67,
branches: 90,
functions: 95,
lines: 91,
statements: -16,
lines: 95,
statements: -3,
},
},
moduleNameMapper: {
'^@platform-mesh/portal-ui-lib$': '<rootDir>/projects/lib/public-api.ts',
'^@platform-mesh/portal-ui-lib/services$': '<rootDir>/projects/lib/services/public-api.ts',
'^@platform-mesh/portal-ui-lib/utils$': '<rootDir>/projects/lib/utils/public-api.ts',
'^@platform-mesh/portal-ui-lib/(.*)': '<rootDir>/projects/lib/$1',
'^@platform-mesh/portal-ui-lib$': path.resolve(
__dirname,
'./public-api.ts',
),
'^@platform-mesh/portal-ui-lib/services$': path.resolve(
__dirname,
'./services/public-api.ts',
),
'^@platform-mesh/portal-ui-lib/utils$': path.resolve(
__dirname,
'./utils/public-api.ts',
),
'^@platform-mesh/portal-ui-lib/(.*)': path.resolve(__dirname, './$1'),
},
};

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions projects/lib/organization/ng-package.json

This file was deleted.

9 changes: 0 additions & 9 deletions projects/lib/organization/provide-organization-feature.ts

This file was deleted.

1 change: 0 additions & 1 deletion projects/lib/organization/public-api.ts

This file was deleted.

1 change: 1 addition & 0 deletions projects/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"dependencies": {
"tslib": "^2.3.0"
},
"prettier": "@openmfp/config-prettier",
"peerDependencies": {
"@openmfp/portal-ui-lib": ">=0.177.0",
"@angular/common": "^19.0.0 || ^20.0.0",
Expand Down
1 change: 1 addition & 0 deletions projects/lib/portal-options/models/luigi-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface PortalEntityContext {
export interface PortalNodeContext extends NodeContext {
portalContext: PortalContext;
kcpPath?: string;
translationTable?: any;
namespaceId?: string;
entity?: Resource;
entityId?: string;
Expand Down
12 changes: 6 additions & 6 deletions projects/lib/portal-options/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './services/custom-global-nodes.service'
export * from './services/header-bar-config.service'
export * from './services/luigi-extended-global-context-config.service'
export * from './services/node-change-hook-config.service'
export * from './services/node-context-processing.service'
export * from './services/user-profile-config.service'
export * from './services/custom-global-nodes.service';
export * from './services/header-bar-config.service';
export * from './services/luigi-extended-global-context-config.service';
export * from './services/node-change-hook-config.service';
export * from './services/node-context-processing.service';
export * from './services/user-profile-config.service';
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { TestBed } from '@angular/core/testing';
import {
EnvConfigService
} from '@openmfp/portal-ui-lib';
import { GatewayService } from '@platform-mesh/portal-ui-lib/services/resource';
import { kcpRootOrgsPath } from '../models/constants';
import { PortalLuigiNode } from '../models/luigi-node';
import { CrdGatewayKcpPatchResolver } from './crd-gateway-kcp-patch-resolver.service';
import { TestBed } from '@angular/core/testing';
import { EnvConfigService } from '@openmfp/portal-ui-lib';
import { GatewayService } from '@platform-mesh/portal-ui-lib/services/resource';

describe('CrdGatewayKcpPatchResolver', () => {
let resolver: CrdGatewayKcpPatchResolver;
Expand All @@ -15,7 +13,7 @@ describe('CrdGatewayKcpPatchResolver', () => {
beforeEach(() => {
gatewayServiceMock = { updateCrdGatewayUrlWithEntityPath: jest.fn() };
envConfigServiceMock = {
getEnvConfig: jest.fn().mockResolvedValue({ organization: 'org1' }),
getEnvConfig: jest.fn().mockResolvedValue({ idpName: 'org1' }),
} as any;

TestBed.configureTestingModule({
Expand Down Expand Up @@ -88,40 +86,56 @@ describe('CrdGatewayKcpPatchResolver', () => {

describe('resolveCrdGatewayKcpPathForNextAccountEntity', () => {
it('should return early if kind is not Account', async () => {
const nextNode: PortalLuigiNode = { context: {}, parent: undefined } as any;
const nextNode: PortalLuigiNode = {
context: {},
parent: undefined,
} as any;

await resolver.resolveCrdGatewayKcpPathForNextAccountEntity(
'leafAcc',
'Project',
nextNode,
);

expect(gatewayServiceMock.updateCrdGatewayUrlWithEntityPath).not.toHaveBeenCalled();
expect(
gatewayServiceMock.updateCrdGatewayUrlWithEntityPath,
).not.toHaveBeenCalled();
expect(envConfigServiceMock.getEnvConfig).not.toHaveBeenCalled();
});

it('should return early if entityId is empty', async () => {
const nextNode: PortalLuigiNode = { context: {}, parent: undefined } as any;
const nextNode: PortalLuigiNode = {
context: {},
parent: undefined,
} as any;

await resolver.resolveCrdGatewayKcpPathForNextAccountEntity(
'',
'Account',
nextNode,
);

expect(gatewayServiceMock.updateCrdGatewayUrlWithEntityPath).not.toHaveBeenCalled();
expect(
gatewayServiceMock.updateCrdGatewayUrlWithEntityPath,
).not.toHaveBeenCalled();
expect(envConfigServiceMock.getEnvConfig).not.toHaveBeenCalled();
});

it('should aggregate parent Account entities and append entityId', async () => {
const nextNode: PortalLuigiNode = {
context: {},
parent: {
context: { entity: { metadata: { name: 'acc2' }, __typename: 'Account' } },
context: {
entity: { metadata: { name: 'acc2' }, __typename: 'Account' },
},
parent: {
context: { entity: { metadata: { name: 'team1' }, __typename: 'Team' } },
context: {
entity: { metadata: { name: 'team1' }, __typename: 'Team' },
},
parent: {
context: { entity: { metadata: { name: 'acc1' }, __typename: 'Account' } },
context: {
entity: { metadata: { name: 'acc1' }, __typename: 'Account' },
},
parent: undefined,
},
},
Expand All @@ -144,7 +158,9 @@ describe('CrdGatewayKcpPatchResolver', () => {
const nextNode: PortalLuigiNode = {
context: { kcpPath: 'overridePath' },
parent: {
context: { entity: { metadata: { name: 'accParent' }, __typename: 'Account' } },
context: {
entity: { metadata: { name: 'accParent' }, __typename: 'Account' },
},
parent: undefined,
},
} as any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { kcpRootOrgsPath } from '../models/constants';
import { PortalLuigiNode } from '../models/luigi-node';
import { Injectable, inject } from '@angular/core';
import { EnvConfigService } from '@openmfp/portal-ui-lib';
import { GatewayService } from '@platform-mesh/portal-ui-lib/services';
import { kcpRootOrgsPath } from '../models/constants';
import { PortalLuigiNode } from '../models/luigi-node';

@Injectable({ providedIn: 'root' })
export class CrdGatewayKcpPatchResolver {
Expand All @@ -29,7 +29,7 @@ export class CrdGatewayKcpPatchResolver {
node = node?.parent;
} while (node);

const org = (await this.envConfigService.getEnvConfig())['organization'];
const org = (await this.envConfigService.getEnvConfig()).idpName;
const kcpPath =
nextNode.context?.kcpPath || `${kcpRootOrgsPath}:${org}${entityKcpPath}`;
this.gatewayService.updateCrdGatewayUrlWithEntityPath(kcpPath);
Expand All @@ -46,7 +46,7 @@ export class CrdGatewayKcpPatchResolver {
node = node.parent;
} while (node);

const org = (await this.envConfigService.getEnvConfig())['organization'];
const org = (await this.envConfigService.getEnvConfig()).idpName;
const kcpPath =
nextNode.context?.kcpPath || `${kcpRootOrgsPath}:${org}${entityKcpPath}`;
this.gatewayService.updateCrdGatewayUrlWithEntityPath(kcpPath);
Expand Down
Loading