Skip to content
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

feat: import summaries #4489

Merged
merged 9 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: port to all importers
  • Loading branch information
amk-dev committed Nov 24, 2024
commit d1a06178dd1d94b28e26429aaa8d85da3726f75c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ const HoppPostmanImporter: ImporterOrExporter = {
disabled: false,
applicableTo: ["personal-workspace", "team-workspace", "url-import"],
},
importSummary: currentImportSummary,
component: FileSource({
caption: "import.from_file",
acceptedFileTypes: ".json",
Expand Down Expand Up @@ -410,6 +411,7 @@ const HoppInsomniaImporter: ImporterOrExporter = {
disabled: false,
applicableTo: ["personal-workspace", "team-workspace", "url-import"],
},
importSummary: currentImportSummary,
component: FileSource({
caption: "import.from_file",
acceptedFileTypes: ".json",
Expand Down Expand Up @@ -451,6 +453,7 @@ const HoppGistImporter: ImporterOrExporter = {
disabled: false,
applicableTo: ["personal-workspace", "team-workspace", "url-import"],
},
importSummary: currentImportSummary,
component: GistSource({
caption: "import.from_url",
description: "import.from_gist_import_summary",
Expand Down Expand Up @@ -497,6 +500,7 @@ const HoppMyCollectionsExporter: ImporterOrExporter = {
applicableTo: ["personal-workspace"],
isLoading: isHoppMyCollectionExporterInProgress,
},
importSummary: currentImportSummary,
action: async () => {
if (!myCollections.value.length) {
return toast.error(t("error.no_collections_to_export"))
Expand Down Expand Up @@ -535,6 +539,7 @@ const HoppTeamCollectionsExporter: ImporterOrExporter = {
applicableTo: ["team-workspace"],
isLoading: isHoppTeamCollectionExporterInProgress,
},
importSummary: currentImportSummary,
action: async () => {
isHoppTeamCollectionExporterInProgress.value = true
if (
Expand Down Expand Up @@ -632,6 +637,7 @@ const HARImporter: ImporterOrExporter = {
disabled: false,
applicableTo: ["personal-workspace", "team-workspace"],
},
importSummary: currentImportSummary,
component: FileSource({
caption: "import.from_file",
acceptedFileTypes: ".har",
Expand Down
15 changes: 3 additions & 12 deletions packages/hoppscotch-common/src/components/importExport/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,6 @@ watch(
{ deep: true }
)

watch(selectedImporterID, (id) => {
if (!id) return

const importer = props.importerModules.find((i) => i.metadata.id === id)

if (!importer) return

// if (importer.importSummary?.showImportSummary) {
// goToStep(`import_summary_${importer.metadata.id}`)
// }
})

props.importerModules.forEach((importer) => {
if (importer.component) {
addStep(importer.component)
Expand All @@ -212,6 +200,9 @@ props.importerModules.forEach((importer) => {
component: ImportSummary,
props: () => ({
collections: importSummary.value.importedCollections,
"on-close": () => {
emit("hide-modal")
},
}),
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ const t = useI18n()

const props = defineProps<{
collections: HoppCollection[]
}>()

const emit = defineEmits<{
(e: "onClose"): void
onClose: () => void
}>()

type CountBlock = {
Expand Down Expand Up @@ -117,7 +114,11 @@ watch(
:label="t('action.close')"
outline
filled
@click="() => emit('onClose')"
@click="
() => {
onClose()
}
"
/>
</div>
</template>