From d52bded58462e8dfa29c7071b69f5b47bd075c8d Mon Sep 17 00:00:00 2001 From: Toufik mouhmouh Date: Tue, 10 Mar 2026 11:28:32 +0100 Subject: [PATCH] feat(pci-ai-tools): update DATATR-UX lib to be compatible with toolkit ovh ref: #DATATR-3055 Signed-off-by: Toufik mouhmouh --- .../manager/apps/pci-ai-tools/.eslintrc.cjs | 33 --------------- .../apps/pci-ai-tools/eslint.config.mjs | 8 ++++ .../manager/apps/pci-ai-tools/package.json | 8 ++-- .../src/__tests__/helpers/mocks/app/app.ts | 11 +++-- .../__tests__/helpers/mocks/app/appHelper.ts | 15 +++++++ .../helpers/mocks/capabilities/flavor.ts | 2 + .../helpers/mocks/catalog/catalog.ts | 4 +- .../src/__tests__/helpers/mocks/project.ts | 5 +-- .../helpers/mocks/shared/currentUsage.ts | 12 +++++- .../src/__tests__/helpers/mocks/sshkey.ts | 2 +- .../configuration/SshKeyForm.component.tsx | 2 +- .../src/data/api/ai/app/app.spec.tsx | 32 +++------------ .../scaling-strategy.spec.tsx | 4 +- .../src/data/api/project/project.api.ts | 2 +- .../src/data/api/sshkey/sshkey.api.ts | 2 +- .../src/data/api/usage/usage.api.ts | 2 +- .../src/data/hooks/ai/app/useAddApp.spec.tsx | 9 +++-- .../data/hooks/ai/app/useGetCommand.spec.tsx | 4 +- .../data/hooks/sshkey/useAddSshKey.hook.tsx | 2 +- .../data/hooks/sshkey/useGetSshkey.hook.tsx | 2 +- .../src/data/hooks/usage/useGetUsage.hook.tsx | 2 +- .../manager/apps/pci-ai-tools/src/main.tsx | 2 +- .../src/pages/_components/AddSSHKey.modal.tsx | 2 +- .../_components/DashboardTabs.component.tsx | 2 +- .../home/_components/Billing.components.tsx | 2 +- .../src/pages/dashboard/users/Users.page.tsx | 2 +- .../_components/JobStatusBadge.component.tsx | 11 ++--- .../_components/OrderFunnel.component.tsx | 2 +- .../[notebookId]/dashboard/Dashboard.page.tsx | 7 ++-- .../NotebookStatusBadge.component.tsx | 12 +++--- .../_components/OrderFunnel.component.tsx | 2 +- .../_components/OrderFunnel.component.tsx | 2 +- .../manager/apps/pci-ai-tools/src/types/AI.ts | 2 +- .../apps/pci-ai-tools/src/types/Catalog.ts | 2 +- .../apps/pci-ai-tools/src/types/Quantum.ts | 2 +- .../apps/pci-ai-tools/src/types/User.ts | 4 +- .../apps/pci-ai-tools/tsconfig.build.json | 3 +- .../manager/apps/pci-ai-tools/tsconfig.json | 40 ++++++++++--------- 38 files changed, 127 insertions(+), 135 deletions(-) delete mode 100644 packages/manager/apps/pci-ai-tools/.eslintrc.cjs create mode 100644 packages/manager/apps/pci-ai-tools/eslint.config.mjs diff --git a/packages/manager/apps/pci-ai-tools/.eslintrc.cjs b/packages/manager/apps/pci-ai-tools/.eslintrc.cjs deleted file mode 100644 index 4f2e3c4ba0d2..000000000000 --- a/packages/manager/apps/pci-ai-tools/.eslintrc.cjs +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - extends: [ - '../../../../.eslintrc.js', - 'plugin:react/recommended', - 'plugin:react/jsx-runtime', - ], - parser: require.resolve('@typescript-eslint/parser'), - parserOptions: { - project: ['./tsconfig.json', './tsconfig.build.json'], - tsconfigRootDir: __dirname, - }, - settings: { - react: { - version: 'detect', - }, - }, - globals: { - __VERSION__: true, - }, - overrides: [ - { - files: ['*.config.*js', '*.config.ts'], - parserOptions: { project: null }, - }, - ], - rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-explicit-any': 'off', - 'react/jsx-key': 'off', - }, -}; - - diff --git a/packages/manager/apps/pci-ai-tools/eslint.config.mjs b/packages/manager/apps/pci-ai-tools/eslint.config.mjs new file mode 100644 index 000000000000..1aa9902e146e --- /dev/null +++ b/packages/manager/apps/pci-ai-tools/eslint.config.mjs @@ -0,0 +1,8 @@ +import { typescriptEslintConfig } from '@ovh-ux/manager-static-analysis-kit/eslint/typescript'; + +export default [ + { + ...typescriptEslintConfig, + rules: {}, + }, +]; diff --git a/packages/manager/apps/pci-ai-tools/package.json b/packages/manager/apps/pci-ai-tools/package.json index 65b469ee06e9..e028fa4089e7 100644 --- a/packages/manager/apps/pci-ai-tools/package.json +++ b/packages/manager/apps/pci-ai-tools/package.json @@ -13,16 +13,17 @@ "type": "module", "scripts": { "build": "tsc --project tsconfig.build.json && vite build", + "build:strict": "tsc --project tsconfig.json && vite build", "coverage": "vitest run --coverage", - "lint": "manager-legacy-lint --kinds tsx,js,css,html,md --continue", - "lint:fix": "manager-legacy-lint --kinds tsx,js,css,html,md --fix --continue", + "lint": "manager-lint --config eslint.config.mjs ./src", + "lint:fix": "manager-lint --fix --config eslint.config.mjs ./src", "start": "vite", "test": "vitest run --pool=threads", "test-ui": "vitest --ui --coverage.enabled=true --pool=threads" }, "dependencies": { "@datatr-ux/ods-tailwind-config": "^1.0.3", - "@datatr-ux/ovhcloud-types": "^1.0.83", + "@datatr-ux/ovhcloud-types": "^2.0.79", "@datatr-ux/uxlib": "^0.0.11-beta-8", "@hookform/resolvers": "5.0.1", "@ovh-ux/manager-config": "^8.9.0", @@ -52,6 +53,7 @@ }, "devDependencies": { "@jest/globals": "29.7.0", + "@ovh-ux/manager-static-analysis-kit": "^0.15.0", "@ovh-ux/manager-static-analysis-legacy-kit": "^0.1.0", "@ovh-ux/manager-tests-setup": "^0.6.2", "@ovh-ux/manager-vite-config": "^0.15.6", diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/app.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/app.ts index 6971b556bd72..eae35096ebcf 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/app.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/app.ts @@ -1,6 +1,11 @@ import ai from '@/types/AI'; import { mockedDataSync } from '../volume/datasync'; -import { mockedAutoScaling, mockedFixedScaling } from './appHelper'; +import { + mockedAutoScaling, + mockedAutoScalingInput, + mockedFixedScaling, + mockedFixedScalingInput, +} from './appHelper'; import { mockedCPUResources, mockedGPUResources } from '../shared/resource'; import { mockedGitVolume, @@ -81,7 +86,7 @@ export const mockedAppSpecInput: ai.app.AppSpecInput = { }, command: ['command', 'docker'], volumes: [mockedS3Volume, mockedGitVolume], - scalingStrategy: mockedAutoScaling, + scalingStrategy: mockedAutoScalingInput, probe: { path: '/health', port: 8080, @@ -104,5 +109,5 @@ export const mockedAppSpecInputGPU: ai.app.AppSpecInput = { partnerId: 'lettria', resources: { flavor: 'ai1-1-gpu', gpu: 2 }, volumes: [mockedPublicGitVolume], - scalingStrategy: mockedFixedScaling, + scalingStrategy: mockedFixedScalingInput, }; diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/appHelper.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/appHelper.ts index 3e4a4cc5621c..8a7f4e0d5a61 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/appHelper.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/app/appHelper.ts @@ -21,6 +21,12 @@ export const mockedFixedScaling: ai.app.ScalingStrategy = { }, }; +export const mockedFixedScalingInput: ai.app.ScalingStrategyInput = { + fixed: { + replicas: 2, + }, +}; + export const mockedAutoScaling: ai.app.ScalingStrategy = { automatic: { replicasMin: 2, @@ -29,3 +35,12 @@ export const mockedAutoScaling: ai.app.ScalingStrategy = { resourceType: ai.app.ScalingAutomaticStrategyResourceTypeEnum.CPU, }, }; + +export const mockedAutoScalingInput: ai.app.ScalingStrategyInput = { + automatic: { + replicasMin: 2, + replicasMax: 100, + averageUsageTarget: 75, + resourceType: ai.app.ScalingAutomaticStrategyResourceTypeEnum.CPU, + }, +}; diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/capabilities/flavor.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/capabilities/flavor.ts index 5ee99ef66333..b84d8ad2b4f5 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/capabilities/flavor.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/capabilities/flavor.ts @@ -9,6 +9,7 @@ export const mockedCapabilitiesFlavorCPU: ai.capabilities.Flavor = { max: 4, resourcesPerUnit: { cpu: 1, + gpu: 0, ephemeralStorage: 15, memory: 5, privateNetwork: 5, @@ -29,6 +30,7 @@ export const mockedCapabilitiesFlavorGPU: ai.capabilities.Flavor = { max: 2, resourcesPerUnit: { cpu: 11, + gpu: 1, ephemeralStorage: 15, memory: 5, privateNetwork: 5, diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/catalog/catalog.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/catalog/catalog.ts index 175dd71134fb..64ca7c17475e 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/catalog/catalog.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/catalog/catalog.ts @@ -1,5 +1,5 @@ -import * as order from '@datatr-ux/ovhcloud-types/order/index'; -import * as nichandle from '@datatr-ux/ovhcloud-types/nichandle/index'; +import * as order from '@datatr-ux/ovhcloud-types/order'; +import * as nichandle from '@datatr-ux/ovhcloud-types/nichandle'; import catalog from '@/types/Catalog'; export const mockedPricing: catalog.Pricing = { diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/project.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/project.ts index baff26a52b53..e3995ed624af 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/project.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/project.ts @@ -1,6 +1,5 @@ -import { AccessTypeEnum } from '@datatr-ux/ovhcloud-types/cloud/AccessTypeEnum'; -import { Project } from '@datatr-ux/ovhcloud-types/cloud/Project'; -import { ProjectStatusEnum } from '@datatr-ux/ovhcloud-types/cloud/project/ProjectStatusEnum'; +import { AccessTypeEnum, Project } from '@datatr-ux/ovhcloud-types/cloud'; +import { ProjectStatusEnum } from '@datatr-ux/ovhcloud-types/cloud/project'; export const mockedPciProject: Project = { access: AccessTypeEnum.full, diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/shared/currentUsage.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/shared/currentUsage.ts index f3d1447eb826..6c2f5617cfc4 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/shared/currentUsage.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/shared/currentUsage.ts @@ -1,11 +1,14 @@ -import * as billingView from '@datatr-ux/ovhcloud-types/cloud/billingView/index'; -import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage/index'; +import * as billingView from '@datatr-ux/ovhcloud-types/cloud/billingView'; +import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage'; +import * as order from '@datatr-ux/ovhcloud-types/order'; const mockedRegionalizedResource: billingView.RegionalizedResource = { components: [ { + id: 'component-id-1', name: 'regResourceName', quantity: { unit: billingView.UnitQuantityEnum.Minute, value: 5 }, + resourceId: 'resource-id-1', totalPrice: 10, }, ], @@ -40,4 +43,9 @@ export const mockedCurrentUsage: usage.UsageCurrent = { type: 'ai-app', }, ], + totalPrice: { + currencyCode: order.CurrencyCodeEnum.EUR, + text: '100 EUR', + value: 100, + }, }; diff --git a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/sshkey.ts b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/sshkey.ts index ae3ff2771ab4..15e3f3af6bac 100644 --- a/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/sshkey.ts +++ b/packages/manager/apps/pci-ai-tools/src/__tests__/helpers/mocks/sshkey.ts @@ -1,4 +1,4 @@ -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { OrderSshKey } from '@/types/orderFunnel'; export const mockedSshKey: sshkey.SshKey = { diff --git a/packages/manager/apps/pci-ai-tools/src/components/order/configuration/SshKeyForm.component.tsx b/packages/manager/apps/pci-ai-tools/src/components/order/configuration/SshKeyForm.component.tsx index 4aabee704d9a..6c3fb4b470ee 100644 --- a/packages/manager/apps/pci-ai-tools/src/components/order/configuration/SshKeyForm.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/components/order/configuration/SshKeyForm.component.tsx @@ -3,7 +3,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import { useForm, SubmitHandler } from 'react-hook-form'; import { Plus, Trash2 } from 'lucide-react'; -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { useTranslation } from 'react-i18next'; import { Button, diff --git a/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/app.spec.tsx b/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/app.spec.tsx index 402c950d5372..9a5056401cf2 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/app.spec.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/app.spec.tsx @@ -11,7 +11,7 @@ import { updateApp, } from './app.api'; import { - mockedAppSpec, + mockedAppSpecInput, mockedAppUpdate, } from '@/__tests__/helpers/mocks/app/app'; @@ -52,22 +52,11 @@ describe('app functions', () => { expect(apiClient.v6.post).not.toHaveBeenCalled(); await addApp({ projectId: 'projectId', - appInfo: mockedAppSpec, + appInfo: mockedAppSpecInput, }); expect(apiClient.v6.post).toHaveBeenCalledWith( '/cloud/project/projectId/ai/app', - { - image: mockedAppSpec.image, - name: mockedAppSpec.name, - grpcPort: mockedAppSpec.grpcPort, - command: mockedAppSpec.command, - defaultHttpPort: mockedAppSpec.defaultHttpPort, - deploymentStrategy: mockedAppSpec.deploymentStrategy, - region: mockedAppSpec.region, - resources: mockedAppSpec.resources, - scalingStrategy: mockedAppSpec.scalingStrategy, - unsecureHttp: false, - }, + mockedAppSpecInput, ); }); @@ -129,22 +118,11 @@ describe('app functions', () => { expect(apiClient.v6.post).not.toHaveBeenCalled(); await getCommand({ projectId: 'projectId', - appInfo: mockedAppSpec, + appInfo: mockedAppSpecInput, }); expect(apiClient.v6.post).toHaveBeenCalledWith( '/cloud/project/projectId/ai/app/command', - { - image: mockedAppSpec.image, - name: mockedAppSpec.name, - grpcPort: mockedAppSpec.grpcPort, - command: mockedAppSpec.command, - defaultHttpPort: mockedAppSpec.defaultHttpPort, - deploymentStrategy: mockedAppSpec.deploymentStrategy, - region: mockedAppSpec.region, - resources: mockedAppSpec.resources, - scalingStrategy: mockedAppSpec.scalingStrategy, - unsecureHttp: false, - }, + mockedAppSpecInput, ); }); }); diff --git a/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/scaling-strategy/scaling-strategy.spec.tsx b/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/scaling-strategy/scaling-strategy.spec.tsx index 6f47ed23cd21..346a04b55c1a 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/scaling-strategy/scaling-strategy.spec.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/api/ai/app/scaling-strategy/scaling-strategy.spec.tsx @@ -1,7 +1,7 @@ import { apiClient } from '@ovh-ux/manager-core-api'; import { describe, expect, vi } from 'vitest'; import { scalingStrategy } from './scaling-strategy.api'; -import { mockedFixedScaling } from '@/__tests__/helpers/mocks/app/appHelper'; +import { mockedFixedScalingInput } from '@/__tests__/helpers/mocks/app/appHelper'; describe('scaling stategy functions', () => { afterEach(() => { @@ -13,7 +13,7 @@ describe('scaling stategy functions', () => { await scalingStrategy({ projectId: 'projectId', appId: 'appId', - scalingStrat: mockedFixedScaling, + scalingStrat: mockedFixedScalingInput, }); expect(apiClient.v6.put).toHaveBeenCalledWith( '/cloud/project/projectId/ai/app/appId/scalingstrategy', diff --git a/packages/manager/apps/pci-ai-tools/src/data/api/project/project.api.ts b/packages/manager/apps/pci-ai-tools/src/data/api/project/project.api.ts index 469b550dc528..9d6028a68e82 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/api/project/project.api.ts +++ b/packages/manager/apps/pci-ai-tools/src/data/api/project/project.api.ts @@ -1,5 +1,5 @@ import { apiClient } from '@ovh-ux/manager-core-api'; -import { Project } from '@datatr-ux/ovhcloud-types/cloud/Project'; +import { Project } from '@datatr-ux/ovhcloud-types/cloud'; export const getProject = async (projectId: string): Promise => { const response = await apiClient.v6.get(`/cloud/project/${projectId}`); diff --git a/packages/manager/apps/pci-ai-tools/src/data/api/sshkey/sshkey.api.ts b/packages/manager/apps/pci-ai-tools/src/data/api/sshkey/sshkey.api.ts index fec39640f867..c2db7e6fa610 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/api/sshkey/sshkey.api.ts +++ b/packages/manager/apps/pci-ai-tools/src/data/api/sshkey/sshkey.api.ts @@ -1,5 +1,5 @@ import { apiClient } from '@ovh-ux/manager-core-api'; -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud'; import { PCIAi } from '..'; export const getSshkey = async ({ projectId }: PCIAi) => diff --git a/packages/manager/apps/pci-ai-tools/src/data/api/usage/usage.api.ts b/packages/manager/apps/pci-ai-tools/src/data/api/usage/usage.api.ts index 568b4d0d5d68..afed6707503c 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/api/usage/usage.api.ts +++ b/packages/manager/apps/pci-ai-tools/src/data/api/usage/usage.api.ts @@ -1,4 +1,4 @@ -import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage/index'; +import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage'; import { apiClient } from '@ovh-ux/manager-core-api'; import { PCIAi } from '..'; diff --git a/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useAddApp.spec.tsx b/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useAddApp.spec.tsx index 71d610d75f25..0325a76ecc26 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useAddApp.spec.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useAddApp.spec.tsx @@ -2,7 +2,10 @@ import { renderHook, waitFor } from '@testing-library/react'; import { vi } from 'vitest'; import { QueryClientWrapper } from '@/__tests__/helpers/wrappers/QueryClientWrapper'; import * as appApi from '@/data/api/ai/app/app.api'; -import { mockedApp, mockedAppSpec } from '@/__tests__/helpers/mocks/app/app'; +import { + mockedApp, + mockedAppSpecInput, +} from '@/__tests__/helpers/mocks/app/app'; import { useAddApp } from './useAddApp.hook'; vi.mock('@/data/api/ai/app/app.api', () => ({ @@ -20,12 +23,12 @@ describe('useAddApp', () => { wrapper: QueryClientWrapper, }); - result.current.addApp(mockedAppSpec); + result.current.addApp(mockedAppSpecInput); await waitFor(() => { expect(appApi.addApp).toHaveBeenCalledWith({ projectId: undefined, - appInfo: mockedAppSpec, + appInfo: mockedAppSpecInput, }); expect(onSuccess).toHaveBeenCalledWith(mockedApp); }); diff --git a/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useGetCommand.spec.tsx b/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useGetCommand.spec.tsx index 254f8af0f9a8..64fc2f6c85d8 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useGetCommand.spec.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/hooks/ai/app/useGetCommand.spec.tsx @@ -4,7 +4,7 @@ import { QueryClientWrapper } from '@/__tests__/helpers/wrappers/QueryClientWrap import * as appApi from '@/data/api/ai/app/app.api'; import { useGetCommand } from './useGetCommand.hook'; import { mockedCommand } from '@/__tests__/helpers/mocks/shared/command'; -import { mockedAppSpec } from '@/__tests__/helpers/mocks/app/app'; +import { mockedAppSpecInput } from '@/__tests__/helpers/mocks/app/app'; import { AddApp } from '@/data/api/ai/app/app.api'; vi.mock('@/data/api/ai/app/app.api', () => ({ @@ -25,7 +25,7 @@ describe('useGetCommand', () => { const addAppProps: AddApp = { projectId, - appInfo: mockedAppSpec, + appInfo: mockedAppSpecInput, }; result.current.getCommand(addAppProps); diff --git a/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useAddSshKey.hook.tsx b/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useAddSshKey.hook.tsx index 3122c1bfab3a..1cd16964244e 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useAddSshKey.hook.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useAddSshKey.hook.tsx @@ -1,5 +1,5 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { useParams } from 'react-router-dom'; import { AIError } from '@/data/api'; import { AddSSHKey, addSSHKey } from '@/data/api/sshkey/sshkey.api'; diff --git a/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useGetSshkey.hook.tsx b/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useGetSshkey.hook.tsx index 68bf52c02c2b..01b59b70a14a 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useGetSshkey.hook.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/hooks/sshkey/useGetSshkey.hook.tsx @@ -1,5 +1,5 @@ import { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'; -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { getSshkey } from '@/data/api/sshkey/sshkey.api'; import { useQueryImmediateRefetch } from '@/hooks/useImmediateRefetch'; diff --git a/packages/manager/apps/pci-ai-tools/src/data/hooks/usage/useGetUsage.hook.tsx b/packages/manager/apps/pci-ai-tools/src/data/hooks/usage/useGetUsage.hook.tsx index 51c004da0877..a01dd9441709 100644 --- a/packages/manager/apps/pci-ai-tools/src/data/hooks/usage/useGetUsage.hook.tsx +++ b/packages/manager/apps/pci-ai-tools/src/data/hooks/usage/useGetUsage.hook.tsx @@ -1,5 +1,5 @@ import { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'; -import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage/index'; +import * as usage from '@datatr-ux/ovhcloud-types/cloud/usage'; import { getCurrentUsage } from '@/data/api/usage/usage.api'; import { useQueryImmediateRefetch } from '@/hooks/useImmediateRefetch'; diff --git a/packages/manager/apps/pci-ai-tools/src/main.tsx b/packages/manager/apps/pci-ai-tools/src/main.tsx index e18983d4e684..4bea1c87cc54 100644 --- a/packages/manager/apps/pci-ai-tools/src/main.tsx +++ b/packages/manager/apps/pci-ai-tools/src/main.tsx @@ -9,7 +9,7 @@ import initI18n from './i18n'; import './index.css'; import App from './App'; -import '@/vite-hmr.ts'; +import '@/vite-hmr'; import { LoadingIndicatorProvider } from './contexts/LoadingIndicator.context'; const init = async ( diff --git a/packages/manager/apps/pci-ai-tools/src/pages/_components/AddSSHKey.modal.tsx b/packages/manager/apps/pci-ai-tools/src/pages/_components/AddSSHKey.modal.tsx index 55d62a051703..21e285aef09c 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/_components/AddSSHKey.modal.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/_components/AddSSHKey.modal.tsx @@ -20,7 +20,7 @@ import { Input, useToast, } from '@datatr-ux/uxlib'; -import * as sshkey from '@datatr-ux/ovhcloud-types/cloud/index'; +import * as sshkey from '@datatr-ux/ovhcloud-types/cloud'; import { getAIApiErrorMessage } from '@/lib/apiHelper'; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/_components/DashboardTabs.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/_components/DashboardTabs.component.tsx index ea62dbed9dc9..f60b90b3e6de 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/_components/DashboardTabs.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/_components/DashboardTabs.component.tsx @@ -1,6 +1,6 @@ import { useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import * as role from '@datatr-ux/ovhcloud-types/cloud/role/index'; +import * as role from '@datatr-ux/ovhcloud-types/cloud/role'; import ai from '@/types/AI'; import user from '@/types/User'; import { useGetTokens } from '@/data/hooks/ai/token/useGetTokens.hook'; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/home/_components/Billing.components.tsx b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/home/_components/Billing.components.tsx index 55e3a78c1a7a..a6bfc2f8c313 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/home/_components/Billing.components.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/home/_components/Billing.components.tsx @@ -2,7 +2,7 @@ import { ArrowRight } from 'lucide-react'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; -import * as billingView from '@datatr-ux/ovhcloud-types/cloud/billingView/index'; +import * as billingView from '@datatr-ux/ovhcloud-types/cloud/billingView'; import OvhLink from '@/components/links/OvhLink.component'; import FormattedDate from '@/components/formatted-date/FormattedDate.component'; import { useGetCurrentUsage } from '@/data/hooks/usage/useGetUsage.hook'; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/users/Users.page.tsx b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/users/Users.page.tsx index 5e3e278179db..f083ae9fb8b9 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/dashboard/users/Users.page.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/dashboard/users/Users.page.tsx @@ -1,7 +1,7 @@ import { Plus } from 'lucide-react'; import { Outlet, useNavigate, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import * as role from '@datatr-ux/ovhcloud-types/cloud/role/index'; +import * as role from '@datatr-ux/ovhcloud-types/cloud/role'; import { Button } from '@datatr-ux/uxlib'; import user from '@/types/User'; import ai from '@/types/AI'; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/jobs/_components/JobStatusBadge.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/jobs/_components/JobStatusBadge.component.tsx index 5b4ef21569ab..996532ba78e3 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/jobs/_components/JobStatusBadge.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/jobs/_components/JobStatusBadge.component.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import { Badge, BadgeProps, badgeVariants } from '@datatr-ux/uxlib'; +import { Badge, BadgeProps } from '@datatr-ux/uxlib'; import ai from '@/types/AI'; const JobStatusBadge = ({ status }: { status: ai.job.JobStateEnum }) => { @@ -11,24 +11,25 @@ const JobStatusBadge = ({ status }: { status: ai.job.JobStateEnum }) => { case 'INTERRUPTING': case 'QUEUED': case 'INTERRUPTED': - variant = badgeVariants({ variant: 'warning' }); + variant = 'warning'; break; case 'FAILED': case 'ERROR': case 'TIMEOUT': case 'SYNC_FAILED': - variant = badgeVariants({ variant: 'destructive' }); + variant = 'destructive'; break; case 'PENDING': case 'RESTARTING': case 'RUNNING': case 'DONE': - variant = badgeVariants({ variant: 'success' }); + variant = 'success'; break; default: + variant = 'primary'; break; } - return {t(`status-${status}`)}; + return {t(`status-${status}`)}; }; export default JobStatusBadge; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/jobs/create/_components/OrderFunnel.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/jobs/create/_components/OrderFunnel.component.tsx index f4bede3021c9..b23e136334a5 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/jobs/create/_components/OrderFunnel.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/jobs/create/_components/OrderFunnel.component.tsx @@ -30,7 +30,7 @@ import { Separator, useToast, } from '@datatr-ux/uxlib'; -import * as sshKey from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import * as sshKey from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import RegionsSelect from '@/components/order/region/RegionSelect.component'; import FlavorsSelect from '@/components/order/flavor/FlavorSelect.component'; import OrderPrice from '@/components/order/price/OrderPrice.component'; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/[notebookId]/dashboard/Dashboard.page.tsx b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/[notebookId]/dashboard/Dashboard.page.tsx index 6c63a5225e6f..8a6d7322349f 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/[notebookId]/dashboard/Dashboard.page.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/[notebookId]/dashboard/Dashboard.page.tsx @@ -24,7 +24,6 @@ import { TooltipContent, TooltipProvider, TooltipTrigger, - badgeVariants, bash, githubDark, useToast, @@ -59,8 +58,8 @@ const Dashboard = () => { const { toast } = useToast(); const [command, setCommand] = useState(); const variant: BadgeProps['variant'] = notebook.spec.timeoutAutoRestart - ? badgeVariants({ variant: 'success' }) - : badgeVariants({ variant: 'destructive' }); + ? 'success' + : 'destructive'; const { getCommand } = useGetCommand({ onError: (err) => { @@ -139,7 +138,7 @@ const Dashboard = () => {
{t('autoRestartLabel')}
- + {notebook.spec.timeoutAutoRestart ? t('autoRestartEnabled') : t('autoRestartDisabled')} diff --git a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/_components/NotebookStatusBadge.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/_components/NotebookStatusBadge.component.tsx index 214e9106a602..40e7cf8388ac 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/_components/NotebookStatusBadge.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/_components/NotebookStatusBadge.component.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import { Badge, BadgeProps, badgeVariants } from '@datatr-ux/uxlib'; +import { Badge, BadgeProps } from '@datatr-ux/uxlib'; import ai from '@/types/AI'; const NotebookStatusBadge = ({ @@ -14,22 +14,22 @@ const NotebookStatusBadge = ({ case 'RESTARTING': case 'STARTING': case 'STOPPING': - variant = badgeVariants({ variant: 'warning' }); + variant = 'warning'; break; case 'FAILED': case 'ERROR': case 'STOPPED': case 'SYNC_FAILED': - variant = badgeVariants({ variant: 'destructive' }); + variant = 'destructive'; break; case 'RUNNING': - variant = badgeVariants({ variant: 'success' }); + variant = 'success'; break; default: - variant = badgeVariants({ variant: 'primary' }); + variant = 'primary'; break; } - return {t(`status-${status}`)}; + return {t(`status-${status}`)}; }; export default NotebookStatusBadge; diff --git a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/create/_components/OrderFunnel.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/create/_components/OrderFunnel.component.tsx index bd7bb9253530..274cbec153ca 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/notebooks/create/_components/OrderFunnel.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/notebooks/create/_components/OrderFunnel.component.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import { SshKey } from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import { SshKey } from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { AlertCircle, Check, diff --git a/packages/manager/apps/pci-ai-tools/src/pages/qpus/create/_components/OrderFunnel.component.tsx b/packages/manager/apps/pci-ai-tools/src/pages/qpus/create/_components/OrderFunnel.component.tsx index 1e8bc3132a6d..64ab86f292cf 100644 --- a/packages/manager/apps/pci-ai-tools/src/pages/qpus/create/_components/OrderFunnel.component.tsx +++ b/packages/manager/apps/pci-ai-tools/src/pages/qpus/create/_components/OrderFunnel.component.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import { SshKey } from '@datatr-ux/ovhcloud-types/cloud/sshkey/index'; +import { SshKey } from '@datatr-ux/ovhcloud-types/cloud/sshkey'; import { AlertCircle, Check, diff --git a/packages/manager/apps/pci-ai-tools/src/types/AI.ts b/packages/manager/apps/pci-ai-tools/src/types/AI.ts index 60a134565148..07a536865b16 100644 --- a/packages/manager/apps/pci-ai-tools/src/types/AI.ts +++ b/packages/manager/apps/pci-ai-tools/src/types/AI.ts @@ -1,3 +1,3 @@ -import * as ai from '@datatr-ux/ovhcloud-types/cloud/project/ai/index'; +import * as ai from '@datatr-ux/ovhcloud-types/cloud/project/ai'; export default ai; diff --git a/packages/manager/apps/pci-ai-tools/src/types/Catalog.ts b/packages/manager/apps/pci-ai-tools/src/types/Catalog.ts index e6027565eb5d..eec5c9956de3 100644 --- a/packages/manager/apps/pci-ai-tools/src/types/Catalog.ts +++ b/packages/manager/apps/pci-ai-tools/src/types/Catalog.ts @@ -1,3 +1,3 @@ -import * as publicCatalog from '@datatr-ux/ovhcloud-types/order/catalog/public/index'; +import * as publicCatalog from '@datatr-ux/ovhcloud-types/order/catalog/public'; export default publicCatalog; diff --git a/packages/manager/apps/pci-ai-tools/src/types/Quantum.ts b/packages/manager/apps/pci-ai-tools/src/types/Quantum.ts index 8c3e7fa77b45..24105eea4bd7 100644 --- a/packages/manager/apps/pci-ai-tools/src/types/Quantum.ts +++ b/packages/manager/apps/pci-ai-tools/src/types/Quantum.ts @@ -1,3 +1,3 @@ -import * as quantum from '@datatr-ux/ovhcloud-types/cloud/project/quantum/index'; +import * as quantum from '@datatr-ux/ovhcloud-types/cloud/project/quantum'; export default quantum; diff --git a/packages/manager/apps/pci-ai-tools/src/types/User.ts b/packages/manager/apps/pci-ai-tools/src/types/User.ts index 4d37c4f59288..b571f97b54f8 100644 --- a/packages/manager/apps/pci-ai-tools/src/types/User.ts +++ b/packages/manager/apps/pci-ai-tools/src/types/User.ts @@ -1,3 +1,3 @@ -import * as user from '@datatr-ux/ovhcloud-types/cloud/user/index'; +import * as cloud from '@datatr-ux/ovhcloud-types/cloud'; -export default user; +export default cloud.user; diff --git a/packages/manager/apps/pci-ai-tools/tsconfig.build.json b/packages/manager/apps/pci-ai-tools/tsconfig.build.json index 4dc23fb9c4c5..df291a60da99 100644 --- a/packages/manager/apps/pci-ai-tools/tsconfig.build.json +++ b/packages/manager/apps/pci-ai-tools/tsconfig.build.json @@ -1,4 +1,5 @@ { "extends": "./tsconfig.json", - "exclude": ["src/__tests__"] + "include": ["src", "src/**/*.json", "public/**/*.json"], + "exclude": ["src/**/*.spec.ts", "src/**/*.spec.tsx"] } diff --git a/packages/manager/apps/pci-ai-tools/tsconfig.json b/packages/manager/apps/pci-ai-tools/tsconfig.json index e44fbbeb3579..78cb99db342d 100644 --- a/packages/manager/apps/pci-ai-tools/tsconfig.json +++ b/packages/manager/apps/pci-ai-tools/tsconfig.json @@ -1,27 +1,31 @@ { + "extends": "@ovh-ux/manager-static-analysis-kit/tsconfig/react", "compilerOptions": { - "lib": ["dom", "es2020", "ESNext"], - "noEmit": true, - "target": "ESNext", - "types": ["vite/client", "node", "jest", "@testing-library/jest-dom"], - "module": "esnext", - "moduleResolution": "Node", - "removeComments": true, + "types": [ + "vite/client", + "node", + "vitest/globals", + "@testing-library/jest-dom" + ], "outDir": "dist", - "esModuleInterop": true, - "isolatedModules": true, - "allowSyntheticDefaultImports": true, - "skipLibCheck": true, "noImplicitAny": true, - "declaration": true, "resolveJsonModule": true, "allowJs": true, - "jsx": "react-jsx", - "baseUrl": ".", "paths": { - "@/*": ["./src/*"] - } + "@/*": [ + "./src/*" + ] + }, + "baseUrl": "." }, - "include": ["src"], - "exclude": ["node_modules", "dist", "types"] + "include": [ + "src", + "src/**/*.json", + "public/**/*.json" + ], + "exclude": [ + "node_modules", + "dist", + "types" + ] }