Skip to content

Commit 4c36092

Browse files
bug: fix entity name (#24)
--------- Co-authored-by: Grzegorz Krajniak <[email protected]>
1 parent 6dc43db commit 4c36092

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/portal-options/account-entity-context-provider.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { EntityContextProvider } from '@openmfp/portal-server-lib';
44
@Injectable()
55
export class AccountEntityContextProvider implements EntityContextProvider {
66
async getContextValues(
7-
token: string,
8-
context?: Record<string, any>
7+
_token: string,
8+
context?: Record<string, any>,
99
): Promise<Record<string, any>> {
1010
return {
11-
id: context.account,
11+
id: context['core_platform-mesh_io_account'],
1212
policies: [
1313
'create',
1414
'delete',

src/portal-options/service-providers/content-configuration-service-providers.service.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { RequestContext } from '../openmfp-request-context-provider.js';
22
import { ContentConfigurationServiceProvidersService } from './content-configuration-service-providers.service.js';
3+
import { welcomeNodeConfig } from './models/welcome-node-config.js';
34
import { GraphQLClient } from 'graphql-request';
45

56
jest.mock('graphql-request', () => {
@@ -44,6 +45,17 @@ describe('ContentConfigurationServiceProvidersService', () => {
4445
).rejects.toThrow('Context with organization is required');
4546
});
4647

48+
it('returns welcome node config when on the base domain', async () => {
49+
context.isSubDomain = false;
50+
const result = await service.getServiceProviders(
51+
'token',
52+
['entity'],
53+
context,
54+
);
55+
56+
expect(result).toEqual(welcomeNodeConfig);
57+
});
58+
4759
it('returns parsed content configurations', async () => {
4860
mockClient.request.mockResolvedValue({
4961
ui_platform_mesh_io: {

src/portal-options/service-providers/content-configuration-service-providers.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ export class ContentConfigurationServiceProvidersService
3434
'kubernetes-graphql-gateway/root',
3535
'kubernetes-graphql-gateway/virtual-workspace/contentconfigurations/root',
3636
);
37-
if (context?.account) {
38-
url = url.replace('/graphql', `:${context.account}/graphql`);
37+
38+
const platformMeshAccountId = context?.['core_platform-mesh_io_account'];
39+
if (platformMeshAccountId) {
40+
url = url.replace('/graphql', `:${platformMeshAccountId}/graphql`);
3941
}
4042

4143
console.log(`Calculated crd gateway api url: ${url}`);

0 commit comments

Comments
 (0)