perf: template literals

This commit is contained in:
liyasthomas
2021-09-18 16:09:58 +05:30
parent 4236d1179c
commit e1e763575d
64 changed files with 425 additions and 333 deletions

View File

@@ -37,8 +37,10 @@
:info-icon="contentType === null ? 'done' : ''"
:active-info-icon="contentType === null"
@click.native="
contentType = null
$refs.contentTypeOptions.tippy().hide()
() => {
contentType = null
$refs.contentTypeOptions.tippy().hide()
}
"
/>
<SmartItem
@@ -48,8 +50,10 @@
:info-icon="contentTypeItem === contentType ? 'done' : ''"
:active-info-icon="contentTypeItem === contentType"
@click.native="
contentType = contentTypeItem
$refs.contentTypeOptions.tippy().hide()
() => {
contentType = contentTypeItem
$refs.contentTypeOptions.tippy().hide()
}
"
/>
</tippy>
@@ -66,7 +70,7 @@
</span>
<ButtonSecondary
outline
:label="$t('app.documentation')"
:label="`${$t('app.documentation')}`"
to="https://docs.hoppscotch.io"
blank
svg="external-link"

View File

@@ -46,7 +46,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="param.key"
:placeholder="$t('count.parameter', { count: index + 1 })"
:placeholder="`${$t('count.parameter', { count: index + 1 })}`"
styles="
bg-transparent
flex
@@ -66,7 +66,7 @@
<input
v-else
class="bg-transparent flex flex-1 py-2 px-4"
:placeholder="$t('count.parameter', { count: index + 1 })"
:placeholder="`${$t('count.parameter', { count: index + 1 })}`"
:name="'param' + index"
:value="param.key"
autofocus
@@ -94,7 +94,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="param.value"
:placeholder="$t('count.value', { count: index + 1 })"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
styles="
bg-transparent
flex
@@ -114,7 +114,7 @@
<input
v-else
class="bg-transparent flex flex-1 py-2 px-4"
:placeholder="$t('count.value', { count: index + 1 })"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
:name="'value' + index"
:value="param.value"
@change="
@@ -190,7 +190,7 @@
{{ $t("empty.body") }}
</span>
<ButtonSecondary
:label="$t('add.new')"
:label="`${$t('add.new')}`"
filled
svg="plus"
@click.native="addBodyParam"

View File

@@ -1,7 +1,7 @@
<template>
<SmartModal
v-if="show"
:title="t('request.generate_code')"
:title="`${t('request.generate_code')}`"
@close="hideModal"
>
<template #body>
@@ -48,12 +48,12 @@
<template #footer>
<span class="flex">
<ButtonPrimary
:label="t('action.copy').toString()"
:label="`${t('action.copy')}`"
:svg="copyIcon"
@click.native="copyRequestCode"
/>
<ButtonSecondary
:label="t('action.dismiss').toString()"
:label="`${t('action.dismiss')}`"
@click.native="hideModal"
/>
</span>
@@ -126,7 +126,7 @@ const hideModal = () => emit("hide-modal")
const copyRequestCode = () => {
copyToClipboard(requestCode.value)
copyIcon.value = "check"
$toast.success(t("state.copied_to_clipboard").toString(), {
$toast.success(`${t("state.copied_to_clipboard")}`, {
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000)

View File

@@ -55,7 +55,7 @@
class="divide-x divide-dividerLight border-b border-dividerLight flex"
>
<SmartAutoComplete
:placeholder="$t('count.header', { count: index + 1 })"
:placeholder="`${$t('count.header', { count: index + 1 })}`"
:source="commonHeaders"
:spellcheck="false"
:value="header.key"
@@ -80,7 +80,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="header.value"
:placeholder="$t('count.value', { count: index + 1 })"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
styles="
bg-transparent
flex
@@ -99,7 +99,7 @@
<input
v-else
class="bg-transparent flex flex-1 py-2 px-4"
:placeholder="$t('count.value', { count: index + 1 })"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
:name="'value' + index"
:value="header.value"
@change="
@@ -164,7 +164,7 @@
</span>
<ButtonSecondary
filled
:label="$t('add.new')"
:label="`${$t('add.new')}`"
svg="plus"
@click.native="addHeader"
/>
@@ -202,7 +202,7 @@ const bulkEditor = ref<any | null>(null)
useCodemirror(bulkEditor, bulkHeaders, {
extendedEditorConfig: {
mode: "text/x-yaml",
placeholder: t("state.bulk_mode_placeholder").toString(),
placeholder: `${t("state.bulk_mode_placeholder")}`,
},
linter: null,
completer: null,
@@ -217,7 +217,7 @@ watch(bulkHeaders, () => {
}))
setRESTHeaders(transformation)
} catch (e) {
$toast.error(t("error.something_went_wrong").toString(), {
$toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline",
})
console.error(e)

View File

@@ -1,9 +1,5 @@
<template>
<SmartModal
v-if="show"
:title="$t('import.curl').toString()"
@close="hideModal"
>
<SmartModal v-if="show" :title="`${$t('import.curl')}`" @close="hideModal">
<template #body>
<div class="flex flex-col px-2">
<div ref="curlEditor" class="border border-dividerLight rounded"></div>
@@ -12,11 +8,11 @@
<template #footer>
<span class="flex">
<ButtonPrimary
:label="$t('import.title').toString()"
:label="`${$t('import.title')}`"
@click.native="handleImport"
/>
<ButtonSecondary
:label="$t('action.cancel').toString()"
:label="`${$t('action.cancel')}`"
@click.native="hideModal"
/>
</span>
@@ -49,7 +45,7 @@ const curlEditor = ref<any | null>(null)
useCodemirror(curlEditor, curl, {
extendedEditorConfig: {
mode: "application/x-sh",
placeholder: t("request.enter_curl").toString(),
placeholder: `${t("request.enter_curl")}`,
},
linter: null,
completer: null,
@@ -128,7 +124,7 @@ const handleImport = () => {
)
} catch (e) {
console.error(e)
$toast.error(t("error.curl_invalid_format").toString(), {
$toast.error(`${t("error.curl_invalid_format")}`, {
icon: "error_outline",
})
}

View File

@@ -48,7 +48,7 @@
<div class="p-2">
<ButtonSecondary
filled
:label="$t('authorization.generate_token')"
:label="`${$t('authorization.generate_token')}`"
@click.native="handleAccessTokenRequest()"
/>
</div>
@@ -97,7 +97,7 @@ export default {
oidcDiscoveryURL.value === "" &&
(authURL.value === "" || accessTokenURL.value === "")
) {
$toast.error($t("complete_config_urls").toString(), {
$toast.error(`${$t("complete_config_urls")}`, {
icon: "error",
})
return
@@ -113,7 +113,7 @@ export default {
}
await tokenRequest(tokenReqParams)
} catch (e) {
$toast.error(e, {
$toast.error(`${e}`, {
icon: "code",
})
}

View File

@@ -57,7 +57,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="param.key"
:placeholder="$t('count.parameter', { count: index + 1 })"
:placeholder="`${$t('count.parameter', { count: index + 1 })}`"
styles="
bg-transparent
flex
@@ -76,7 +76,9 @@
<input
v-else
class="bg-transparent flex flex-1 py-2 px-4"
:placeholder="$t('count.parameter', { count: index + 1 }).toString()"
:placeholder="`${$t('count.parameter', {
count: index + 1,
})}`"
:name="'param' + index"
:value="param.key"
autofocus
@@ -91,7 +93,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="param.value"
:placeholder="$t('count.value', { count: index + 1 })"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
styles="
bg-transparent
flex
@@ -110,7 +112,7 @@
<input
v-else
class="bg-transparent flex flex-1 py-2 px-4"
:placeholder="$t('count.value', { count: index + 1 }).toString()"
:placeholder="`${$t('count.value', { count: index + 1 })}`"
:name="'value' + index"
:value="param.value"
@change="
@@ -172,7 +174,7 @@
{{ $t("empty.parameters") }}
</span>
<ButtonSecondary
:label="$t('add.new')"
:label="`${$t('add.new')}`"
svg="plus"
filled
@click.native="addParam"
@@ -216,7 +218,7 @@ watch(bulkParams, () => {
}))
setRESTParams(transformation)
} catch (e) {
$toast.error(t("error.something_went_wrong").toString(), {
$toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline",
})
console.error(e)
@@ -228,7 +230,7 @@ const bulkEditor = ref<any | null>(null)
useCodemirror(bulkEditor, bulkParams, {
extendedEditorConfig: {
mode: "text/x-yaml",
placeholder: t("state.bulk_mode_placeholder").toString(),
placeholder: `${t("state.bulk_mode_placeholder")}`,
},
linter: null,
completer: null,

View File

@@ -1,5 +1,5 @@
<template>
<AppSection id="script" :label="$t('preRequest.script')">
<AppSection id="script" :label="`${$t('preRequest.script')}`">
<div
class="
bg-primary
@@ -60,7 +60,7 @@
{{ $t("helpers.pre_request_script") }}
</div>
<SmartAnchor
:label="$t('preRequest.learn')"
:label="`${$t('preRequest.learn')}`"
to="https://docs.hoppscotch.io/features/pre-request-script"
blank
/>
@@ -107,7 +107,7 @@ useCodemirror(
extendedEditorConfig: {
mode: "application/javascript",
lineWrapping: linewrapEnabled,
placeholder: t("preRequest.javascript_code").toString(),
placeholder: `${t("preRequest.javascript_code")}`,
},
linter,
completer,

View File

@@ -35,7 +35,7 @@
v-tippy="{ theme: 'tooltip' }"
:title="$t('action.clear')"
svg="trash-2"
@click.native="clearContent('rawParams', $event)"
@click.native="clearContent"
/>
<ButtonSecondary
v-if="contentType && contentType.endsWith('json')"
@@ -104,7 +104,7 @@ useCodemirror(
extendedEditorConfig: {
lineWrapping: linewrapEnabled,
mode: rawInputEditorLang,
placeholder: t("request.raw_body").toString(),
placeholder: t("request.raw_body"),
},
linter: null,
completer: null,
@@ -123,11 +123,11 @@ const uploadPayload = (e: InputEvent) => {
rawParamsBody.value = target?.result
}
reader.readAsText(file)
$toast.success(t("state.file_imported").toString(), {
$toast.success(`${t("state.file_imported")}`, {
icon: "attach_file",
})
} else {
$toast.error(t("action.choose_file").toString(), {
$toast.error(`${t("action.choose_file")}`, {
icon: "attach_file",
})
}

View File

@@ -43,7 +43,7 @@
"
:value="newMethod"
:readonly="!isCustomMethod"
:placeholder="$t('request.method')"
:placeholder="`${$t('request.method')}`"
@input="onSelectMethod($event.target.value)"
/>
</span>
@@ -61,7 +61,7 @@
<SmartEnvInput
v-if="EXPERIMENTAL_URL_BAR_ENABLED"
v-model="newEndpoint"
:placeholder="$t('request.url')"
:placeholder="`${$t('request.url')}`"
styles="
bg-primaryLight
border border-divider
@@ -100,7 +100,7 @@
type="text"
autocomplete="off"
spellcheck="false"
:placeholder="$t('request.url')"
:placeholder="`${$t('request.url')}`"
autofocus
@keyup.enter="newSendRequest()"
/>
@@ -110,7 +110,7 @@
<ButtonPrimary
id="send"
class="rounded-r-none flex-1 min-w-22"
:label="!loading ? $t('action.send') : $t('action.cancel')"
:label="`${!loading ? $t('action.send') : $t('action.cancel')}`"
@click.native="!loading ? newSendRequest() : cancelRequest()"
/>
<span class="flex">
@@ -125,7 +125,7 @@
<ButtonPrimary class="rounded-l-none" filled svg="chevron-down" />
</template>
<SmartItem
:label="$t('import.curl')"
:label="`${$t('import.curl')}`"
svg="terminal"
@click.native="
() => {
@@ -135,7 +135,7 @@
"
/>
<SmartItem
:label="$t('show.code')"
:label="`${$t('show.code')}`"
svg="code"
@click.native="
() => {
@@ -146,7 +146,7 @@
/>
<SmartItem
ref="clearAll"
:label="$t('action.clear_all')"
:label="`${$t('action.clear_all')}`"
svg="rotate-ccw"
@click.native="
() => {
@@ -159,7 +159,7 @@
</span>
<ButtonSecondary
class="rounded-r-none ml-2"
:label="$t('request.save')"
:label="`${$t('request.save')}`"
filled
svg="save"
@click.native="saveRequest()"
@@ -178,7 +178,7 @@
<input
id="request-name"
v-model="requestName"
:placeholder="$t('request.name')"
:placeholder="`${$t('request.name')}`"
name="request-name"
type="text"
autocomplete="off"
@@ -187,7 +187,7 @@
/>
<SmartItem
ref="copyRequest"
:label="$t('request.copy_link')"
:label="`${$t('request.copy_link')}`"
:svg="hasNavigatorShare ? 'share-2' : 'copy'"
@click.native="
() => {
@@ -198,7 +198,7 @@
/>
<SmartItem
ref="saveRequest"
:label="$t('request.save_as')"
:label="`${$t('request.save_as')}`"
svg="folder-plus"
@click.native="
() => {
@@ -352,7 +352,7 @@ const copyRequest = () => {
.catch(() => {})
} else {
copyToClipboard(window.location.href)
$toast.success(t("state.copied_to_clipboard").toString(), {
$toast.success(`${t("state.copied_to_clipboard")}`, {
icon: "content_paste",
})
}
@@ -409,7 +409,7 @@ const saveRequest = () => {
return
}
}
$toast.success(t("request.saved").toString(), {
$toast.success(`${t("request.saved")}`, {
icon: "playlist_add_check",
})
}

View File

@@ -1,5 +1,5 @@
<template>
<AppSection :label="$t('test.results')">
<AppSection :label="`${$t('test.results')}`">
<div
v-if="
testResults &&
@@ -64,7 +64,9 @@
<span class="text-secondaryLight">
{{
` \xA0 — \xA0test ${
result.status === "pass" ? $t("passed") : $t("failed")
result.status === "pass"
? $t("test.passed")
: $t("test.failed")
}`
}}
</span>
@@ -84,7 +86,7 @@
</span>
<ButtonSecondary
outline
:label="$t('action.learn_more')"
:label="`${$t('action.learn_more')}`"
to="https://docs.hoppscotch.io"
blank
svg="external-link"

View File

@@ -27,8 +27,8 @@
</span>
<span class="text-secondaryLight">
{{
` \xA0 — \xA0test ${
result.status === "pass" ? $t("passed") : $t("failed")
` \xA0 — \xA0 ${
result.status === "pass" ? $t("test.passed") : $t("test.failed")
}`
}}
</span>

View File

@@ -1,5 +1,5 @@
<template>
<AppSection id="script" :label="$t('test.script')">
<AppSection id="script" :label="`${$t('test.script')}`">
<div
class="
bg-primary
@@ -60,7 +60,7 @@
{{ $t("helpers.post_request_tests") }}
</div>
<SmartAnchor
:label="$t('test.learn')"
:label="`${$t('test.learn')}`"
to="https://docs.hoppscotch.io/features/tests"
blank
/>
@@ -107,7 +107,7 @@ useCodemirror(
extendedEditorConfig: {
mode: "application/javascript",
lineWrapping: linewrapEnabled,
placeholder: t("test.javascript_code").toString(),
placeholder: `${t("test.javascript_code")}`,
},
linter,
completer,