Skip to content

Commit

Permalink
chore: updated types
Browse files Browse the repository at this point in the history
  • Loading branch information
liyasthomas committed Dec 17, 2021
1 parent f174086 commit d305168
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 90 deletions.
7 changes: 6 additions & 1 deletion packages/hoppscotch-app/components/app/PowerSearchEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ import { useI18n } from "~/helpers/utils/composables"
const t = useI18n()
defineProps<{
shortcut: Object
shortcut: {
label: string
keys: string[]
action: string
icon: string
}
active: Boolean
}>()
</script>
Expand Down
5 changes: 4 additions & 1 deletion packages/hoppscotch-app/components/app/ShortcutsEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { useI18n } from "~/helpers/utils/composables"
const t = useI18n()
defineProps<{
shortcut: Object
shortcut: {
label: string
keys: string[]
}
}>()
</script>
3 changes: 0 additions & 3 deletions packages/hoppscotch-app/components/app/Sidenav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
class="nav-link"
tabindex="0"
>
<i v-if="navigation.icon" class="material-icons">
{{ navigation.icon }}
</i>
<div v-if="navigation.svg">
<SmartIcon :name="navigation.svg" class="svg-icons" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,8 @@ export default defineComponent({
},
dropEvent({ dataTransfer }: any) {
this.dragging = !this.dragging
const folderPath = dataTransfer.getData("folderPath")
const requestIndex = dataTransfer.getData("requestIndex")
moveGraphqlRequest(folderPath, requestIndex, `${this.collectionIndex}`)
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
:src="`/images/states/${$colorMode.value}/pack.svg`"
loading="lazy"
class="flex-col object-contain object-center h-16 mb-4 w-16 inline-flex"
:alt="$t('empty.folder')"
:alt="`${$t('empty.folder')}`"
/>
<span class="text-center">
{{ $t("empty.folder") }}
Expand Down Expand Up @@ -226,7 +226,6 @@ export default defineComponent({
this.dragging = !this.dragging
const folderPath = dataTransfer.getData("folderPath")
const requestIndex = dataTransfer.getData("requestIndex")
moveGraphqlRequest(folderPath, requestIndex, this.folderPath)
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
icon="assignment_returned"
:label="$t('import.from_gist')"
@click.native="
readCollectionGist
$refs.options.tippy().hide()
() => {
readCollectionGist()
$refs.options.tippy().hide()
}
"
/>
<span
Expand All @@ -44,8 +46,10 @@
icon="assignment_turned_in"
:label="$t('export.create_secret_gist')"
@click.native="
createCollectionGist()
$refs.options.tippy().hide()
() => {
createCollectionGist()
$refs.options.tippy().hide()
}
"
/>
</span>
Expand Down
46 changes: 26 additions & 20 deletions packages/hoppscotch-app/components/collections/my/Request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,38 +71,44 @@
svg="edit"
:label="$t('action.edit')"
@click.native="
$emit('edit-request', {
collectionIndex,
folderIndex,
folderName,
request,
requestIndex,
folderPath,
})
$refs.options.tippy().hide()
() => {
$emit('edit-request', {
collectionIndex,
folderIndex,
folderName,
request,
requestIndex,
folderPath,
})
$refs.options.tippy().hide()
}
"
/>
<SmartItem
svg="copy"
:label="$t('action.duplicate')"
@click.native="
$emit('duplicate-request', {
collectionIndex,
folderIndex,
folderName,
request,
requestIndex,
folderPath,
})
$refs.options.tippy().hide()
() => {
$emit('duplicate-request', {
collectionIndex,
folderIndex,
folderName,
request,
requestIndex,
folderPath,
})
$refs.options.tippy().hide()
}
"
/>
<SmartItem
svg="trash-2"
:label="$t('action.delete')"
@click.native="
confirmRemove = true
$refs.options.tippy().hide()
() => {
confirmRemove = true
$refs.options.tippy().hide()
}
"
/>
</tippy>
Expand Down
12 changes: 8 additions & 4 deletions packages/hoppscotch-app/components/environments/ImportExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
icon="assignment_returned"
:label="$t('import.from_gist')"
@click.native="
readEnvironmentGist
$refs.options.tippy().hide()
() => {
readEnvironmentGist()
$refs.options.tippy().hide()
}
"
/>
<span
Expand All @@ -44,8 +46,10 @@
icon="assignment_turned_in"
:label="$t('export.create_secret_gist')"
@click.native="
createEnvironmentGist
$refs.options.tippy().hide()
() => {
createEnvironmentGist()
$refs.options.tippy().hide()
}
"
/>
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-app/components/environments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
:src="`/images/states/${$colorMode.value}/blockchain.svg`"
loading="lazy"
class="flex-col object-contain object-center h-16 my-4 w-16 inline-flex"
:alt="$t('empty.environments')"
:alt="`${$t('empty.environments')}`"
/>
<span class="text-center pb-4">
{{ $t("empty.environments") }}
Expand Down
102 changes: 55 additions & 47 deletions packages/hoppscotch-app/components/http/Authorization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,15 @@
<div
class="bg-primary h-full top-upperTertiaryStickyFold min-w-46 max-w-1/3 p-4 z-9 sticky overflow-auto"
>
<div class="p-2">
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
</div>
</div>
<div v-if="authType === 'bearer'" class="border-b border-dividerLight flex">
Expand All @@ -182,17 +180,15 @@
<div
class="bg-primary h-full top-upperTertiaryStickyFold min-w-46 max-w-1/3 p-4 z-9 sticky overflow-auto"
>
<div class="p-2">
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
</div>
</div>
<div
Expand All @@ -212,17 +208,15 @@
<div
class="bg-primary h-full top-upperTertiaryStickyFold min-w-46 max-w-1/3 p-4 z-9 sticky overflow-auto"
>
<div class="p-2">
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
</div>
</div>
<div
Expand Down Expand Up @@ -258,19 +252,29 @@
<template #trigger>
<span class="select-wrapper">
<ButtonSecondary
:label="addTo || 'Header'"
:label="addTo || $t('state.none')"
class="rounded-none ml-2 pr-8"
/>
</span>
</template>
<SmartItem
:label="'Header'"
:icon="
addTo === 'Headers'
? 'radio_button_checked'
: 'radio_button_unchecked'
"
:label="'Headers'"
@click.native="
addTo = 'Header'
addTo = 'Headers'
$refs.addToOptions.tippy().hide()
"
/>
<SmartItem
:icon="
addTo === 'Query params'
? 'radio_button_checked'
: 'radio_button_unchecked'
"
:label="'Query params'"
@click.native="
addTo = 'Query params'
Expand All @@ -283,17 +287,15 @@
<div
class="bg-primary h-full top-upperTertiaryStickyFold min-w-46 max-w-1/3 p-4 z-9 sticky overflow-auto"
>
<div class="p-2">
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
<div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }}
</div>
<SmartAnchor
class="link"
:label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/features/authorization"
blank
/>
</div>
</div>
</div>
Expand All @@ -305,7 +307,7 @@ import {
HoppRESTAuthBasic,
HoppRESTAuthBearer,
HoppRESTAuthOAuth2,
HoppRESTAuthApiKey,
HoppRESTAuthAPIKey,
} from "@hoppscotch/data"
import { pluckRef, useStream } from "~/helpers/utils/composables"
import { restAuth$, setRESTAuth } from "~/newstore/RESTSession"
Expand All @@ -331,9 +333,15 @@ export default defineComponent({
const basicPassword = pluckRef(auth as Ref<HoppRESTAuthBasic>, "password")
const bearerToken = pluckRef(auth as Ref<HoppRESTAuthBearer>, "token")
const oauth2Token = pluckRef(auth as Ref<HoppRESTAuthOAuth2>, "token")
const apiKey = pluckRef(auth as Ref<HoppRESTAuthApiKey>, "key")
const apiValue = pluckRef(auth as Ref<HoppRESTAuthApiKey>, "value")
const addTo = pluckRef(auth as Ref<HoppRESTAuthApiKey>, "addTo")
const apiKey = pluckRef(auth as Ref<HoppRESTAuthAPIKey>, "key")
const apiValue = pluckRef(auth as Ref<HoppRESTAuthAPIKey>, "value")
const addTo = pluckRef(auth as Ref<HoppRESTAuthAPIKey>, "addTo")
if (typeof addTo.value === "undefined") {
addTo.value = "Headers"
apiKey.value = ""
apiValue.value = ""
}
const URLExcludes = useSetting("URL_EXCLUDES")
const clearContent = () => {
auth.value = {
Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-app/components/http/Body.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
:src="`/images/states/${$colorMode.value}/upload_single_file.svg`"
loading="lazy"
class="flex-col object-contain object-center h-16 my-4 w-16 inline-flex"
:alt="$t('empty.body')"
:alt="`${$t('empty.body')}`"
/>
<span class="text-center pb-4">
{{ $t("empty.body") }}
Expand Down
6 changes: 5 additions & 1 deletion packages/hoppscotch-app/components/http/TestResultReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@

<script setup lang="ts">
import { computed, PropType } from "@nuxtjs/composition-api"
import { HoppTestResult } from "~/helpers/types/HoppTestResult"
import {
HoppTestExpectResult,
HoppTestResult,
} from "~/helpers/types/HoppTestResult"
const props = defineProps({
testResults: {
type: Object as PropType<HoppTestResult>,
required: true,
expectResults: [] as HoppTestExpectResult[],
},
})
Expand Down
1 change: 1 addition & 0 deletions packages/hoppscotch-app/helpers/types/HoppTestResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export type HoppTestData = {
export type HoppTestResult = {
tests: HoppTestData[]
expectResults: HoppTestExpectResult[]
description: string
}
3 changes: 1 addition & 2 deletions packages/hoppscotch-app/helpers/utils/EffectiveURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ export function getEffectiveRESTRequest(
})
} else if (request.auth.authType === "api-key") {
const { key, value, addTo } = request.auth

if (addTo === "Header") {
if (addTo === "Headers") {
effectiveFinalHeaders.push({
active: true,
key: parseTemplateString(key, envVariables),
Expand Down
Loading

0 comments on commit d305168

Please sign in to comment.