From 104bd43dc130f5e43b53dcc7e6e958a4503c6005 Mon Sep 17 00:00:00 2001 From: Jin Yi Date: Thu, 31 Jul 2025 15:34:03 +0900 Subject: [PATCH] [fix] TypeScript errors in manager/compatibility branch (#4625) --- .../manager/PackVersionSelectorPopover.test.ts | 13 ++++++------- .../content/manager/button/PackEnableToggle.vue | 2 +- .../manager/infoPanel/tabs/WarningTabPanel.vue | 2 +- src/services/dialogService.ts | 8 ++++++-- .../manager/NodeConflictDialogContent.test.ts | 2 +- .../tests/composables/useConflictDetection.test.ts | 5 +---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/dialog/content/manager/PackVersionSelectorPopover.test.ts b/src/components/dialog/content/manager/PackVersionSelectorPopover.test.ts index b65ab2f2c..83b4d320e 100644 --- a/src/components/dialog/content/manager/PackVersionSelectorPopover.test.ts +++ b/src/components/dialog/content/manager/PackVersionSelectorPopover.test.ts @@ -18,8 +18,8 @@ import PackVersionSelectorPopover from './PackVersionSelectorPopover.vue' // Default mock versions for reference const defaultMockVersions = [ - { - version: '1.0.0', + { + version: '1.0.0', createdAt: '2023-01-01', supported_os: ['windows', 'linux'], supported_accelerators: ['CPU'], @@ -36,7 +36,7 @@ const defaultMockVersions = [ const mockNodePack = { id: 'test-pack', name: 'Test Pack', - latest_version: { + latest_version: { version: '1.0.0', supported_os: ['windows', 'linux'], supported_accelerators: ['CPU'], @@ -471,7 +471,7 @@ describe('PackVersionSelectorPopover', () => { // Clear previous calls from component mounting/rendering mockCheckNodeCompatibility.mockClear() - + // Trigger compatibility check by accessing getVersionCompatibility const vm = wrapper.vm as any vm.getVersionCompatibility('1.0.0') @@ -581,7 +581,7 @@ describe('PackVersionSelectorPopover', () => { // Clear for next test call mockCheckNodeCompatibility.mockClear() - + // Test nightly version vm.getVersionCompatibility('nightly') expect(mockCheckNodeCompatibility).toHaveBeenCalledWith({ @@ -595,7 +595,7 @@ describe('PackVersionSelectorPopover', () => { has_registry_data: true, latest_version: { supported_os: ['windows'], - supported_accelerators: ['CPU'], + supported_accelerators: ['CPU'], supported_python_version: '>=3.8', is_banned: false, has_registry_data: true, @@ -606,7 +606,6 @@ describe('PackVersionSelectorPopover', () => { }) }) - it('shows banned package warnings', async () => { // Set up the mock for versions mockGetPackVersions.mockResolvedValueOnce(defaultMockVersions) diff --git a/src/components/dialog/content/manager/button/PackEnableToggle.vue b/src/components/dialog/content/manager/button/PackEnableToggle.vue index 6c57d9fa4..230fb9ae2 100644 --- a/src/components/dialog/content/manager/button/PackEnableToggle.vue +++ b/src/components/dialog/content/manager/button/PackEnableToggle.vue @@ -147,7 +147,7 @@ const onToggle = debounce( const handleToggleInteraction = async (event: Event) => { if (!canToggleDirectly.value) { event.preventDefault() - showConflictModal() + showConflictModal(false) } } diff --git a/src/components/dialog/content/manager/infoPanel/tabs/WarningTabPanel.vue b/src/components/dialog/content/manager/infoPanel/tabs/WarningTabPanel.vue index 2449b5fea..8d4a6e224 100644 --- a/src/components/dialog/content/manager/infoPanel/tabs/WarningTabPanel.vue +++ b/src/components/dialog/content/manager/infoPanel/tabs/WarningTabPanel.vue @@ -35,7 +35,7 @@ import { getConflictMessage } from '@/utils/conflictMessageUtil' const { nodePack, conflictResult } = defineProps<{ nodePack: components['schemas']['Node'] - conflictResult: ConflictDetectionResult | null + conflictResult: ConflictDetectionResult | null | undefined }>() const packageId = computed(() => nodePack?.id || '') diff --git a/src/services/dialogService.ts b/src/services/dialogService.ts index 6510ae7ec..51f44131f 100644 --- a/src/services/dialogService.ts +++ b/src/services/dialogService.ts @@ -28,6 +28,7 @@ import { type ShowDialogOptions, useDialogStore } from '@/stores/dialogStore' +import type { ConflictDetectionResult } from '@/types/conflictDetectionTypes' export type ConfirmationDialogType = | 'default' @@ -434,6 +435,7 @@ export const useDialogService = () => { function showNodeConflictDialog( options: { showAfterWhatsNew?: boolean + conflictedPackages?: ConflictDetectionResult[] dialogComponentProps?: DialogComponentProps buttonText?: string onButtonClick?: () => void @@ -443,7 +445,8 @@ export const useDialogService = () => { dialogComponentProps, buttonText, onButtonClick, - showAfterWhatsNew + showAfterWhatsNew, + conflictedPackages } = options return dialogStore.showDialog({ @@ -467,7 +470,8 @@ export const useDialogService = () => { ...dialogComponentProps }, props: { - showAfterWhatsNew + showAfterWhatsNew, + conflictedPackages }, footerProps: { buttonText, diff --git a/tests-ui/tests/components/dialog/content/manager/NodeConflictDialogContent.test.ts b/tests-ui/tests/components/dialog/content/manager/NodeConflictDialogContent.test.ts index 324f42770..b5226d38f 100644 --- a/tests-ui/tests/components/dialog/content/manager/NodeConflictDialogContent.test.ts +++ b/tests-ui/tests/components/dialog/content/manager/NodeConflictDialogContent.test.ts @@ -9,7 +9,7 @@ import type { ConflictDetectionResult } from '@/types/conflictDetectionTypes' // Mock getConflictMessage utility vi.mock('@/utils/conflictMessageUtil', () => ({ - getConflictMessage: vi.fn((conflict, t) => { + getConflictMessage: vi.fn((conflict) => { return `${conflict.type}: ${conflict.current_value} vs ${conflict.required_value}` }) })) diff --git a/tests-ui/tests/composables/useConflictDetection.test.ts b/tests-ui/tests/composables/useConflictDetection.test.ts index c7b6b81c5..883a32ae3 100644 --- a/tests-ui/tests/composables/useConflictDetection.test.ts +++ b/tests-ui/tests/composables/useConflictDetection.test.ts @@ -907,9 +907,7 @@ describe.skip('useConflictDetection with Registry Store', () => { }) it('should expose conflict modal display method', () => { - const { - shouldShowConflictModalAfterUpdate - } = useConflictDetection() + const { shouldShowConflictModalAfterUpdate } = useConflictDetection() expect(shouldShowConflictModalAfterUpdate).toBeDefined() }) @@ -969,7 +967,6 @@ describe.skip('useConflictDetection with Registry Store', () => { expect(result).toBe(true) // Should show modal when conflicts exist and not dismissed }) - it('should detect system environment correctly', async () => { // Mock system environment mockSystemStatsStore.systemStats = {