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
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { EntityContextProvider } from '@openmfp/portal-server-lib';
@Injectable()
export class AccountEntityContextProvider implements EntityContextProvider {
async getContextValues(
token: string,
context?: Record<string, any>
_token: string,
context?: Record<string, any>,
): Promise<Record<string, any>> {
return {
id: context.account,
id: context['core_platform-mesh_io_account'],
policies: [
'create',
'delete',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { RequestContext } from '../openmfp-request-context-provider.js';
import { ContentConfigurationServiceProvidersService } from './content-configuration-service-providers.service.js';
import { welcomeNodeConfig } from './models/welcome-node-config.js';
import { GraphQLClient } from 'graphql-request';

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

it('returns welcome node config when on the base domain', async () => {
context.isSubDomain = false;
const result = await service.getServiceProviders(
'token',
['entity'],
context,
);

expect(result).toEqual(welcomeNodeConfig);
});

it('returns parsed content configurations', async () => {
mockClient.request.mockResolvedValue({
ui_platform_mesh_io: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export class ContentConfigurationServiceProvidersService
'kubernetes-graphql-gateway/root',
'kubernetes-graphql-gateway/virtual-workspace/contentconfigurations/root',
);
if (context?.account) {
url = url.replace('/graphql', `:${context.account}/graphql`);

const platformMeshAccountId = context?.['core_platform-mesh_io_account'];
if (platformMeshAccountId) {
url = url.replace('/graphql', `:${platformMeshAccountId}/graphql`);
}

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