-
Notifications
You must be signed in to change notification settings - Fork 488
Improve Import Failed Error Messages #7871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/workbench/extensions/manager/components/manager/ImportFailedNodeContent.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <template> | ||
| <div class="flex w-[490px] flex-col border-t-1 border-border-default"> | ||
| <div class="flex h-full w-full flex-col gap-4 p-4"> | ||
| <!-- Error Details --> | ||
| <div v-if="importFailedPackages.length > 0" class="flex flex-col gap-3"> | ||
| <div | ||
| v-for="pkg in importFailedPackages" | ||
| :key="pkg.packageId" | ||
| class="flex flex-col gap-2 max-h-60 overflow-x-hidden overflow-y-auto scrollbar-custom" | ||
| role="region" | ||
| :aria-label="`Error traceback for ${pkg.packageId}`" | ||
| tabindex="0" | ||
| > | ||
| <!-- Error Message --> | ||
| <div | ||
| v-if="pkg.traceback || pkg.errorMessage" | ||
| class="text-xs p-4 rounded-md bg-secondary-background font-mono" | ||
| > | ||
| {{ pkg.traceback || pkg.errorMessage }} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
|
|
||
| import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes' | ||
|
|
||
| const { conflictedPackages } = defineProps<{ | ||
| conflictedPackages: ConflictDetectionResult[] | ||
| }>() | ||
|
|
||
| interface ImportFailedPackage { | ||
| packageId: string | ||
| packageName: string | ||
| errorMessage: string | ||
| traceback: string | ||
| } | ||
|
|
||
| const importFailedPackages = computed((): ImportFailedPackage[] => { | ||
| return conflictedPackages | ||
| .filter((pkg) => | ||
| pkg.conflicts.some((conflict) => conflict.type === 'import_failed') | ||
| ) | ||
| .map((pkg) => { | ||
| const importFailedConflict = pkg.conflicts.find( | ||
| (conflict) => conflict.type === 'import_failed' | ||
| ) | ||
| if (!importFailedConflict) { | ||
| return { | ||
| packageId: pkg.package_id, | ||
| packageName: pkg.package_name, | ||
| errorMessage: 'Unknown import error', | ||
| traceback: '' | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| packageId: pkg.package_id, | ||
| packageName: pkg.package_name, | ||
| errorMessage: | ||
| importFailedConflict.current_value || 'Unknown import error', | ||
| traceback: importFailedConflict.required_value || '' | ||
| } | ||
| }) | ||
| }) | ||
| </script> |
43 changes: 43 additions & 0 deletions
43
src/workbench/extensions/manager/components/manager/ImportFailedNodeFooter.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <template> | ||
| <div class="flex w-full items-center justify-between px-3 pb-4"> | ||
| <div class="flex w-full items-start justify-end gap-2 pr-1"> | ||
| <Button variant="secondary" @click="handleCopyError"> | ||
| {{ $t('importFailed.copyError') }} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
|
|
||
| import Button from '@/components/ui/button/Button.vue' | ||
| import { useCopyToClipboard } from '@/composables/useCopyToClipboard' | ||
| import type { ConflictDetectionResult } from '@/workbench/extensions/manager/types/conflictDetectionTypes' | ||
|
|
||
| const { conflictedPackages = [] } = defineProps<{ | ||
| conflictedPackages?: ConflictDetectionResult[] | ||
| }>() | ||
|
|
||
| const { copyToClipboard } = useCopyToClipboard() | ||
|
|
||
| const formatErrorText = computed(() => { | ||
| const errorParts: string[] = [] | ||
|
|
||
| conflictedPackages.forEach((pkg) => { | ||
| const importFailedConflict = pkg.conflicts.find( | ||
| (conflict) => conflict.type === 'import_failed' | ||
| ) | ||
|
|
||
| if (importFailedConflict?.required_value) { | ||
| errorParts.push(importFailedConflict.required_value) | ||
| } | ||
| }) | ||
|
|
||
| return errorParts.join('\n\n') | ||
| }) | ||
|
|
||
| const handleCopyError = () => { | ||
| copyToClipboard(formatErrorText.value) | ||
| } | ||
| </script> |
12 changes: 12 additions & 0 deletions
12
src/workbench/extensions/manager/components/manager/ImportFailedNodeHeader.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <template> | ||
| <div class="flex w-full items-center justify-between p-4"> | ||
| <div class="flex items-center gap-2"> | ||
| <i class="icon-[lucide--triangle-alert] text-gold-600"></i> | ||
| <p class="m-0 text-sm"> | ||
| {{ $t('importFailed.title') }} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.