refactor: lint
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
<div class="px-2 row-wrapper">
|
||||
<span>
|
||||
<a
|
||||
v-tooltip.right="$t('recurring')"
|
||||
href="https://github.com/sponsors/hoppscotch"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
v-tooltip.right="$t('recurring')"
|
||||
>
|
||||
<button class="icon">
|
||||
<i class="material-icons">
|
||||
@@ -36,10 +36,10 @@
|
||||
<div class="px-2 row-wrapper">
|
||||
<span>
|
||||
<a
|
||||
v-tooltip.right="$t('one_time_recurring')"
|
||||
href="https://opencollective.com/hoppscotch"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
v-tooltip.right="$t('one_time_recurring')"
|
||||
>
|
||||
<button class="icon">
|
||||
<i class="material-icons">donut_large</i>
|
||||
@@ -51,10 +51,10 @@
|
||||
<div class="px-2 row-wrapper">
|
||||
<span>
|
||||
<a
|
||||
v-tooltip.right="$t('recurring')"
|
||||
href="https://www.patreon.com/liyasthomas"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
v-tooltip.right="$t('recurring')"
|
||||
>
|
||||
<button class="icon">
|
||||
<i class="material-icons">local_parking</i>
|
||||
@@ -66,10 +66,10 @@
|
||||
<div class="px-2 row-wrapper">
|
||||
<span>
|
||||
<a
|
||||
v-tooltip.right="$t('one_time')"
|
||||
href="https://www.paypal.me/liyascthomas"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
v-tooltip.right="$t('one_time')"
|
||||
>
|
||||
<button class="icon">
|
||||
<i class="material-icons">payment</i>
|
||||
@@ -82,7 +82,11 @@
|
||||
<div class="p-2">
|
||||
<h3 class="title">Financial Contributors</h3>
|
||||
<div class="contributors">
|
||||
<a href="https://oss.capital/?ref=hoppscotch" target="_blank" rel="noopener">
|
||||
<a
|
||||
href="https://oss.capital/?ref=hoppscotch"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<img
|
||||
style="height: 100%; width: 300px"
|
||||
src="~assets/images/ossc-banner.svg"
|
||||
@@ -100,8 +104,16 @@
|
||||
alt="Appwrite"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://pipedream.com/?ref=hoppscotch" target="_blank" rel="noopener">
|
||||
<img style="max-width: 100px" src="~assets/images/pipedream.png" alt="pipedream" />
|
||||
<a
|
||||
href="https://pipedream.com/?ref=hoppscotch"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<img
|
||||
style="max-width: 100px"
|
||||
src="~assets/images/pipedream.png"
|
||||
alt="pipedream"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
href="https://paw.cloud/?utm_source=hoppscotch&utm_medium=website&utm_campaign=hoppscotch-sponsorship"
|
||||
@@ -114,7 +126,11 @@
|
||||
alt="Paw"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://simplescraper.io/?utm_source=hs" target="_blank" rel="noopener">
|
||||
<a
|
||||
href="https://simplescraper.io/?utm_source=hs"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<img
|
||||
style="max-height: 50px"
|
||||
src="~assets/images/Simplescraper_dark.png"
|
||||
|
||||
@@ -21,13 +21,22 @@
|
||||
rel="noopener"
|
||||
>
|
||||
<button class="icon">
|
||||
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||
<svg
|
||||
class="material-icons"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path
|
||||
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm8.003 8.657c-1.276-3.321-4.46-4.605-5.534-4.537 3.529 1.376 4.373 6.059 4.06 7.441-.307-1.621-1.286-3.017-1.872-3.385 3.417 8.005-4.835 10.465-7.353 7.687.649.168 1.931.085 2.891-.557.898-.602.983-.638 1.56-.683.686-.053-.041-1.406-1.539-1.177-.616.094-1.632.819-2.88.341-1.508-.576-1.46-2.634.096-2.015.337-.437.088-1.263.088-1.263.452-.414 1.022-.706 1.37-.911.228-.135.829-.507.795-1.23-.123-.096-.32-.219-.766-.193-1.736.11-1.852-.518-1.967-.808.078-.668.524-1.534 1.361-1.931-1.257-.193-2.28.397-2.789 1.154-.809-.174-1.305-.183-2.118-.031-.316-.24-.666-.67-.878-1.181C6.36 3.312 9.027 2 12 2c5.912 0 8.263 4.283 8.003 6.657z"
|
||||
/>
|
||||
</svg>
|
||||
<span>Firefox</span>
|
||||
<span class="icon" v-if="hasFirefoxExtInstalled" v-tooltip="$t('installed')">
|
||||
<span
|
||||
v-if="hasFirefoxExtInstalled"
|
||||
v-tooltip="$t('installed')"
|
||||
class="icon"
|
||||
>
|
||||
<i class="material-icons">done</i>
|
||||
</span>
|
||||
</button>
|
||||
@@ -40,13 +49,22 @@
|
||||
rel="noopener"
|
||||
>
|
||||
<button class="icon">
|
||||
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||
<svg
|
||||
class="material-icons"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
>
|
||||
<path
|
||||
d="M2.897 4.181A11.87 11.87 0 0111.969 0c4.288 0 8.535 2.273 10.717 6.554h-9.293c-1.674.001-2.755-.037-3.926.579-1.376.724-2.415 2.067-2.777 3.644L2.897 4.181zM8.007 12c0 2.2 1.789 3.99 3.988 3.99s3.988-1.79 3.988-3.99-1.789-3.991-3.988-3.991S8.007 9.8 8.007 12zm5.536 5.223c-2.238.666-4.858-.073-6.293-2.549-1.095-1.891-3.989-6.933-5.305-9.225A11.856 11.856 0 000 11.956c0 5.448 3.726 10.65 9.673 11.818l3.87-6.551zm2.158-9.214a5.463 5.463 0 011.007 6.719 1815.43 1815.43 0 01-5.46 9.248C18.437 24.419 24 18.616 24 12.004c0-1.313-.22-2.66-.69-3.995h-7.609z"
|
||||
/>
|
||||
</svg>
|
||||
<span>Chrome</span>
|
||||
<span class="icon" v-if="hasChromeExtInstalled" v-tooltip="$t('installed')">
|
||||
<span
|
||||
v-if="hasChromeExtInstalled"
|
||||
v-tooltip="$t('installed')"
|
||||
class="icon"
|
||||
>
|
||||
<i class="material-icons">done</i>
|
||||
</span>
|
||||
</button>
|
||||
@@ -67,18 +85,18 @@ export default {
|
||||
props: {
|
||||
show: Boolean,
|
||||
},
|
||||
watch: {
|
||||
show() {
|
||||
this.hasChromeExtInstalled = hasChromeExtensionInstalled()
|
||||
this.hasFirefoxExtInstalled = hasFirefoxExtensionInstalled()
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
hasChromeExtInstalled: hasChromeExtensionInstalled(),
|
||||
hasFirefoxExtInstalled: hasFirefoxExtensionInstalled(),
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show() {
|
||||
this.hasChromeExtInstalled = hasChromeExtensionInstalled()
|
||||
this.hasFirefoxExtInstalled = hasFirefoxExtensionInstalled()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
hideModal() {
|
||||
this.$emit("hide-modal")
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
<template>
|
||||
<footer class="footer">
|
||||
<div class="row-wrapper">
|
||||
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||
<a class="footer-link" href="https://www.netlify.com" target="_blank" rel="noopener">
|
||||
<span
|
||||
class="flex flex-col font-mono md:flex-row"
|
||||
style="align-items: start"
|
||||
>
|
||||
<a
|
||||
class="footer-link"
|
||||
href="https://www.netlify.com"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
Powered by Netlify
|
||||
</a>
|
||||
<span>
|
||||
@@ -42,20 +50,23 @@
|
||||
loading="lazy"
|
||||
></iframe>
|
||||
</span>
|
||||
<span class="flex flex-col font-mono md:flex-row" style="align-items: start">
|
||||
<span
|
||||
class="flex flex-col font-mono md:flex-row"
|
||||
style="align-items: start"
|
||||
>
|
||||
<a href="mailto:support@hoppscotch.io" target="_blank" rel="noopener">
|
||||
<button class="icon" v-tooltip="$t('contact_us')">
|
||||
<button v-tooltip="$t('contact_us')" class="icon">
|
||||
<i class="material-icons">email</i>
|
||||
</button>
|
||||
</a>
|
||||
<v-popover>
|
||||
<button class="icon" v-tooltip="$t('choose_language')">
|
||||
<button v-tooltip="$t('choose_language')" class="icon">
|
||||
<i class="material-icons">translate</i>
|
||||
</button>
|
||||
<template slot="popover">
|
||||
<div v-for="locale in availableLocales" :key="locale.code">
|
||||
<nuxt-link :to="switchLocalePath(locale.code)">
|
||||
<button class="icon" v-close-popover>
|
||||
<button v-close-popover class="icon">
|
||||
{{ locale.name }}
|
||||
</button>
|
||||
</nuxt-link>
|
||||
@@ -67,6 +78,16 @@
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
availableLocales() {
|
||||
return this.$i18n.locales.filter(({ code }) => code !== this.$i18n.locale)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.footer-link {
|
||||
@apply inline-flex;
|
||||
@@ -81,13 +102,3 @@
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
availableLocales() {
|
||||
return this.$i18n.locales.filter(({ code }) => code !== this.$i18n.locale)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -36,13 +36,17 @@
|
||||
"
|
||||
>
|
||||
Appwrite - Open-Source Backend as a Service
|
||||
<img class="w-8 ml-2" src="~assets/images/appwrite-icon.svg" alt="Appwrite" />
|
||||
<img
|
||||
class="w-8 ml-2"
|
||||
src="~assets/images/appwrite-icon.svg"
|
||||
alt="Appwrite"
|
||||
/>
|
||||
</a>
|
||||
<button
|
||||
class="icon"
|
||||
id="installPWA"
|
||||
@click.prevent="showInstallPrompt()"
|
||||
v-tooltip="$t('install_pwa')"
|
||||
class="icon"
|
||||
@click.prevent="showInstallPrompt()"
|
||||
>
|
||||
<i class="material-icons">offline_bolt</i>
|
||||
</button>
|
||||
@@ -52,8 +56,13 @@
|
||||
aria-label="GitHub"
|
||||
rel="noopener"
|
||||
>
|
||||
<button class="icon" aria-label="GitHub" v-tooltip="'GitHub'">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="material-icons">
|
||||
<button v-tooltip="'GitHub'" class="icon" aria-label="GitHub">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
class="material-icons"
|
||||
>
|
||||
<path
|
||||
d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
||||
/>
|
||||
@@ -61,7 +70,7 @@
|
||||
</button>
|
||||
</a>
|
||||
<v-popover v-if="fb.currentUser === null">
|
||||
<button class="icon" v-tooltip="$t('login_with')">
|
||||
<button v-tooltip="$t('login_with')" class="icon">
|
||||
<i class="material-icons">login</i>
|
||||
</button>
|
||||
<template slot="popover">
|
||||
@@ -70,12 +79,13 @@
|
||||
</v-popover>
|
||||
<v-popover v-else>
|
||||
<button
|
||||
class="icon"
|
||||
v-tooltip="
|
||||
(fb.currentUser.displayName || '<label><i>Name not found</i></label>') +
|
||||
(fb.currentUser.displayName ||
|
||||
'<label><i>Name not found</i></label>') +
|
||||
'<br>' +
|
||||
(fb.currentUser.email || '<label><i>Email not found</i></label>')
|
||||
"
|
||||
class="icon"
|
||||
aria-label="Account"
|
||||
>
|
||||
<img
|
||||
@@ -88,7 +98,7 @@
|
||||
</button>
|
||||
<template slot="popover">
|
||||
<div>
|
||||
<nuxt-link :to="localePath('settings')" v-close-popover>
|
||||
<nuxt-link v-close-popover :to="localePath('settings')">
|
||||
<button class="icon">
|
||||
<i class="material-icons">settings</i>
|
||||
<span>
|
||||
@@ -103,26 +113,26 @@
|
||||
</template>
|
||||
</v-popover>
|
||||
<v-popover>
|
||||
<button class="icon" v-tooltip="$t('more')">
|
||||
<button v-tooltip="$t('more')" class="icon">
|
||||
<i class="material-icons">drag_indicator</i>
|
||||
</button>
|
||||
<template slot="popover">
|
||||
<button class="icon" @click="showExtensions = true" v-close-popover>
|
||||
<button v-close-popover class="icon" @click="showExtensions = true">
|
||||
<i class="material-icons">extension</i>
|
||||
<span>{{ $t("extensions") }}</span>
|
||||
</button>
|
||||
<button class="icon" @click="showShortcuts = true" v-close-popover>
|
||||
<button v-close-popover class="icon" @click="showShortcuts = true">
|
||||
<i class="material-icons">keyboard</i>
|
||||
<span>{{ $t("shortcuts") }}</span>
|
||||
</button>
|
||||
<button class="icon" @click="showSupport = true" v-close-popover>
|
||||
<button v-close-popover class="icon" @click="showSupport = true">
|
||||
<i class="material-icons">favorite</i>
|
||||
<span>{{ $t("support_us") }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-close-popover
|
||||
class="icon"
|
||||
onClick="window.open('https://twitter.com/share?text=👽 Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.&url=https://hoppscotch.io&hashtags=hoppscotch&via=hoppscotch_io');"
|
||||
v-close-popover
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||
<path
|
||||
@@ -133,10 +143,10 @@
|
||||
</button>
|
||||
<button
|
||||
v-if="navigatorShare"
|
||||
class="icon"
|
||||
@click="nativeShare"
|
||||
v-close-popover
|
||||
v-tooltip="$t('more')"
|
||||
class="icon"
|
||||
@click="nativeShare"
|
||||
>
|
||||
<i class="material-icons">share</i>
|
||||
<span>Share</span>
|
||||
@@ -145,12 +155,149 @@
|
||||
</v-popover>
|
||||
</span>
|
||||
</div>
|
||||
<AppExtensions :show="showExtensions" @hide-modal="showExtensions = false" />
|
||||
<AppExtensions
|
||||
:show="showExtensions"
|
||||
@hide-modal="showExtensions = false"
|
||||
/>
|
||||
<AppShortcuts :show="showShortcuts" @hide-modal="showShortcuts = false" />
|
||||
<AppSupport :show="showSupport" @hide-modal="showSupport = false" />
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import intializePwa from "~/helpers/pwa"
|
||||
import { fb } from "~/helpers/fb"
|
||||
// import { hasExtensionInstalled } from "~/helpers/strategies/ExtensionStrategy"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// Once the PWA code is initialized, this holds a method
|
||||
// that can be called to show the user the installation
|
||||
// prompt.
|
||||
showInstallPrompt: null,
|
||||
showExtensions: false,
|
||||
showShortcuts: false,
|
||||
showSupport: false,
|
||||
navigatorShare: navigator.share,
|
||||
fb,
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this._keyListener = function (e) {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
this.showExtensions = this.showShortcuts = this.showSupport = false
|
||||
}
|
||||
}
|
||||
document.addEventListener("keydown", this._keyListener.bind(this))
|
||||
|
||||
// Initializes the PWA code - checks if the app is installed,
|
||||
// etc.
|
||||
this.showInstallPrompt = await intializePwa()
|
||||
const cookiesAllowed = localStorage.getItem("cookiesAllowed") === "yes"
|
||||
if (!cookiesAllowed) {
|
||||
this.$toast.show(this.$t("we_use_cookies"), {
|
||||
icon: "info",
|
||||
duration: 5000,
|
||||
theme: "toasted-primary",
|
||||
action: [
|
||||
{
|
||||
text: this.$t("dismiss"),
|
||||
onClick: (_, toastObject) => {
|
||||
localStorage.setItem("cookiesAllowed", "yes")
|
||||
toastObject.goAway(0)
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
// let showAd = localStorage.getItem("showAd") === "no"
|
||||
// if (!showAd) {
|
||||
// setTimeout(() => {
|
||||
// this.$toast.clear()
|
||||
// this.$toast.show(
|
||||
// "<span><a href='https://github.com/sponsors/hoppscotch' target='_blank' rel='noopener'>Sponsor us to support Hoppscotch open source project 💖</a><br><sub>Whoosh this away to dismiss.</sub></span>",
|
||||
// {
|
||||
// icon: "",
|
||||
// duration: 0,
|
||||
// theme: "toasted-ad",
|
||||
// action: [
|
||||
// {
|
||||
// text: "Sponsor",
|
||||
// icon: "chevron_right",
|
||||
// onClick: (_, toastObject) => {
|
||||
// localStorage.setItem("showAd", "no")
|
||||
// toastObject.goAway(0)
|
||||
// window.open("https://github.com/sponsors/hoppscotch")
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// onComplete() {
|
||||
// localStorage.setItem("showAd", "no")
|
||||
// },
|
||||
// }
|
||||
// )
|
||||
// }, 8000)
|
||||
// }
|
||||
|
||||
// let showExtensionsToast = localStorage.getItem("showExtensionsToast") === "yes"
|
||||
// if (!showExtensionsToast) {
|
||||
// setTimeout(() => {
|
||||
// if (!hasExtensionInstalled()) {
|
||||
// this.$toast.show(this.$t("extensions_info2"), {
|
||||
// icon: "extension",
|
||||
// duration: 5000,
|
||||
// theme: "toasted-primary",
|
||||
// action: [
|
||||
// {
|
||||
// text: this.$t("yes"),
|
||||
// onClick: (_, toastObject) => {
|
||||
// this.showExtensions = true
|
||||
// localStorage.setItem("showExtensionsToast", "yes")
|
||||
// toastObject.goAway(0)
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// text: this.$t("no"),
|
||||
// onClick: (_, toastObject) => {
|
||||
// this.$store.commit("setMiscState", {
|
||||
// value: false,
|
||||
// attribute: "showExtensionsToast",
|
||||
// })
|
||||
// localStorage.setItem("showExtensionsToast", "no")
|
||||
// toastObject.goAway(0)
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// })
|
||||
// }
|
||||
// }, 5000)
|
||||
// }
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
methods: {
|
||||
nativeShare() {
|
||||
if (navigator.share) {
|
||||
navigator
|
||||
.share({
|
||||
title: "Hoppscotch",
|
||||
text: "Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.",
|
||||
url: "https://hoppscotch.io",
|
||||
})
|
||||
.then(() => {})
|
||||
.catch(console.error)
|
||||
} else {
|
||||
// fallback
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$responsiveWidth: 768px;
|
||||
|
||||
@@ -193,137 +340,3 @@ $responsiveWidth: 768px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import intializePwa from "~/helpers/pwa"
|
||||
import { fb } from "~/helpers/fb"
|
||||
// import { hasExtensionInstalled } from "~/helpers/strategies/ExtensionStrategy"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// Once the PWA code is initialized, this holds a method
|
||||
// that can be called to show the user the installation
|
||||
// prompt.
|
||||
showInstallPrompt: null,
|
||||
showExtensions: false,
|
||||
showShortcuts: false,
|
||||
showSupport: false,
|
||||
navigatorShare: navigator.share,
|
||||
fb,
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this._keyListener = function (e) {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
this.showExtensions = this.showShortcuts = this.showSupport = false
|
||||
}
|
||||
}
|
||||
document.addEventListener("keydown", this._keyListener.bind(this))
|
||||
|
||||
// Initializes the PWA code - checks if the app is installed,
|
||||
// etc.
|
||||
this.showInstallPrompt = await intializePwa()
|
||||
let cookiesAllowed = localStorage.getItem("cookiesAllowed") === "yes"
|
||||
if (!cookiesAllowed) {
|
||||
this.$toast.show(this.$t("we_use_cookies"), {
|
||||
icon: "info",
|
||||
duration: 5000,
|
||||
theme: "toasted-primary",
|
||||
action: [
|
||||
{
|
||||
text: this.$t("dismiss"),
|
||||
onClick: (e, toastObject) => {
|
||||
localStorage.setItem("cookiesAllowed", "yes")
|
||||
toastObject.goAway(0)
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
// let showAd = localStorage.getItem("showAd") === "no"
|
||||
// if (!showAd) {
|
||||
// setTimeout(() => {
|
||||
// this.$toast.clear()
|
||||
// this.$toast.show(
|
||||
// "<span><a href='https://github.com/sponsors/hoppscotch' target='_blank' rel='noopener'>Sponsor us to support Hoppscotch open source project 💖</a><br><sub>Whoosh this away to dismiss.</sub></span>",
|
||||
// {
|
||||
// icon: "",
|
||||
// duration: 0,
|
||||
// theme: "toasted-ad",
|
||||
// action: [
|
||||
// {
|
||||
// text: "Sponsor",
|
||||
// icon: "chevron_right",
|
||||
// onClick: (e, toastObject) => {
|
||||
// localStorage.setItem("showAd", "no")
|
||||
// toastObject.goAway(0)
|
||||
// window.open("https://github.com/sponsors/hoppscotch")
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// onComplete() {
|
||||
// localStorage.setItem("showAd", "no")
|
||||
// },
|
||||
// }
|
||||
// )
|
||||
// }, 8000)
|
||||
// }
|
||||
|
||||
// let showExtensionsToast = localStorage.getItem("showExtensionsToast") === "yes"
|
||||
// if (!showExtensionsToast) {
|
||||
// setTimeout(() => {
|
||||
// if (!hasExtensionInstalled()) {
|
||||
// this.$toast.show(this.$t("extensions_info2"), {
|
||||
// icon: "extension",
|
||||
// duration: 5000,
|
||||
// theme: "toasted-primary",
|
||||
// action: [
|
||||
// {
|
||||
// text: this.$t("yes"),
|
||||
// onClick: (e, toastObject) => {
|
||||
// this.showExtensions = true
|
||||
// localStorage.setItem("showExtensionsToast", "yes")
|
||||
// toastObject.goAway(0)
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// text: this.$t("no"),
|
||||
// onClick: (e, toastObject) => {
|
||||
// this.$store.commit("setMiscState", {
|
||||
// value: false,
|
||||
// attribute: "showExtensionsToast",
|
||||
// })
|
||||
// localStorage.setItem("showExtensionsToast", "no")
|
||||
// toastObject.goAway(0)
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// })
|
||||
// }
|
||||
// }, 5000)
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
nativeShare() {
|
||||
if (navigator.share) {
|
||||
navigator
|
||||
.share({
|
||||
title: "Hoppscotch",
|
||||
text: "Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.",
|
||||
url: "https://hoppscotch.io",
|
||||
})
|
||||
.then(() => {})
|
||||
.catch(console.error)
|
||||
} else {
|
||||
// fallback
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -15,6 +15,7 @@ export default {
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,12 +6,51 @@
|
||||
{{ isCollapsed(label) ? "expand_more" : "expand_less" }}
|
||||
</i>
|
||||
</legend>
|
||||
<div class="collapsible" :class="{ hidden: isCollapsed(label.toLowerCase()) }">
|
||||
<slot />
|
||||
<div
|
||||
class="collapsible"
|
||||
:class="{ hidden: isCollapsed(label.toLowerCase()) }"
|
||||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from "vue"
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
default: "Section",
|
||||
},
|
||||
noLegend: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
sectionString(): string {
|
||||
return `${this.$route.path.replace(/\/+$/, "")}/${this.label}`
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
collapse() {
|
||||
// Save collapsed section into the collapsedSections array
|
||||
this.$store.commit("setCollapsedSection", this.sectionString)
|
||||
},
|
||||
isCollapsed(_label: string) {
|
||||
return (
|
||||
this.$store.state.theme.collapsedSections.includes(
|
||||
this.sectionString
|
||||
) || false
|
||||
)
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
fieldset {
|
||||
@apply my-4;
|
||||
@@ -33,35 +72,3 @@ fieldset {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from "vue"
|
||||
|
||||
export default Vue.extend({
|
||||
computed: {
|
||||
sectionString(): string {
|
||||
return `${this.$route.path.replace(/\/+$/, "")}/${this.label}`
|
||||
},
|
||||
},
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
default: "Section",
|
||||
},
|
||||
noLegend: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
collapse() {
|
||||
// Save collapsed section into the collapsedSections array
|
||||
this.$store.commit("setCollapsedSection", this.sectionString)
|
||||
},
|
||||
isCollapsed(_label: string) {
|
||||
return this.$store.state.theme.collapsedSections.includes(this.sectionString) || false
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -73,18 +73,6 @@
|
||||
</SmartModal>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
kbd {
|
||||
@apply inline-flex;
|
||||
@apply resize-none;
|
||||
@apply m-2;
|
||||
@apply rounded-lg;
|
||||
@apply py-2;
|
||||
@apply px-4;
|
||||
@apply text-sm;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
||||
|
||||
@@ -100,3 +88,15 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
kbd {
|
||||
@apply inline-flex;
|
||||
@apply resize-none;
|
||||
@apply m-2;
|
||||
@apply rounded-lg;
|
||||
@apply py-2;
|
||||
@apply px-4;
|
||||
@apply text-sm;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,27 +6,32 @@
|
||||
seems to mess up the nuxt-link active class.
|
||||
-->
|
||||
<nuxt-link
|
||||
v-tooltip.right="$t('home')"
|
||||
:to="localePath('index')"
|
||||
:class="linkActive('/')"
|
||||
v-tooltip.right="$t('home')"
|
||||
:aria-label="$t('home')"
|
||||
>
|
||||
<AppLogo alt class="material-icons" style="height: 24px" />
|
||||
</nuxt-link>
|
||||
<nuxt-link
|
||||
v-tooltip.right="$t('realtime')"
|
||||
:to="localePath('realtime')"
|
||||
:class="linkActive('/realtime')"
|
||||
v-tooltip.right="$t('realtime')"
|
||||
>
|
||||
<i class="material-icons">language</i>
|
||||
</nuxt-link>
|
||||
<nuxt-link
|
||||
v-tooltip.right="$t('graphql')"
|
||||
:to="localePath('graphql')"
|
||||
:class="linkActive('/graphql')"
|
||||
v-tooltip.right="$t('graphql')"
|
||||
:aria-label="$t('graphql')"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 29.999 30">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
height="24"
|
||||
width="24"
|
||||
viewBox="0 0 29.999 30"
|
||||
>
|
||||
<path d="M4.08 22.864l-1.1-.636L15.248.98l1.1.636z" />
|
||||
<path d="M2.727 20.53h24.538v1.272H2.727z" />
|
||||
<path
|
||||
@@ -43,80 +48,111 @@
|
||||
</svg>
|
||||
</nuxt-link>
|
||||
<nuxt-link
|
||||
v-tooltip.right="$t('documentation')"
|
||||
:to="localePath('doc')"
|
||||
:class="linkActive('/doc')"
|
||||
v-tooltip.right="$t('documentation')"
|
||||
:aria-label="$t('documentation')"
|
||||
>
|
||||
<i class="material-icons">topic</i>
|
||||
</nuxt-link>
|
||||
<nuxt-link
|
||||
v-tooltip.right="$t('settings')"
|
||||
:to="localePath('settings')"
|
||||
:class="linkActive('/settings')"
|
||||
v-tooltip.right="$t('settings')"
|
||||
:aria-label="$t('settings')"
|
||||
>
|
||||
<i class="material-icons">settings</i>
|
||||
</nuxt-link>
|
||||
</nav>
|
||||
<nav v-if="$route.path == '/'" class="secondary-nav">
|
||||
<a href="#request" v-tooltip.right="$t('request')">
|
||||
<a v-tooltip.right="$t('request')" href="#request">
|
||||
<i class="material-icons">cloud_upload</i>
|
||||
</a>
|
||||
<a href="#options" v-tooltip.right="$t('options')">
|
||||
<a v-tooltip.right="$t('options')" href="#options">
|
||||
<i class="material-icons">toc</i>
|
||||
</a>
|
||||
<a href="#response" v-tooltip.right="$t('response')">
|
||||
<a v-tooltip.right="$t('response')" href="#response">
|
||||
<i class="material-icons">cloud_download</i>
|
||||
</a>
|
||||
</nav>
|
||||
<nav v-else-if="$route.path.includes('/realtime')" class="secondary-nav">
|
||||
<a href="#request" v-tooltip.right="$t('request')">
|
||||
<a v-tooltip.right="$t('request')" href="#request">
|
||||
<i class="material-icons">cloud_upload</i>
|
||||
</a>
|
||||
<a href="#response" v-tooltip.right="$t('communication')">
|
||||
<a v-tooltip.right="$t('communication')" href="#response">
|
||||
<i class="material-icons">cloud_download</i>
|
||||
</a>
|
||||
</nav>
|
||||
<nav v-else-if="$route.path.includes('/graphql')" class="secondary-nav">
|
||||
<a href="#endpoint" v-tooltip.right="$t('endpoint')">
|
||||
<a v-tooltip.right="$t('endpoint')" href="#endpoint">
|
||||
<i class="material-icons">cloud</i>
|
||||
</a>
|
||||
<a href="#schema" v-tooltip.right="$t('schema')">
|
||||
<a v-tooltip.right="$t('schema')" href="#schema">
|
||||
<i class="material-icons">assignment_returned</i>
|
||||
</a>
|
||||
<a href="#query" v-tooltip.right="$t('query')">
|
||||
<a v-tooltip.right="$t('query')" href="#query">
|
||||
<i class="material-icons">cloud_upload</i>
|
||||
</a>
|
||||
<a href="#response" v-tooltip.right="$t('response')">
|
||||
<a v-tooltip.right="$t('response')" href="#response">
|
||||
<i class="material-icons">cloud_download</i>
|
||||
</a>
|
||||
</nav>
|
||||
<nav v-else-if="$route.path.includes('/doc')" class="secondary-nav">
|
||||
<a href="#import" v-tooltip.right="$t('import')">
|
||||
<a v-tooltip.right="$t('import')" href="#import">
|
||||
<i class="material-icons">folder</i>
|
||||
</a>
|
||||
<a href="#documentation" v-tooltip.right="$t('documentation')">
|
||||
<a v-tooltip.right="$t('documentation')" href="#documentation">
|
||||
<i class="material-icons">insert_drive_file</i>
|
||||
</a>
|
||||
</nav>
|
||||
<nav v-else-if="$route.path.includes('/settings')" class="secondary-nav">
|
||||
<a href="#account" v-tooltip.right="$t('account')">
|
||||
<a v-tooltip.right="$t('account')" href="#account">
|
||||
<i class="material-icons">person</i>
|
||||
</a>
|
||||
<a href="#theme" v-tooltip.right="$t('theme')">
|
||||
<a v-tooltip.right="$t('theme')" href="#theme">
|
||||
<i class="material-icons">brush</i>
|
||||
</a>
|
||||
<a href="#extensions" v-tooltip.right="$t('extensions')">
|
||||
<a v-tooltip.right="$t('extensions')" href="#extensions">
|
||||
<i class="material-icons">extension</i>
|
||||
</a>
|
||||
<a href="#proxy" v-tooltip.right="$t('proxy')">
|
||||
<a v-tooltip.right="$t('proxy')" href="#proxy">
|
||||
<i class="material-icons">public</i>
|
||||
</a>
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
mounted() {
|
||||
window.addEventListener("scroll", () => {
|
||||
const mainNavLinks = document.querySelectorAll("nav.secondary-nav a")
|
||||
const fromTop = window.scrollY
|
||||
mainNavLinks.forEach(({ hash, classList }) => {
|
||||
const section = document.querySelector(hash)
|
||||
if (
|
||||
section &&
|
||||
section.offsetTop <= fromTop &&
|
||||
section.offsetTop + section.offsetHeight > fromTop
|
||||
) {
|
||||
classList.add("current")
|
||||
} else {
|
||||
classList.remove("current")
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
linkActive(path) {
|
||||
return {
|
||||
"nuxt-link-exact-active": this.$route.path === path,
|
||||
"nuxt-link-active": this.$route.path === path,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$responsiveWidth: 768px;
|
||||
|
||||
@@ -269,39 +305,3 @@ nav.secondary-nav {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
linkActive(path) {
|
||||
return {
|
||||
"nuxt-link-exact-active": this.$route.path === path,
|
||||
"nuxt-link-active": this.$route.path === path,
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener("scroll", (event) => {
|
||||
let mainNavLinks = document.querySelectorAll("nav ul li a")
|
||||
let fromTop = window.scrollY
|
||||
mainNavLinks.forEach(({ hash, classList }) => {
|
||||
let section = document.querySelector(hash)
|
||||
if (
|
||||
section &&
|
||||
section.offsetTop <= fromTop &&
|
||||
section.offsetTop + section.offsetHeight > fromTop
|
||||
) {
|
||||
classList.add("current")
|
||||
} else {
|
||||
classList.remove("current")
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// watch: {
|
||||
// $route() {
|
||||
// // this.$toast.clear();
|
||||
// },
|
||||
// },
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -5,13 +5,16 @@
|
||||
{{ collection.name || $t("none") }}
|
||||
</h2>
|
||||
<span
|
||||
class="folder"
|
||||
v-for="(folder, index) in collection.folders"
|
||||
:key="`sub-collection-${index}`"
|
||||
class="folder"
|
||||
>
|
||||
<DocsFolder :folder="folder" />
|
||||
</span>
|
||||
<div v-for="(request, index) in collection.requests" :key="`request-${index}`">
|
||||
<div
|
||||
v-for="(request, index) in collection.requests"
|
||||
:key="`request-${index}`"
|
||||
>
|
||||
<DocsRequest :request="request" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,7 +23,7 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
collection: Object,
|
||||
collection: { type: Object, default: () => {} },
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<div slot="body" class="flex flex-col">
|
||||
<label for="selectLabel">{{ $t("label") }}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="selectLabel"
|
||||
v-model="name"
|
||||
type="text"
|
||||
:placeholder="$t('my_new_environment')"
|
||||
@keyup.enter="addNewEnvironment"
|
||||
/>
|
||||
@@ -57,7 +57,9 @@ export default {
|
||||
methods: {
|
||||
syncEnvironments() {
|
||||
if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) {
|
||||
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
|
||||
fb.writeEnvironments(
|
||||
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
|
||||
)
|
||||
}
|
||||
},
|
||||
addNewEnvironment() {
|
||||
@@ -65,7 +67,7 @@ export default {
|
||||
this.$toast.info(this.$t("invalid_environment_name"))
|
||||
return
|
||||
}
|
||||
let newEnvironment = [
|
||||
const newEnvironment = [
|
||||
{
|
||||
name: this.$data.name,
|
||||
variables: [],
|
||||
|
||||
@@ -13,22 +13,26 @@
|
||||
<div slot="body" class="flex flex-col">
|
||||
<label for="selectLabel">{{ $t("label") }}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="selectLabel"
|
||||
v-model="name"
|
||||
type="text"
|
||||
:placeholder="editingEnvironment.name"
|
||||
@keyup.enter="saveEnvironment"
|
||||
/>
|
||||
<div class="row-wrapper">
|
||||
<label for="variableList">{{ $t("env_variable_list") }}</label>
|
||||
<div>
|
||||
<button class="icon" @click="clearContent($event)" v-tooltip.bottom="$t('clear')">
|
||||
<button
|
||||
v-tooltip.bottom="$t('clear')"
|
||||
class="icon"
|
||||
@click="clearContent($event)"
|
||||
>
|
||||
<i class="material-icons">clear_all</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
v-for="(variable, index) in this.editingEnvCopy.variables"
|
||||
v-for="(variable, index) in editingEnvCopy.variables"
|
||||
:key="index"
|
||||
class="
|
||||
border-b border-dashed
|
||||
@@ -45,13 +49,13 @@
|
||||
:placeholder="$t('variable_count', { count: index + 1 })"
|
||||
:name="'param' + index"
|
||||
:value="variable.key"
|
||||
autofocus
|
||||
@change="
|
||||
$store.commit('postwoman/setVariableKey', {
|
||||
index,
|
||||
value: $event.target.value,
|
||||
})
|
||||
"
|
||||
autofocus
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
@@ -59,7 +63,9 @@
|
||||
:placeholder="$t('value_count', { count: index + 1 })"
|
||||
:name="'value' + index"
|
||||
:value="
|
||||
typeof variable.value === 'string' ? variable.value : JSON.stringify(variable.value)
|
||||
typeof variable.value === 'string'
|
||||
? variable.value
|
||||
: JSON.stringify(variable.value)
|
||||
"
|
||||
@change="
|
||||
$store.commit('postwoman/setVariableValue', {
|
||||
@@ -72,10 +78,10 @@
|
||||
<div>
|
||||
<li>
|
||||
<button
|
||||
id="variable"
|
||||
v-tooltip.bottom="$t('delete')"
|
||||
class="icon"
|
||||
@click="removeEnvironmentVariable(index)"
|
||||
v-tooltip.bottom="$t('delete')"
|
||||
id="variable"
|
||||
>
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
@@ -114,8 +120,8 @@ import { getSettingSubject } from "~/newstore/settings"
|
||||
export default {
|
||||
props: {
|
||||
show: Boolean,
|
||||
editingEnvironment: Object,
|
||||
editingEnvironmentIndex: Number,
|
||||
editingEnvironment: { type: Object, default: () => {} },
|
||||
editingEnvironmentIndex: { type: Number, default: null },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -128,15 +134,6 @@ export default {
|
||||
SYNC_ENVIRONMENTS: getSettingSubject("syncEnvironments"),
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
editingEnvironment(update) {
|
||||
this.name =
|
||||
this.$props.editingEnvironment && this.$props.editingEnvironment.name
|
||||
? this.$props.editingEnvironment.name
|
||||
: undefined
|
||||
this.$store.commit("postwoman/setEditingEnvironment", this.$props.editingEnvironment)
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
editingEnvCopy() {
|
||||
return this.$store.state.postwoman.editingEnvironment
|
||||
@@ -146,10 +143,24 @@ export default {
|
||||
return result === "" ? "" : JSON.stringify(result)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
editingEnvironment() {
|
||||
this.name =
|
||||
this.$props.editingEnvironment && this.$props.editingEnvironment.name
|
||||
? this.$props.editingEnvironment.name
|
||||
: undefined
|
||||
this.$store.commit(
|
||||
"postwoman/setEditingEnvironment",
|
||||
this.$props.editingEnvironment
|
||||
)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
syncEnvironments() {
|
||||
if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) {
|
||||
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
|
||||
fb.writeEnvironments(
|
||||
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
|
||||
)
|
||||
}
|
||||
},
|
||||
clearContent({ target }) {
|
||||
@@ -158,18 +169,21 @@ export default {
|
||||
this.$toast.info(this.$t("cleared"), {
|
||||
icon: "clear_all",
|
||||
})
|
||||
setTimeout(() => (target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
|
||||
setTimeout(
|
||||
() => (target.innerHTML = '<i class="material-icons">clear_all</i>'),
|
||||
1000
|
||||
)
|
||||
},
|
||||
addEnvironmentVariable() {
|
||||
let value = { key: "", value: "" }
|
||||
const value = { key: "", value: "" }
|
||||
this.$store.commit("postwoman/addVariable", value)
|
||||
this.syncEnvironments()
|
||||
},
|
||||
removeEnvironmentVariable(index) {
|
||||
let variableIndex = index
|
||||
const variableIndex = index
|
||||
const oldVariables = this.editingEnvCopy.variables.slice()
|
||||
const newVariables = this.editingEnvCopy.variables.filter(
|
||||
(variable, index) => variableIndex !== index
|
||||
(_, index) => variableIndex !== index
|
||||
)
|
||||
|
||||
this.$store.commit("postwoman/removeVariable", newVariables)
|
||||
@@ -177,7 +191,7 @@ export default {
|
||||
icon: "delete",
|
||||
action: {
|
||||
text: this.$t("undo"),
|
||||
onClick: (e, toastObject) => {
|
||||
onClick: (_, toastObject) => {
|
||||
this.$store.commit("postwoman/removeVariable", oldVariables)
|
||||
toastObject.remove()
|
||||
},
|
||||
|
||||
@@ -8,18 +8,22 @@
|
||||
</button>
|
||||
</div>
|
||||
<v-popover>
|
||||
<button class="tooltip-target icon" v-tooltip.left="$t('more')">
|
||||
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</button>
|
||||
<template slot="popover">
|
||||
<div>
|
||||
<button class="icon" @click="$emit('edit-environment')" v-close-popover>
|
||||
<button
|
||||
v-close-popover
|
||||
class="icon"
|
||||
@click="$emit('edit-environment')"
|
||||
>
|
||||
<i class="material-icons">create</i>
|
||||
<span>{{ $t("edit") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="confirmRemove = true" v-close-popover>
|
||||
<button v-close-popover class="icon" @click="confirmRemove = true">
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
@@ -42,8 +46,8 @@ import { getSettingSubject } from "~/newstore/settings"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
environment: Object,
|
||||
environmentIndex: Number,
|
||||
environment: { type: Object, default: () => {} },
|
||||
environmentIndex: { type: Number, default: null },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -58,7 +62,9 @@ export default {
|
||||
methods: {
|
||||
syncEnvironments() {
|
||||
if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) {
|
||||
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
|
||||
fb.writeEnvironments(
|
||||
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
|
||||
)
|
||||
}
|
||||
},
|
||||
removeEnvironment() {
|
||||
|
||||
@@ -2,15 +2,21 @@
|
||||
<SmartModal v-if="show" @close="hideModal">
|
||||
<div slot="header">
|
||||
<div class="row-wrapper">
|
||||
<h3 class="title">{{ $t("import_export") }} {{ $t("environments") }}</h3>
|
||||
<h3 class="title">
|
||||
{{ $t("import_export") }} {{ $t("environments") }}
|
||||
</h3>
|
||||
<div>
|
||||
<v-popover>
|
||||
<button class="tooltip-target icon" v-tooltip.left="$t('more')">
|
||||
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</button>
|
||||
<template slot="popover">
|
||||
<div>
|
||||
<button class="icon" @click="readEnvironmentGist" v-close-popover>
|
||||
<button
|
||||
v-close-popover
|
||||
class="icon"
|
||||
@click="readEnvironmentGist"
|
||||
>
|
||||
<i class="material-icons">assignment_returned</i>
|
||||
<span>{{ $t("import_from_gist") }}</span>
|
||||
</button>
|
||||
@@ -25,12 +31,16 @@
|
||||
}"
|
||||
>
|
||||
<button
|
||||
v-close-popover
|
||||
:disabled="
|
||||
!fb.currentUser ? true : fb.currentUser.provider !== 'github.com' ? true : false
|
||||
!fb.currentUser
|
||||
? true
|
||||
: fb.currentUser.provider !== 'github.com'
|
||||
? true
|
||||
: false
|
||||
"
|
||||
class="icon"
|
||||
@click="createEnvironmentGist"
|
||||
v-close-popover
|
||||
>
|
||||
<i class="material-icons">assignment_turned_in</i>
|
||||
<span>{{ $t("create_secret_gist") }}</span>
|
||||
@@ -48,42 +58,48 @@
|
||||
<div class="flex flex-col items-start p-2">
|
||||
<span
|
||||
v-tooltip="{
|
||||
content: !fb.currentUser ? $t('login_first') : $t('replace_current'),
|
||||
content: !fb.currentUser
|
||||
? $t('login_first')
|
||||
: $t('replace_current'),
|
||||
}"
|
||||
>
|
||||
<button :disabled="!fb.currentUser" class="icon" @click="syncEnvironments">
|
||||
<button
|
||||
:disabled="!fb.currentUser"
|
||||
class="icon"
|
||||
@click="syncEnvironments"
|
||||
>
|
||||
<i class="material-icons">folder_shared</i>
|
||||
<span>{{ $t("import_from_sync") }}</span>
|
||||
</button>
|
||||
</span>
|
||||
<button
|
||||
v-tooltip="$t('replace_current')"
|
||||
class="icon"
|
||||
@click="openDialogChooseFileToReplaceWith"
|
||||
v-tooltip="$t('replace_current')"
|
||||
>
|
||||
<i class="material-icons">create_new_folder</i>
|
||||
<span>{{ $t("replace_json") }}</span>
|
||||
<input
|
||||
type="file"
|
||||
@change="replaceWithJSON"
|
||||
style="display: none"
|
||||
ref="inputChooseFileToReplaceWith"
|
||||
type="file"
|
||||
style="display: none"
|
||||
accept="application/json"
|
||||
@change="replaceWithJSON"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
v-tooltip="$t('preserve_current')"
|
||||
class="icon"
|
||||
@click="openDialogChooseFileToImportFrom"
|
||||
v-tooltip="$t('preserve_current')"
|
||||
>
|
||||
<i class="material-icons">folder_special</i>
|
||||
<span>{{ $t("import_json") }}</span>
|
||||
<input
|
||||
type="file"
|
||||
@change="importFromJSON"
|
||||
style="display: none"
|
||||
ref="inputChooseFileToImportFrom"
|
||||
type="file"
|
||||
style="display: none"
|
||||
accept="application/json"
|
||||
@change="importFromJSON"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
@@ -102,7 +118,11 @@
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="exportJSON" v-tooltip="$t('download_file')">
|
||||
<button
|
||||
v-tooltip="$t('download_file')"
|
||||
class="icon primary"
|
||||
@click="exportJSON"
|
||||
>
|
||||
{{ $t("export") }}
|
||||
</button>
|
||||
</span>
|
||||
@@ -116,6 +136,9 @@ import { fb } from "~/helpers/fb"
|
||||
import { getSettingSubject } from "~/newstore/settings"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
show: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fb,
|
||||
@@ -127,9 +150,6 @@ export default {
|
||||
SYNC_ENVIRONMENTS: getSettingSubject("syncEnvironments"),
|
||||
}
|
||||
},
|
||||
props: {
|
||||
show: Boolean,
|
||||
},
|
||||
computed: {
|
||||
environmentJson() {
|
||||
return JSON.stringify(this.$store.state.postwoman.environments, null, 2)
|
||||
@@ -154,11 +174,11 @@ export default {
|
||||
},
|
||||
}
|
||||
)
|
||||
.then(({ html_url }) => {
|
||||
.then((res) => {
|
||||
this.$toast.success(this.$t("gist_created"), {
|
||||
icon: "done",
|
||||
})
|
||||
window.open(html_url)
|
||||
window.open(res.html_url)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("something_went_wrong"), {
|
||||
@@ -168,7 +188,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async readEnvironmentGist() {
|
||||
let gist = prompt(this.$t("enter_gist_url"))
|
||||
const gist = prompt(this.$t("enter_gist_url"))
|
||||
if (!gist) return
|
||||
await this.$axios
|
||||
.$get(`https://api.github.com/gists/${gist.split("/").pop()}`, {
|
||||
@@ -177,7 +197,7 @@ export default {
|
||||
},
|
||||
})
|
||||
.then(({ files }) => {
|
||||
let environments = JSON.parse(Object.values(files)[0].content)
|
||||
const environments = JSON.parse(Object.values(files)[0].content)
|
||||
this.$store.commit("postwoman/replaceEnvironments", environments)
|
||||
this.fileImported()
|
||||
this.syncToFBEnvironments()
|
||||
@@ -197,10 +217,10 @@ export default {
|
||||
this.$refs.inputChooseFileToImportFrom.click()
|
||||
},
|
||||
replaceWithJSON() {
|
||||
let reader = new FileReader()
|
||||
const reader = new FileReader()
|
||||
reader.onload = ({ target }) => {
|
||||
let content = target.result
|
||||
let environments = JSON.parse(content)
|
||||
const content = target.result
|
||||
const environments = JSON.parse(content)
|
||||
this.$store.commit("postwoman/replaceEnvironments", environments)
|
||||
}
|
||||
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0])
|
||||
@@ -209,13 +229,13 @@ export default {
|
||||
this.$refs.inputChooseFileToReplaceWith.value = ""
|
||||
},
|
||||
importFromJSON() {
|
||||
let reader = new FileReader()
|
||||
const reader = new FileReader()
|
||||
reader.onload = ({ target }) => {
|
||||
let content = target.result
|
||||
let importFileObj = JSON.parse(content)
|
||||
const content = target.result
|
||||
const importFileObj = JSON.parse(content)
|
||||
if (
|
||||
importFileObj["_postman_variable_scope"] === "environment" ||
|
||||
importFileObj["_postman_variable_scope"] === "globals"
|
||||
importFileObj._postman_variable_scope === "environment" ||
|
||||
importFileObj._postman_variable_scope === "globals"
|
||||
) {
|
||||
this.importFromPostman(importFileObj)
|
||||
} else {
|
||||
@@ -227,25 +247,27 @@ export default {
|
||||
this.$refs.inputChooseFileToImportFrom.value = ""
|
||||
},
|
||||
importFromPostwoman(environments) {
|
||||
let confirmation = this.$t("file_imported")
|
||||
const confirmation = this.$t("file_imported")
|
||||
this.$store.commit("postwoman/importAddEnvironments", {
|
||||
environments,
|
||||
confirmation,
|
||||
})
|
||||
},
|
||||
importFromPostman({ name, values }) {
|
||||
let environment = { name, variables: [] }
|
||||
values.forEach(({ key, value }) => environment.variables.push({ key, value }))
|
||||
let environments = [environment]
|
||||
const environment = { name, variables: [] }
|
||||
values.forEach(({ key, value }) =>
|
||||
environment.variables.push({ key, value })
|
||||
)
|
||||
const environments = [environment]
|
||||
this.importFromPostwoman(environments)
|
||||
},
|
||||
exportJSON() {
|
||||
let text = this.environmentJson
|
||||
text = text.replace(/\n/g, "\r\n")
|
||||
let blob = new Blob([text], {
|
||||
const blob = new Blob([text], {
|
||||
type: "text/json",
|
||||
})
|
||||
let anchor = document.createElement("a")
|
||||
const anchor = document.createElement("a")
|
||||
anchor.download = "hoppscotch-environment.json"
|
||||
anchor.href = window.URL.createObjectURL(blob)
|
||||
anchor.target = "_blank"
|
||||
@@ -258,12 +280,17 @@ export default {
|
||||
})
|
||||
},
|
||||
syncEnvironments() {
|
||||
this.$store.commit("postwoman/replaceEnvironments", fb.currentEnvironments)
|
||||
this.$store.commit(
|
||||
"postwoman/replaceEnvironments",
|
||||
fb.currentEnvironments
|
||||
)
|
||||
this.fileImported()
|
||||
},
|
||||
syncToFBEnvironments() {
|
||||
if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) {
|
||||
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
|
||||
fb.writeEnvironments(
|
||||
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
|
||||
)
|
||||
}
|
||||
},
|
||||
fileImported() {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<AppSection icon="history" :label="$t('environments')" ref="environments" no-legend>
|
||||
<AppSection
|
||||
ref="environments"
|
||||
icon="history"
|
||||
:label="$t('environments')"
|
||||
no-legend
|
||||
>
|
||||
<div class="show-on-large-screen">
|
||||
<span class="select-wrapper">
|
||||
<select
|
||||
@@ -11,17 +16,24 @@
|
||||
<option v-if="environments.length === 0" value="0">
|
||||
{{ $t("create_new_environment") }}
|
||||
</option>
|
||||
<option v-for="(environment, index) in environments" :value="index" :key="index">
|
||||
<option
|
||||
v-for="(environment, index) in environments"
|
||||
:key="index"
|
||||
:value="index"
|
||||
>
|
||||
{{ environment.name }}
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<EnvironmentsAdd :show="showModalAdd" @hide-modal="displayModalAdd(false)" />
|
||||
<EnvironmentsAdd
|
||||
:show="showModalAdd"
|
||||
@hide-modal="displayModalAdd(false)"
|
||||
/>
|
||||
<EnvironmentsEdit
|
||||
:show="showModalEdit"
|
||||
:editingEnvironment="editingEnvironment"
|
||||
:editingEnvironmentIndex="editingEnvironmentIndex"
|
||||
:editing-environment="editingEnvironment"
|
||||
:editing-environment-index="editingEnvironmentIndex"
|
||||
@hide-modal="displayModalEdit(false)"
|
||||
/>
|
||||
<EnvironmentsImportExport
|
||||
@@ -42,13 +54,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="environments.length === 0" class="info">
|
||||
<i class="material-icons">help_outline</i> {{ $t("create_new_environment") }}
|
||||
<i class="material-icons">help_outline</i>
|
||||
{{ $t("create_new_environment") }}
|
||||
</p>
|
||||
<div class="virtual-list">
|
||||
<ul class="flex-col">
|
||||
<li v-for="(environment, index) in environments" :key="environment.name">
|
||||
<li
|
||||
v-for="(environment, index) in environments"
|
||||
:key="environment.name"
|
||||
>
|
||||
<EnvironmentsEnvironment
|
||||
:environmentIndex="index"
|
||||
:environment-index="index"
|
||||
:environment="environment"
|
||||
@edit-environment="editEnvironment(environment, index)"
|
||||
/>
|
||||
@@ -58,12 +74,6 @@
|
||||
</AppSection>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 270px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { fb } from "~/helpers/fb"
|
||||
import { getSettingSubject } from "~/newstore/settings"
|
||||
@@ -116,26 +126,30 @@ export default {
|
||||
environment: this.defaultEnvironment,
|
||||
environments: this.environments,
|
||||
})
|
||||
} else {
|
||||
if (this.environments[this.selectedEnvironmentIndex])
|
||||
} else if (this.environments[this.selectedEnvironmentIndex])
|
||||
this.$emit("use-environment", {
|
||||
environment: this.environments[this.selectedEnvironmentIndex],
|
||||
environments: this.environments,
|
||||
})
|
||||
else this.selectedEnvironmentIndex = -1
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
mounted() {
|
||||
this._keyListener = function (e) {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
this.showModalImportExport = this.showModalAdd = this.showModalEdit = false
|
||||
this.showModalImportExport =
|
||||
this.showModalAdd =
|
||||
this.showModalEdit =
|
||||
false
|
||||
}
|
||||
}
|
||||
document.addEventListener("keydown", this._keyListener.bind(this))
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
methods: {
|
||||
displayModalAdd(shouldDisplay) {
|
||||
this.showModalAdd = shouldDisplay
|
||||
@@ -160,12 +174,17 @@ export default {
|
||||
},
|
||||
syncEnvironments() {
|
||||
if (fb.currentUser !== null && this.SYNC_ENVIRONMENTS) {
|
||||
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
|
||||
fb.writeEnvironments(
|
||||
JSON.parse(JSON.stringify(this.$store.state.postwoman.environments))
|
||||
)
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.virtual-list {
|
||||
max-height: calc(100vh - 270px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<button class="icon" @click="signInWithGoogle" v-close-popover>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="material-icons">
|
||||
<button v-close-popover class="icon" @click="signInWithGoogle">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
class="material-icons"
|
||||
>
|
||||
<path
|
||||
d="M12.24 10.285V14.4h6.806c-.275 1.765-2.056 5.174-6.806 5.174-4.095 0-7.439-3.389-7.439-7.574s3.345-7.574 7.439-7.574c2.33 0 3.891.989 4.785 1.849l3.254-3.138C18.189 1.186 15.479 0 12.24 0c-6.635 0-12 5.365-12 12s5.365 12 12 12c6.926 0 11.52-4.869 11.52-11.726 0-.788-.085-1.39-.189-1.989H12.24z"
|
||||
/>
|
||||
@@ -11,8 +16,13 @@
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="signInWithGithub" v-close-popover>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="material-icons">
|
||||
<button v-close-popover class="icon" @click="signInWithGithub">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
class="material-icons"
|
||||
>
|
||||
<path
|
||||
d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"
|
||||
/>
|
||||
@@ -49,7 +59,7 @@ export default {
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t("yes"),
|
||||
onClick: (e, toastObject) => {
|
||||
onClick: (_, toastObject) => {
|
||||
fb.writeSettings("syncHistory", true)
|
||||
fb.writeSettings("syncCollections", true)
|
||||
fb.writeSettings("syncEnvironments", true)
|
||||
@@ -96,7 +106,7 @@ export default {
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t("yes"),
|
||||
onClick: async (e, toastObject) => {
|
||||
onClick: async (_, toastObject) => {
|
||||
const { user } = await fb.signInWithGithub()
|
||||
await user.linkAndRetrieveDataWithCredential(pendingCred)
|
||||
|
||||
@@ -111,7 +121,8 @@ export default {
|
||||
},
|
||||
async signInWithGithub() {
|
||||
try {
|
||||
const { credential, additionalUserInfo } = await fb.signInUserWithGithub()
|
||||
const { credential, additionalUserInfo } =
|
||||
await fb.signInUserWithGithub()
|
||||
|
||||
fb.setProviderInfo(credential.providerId, credential.accessToken)
|
||||
|
||||
@@ -122,7 +133,7 @@ export default {
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t("yes"),
|
||||
onClick: (e, toastObject) => {
|
||||
onClick: (_, toastObject) => {
|
||||
fb.writeSettings("syncHistory", true)
|
||||
fb.writeSettings("syncCollections", true)
|
||||
fb.writeSettings("syncEnvironments", true)
|
||||
@@ -169,7 +180,7 @@ export default {
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t("yes"),
|
||||
onClick: async (e, toastObject) => {
|
||||
onClick: async (_, toastObject) => {
|
||||
const { user } = await fb.signInUserWithGoogle()
|
||||
await user.linkAndRetrieveDataWithCredential(pendingCred)
|
||||
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppSection :label="$t('request')" ref="request" no-legend>
|
||||
<AppSection ref="request" :label="$t('request')" no-legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="socketio-url">{{ $t("url") }}</label>
|
||||
<input
|
||||
id="socketio-url"
|
||||
v-model="url"
|
||||
type="url"
|
||||
spellcheck="false"
|
||||
:class="{ error: !urlValid }"
|
||||
v-model="url"
|
||||
@keyup.enter="urlValid ? toggleConnection() : null"
|
||||
class="md:rounded-bl-lg"
|
||||
:placeholder="$t('url')"
|
||||
@keyup.enter="urlValid ? toggleConnection() : null"
|
||||
/>
|
||||
</li>
|
||||
<div>
|
||||
<li>
|
||||
<label for="socketio-path">{{ $t("path") }}</label>
|
||||
<input id="socketio-path" spellcheck="false" v-model="path" />
|
||||
<input id="socketio-path" v-model="path" spellcheck="false" />
|
||||
</li>
|
||||
</div>
|
||||
<div>
|
||||
<li>
|
||||
<label for="connect" class="hide-on-small-screen"> </label>
|
||||
<button
|
||||
:disabled="!urlValid"
|
||||
id="connect"
|
||||
:disabled="!urlValid"
|
||||
name="connect"
|
||||
@click="toggleConnection"
|
||||
class="rounded-b-lg md:rounded-bl-none md:rounded-br-lg"
|
||||
@click="toggleConnection"
|
||||
>
|
||||
{{ !connectionState ? $t("connect") : $t("disconnect") }}
|
||||
<span>
|
||||
@@ -43,7 +43,12 @@
|
||||
</ul>
|
||||
</AppSection>
|
||||
|
||||
<AppSection :label="$t('communication')" id="response" ref="response" no-legend>
|
||||
<AppSection
|
||||
id="response"
|
||||
ref="response"
|
||||
:label="$t('communication')"
|
||||
no-legend
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<RealtimeLog :title="$t('log')" :log="communication.log" />
|
||||
@@ -54,9 +59,9 @@
|
||||
<label for="event_name">{{ $t("event_name") }}</label>
|
||||
<input
|
||||
id="event_name"
|
||||
v-model="communication.eventName"
|
||||
name="event_name"
|
||||
type="text"
|
||||
v-model="communication.eventName"
|
||||
:readonly="!connectionState"
|
||||
/>
|
||||
</li>
|
||||
@@ -71,6 +76,7 @@
|
||||
<ul
|
||||
v-for="(input, index) of communication.inputs"
|
||||
:key="`input-${index}`"
|
||||
:class="{ 'border-t': index == 0 }"
|
||||
class="
|
||||
border-b border-dashed
|
||||
divide-y
|
||||
@@ -79,13 +85,12 @@
|
||||
divide-dashed divide-brdColor
|
||||
md:divide-y-0
|
||||
"
|
||||
:class="{ 'border-t': index == 0 }"
|
||||
>
|
||||
<li>
|
||||
<input
|
||||
v-model="communication.inputs[index]"
|
||||
name="message"
|
||||
type="text"
|
||||
v-model="communication.inputs[index]"
|
||||
:readonly="!connectionState"
|
||||
@keyup.enter="connectionState ? sendMessage() : null"
|
||||
/>
|
||||
@@ -93,9 +98,9 @@
|
||||
<div v-if="index + 1 !== communication.inputs.length">
|
||||
<li>
|
||||
<button
|
||||
v-tooltip.bottom="$t('delete')"
|
||||
class="icon"
|
||||
@click="removeCommunicationInput({ index })"
|
||||
v-tooltip.bottom="$t('delete')"
|
||||
>
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
@@ -103,7 +108,12 @@
|
||||
</div>
|
||||
<div v-if="index + 1 === communication.inputs.length">
|
||||
<li>
|
||||
<button id="send" name="send" :disabled="!connectionState" @click="sendMessage">
|
||||
<button
|
||||
id="send"
|
||||
name="send"
|
||||
:disabled="!connectionState"
|
||||
@click="sendMessage"
|
||||
>
|
||||
{{ $t("send") }}
|
||||
<span>
|
||||
<i class="material-icons">send</i>
|
||||
@@ -125,7 +135,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import io from "socket.io-client"
|
||||
import { io as Client } from "socket.io-client"
|
||||
import wildcard from "socketio-wildcard"
|
||||
import debounce from "~/helpers/utils/debounce"
|
||||
|
||||
@@ -144,6 +154,16 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
urlValid() {
|
||||
return this.isUrlValid
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
url() {
|
||||
this.debouncer()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (process.browser) {
|
||||
this.worker = this.$worker.createRejexWorker()
|
||||
@@ -153,16 +173,6 @@ export default {
|
||||
destroyed() {
|
||||
this.worker.terminate()
|
||||
},
|
||||
computed: {
|
||||
urlValid() {
|
||||
return this.isUrlValid
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
url(val) {
|
||||
this.debouncer()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
debouncer: debounce(function () {
|
||||
this.worker.postMessage({ type: "socketio", url: this.url })
|
||||
@@ -195,11 +205,11 @@ export default {
|
||||
if (!this.path) {
|
||||
this.path = "/socket.io"
|
||||
}
|
||||
this.io = new io(this.url, {
|
||||
this.io = new Client(this.url, {
|
||||
path: this.path,
|
||||
})
|
||||
// Add ability to listen to all events
|
||||
wildcard(io.Manager)(this.io)
|
||||
wildcard(Client.Manager)(this.io)
|
||||
this.io.on("connect", () => {
|
||||
this.connectionState = true
|
||||
this.communication.log = [
|
||||
@@ -228,7 +238,7 @@ export default {
|
||||
this.io.on("reconnect_error", (error) => {
|
||||
this.handleError(error)
|
||||
})
|
||||
this.io.on("error", (data) => {
|
||||
this.io.on("error", () => {
|
||||
this.handleError()
|
||||
})
|
||||
this.io.on("disconnect", () => {
|
||||
|
||||
@@ -23,13 +23,11 @@ export default {
|
||||
beforeMount() {
|
||||
registerApolloAuthUpdate()
|
||||
|
||||
let color = localStorage.getItem("THEME_COLOR") || "green"
|
||||
const color = localStorage.getItem("THEME_COLOR") || "green"
|
||||
document.documentElement.setAttribute("data-accent", color)
|
||||
},
|
||||
async mounted() {
|
||||
if (process.client) {
|
||||
document.body.classList.add("afterLoad")
|
||||
}
|
||||
|
||||
performMigrations()
|
||||
|
||||
@@ -53,7 +51,7 @@ export default {
|
||||
action: [
|
||||
{
|
||||
text: this.$t("reload"),
|
||||
onClick: (e, toastObject) => {
|
||||
onClick: (_, toastObject) => {
|
||||
toastObject.goAway(0)
|
||||
this.$router.push("/", () => window.location.reload())
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": "eslint",
|
||||
"*.{ts,js,vue}": "eslint",
|
||||
"*.{css,vue}": "stylelint"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user