Skip to content

Commit 152a260

Browse files
authored
Move wizard common files to wizard folder (#2187)
Part of OPS-4044.
1 parent 9f554c8 commit 152a260

24 files changed

Lines changed: 84 additions & 77 deletions

packages/server/api/src/app/benchmark/attach-benchmark-flows.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import {
22
BenchmarkProviders,
3+
WizardState,
34
openOpsId,
5+
throwValidationError,
46
type BenchmarkWebhookPayload,
57
type BenchmarkWorkflowBase,
6-
type WizardState,
78
} from '@openops/shared';
89
import { webhookUtils } from 'server-worker';
910
import { transaction } from '../core/db/transaction';
1011
import { benchmarkFlowRepo } from './benchmark-flow.repo';
1112
import type { BenchmarkRow } from './benchmark.entity';
1213
import { benchmarkRepo } from './benchmark.repo';
13-
import { throwValidationError } from './errors';
1414

1515
export type AttachFlowsToBenchmarkRequest = {
1616
wizardState: WizardState;

packages/server/api/src/app/benchmark/benchmark-feature-guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AppSystemProp, logger, system } from '@openops/server-shared';
2+
import { throwFeatureDisabledError } from '@openops/shared';
23
import { preHandlerAsyncHookHandler } from 'fastify';
3-
import { throwFeatureDisabledError } from './errors';
44

55
export const assertBenchmarkFeatureEnabled: preHandlerAsyncHookHandler = async (
66
request,

packages/server/api/src/app/benchmark/benchmark.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import {
1515
} from '@openops/shared';
1616
import { StatusCodes } from 'http-status-codes';
1717
import { getProjectScopedRoutePolicy } from '../core/security/route-policies/route-security-policy-factory';
18+
import { resolveWizardNavigation } from '../wizard/wizard.service';
1819
import { assertBenchmarkFeatureEnabled } from './benchmark-feature-guard';
1920
import { getBenchmarkStatus, listBenchmarks } from './benchmark-status.service';
2021
import { createBenchmark } from './create-benchmark.service';
2122
import { getProvider } from './providers/providers-registry';
22-
import { resolveWizardNavigation } from './wizard.service';
2323

2424
export const benchmarkController: FastifyPluginAsyncTypebox = async (app) => {
2525
app.addHook('preHandler', assertBenchmarkFeatureEnabled);

packages/server/api/src/app/benchmark/catalog-resolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { throwValidationError } from '@openops/shared';
12
import fs from 'node:fs';
23
import path from 'node:path';
34
import {
45
type LifecycleWorkflow,
56
PROVIDER_LIFECYCLE_WORKFLOWS,
67
} from './catalog-manifests';
7-
import { throwValidationError } from './errors';
88

99
const WORKFLOWS_CATALOG_DIR = 'workflows-catalog';
1010

packages/server/api/src/app/benchmark/create-benchmark.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
ContentType,
77
ErrorCode,
88
Folder,
9+
throwValidationError,
910
type WizardState,
1011
} from '@openops/shared';
1112
import { IsNull } from 'typeorm';
@@ -25,7 +26,6 @@ import {
2526
type CategorizedWorkflowPaths,
2627
resolveWorkflowPathsForSeed,
2728
} from './catalog-resolver';
28-
import { throwValidationError } from './errors';
2929

3030
function validateWizardState(wizardState: WizardState): void {
3131
const connection = wizardState.connection ?? [];

packages/server/api/src/app/benchmark/errors.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/server/api/src/app/benchmark/providers/aws/index.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/server/api/src/app/benchmark/providers/azure/index.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/server/api/src/app/benchmark/providers/providers-registry.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import { BenchmarkProviders, ProviderAdapter } from '@openops/shared';
2-
import { throwValidationError } from '../errors';
3-
import { awsProviderAdapter } from './aws';
4-
import { azureProviderAdapter } from './azure';
1+
import {
2+
BenchmarkProviders,
3+
ProviderAdapter,
4+
throwValidationError,
5+
WizardConfig,
6+
} from '@openops/shared';
7+
import { awsProviderAdapter } from '../../wizard/aws-provider-adapter';
8+
import { azureProviderAdapter } from '../../wizard/azure-provider-adapter';
9+
import awsConfig from './aws/aws.json';
10+
import azureConfig from './azure/azure.json';
511

612
const providers = new Map<string, ProviderAdapter>();
713

@@ -16,8 +22,15 @@ export function getProvider(provider: string): ProviderAdapter {
1622
}
1723

1824
function registerProviders(): void {
19-
providers.set(BenchmarkProviders.AWS, awsProviderAdapter);
20-
providers.set(BenchmarkProviders.AZURE, azureProviderAdapter);
25+
providers.set(
26+
BenchmarkProviders.AWS,
27+
awsProviderAdapter(awsConfig as WizardConfig),
28+
);
29+
30+
providers.set(
31+
BenchmarkProviders.AZURE,
32+
azureProviderAdapter(azureConfig as WizardConfig),
33+
);
2134
}
2235

2336
registerProviders();

packages/server/api/src/app/openops-analytics/benchmark/benchmark-dashboard-service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { BenchmarkProviders } from '@openops/shared';
2-
import { throwValidationError } from '../../benchmark/errors';
1+
import { BenchmarkProviders, throwValidationError } from '@openops/shared';
32
import { createAwsBenchmarkDashboard } from './create-aws-benchmark-dashboard';
43
import { createAzureBenchmarkDashboard } from './create-azure-benchmark-dashboard';
54

0 commit comments

Comments
 (0)