Compare commits
2 Commits
pr/jamesge
...
fix/action
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f862b4aaae | ||
|
|
7374a35b41 |
@@ -313,12 +313,10 @@
|
||||
"export": {
|
||||
"as_json": "Export as JSON",
|
||||
"create_secret_gist": "Create secret Gist",
|
||||
"create_secret_gist_tooltip_text": "Export as secret Gist",
|
||||
"failed": "Something went wrong while exporting",
|
||||
"secret_gist_success": "Successfully exported as secret Gist",
|
||||
"gist_created": "Gist created",
|
||||
"require_github": "Login with GitHub to create secret gist",
|
||||
"title": "Export",
|
||||
"success": "Successfully exported"
|
||||
"title": "Export"
|
||||
},
|
||||
"filter": {
|
||||
"all": "All",
|
||||
|
||||
11
packages/hoppscotch-common/src/components.d.ts
vendored
11
packages/hoppscotch-common/src/components.d.ts
vendored
@@ -1,11 +1,11 @@
|
||||
// generated by unplugin-vue-components
|
||||
// We suggest you to commit this file into source control
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
import '@vue/runtime-core'
|
||||
|
||||
export {}
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
AppActionHandler: typeof import('./components/app/ActionHandler.vue')['default']
|
||||
AppBanner: typeof import('./components/app/Banner.vue')['default']
|
||||
@@ -210,5 +210,4 @@ declare module '@vue/runtime-core' {
|
||||
WorkspaceCurrent: typeof import('./components/workspace/Current.vue')['default']
|
||||
WorkspaceSelector: typeof import('./components/workspace/Selector.vue')['default']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<Splitpanes
|
||||
class="smart-splitter"
|
||||
:rtl="SIDEBAR_ON_LEFT && mdAndLarger"
|
||||
:class="{
|
||||
'!flex-row-reverse': SIDEBAR_ON_LEFT && mdAndLarger,
|
||||
'smart-splitter': SIDEBAR && hasSidebar,
|
||||
'no-splitter': !(SIDEBAR && hasSidebar),
|
||||
}"
|
||||
:horizontal="!mdAndLarger"
|
||||
@resize="setPaneEvent($event, 'vertical')"
|
||||
>
|
||||
<Pane
|
||||
:size="PANE_MAIN_SIZE"
|
||||
:size="SIDEBAR && hasSidebar ? PANE_MAIN_SIZE : 100"
|
||||
min-size="65"
|
||||
class="flex flex-col !overflow-auto"
|
||||
>
|
||||
@@ -36,9 +37,8 @@
|
||||
</Splitpanes>
|
||||
</Pane>
|
||||
<Pane
|
||||
v-if="SIDEBAR && hasSidebar"
|
||||
:size="PANE_SIDEBAR_SIZE"
|
||||
min-size="25"
|
||||
:size="SIDEBAR && hasSidebar ? PANE_SIDEBAR_SIZE : 0"
|
||||
:min-size="25"
|
||||
class="flex flex-col !overflow-auto bg-primaryContrast"
|
||||
>
|
||||
<slot name="sidebar" />
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { HoppCollection } from "@hoppscotch/data"
|
||||
import * as E from "fp-ts/Either"
|
||||
import { PropType, computed, ref } from "vue"
|
||||
|
||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||
import { UrlSource } from "~/helpers/import-export/import/import-sources/UrlSource"
|
||||
|
||||
@@ -27,9 +24,11 @@ import {
|
||||
} from "~/helpers/import-export/import/importers"
|
||||
|
||||
import { defineStep } from "~/composables/step-components"
|
||||
import { PropType, computed, ref } from "vue"
|
||||
|
||||
import { useI18n } from "~/composables/i18n"
|
||||
import { useToast } from "~/composables/toast"
|
||||
import { HoppCollection } from "@hoppscotch/data"
|
||||
import { appendRESTCollections, restCollections$ } from "~/newstore/collections"
|
||||
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
|
||||
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
|
||||
@@ -49,7 +48,7 @@ import { getTeamCollectionJSON } from "~/helpers/backend/helpers"
|
||||
import { platform } from "~/platform"
|
||||
|
||||
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
||||
import { collectionsGistExporter } from "~/helpers/import-export/export/gistExport"
|
||||
import { myCollectionsExporter } from "~/helpers/import-export/export/myCollections"
|
||||
import { teamCollectionsExporter } from "~/helpers/import-export/export/teamCollections"
|
||||
|
||||
@@ -84,8 +83,6 @@ const currentUser = useReadonlyStream(
|
||||
platform.auth.getCurrentUser()
|
||||
)
|
||||
|
||||
const myCollections = useReadonlyStream(restCollections$, [])
|
||||
|
||||
const showImportFailedError = () => {
|
||||
toast.error(t("import.failed"))
|
||||
}
|
||||
@@ -471,13 +468,8 @@ const HoppGistCollectionsExporter: ImporterOrExporter = {
|
||||
icon: IconGithub,
|
||||
disabled: !currentUser.value
|
||||
? true
|
||||
: currentUser.value?.provider !== "github.com",
|
||||
title:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
currentUser?.value?.provider === "github.com"
|
||||
? "export.create_secret_gist_tooltip_text"
|
||||
: "export.require_github",
|
||||
: currentUser.value.provider !== "github.com",
|
||||
title: t("export.create_secret_gist"),
|
||||
applicableTo: ["personal-workspace", "team-workspace"],
|
||||
isLoading: isHoppGistCollectionExporterInProgress,
|
||||
},
|
||||
@@ -494,27 +486,13 @@ const HoppGistCollectionsExporter: ImporterOrExporter = {
|
||||
}
|
||||
|
||||
if (E.isRight(collectionJSON)) {
|
||||
if (!JSON.parse(collectionJSON.right).length) {
|
||||
isHoppGistCollectionExporterInProgress.value = false
|
||||
return toast.error(t("error.no_collections_to_export"))
|
||||
}
|
||||
|
||||
const res = await gistExporter(collectionJSON.right, accessToken)
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
toast.error(t("export.failed"))
|
||||
return
|
||||
}
|
||||
|
||||
toast.success(t("export.secret_gist_success"))
|
||||
collectionsGistExporter(collectionJSON.right, accessToken)
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
type: "HOPP_EXPORT_COLLECTION",
|
||||
exporter: "gist",
|
||||
platform: "rest",
|
||||
})
|
||||
|
||||
platform.io.openExternalLink(res.right)
|
||||
}
|
||||
|
||||
isHoppGistCollectionExporterInProgress.value = false
|
||||
@@ -582,6 +560,8 @@ const selectedTeamID = computed(() => {
|
||||
: undefined
|
||||
})
|
||||
|
||||
const myCollections = useReadonlyStream(restCollections$, [])
|
||||
|
||||
const getCollectionJSON = async () => {
|
||||
if (
|
||||
props.collectionsType.type === "team-collections" &&
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { HoppCollection } from "@hoppscotch/data"
|
||||
import * as E from "fp-ts/Either"
|
||||
import { ref } from "vue"
|
||||
|
||||
import { useI18n } from "~/composables/i18n"
|
||||
import { useToast } from "~/composables/toast"
|
||||
import { HoppCollection } from "@hoppscotch/data"
|
||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||
|
||||
import * as E from "fp-ts/Either"
|
||||
|
||||
import IconFolderPlus from "~icons/lucide/folder-plus"
|
||||
import IconUser from "~icons/lucide/user"
|
||||
import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
||||
@@ -31,7 +30,7 @@ import {
|
||||
} from "~/newstore/collections"
|
||||
import { hoppGqlCollectionsImporter } from "~/helpers/import-export/import/hoppGql"
|
||||
import { gqlCollectionsExporter } from "~/helpers/import-export/export/gqlCollections"
|
||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
||||
import { gqlCollectionsGistExporter } from "~/helpers/import-export/export/gqlCollectionsGistExporter"
|
||||
import { computed } from "vue"
|
||||
import { hoppGQLImporter } from "~/helpers/import-export/import/hopp"
|
||||
|
||||
@@ -43,10 +42,6 @@ const currentUser = useReadonlyStream(
|
||||
platform.auth.getCurrentUser()
|
||||
)
|
||||
|
||||
const gqlCollections = useReadonlyStream(graphqlCollections$, [])
|
||||
|
||||
const isGqlCollectionGistExportInProgress = ref(false)
|
||||
|
||||
const GqlCollectionsHoppImporter: ImporterOrExporter = {
|
||||
metadata: {
|
||||
id: "import.from_json",
|
||||
@@ -124,6 +119,8 @@ const GqlCollectionsGistImporter: ImporterOrExporter = {
|
||||
}),
|
||||
}
|
||||
|
||||
const gqlCollections = useReadonlyStream(graphqlCollections$, [])
|
||||
|
||||
const GqlCollectionsHoppExporter: ImporterOrExporter = {
|
||||
metadata: {
|
||||
id: "export.as_json",
|
||||
@@ -162,35 +159,29 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
||||
metadata: {
|
||||
id: "export.as_gist",
|
||||
name: "export.create_secret_gist",
|
||||
title:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
currentUser?.value?.provider === "github.com"
|
||||
? "export.create_secret_gist_tooltip_text"
|
||||
: "export.require_github",
|
||||
title: !currentUser
|
||||
? "export.require_github"
|
||||
: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
currentUser.provider !== "github.com"
|
||||
? `export.require_github`
|
||||
: "export.create_secret_gist",
|
||||
icon: IconUser,
|
||||
disabled: !currentUser.value
|
||||
? true
|
||||
: currentUser.value?.provider !== "github.com",
|
||||
: currentUser.value.provider !== "github.com",
|
||||
applicableTo: ["personal-workspace"],
|
||||
isLoading: isGqlCollectionGistExportInProgress,
|
||||
},
|
||||
action: async () => {
|
||||
if (!gqlCollections.value.length) {
|
||||
return toast.error(t("error.no_collections_to_export"))
|
||||
}
|
||||
|
||||
if (!currentUser.value) {
|
||||
toast.error(t("profile.no_permission"))
|
||||
return
|
||||
}
|
||||
|
||||
isGqlCollectionGistExportInProgress.value = true
|
||||
|
||||
const accessToken = currentUser.value?.accessToken
|
||||
|
||||
if (accessToken) {
|
||||
const res = await gistExporter(
|
||||
const res = await gqlCollectionsGistExporter(
|
||||
JSON.stringify(gqlCollections.value),
|
||||
accessToken
|
||||
)
|
||||
@@ -200,7 +191,7 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
||||
return
|
||||
}
|
||||
|
||||
toast.success(t("export.secret_gist_success"))
|
||||
toast.success(t("export.success"))
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
type: "HOPP_EXPORT_COLLECTION",
|
||||
@@ -210,8 +201,6 @@ const GqlCollectionsGistExporter: ImporterOrExporter = {
|
||||
|
||||
platform.io.openExternalLink(res.right)
|
||||
}
|
||||
|
||||
isGqlCollectionGistExportInProgress.value = false
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -9,17 +9,15 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Environment } from "@hoppscotch/data"
|
||||
import * as E from "fp-ts/Either"
|
||||
import { ref } from "vue"
|
||||
|
||||
import { useI18n } from "~/composables/i18n"
|
||||
import { useToast } from "~/composables/toast"
|
||||
import { Environment } from "@hoppscotch/data"
|
||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
|
||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||
import { hoppEnvImporter } from "~/helpers/import-export/import/hoppEnv"
|
||||
|
||||
import * as E from "fp-ts/Either"
|
||||
import {
|
||||
appendEnvironments,
|
||||
addGlobalEnvVariable,
|
||||
@@ -41,7 +39,7 @@ import { initializeDownloadCollection } from "~/helpers/import-export/export"
|
||||
import { computed } from "vue"
|
||||
import { useReadonlyStream } from "~/composables/stream"
|
||||
import { environmentsExporter } from "~/helpers/import-export/export/environments"
|
||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
||||
import { environmentsGistExporter } from "~/helpers/import-export/export/environmentsGistExport"
|
||||
import { platform } from "~/platform"
|
||||
|
||||
const t = useI18n()
|
||||
@@ -60,8 +58,6 @@ const currentUser = useReadonlyStream(
|
||||
platform.auth.getCurrentUser()
|
||||
)
|
||||
|
||||
const isEnvironmentGistExportInProgress = ref(false)
|
||||
|
||||
const isTeamEnvironment = computed(() => {
|
||||
return props.environmentType === "TEAM_ENV"
|
||||
})
|
||||
@@ -266,44 +262,35 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
|
||||
title:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
currentUser?.value?.provider === "github.com"
|
||||
? "export.create_secret_gist_tooltip_text"
|
||||
currentUser?.provider === "github.com"
|
||||
? "export.create_secret_gist"
|
||||
: "export.require_github",
|
||||
icon: IconUser,
|
||||
disabled: !currentUser.value
|
||||
? true
|
||||
: currentUser.value?.provider !== "github.com",
|
||||
: currentUser.value.provider !== "github.com",
|
||||
applicableTo: ["personal-workspace", "team-workspace"],
|
||||
isLoading: isEnvironmentGistExportInProgress,
|
||||
},
|
||||
action: async () => {
|
||||
if (!environmentJson.value.length) {
|
||||
return toast.error(t("error.no_environments_to_export"))
|
||||
}
|
||||
|
||||
if (!currentUser.value) {
|
||||
toast.error(t("profile.no_permission"))
|
||||
return
|
||||
}
|
||||
|
||||
isEnvironmentGistExportInProgress.value = true
|
||||
|
||||
const accessToken = currentUser.value?.accessToken
|
||||
|
||||
if (accessToken) {
|
||||
const res = await gistExporter(
|
||||
const res = await environmentsGistExporter(
|
||||
JSON.stringify(environmentJson.value),
|
||||
accessToken,
|
||||
"hoppscotch-environment.json"
|
||||
accessToken
|
||||
)
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
toast.error(t("export.failed"))
|
||||
isEnvironmentGistExportInProgress.value = false
|
||||
return
|
||||
}
|
||||
|
||||
toast.success(t("export.secret_gist_success"))
|
||||
toast.success(t("export.success"))
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
type: "HOPP_EXPORT_ENVIRONMENT",
|
||||
@@ -312,8 +299,6 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
|
||||
|
||||
platform.io.openExternalLink(res.right)
|
||||
}
|
||||
|
||||
isEnvironmentGistExportInProgress.value = false
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as E from "fp-ts/Either"
|
||||
import { createGist } from "~/helpers/gist"
|
||||
|
||||
export const environmentsGistExporter = async (
|
||||
environmentsJSON: string,
|
||||
accessToken: string
|
||||
) => {
|
||||
const res = await createGist(
|
||||
environmentsJSON,
|
||||
"hoppscotch-collections.json",
|
||||
accessToken
|
||||
)()
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
return E.left(res.left)
|
||||
}
|
||||
return E.right(res.right.data.html_url as string)
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import * as E from "fp-ts/Either"
|
||||
import { createGist } from "~/helpers/gist"
|
||||
|
||||
export const gistExporter = async (
|
||||
JSONFileContents: string,
|
||||
accessToken: string,
|
||||
fileName = "hoppscotch-collections.json"
|
||||
) => {
|
||||
if (!accessToken) {
|
||||
return E.left("Invalid User")
|
||||
}
|
||||
|
||||
const res = await createGist(JSONFileContents, fileName, accessToken)()
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
return E.left(res.left)
|
||||
}
|
||||
return E.right(res.right.data.html_url as string)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { createGist } from "~/helpers/gist"
|
||||
import * as E from "fp-ts/Either"
|
||||
|
||||
export const collectionsGistExporter = async (
|
||||
collectionJSON: string,
|
||||
accessToken: string
|
||||
) => {
|
||||
if (!accessToken) {
|
||||
return E.left("Invalid User")
|
||||
}
|
||||
|
||||
const res = await createGist(
|
||||
collectionJSON,
|
||||
"hoppscotch-collections.json",
|
||||
accessToken
|
||||
)()
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
return E.left(res.left)
|
||||
}
|
||||
return E.right(true)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as E from "fp-ts/Either"
|
||||
import { createGist } from "~/helpers/gist"
|
||||
|
||||
export const gqlCollectionsGistExporter = async (
|
||||
gqlCollectionsJSON: string,
|
||||
accessToken: string
|
||||
) => {
|
||||
const res = await createGist(
|
||||
gqlCollectionsJSON,
|
||||
"hoppscotch-collections.json",
|
||||
accessToken
|
||||
)()
|
||||
|
||||
if (E.isLeft(res)) {
|
||||
return E.left(res.left)
|
||||
}
|
||||
return E.right(res.right.data.html_url as string)
|
||||
}
|
||||
8
packages/hoppscotch-selfhost-web/postcss.config.cjs
Normal file
8
packages/hoppscotch-selfhost-web/postcss.config.cjs
Normal file
@@ -0,0 +1,8 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
Reference in New Issue
Block a user