Lint + ES6
This commit is contained in:
@@ -8,6 +8,7 @@ $responsiveWidth: 768px;
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
@apply antialiased;
|
@apply antialiased;
|
||||||
|
|
||||||
font-variant-ligatures: common-ligatures;
|
font-variant-ligatures: common-ligatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ body {
|
|||||||
@apply transition;
|
@apply transition;
|
||||||
@apply ease-in-out;
|
@apply ease-in-out;
|
||||||
@apply duration-200;
|
@apply duration-200;
|
||||||
|
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
-webkit-touch-callout: none;
|
-webkit-touch-callout: none;
|
||||||
}
|
}
|
||||||
@@ -211,6 +213,7 @@ hr {
|
|||||||
.tooltip-arrow {
|
.tooltip-arrow {
|
||||||
@apply mt-0;
|
@apply mt-0;
|
||||||
@apply mb-0;
|
@apply mb-0;
|
||||||
|
|
||||||
border-width: 5px 5px 0 5px;
|
border-width: 5px 5px 0 5px;
|
||||||
border-left-color: transparent !important;
|
border-left-color: transparent !important;
|
||||||
border-right-color: transparent !important;
|
border-right-color: transparent !important;
|
||||||
@@ -226,6 +229,7 @@ hr {
|
|||||||
.tooltip-arrow {
|
.tooltip-arrow {
|
||||||
@apply mt-0;
|
@apply mt-0;
|
||||||
@apply mb-0;
|
@apply mb-0;
|
||||||
|
|
||||||
border-width: 0 5px 5px 5px;
|
border-width: 0 5px 5px 5px;
|
||||||
border-left-color: transparent !important;
|
border-left-color: transparent !important;
|
||||||
border-right-color: transparent !important;
|
border-right-color: transparent !important;
|
||||||
@@ -241,6 +245,7 @@ hr {
|
|||||||
.tooltip-arrow {
|
.tooltip-arrow {
|
||||||
@apply ml-0;
|
@apply ml-0;
|
||||||
@apply mr-0;
|
@apply mr-0;
|
||||||
|
|
||||||
border-width: 5px 5px 5px 0;
|
border-width: 5px 5px 5px 0;
|
||||||
border-left-color: transparent !important;
|
border-left-color: transparent !important;
|
||||||
border-top-color: transparent !important;
|
border-top-color: transparent !important;
|
||||||
@@ -256,6 +261,7 @@ hr {
|
|||||||
.tooltip-arrow {
|
.tooltip-arrow {
|
||||||
@apply ml-0;
|
@apply ml-0;
|
||||||
@apply mr-0;
|
@apply mr-0;
|
||||||
|
|
||||||
border-width: 5px 0 5px 5px;
|
border-width: 5px 0 5px 5px;
|
||||||
border-top-color: transparent !important;
|
border-top-color: transparent !important;
|
||||||
border-right-color: transparent !important;
|
border-right-color: transparent !important;
|
||||||
@@ -278,11 +284,14 @@ hr {
|
|||||||
@apply rounded-lg;
|
@apply rounded-lg;
|
||||||
@apply overflow-auto;
|
@apply overflow-auto;
|
||||||
@apply shadow-lg;
|
@apply shadow-lg;
|
||||||
|
|
||||||
max-height: 256px;
|
max-height: 256px;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@apply flex-1;
|
@apply flex-1;
|
||||||
@apply m-0;
|
@apply m-0;
|
||||||
|
@apply justify-start;
|
||||||
|
@apply text-left;
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
@@ -290,11 +299,6 @@ hr {
|
|||||||
@apply items-stretch;
|
@apply items-stretch;
|
||||||
@apply flex-col;
|
@apply flex-col;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
@apply justify-start;
|
|
||||||
@apply text-left;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popover-arrow {
|
.popover-arrow {
|
||||||
@@ -362,6 +366,7 @@ button {
|
|||||||
@apply text-actColor;
|
@apply text-actColor;
|
||||||
@apply fill-current;
|
@apply fill-current;
|
||||||
@apply outline-none;
|
@apply outline-none;
|
||||||
|
|
||||||
box-shadow: inset 0 0 0 2px var(--fg-color);
|
box-shadow: inset 0 0 0 2px var(--fg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,6 +428,7 @@ button {
|
|||||||
@apply tracking-normal;
|
@apply tracking-normal;
|
||||||
@apply whitespace-no-wrap;
|
@apply whitespace-no-wrap;
|
||||||
@apply antialiased;
|
@apply antialiased;
|
||||||
|
|
||||||
word-wrap: normal;
|
word-wrap: normal;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
@@ -481,6 +487,7 @@ code {
|
|||||||
@apply select-text;
|
@apply select-text;
|
||||||
@apply resize-y;
|
@apply resize-y;
|
||||||
@apply outline-none;
|
@apply outline-none;
|
||||||
|
|
||||||
width: calc(100% - 16px);
|
width: calc(100% - 16px);
|
||||||
|
|
||||||
&:not([readonly]):not(.ace_editor):hover,
|
&:not([readonly]):not(.ace_editor):hover,
|
||||||
@@ -493,6 +500,7 @@ code {
|
|||||||
.method {
|
.method {
|
||||||
@apply cursor-pointer;
|
@apply cursor-pointer;
|
||||||
@apply uppercase;
|
@apply uppercase;
|
||||||
|
|
||||||
min-width: 128px;
|
min-width: 128px;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
@@ -530,11 +538,12 @@ pre {
|
|||||||
@apply w-full;
|
@apply w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:after {
|
&::after {
|
||||||
@apply inline-block;
|
@apply inline-block;
|
||||||
@apply absolute;
|
@apply absolute;
|
||||||
@apply pointer-events-none;
|
@apply pointer-events-none;
|
||||||
@apply font-icon;
|
@apply font-icon;
|
||||||
|
|
||||||
content: "\e313";
|
content: "\e313";
|
||||||
top: 16px;
|
top: 16px;
|
||||||
right: 16px;
|
right: 16px;
|
||||||
@@ -544,6 +553,7 @@ pre {
|
|||||||
select {
|
select {
|
||||||
@apply cursor-pointer;
|
@apply cursor-pointer;
|
||||||
@apply appearance-none;
|
@apply appearance-none;
|
||||||
|
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
||||||
&::-ms-expand {
|
&::-ms-expand {
|
||||||
@@ -563,7 +573,7 @@ input[type="checkbox"] {
|
|||||||
@apply align-middle;
|
@apply align-middle;
|
||||||
@apply cursor-pointer;
|
@apply cursor-pointer;
|
||||||
|
|
||||||
&:before {
|
&::before {
|
||||||
@apply border;
|
@apply border;
|
||||||
@apply border-fgColor;
|
@apply border-fgColor;
|
||||||
@apply rounded-lg;
|
@apply rounded-lg;
|
||||||
@@ -574,6 +584,7 @@ input[type="checkbox"] {
|
|||||||
@apply transition;
|
@apply transition;
|
||||||
@apply ease-in-out;
|
@apply ease-in-out;
|
||||||
@apply duration-200;
|
@apply duration-200;
|
||||||
|
|
||||||
content: "\2714";
|
content: "\2714";
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
@@ -581,7 +592,7 @@ input[type="checkbox"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:checked + label:before {
|
&:checked + label::before {
|
||||||
@apply bg-acColor;
|
@apply bg-acColor;
|
||||||
@apply border-acColor;
|
@apply border-acColor;
|
||||||
@apply text-actColor;
|
@apply text-actColor;
|
||||||
@@ -616,6 +627,7 @@ ol {
|
|||||||
@apply flex;
|
@apply flex;
|
||||||
@apply p-0;
|
@apply p-0;
|
||||||
@apply list-none;
|
@apply list-none;
|
||||||
|
|
||||||
margin: 4px 0 4px;
|
margin: 4px 0 4px;
|
||||||
|
|
||||||
ul,
|
ul,
|
||||||
@@ -684,6 +696,7 @@ ol li {
|
|||||||
textarea {
|
textarea {
|
||||||
@apply m-0;
|
@apply m-0;
|
||||||
@apply w-full;
|
@apply w-full;
|
||||||
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,6 +721,7 @@ ol li {
|
|||||||
@apply ease-in-out;
|
@apply ease-in-out;
|
||||||
@apply duration-200;
|
@apply duration-200;
|
||||||
@apply shadow-lg;
|
@apply shadow-lg;
|
||||||
|
|
||||||
bottom: 86px;
|
bottom: 86px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
z-index: 10001;
|
z-index: 10001;
|
||||||
@@ -753,6 +767,7 @@ section {
|
|||||||
@apply flex;
|
@apply flex;
|
||||||
@apply order-2;
|
@apply order-2;
|
||||||
@apply ml-4;
|
@apply ml-4;
|
||||||
|
|
||||||
width: 33%;
|
width: 33%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,16 +822,17 @@ section {
|
|||||||
@apply text-sm;
|
@apply text-sm;
|
||||||
@apply rounded-lg;
|
@apply rounded-lg;
|
||||||
@apply shadow-lg;
|
@apply shadow-lg;
|
||||||
|
|
||||||
padding: 16px !important;
|
padding: 16px !important;
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
@apply bg-gray-50;
|
@apply bg-gray-50;
|
||||||
@apply text-gray-900;
|
@apply text-gray-900;
|
||||||
@apply rounded-lg;
|
@apply rounded-lg;
|
||||||
|
@apply font-bold;
|
||||||
|
|
||||||
text-transform: none !important;
|
text-transform: none !important;
|
||||||
padding: 12px 16px !important;
|
padding: 12px 16px !important;
|
||||||
// font-weight: 500 !important;
|
|
||||||
@apply font-bold;
|
|
||||||
font-size: 16px !important;
|
font-size: 16px !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
margin-left: 8px !important;
|
margin-left: 8px !important;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { fb } from "~/helpers/fb"
|
import { fb } from "~/helpers/fb"
|
||||||
import closeIcon from "~/static/icons/close-24px.svg?inline"
|
import closeIcon from "~/static/icons/close-24px.svg?inline"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
closeIcon,
|
closeIcon,
|
||||||
@@ -60,6 +61,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
syncCollections() {
|
||||||
|
if (fb.currentUser !== null) {
|
||||||
|
if (fb.currentSettings[0].value) {
|
||||||
|
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
addFolder() {
|
addFolder() {
|
||||||
this.$store.commit("postwoman/addFolder", {
|
this.$store.commit("postwoman/addFolder", {
|
||||||
name: this.$data.name,
|
name: this.$data.name,
|
||||||
@@ -68,13 +76,6 @@ export default {
|
|||||||
this.hideModal()
|
this.hideModal()
|
||||||
this.syncCollections()
|
this.syncCollections()
|
||||||
},
|
},
|
||||||
syncCollections() {
|
|
||||||
if (fb.currentUser !== null) {
|
|
||||||
if (fb.currentSettings[0].value) {
|
|
||||||
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hideModal() {
|
hideModal() {
|
||||||
this.$emit("hide-modal")
|
this.$emit("hide-modal")
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div :class="['row-wrapper', dragging ? 'drop-zone':'' ]"
|
<div
|
||||||
@dragover.prevent
|
:class="['row-wrapper', dragging ? 'drop-zone' : '']"
|
||||||
@drop.prevent="dropEvent"
|
@dragover.prevent
|
||||||
@dragover="dragging=true"
|
@drop.prevent="dropEvent"
|
||||||
@drop="dragging=false"
|
@dragover="dragging = true"
|
||||||
@dragleave="dragging=false"
|
@drop="dragging = false"
|
||||||
@dragend="dragging=false"
|
@dragleave="dragging = false"
|
||||||
|
@dragend="dragging = false"
|
||||||
>
|
>
|
||||||
<button class="icon" @click="toggleShowChildren">
|
<button class="icon" @click="toggleShowChildren">
|
||||||
<i class="material-icons" v-show="!showChildren && !isFiltered">arrow_right</i>
|
<i class="material-icons" v-show="!showChildren && !isFiltered">arrow_right</i>
|
||||||
@@ -29,7 +30,11 @@
|
|||||||
</button>
|
</button>
|
||||||
<template slot="popover">
|
<template slot="popover">
|
||||||
<div>
|
<div>
|
||||||
<button class="icon" @click="$emit('add-folder', {folder: collection})" v-close-popover>
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="$emit('add-folder', { folder: collection })"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
<i class="material-icons">create_new_folder</i>
|
<i class="material-icons">create_new_folder</i>
|
||||||
<span>{{ $t("new_folder") }}</span>
|
<span>{{ $t("new_folder") }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -135,20 +140,20 @@ export default {
|
|||||||
})
|
})
|
||||||
this.syncCollections()
|
this.syncCollections()
|
||||||
},
|
},
|
||||||
dropEvent(event) {
|
dropEvent({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging;
|
this.dragging = !this.dragging
|
||||||
const oldCollectionIndex = event.dataTransfer.getData('oldCollectionIndex');
|
const oldCollectionIndex = dataTransfer.getData("oldCollectionIndex")
|
||||||
const oldFolderIndex = event.dataTransfer.getData('oldFolderIndex');
|
const oldFolderIndex = dataTransfer.getData("oldFolderIndex")
|
||||||
const oldFolderName = event.dataTransfer.getData('oldFolderName');
|
const oldFolderName = dataTransfer.getData("oldFolderName")
|
||||||
const requestIndex = event.dataTransfer.getData('requestIndex');
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
this.$store.commit("postwoman/moveRequest", {
|
this.$store.commit("postwoman/moveRequest", {
|
||||||
oldCollectionIndex: oldCollectionIndex,
|
oldCollectionIndex,
|
||||||
newCollectionIndex: this.$props.collectionIndex,
|
newCollectionIndex: this.$props.collectionIndex,
|
||||||
newFolderIndex: -1,
|
newFolderIndex: -1,
|
||||||
newFolderName: this.$props.collection.name,
|
newFolderName: this.$props.collection.name,
|
||||||
oldFolderIndex: oldFolderIndex,
|
oldFolderIndex,
|
||||||
oldFolderName: oldFolderName,
|
oldFolderName,
|
||||||
requestIndex: requestIndex
|
requestIndex,
|
||||||
})
|
})
|
||||||
this.syncCollections()
|
this.syncCollections()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
:class="['row-wrapper', dragging ? 'drop-zone':'' ]"
|
:class="['row-wrapper', dragging ? 'drop-zone' : '']"
|
||||||
@dragover.prevent
|
@dragover.prevent
|
||||||
@drop.prevent="dropEvent"
|
@drop.prevent="dropEvent"
|
||||||
@dragover="dragging=true"
|
@dragover="dragging = true"
|
||||||
@drop="dragging=false"
|
@drop="dragging = false"
|
||||||
@dragleave="dragging=false"
|
@dragleave="dragging = false"
|
||||||
@dragend="dragging=false"
|
@dragend="dragging = false"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<button class="icon" @click="toggleShowChildren">
|
<button class="icon" @click="toggleShowChildren">
|
||||||
@@ -29,7 +29,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="icon" @click="$emit('edit-folder', { folder, folderIndex, collectionIndex })" v-close-popover>
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="$emit('edit-folder', { folder, folderIndex, collectionIndex })"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
<i class="material-icons">edit</i>
|
<i class="material-icons">edit</i>
|
||||||
<span>{{ $t("edit") }}</span>
|
<span>{{ $t("edit") }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -63,7 +67,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul v-if="folder.folders && folder.folders.length" class="flex-col">
|
<ul v-if="folder.folders && folder.folders.length" class="flex-col">
|
||||||
<li v-for="(subFolder, subFolderIndex) in folder.folders" :key="subFolder.name" >
|
<li v-for="(subFolder, subFolderIndex) in folder.folders" :key="subFolder.name">
|
||||||
<folder
|
<folder
|
||||||
:folder="subFolder"
|
:folder="subFolder"
|
||||||
:folder-index="subFolderIndex"
|
:folder-index="subFolderIndex"
|
||||||
@@ -115,31 +119,31 @@ export default {
|
|||||||
this.$store.commit("postwoman/removeFolder", {
|
this.$store.commit("postwoman/removeFolder", {
|
||||||
collectionIndex: this.$props.collectionIndex,
|
collectionIndex: this.$props.collectionIndex,
|
||||||
folderName: this.$props.folder.name,
|
folderName: this.$props.folder.name,
|
||||||
folderIndex: this.$props.folderIndex
|
folderIndex: this.$props.folderIndex,
|
||||||
})
|
})
|
||||||
this.syncCollections()
|
this.syncCollections()
|
||||||
this.$toast.error(this.$t("deleted"), {
|
this.$toast.error(this.$t("deleted"), {
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
dropEvent(event) {
|
dropEvent({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging;
|
this.dragging = !this.dragging
|
||||||
const oldCollectionIndex = event.dataTransfer.getData('oldCollectionIndex');
|
const oldCollectionIndex = dataTransfer.getData("oldCollectionIndex")
|
||||||
const oldFolderIndex = event.dataTransfer.getData('oldFolderIndex');
|
const oldFolderIndex = dataTransfer.getData("oldFolderIndex")
|
||||||
const oldFolderName = event.dataTransfer.getData('oldFolderName');
|
const oldFolderName = dataTransfer.getData("oldFolderName")
|
||||||
const requestIndex = event.dataTransfer.getData('requestIndex');
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
|
|
||||||
this.$store.commit("postwoman/moveRequest", {
|
this.$store.commit("postwoman/moveRequest", {
|
||||||
oldCollectionIndex: oldCollectionIndex,
|
oldCollectionIndex,
|
||||||
newCollectionIndex: this.$props.collectionIndex,
|
newCollectionIndex: this.$props.collectionIndex,
|
||||||
newFolderIndex: this.$props.folderIndex,
|
newFolderIndex: this.$props.folderIndex,
|
||||||
newFolderName: this.$props.folder.name,
|
newFolderName: this.$props.folder.name,
|
||||||
oldFolderIndex: oldFolderIndex,
|
oldFolderIndex,
|
||||||
oldFolderName: oldFolderName,
|
oldFolderName,
|
||||||
requestIndex: requestIndex
|
requestIndex,
|
||||||
})
|
})
|
||||||
this.syncCollections()
|
this.syncCollections()
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ export default {
|
|||||||
},
|
},
|
||||||
replaceWithJSON() {
|
replaceWithJSON() {
|
||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
reader.onload = (event) => {
|
reader.onload = ({ target }) => {
|
||||||
let content = event.target.result
|
let content = target.result
|
||||||
let collections = JSON.parse(content)
|
let collections = JSON.parse(content)
|
||||||
if (collections[0]) {
|
if (collections[0]) {
|
||||||
let [name, folders, requests] = Object.keys(collections[0])
|
let [name, folders, requests] = Object.keys(collections[0])
|
||||||
@@ -130,8 +130,8 @@ export default {
|
|||||||
},
|
},
|
||||||
importFromJSON() {
|
importFromJSON() {
|
||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
reader.onload = (event) => {
|
reader.onload = ({ target }) => {
|
||||||
let content = event.target.result
|
let content = target.result
|
||||||
let collections = JSON.parse(content)
|
let collections = JSON.parse(content)
|
||||||
if (collections[0]) {
|
if (collections[0]) {
|
||||||
let [name, folders, requests] = Object.keys(collections[0])
|
let [name, folders, requests] = Object.keys(collections[0])
|
||||||
@@ -191,24 +191,23 @@ export default {
|
|||||||
icon: "error",
|
icon: "error",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
parsePostmanCollection(collection) {
|
parsePostmanCollection({ info, name, item }) {
|
||||||
let postwomanCollection =
|
let postwomanCollection = {
|
||||||
{
|
name: "",
|
||||||
name: "",
|
folders: [],
|
||||||
folders: [],
|
requests: [],
|
||||||
requests: [],
|
}
|
||||||
}
|
|
||||||
|
|
||||||
postwomanCollection.name = collection.info ? collection.info.name : collection.name
|
postwomanCollection.name = info ? info.name : name
|
||||||
|
|
||||||
if (collection.item && collection.item.length > 0) {
|
if (item && item.length > 0) {
|
||||||
for (let collectionItem of collection.item) {
|
for (let collectionItem of item) {
|
||||||
if (collectionItem.request) {
|
if (collectionItem.request) {
|
||||||
if (postwomanCollection.hasOwnProperty('folders')) {
|
if (postwomanCollection.hasOwnProperty("folders")) {
|
||||||
postwomanCollection.name = collection.info ? collection.info.name : collection.name
|
postwomanCollection.name = info ? info.name : name
|
||||||
postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem))
|
postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem))
|
||||||
} else {
|
} else {
|
||||||
postwomanCollection.name = collection.name ? collection.name : ""
|
postwomanCollection.name = name ? name : ""
|
||||||
postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem))
|
postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem))
|
||||||
}
|
}
|
||||||
} else if (this.hasFolder(collectionItem)) {
|
} else if (this.hasFolder(collectionItem)) {
|
||||||
@@ -295,7 +294,7 @@ export default {
|
|||||||
return pwRequest
|
return pwRequest
|
||||||
},
|
},
|
||||||
hasFolder(item) {
|
hasFolder(item) {
|
||||||
return item.hasOwnProperty('item')
|
return item.hasOwnProperty("item")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export default {
|
|||||||
editingCollection: undefined,
|
editingCollection: undefined,
|
||||||
editingCollectionIndex: undefined,
|
editingCollectionIndex: undefined,
|
||||||
editingFolder: undefined,
|
editingFolder: undefined,
|
||||||
editingFolderName:undefined,
|
editingFolderName: undefined,
|
||||||
editingFolderIndex: undefined,
|
editingFolderIndex: undefined,
|
||||||
editingRequest: undefined,
|
editingRequest: undefined,
|
||||||
editingRequestIndex: undefined,
|
editingRequestIndex: undefined,
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
draggable="true"
|
draggable="true"
|
||||||
@dragstart="dragStart"
|
@dragstart="dragStart"
|
||||||
@dragover.stop
|
@dragover.stop
|
||||||
@dragleave="dragging=false"
|
@dragleave="dragging = false"
|
||||||
@dragend="dragging=false"
|
@dragend="dragging = false"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -23,11 +23,19 @@
|
|||||||
</button>
|
</button>
|
||||||
<template slot="popover">
|
<template slot="popover">
|
||||||
<div>
|
<div>
|
||||||
<button class="icon" @click="$emit('edit-request',{ collectionIndex,
|
<button
|
||||||
folderIndex,
|
class="icon"
|
||||||
folderName,
|
@click="
|
||||||
request,
|
$emit('edit-request', {
|
||||||
requestIndex } )" v-close-popover>
|
collectionIndex,
|
||||||
|
folderIndex,
|
||||||
|
folderName,
|
||||||
|
request,
|
||||||
|
requestIndex,
|
||||||
|
})
|
||||||
|
"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
<i class="material-icons">edit</i>
|
<i class="material-icons">edit</i>
|
||||||
<span>{{ $t("edit") }}</span>
|
<span>{{ $t("edit") }}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -73,12 +81,12 @@ export default {
|
|||||||
selectRequest() {
|
selectRequest() {
|
||||||
this.$store.commit("postwoman/selectRequest", { request: this.request })
|
this.$store.commit("postwoman/selectRequest", { request: this.request })
|
||||||
},
|
},
|
||||||
dragStart(event) {
|
dragStart({ dataTransfer }) {
|
||||||
this.dragging = !this.dragging;
|
this.dragging = !this.dragging
|
||||||
event.dataTransfer.setData('oldCollectionIndex', this.$props.collectionIndex);
|
dataTransfer.setData("oldCollectionIndex", this.$props.collectionIndex)
|
||||||
event.dataTransfer.setData('oldFolderIndex', this.$props.folderIndex)
|
dataTransfer.setData("oldFolderIndex", this.$props.folderIndex)
|
||||||
event.dataTransfer.setData('oldFolderName', this.$props.folderName);
|
dataTransfer.setData("oldFolderName", this.$props.folderName)
|
||||||
event.dataTransfer.setData('requestIndex', this.$props.requestIndex);
|
dataTransfer.setData("requestIndex", this.$props.requestIndex)
|
||||||
},
|
},
|
||||||
removeRequest() {
|
removeRequest() {
|
||||||
if (!confirm(this.$t("are_you_sure_remove_request"))) return
|
if (!confirm(this.$t("are_you_sure_remove_request"))) return
|
||||||
|
|||||||
@@ -108,13 +108,13 @@ export default {
|
|||||||
"requestData.folderName": function resetRequestIndex() {
|
"requestData.folderName": function resetRequestIndex() {
|
||||||
this.$data.requestData.requestIndex = undefined
|
this.$data.requestData.requestIndex = undefined
|
||||||
},
|
},
|
||||||
editingRequest(request) {
|
editingRequest({ label }) {
|
||||||
this.defaultRequestName = request.label || "My Request"
|
this.defaultRequestName = label || "My Request"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
folders() {
|
folders() {
|
||||||
const collections = this.$store.state.postwoman.collections
|
const collections = this.$store.state.postwoman.collections
|
||||||
const collectionIndex = this.$data.requestData.collectionIndex
|
const collectionIndex = this.$data.requestData.collectionIndex
|
||||||
const userSelectedAnyCollection = collectionIndex !== undefined
|
const userSelectedAnyCollection = collectionIndex !== undefined
|
||||||
if (!userSelectedAnyCollection) return []
|
if (!userSelectedAnyCollection) return []
|
||||||
@@ -134,7 +134,7 @@ export default {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const userSelectedAnyFolder = folderName !== undefined && folderName !== ''
|
const userSelectedAnyFolder = folderName !== undefined && folderName !== ""
|
||||||
|
|
||||||
if (userSelectedAnyFolder) {
|
if (userSelectedAnyFolder) {
|
||||||
const collection = collections[collectionIndex]
|
const collection = collections[collectionIndex]
|
||||||
@@ -144,7 +144,7 @@ export default {
|
|||||||
const collection = collections[collectionIndex]
|
const collection = collections[collectionIndex]
|
||||||
const noCollectionAvailable = collection !== undefined
|
const noCollectionAvailable = collection !== undefined
|
||||||
|
|
||||||
if (!noCollectionAvailable){
|
if (!noCollectionAvailable) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ export default {
|
|||||||
|
|
||||||
function getFolderNames(folders, namesList) {
|
function getFolderNames(folders, namesList) {
|
||||||
if (folders.length) {
|
if (folders.length) {
|
||||||
folders.forEach(folder => {
|
folders.forEach((folder) => {
|
||||||
namesList.push(folder.name)
|
namesList.push(folder.name)
|
||||||
if (folder.folders && folder.folders.length) {
|
if (folder.folders && folder.folders.length) {
|
||||||
getFolderNames(folder.folders, namesList)
|
getFolderNames(folder.folders, namesList)
|
||||||
@@ -205,14 +205,15 @@ function getFolderNames(folders, namesList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findFolder(folderName, currentFolder) {
|
function findFolder(folderName, currentFolder) {
|
||||||
let selectedFolder, result;
|
let selectedFolder
|
||||||
|
let result
|
||||||
|
|
||||||
if (folderName === currentFolder.name){
|
if (folderName === currentFolder.name) {
|
||||||
return currentFolder
|
return currentFolder
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < currentFolder.folders.length; i++) {
|
for (let i = 0; i < currentFolder.folders.length; i++) {
|
||||||
selectedFolder = currentFolder.folders[i];
|
selectedFolder = currentFolder.folders[i]
|
||||||
|
|
||||||
result = findFolder(folderName, selectedFolder)
|
result = findFolder(folderName, selectedFolder)
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
editingEnvironment: function (update) {
|
editingEnvironment(update) {
|
||||||
this.name =
|
this.name =
|
||||||
this.$props.editingEnvironment && this.$props.editingEnvironment.name
|
this.$props.editingEnvironment && this.$props.editingEnvironment.name
|
||||||
? this.$props.editingEnvironment.name
|
? this.$props.editingEnvironment.name
|
||||||
@@ -151,13 +151,13 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clearContent(e) {
|
clearContent({ target }) {
|
||||||
this.$store.commit("postwoman/removeVariables", [])
|
this.$store.commit("postwoman/removeVariables", [])
|
||||||
e.target.innerHTML = this.doneButton
|
target.innerHTML = this.doneButton
|
||||||
this.$toast.info(this.$t("cleared"), {
|
this.$toast.info(this.$t("cleared"), {
|
||||||
icon: "clear_all",
|
icon: "clear_all",
|
||||||
})
|
})
|
||||||
setTimeout(() => (e.target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
|
setTimeout(() => (target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
|
||||||
},
|
},
|
||||||
addEnvironmentVariable() {
|
addEnvironmentVariable() {
|
||||||
let value = { key: "", value: "" }
|
let value = { key: "", value: "" }
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ export default {
|
|||||||
},
|
},
|
||||||
replaceWithJSON() {
|
replaceWithJSON() {
|
||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
reader.onload = (event) => {
|
reader.onload = ({ target }) => {
|
||||||
let content = event.target.result
|
let content = target.result
|
||||||
let environments = JSON.parse(content)
|
let environments = JSON.parse(content)
|
||||||
this.$store.commit("postwoman/replaceEnvironments", environments)
|
this.$store.commit("postwoman/replaceEnvironments", environments)
|
||||||
}
|
}
|
||||||
@@ -120,8 +120,8 @@ export default {
|
|||||||
},
|
},
|
||||||
importFromJSON() {
|
importFromJSON() {
|
||||||
let reader = new FileReader()
|
let reader = new FileReader()
|
||||||
reader.onload = (event) => {
|
reader.onload = ({ target }) => {
|
||||||
let content = event.target.result
|
let content = target.result
|
||||||
let importFileObj = JSON.parse(content)
|
let importFileObj = JSON.parse(content)
|
||||||
if (
|
if (
|
||||||
importFileObj["_postman_variable_scope"] === "environment" ||
|
importFileObj["_postman_variable_scope"] === "environment" ||
|
||||||
@@ -143,11 +143,9 @@ export default {
|
|||||||
confirmation,
|
confirmation,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
importFromPostman(importFileObj) {
|
importFromPostman({ name, values }) {
|
||||||
let environment = { name: importFileObj.name, variables: [] }
|
let environment = { name: name, variables: [] }
|
||||||
importFileObj.values.forEach((element) =>
|
values.forEach(({ key, value }) => environment.variables.push({ key: key, value: value }))
|
||||||
environment.variables.push({ key: element.key, value: element.value })
|
|
||||||
)
|
|
||||||
let environments = [environment]
|
let environments = [environment]
|
||||||
this.importFromPostwoman(environments)
|
this.importFromPostwoman(environments)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async deleteFeed(feed) {
|
async deleteFeed({ id }) {
|
||||||
await fb.deleteFeed(feed.id)
|
await fb.deleteFeed(id)
|
||||||
this.$toast.error(this.$t("deleted"), {
|
this.$toast.error(this.$t("deleted"), {
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isFieldHighlighted({ field }) {
|
isFieldHighlighted({ field }) {
|
||||||
return !!this.highlightedFields.find(
|
return !!this.highlightedFields.find(({ name }) => name === field.name)
|
||||||
(highlightedField) => highlightedField.name === field.name
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,8 +368,8 @@ export default {
|
|||||||
useHistory(entry) {
|
useHistory(entry) {
|
||||||
this.$emit("useHistory", entry)
|
this.$emit("useHistory", entry)
|
||||||
},
|
},
|
||||||
findEntryStatus(entry) {
|
findEntryStatus({ status }) {
|
||||||
const foundStatusGroup = findStatusGroup(entry.status)
|
const foundStatusGroup = findStatusGroup(status)
|
||||||
return (
|
return (
|
||||||
foundStatusGroup || {
|
foundStatusGroup || {
|
||||||
className: "",
|
className: "",
|
||||||
|
|||||||
@@ -452,11 +452,5 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
|
||||||
availableLocales() {
|
|
||||||
return this.$i18n.locales.filter((i) => i.code !== this.$i18n.locale)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ export default {
|
|||||||
const blob = new Blob([bytes.buffer])
|
const blob = new Blob([bytes.buffer])
|
||||||
|
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = (e) => {
|
reader.onload = ({ target }) => {
|
||||||
this.imageSource = e.target.result
|
this.imageSource = target.result
|
||||||
}
|
}
|
||||||
reader.readAsDataURL(blob)
|
reader.readAsDataURL(blob)
|
||||||
},
|
},
|
||||||
@@ -65,8 +65,8 @@ export default {
|
|||||||
const blob = new Blob([bytes.buffer])
|
const blob = new Blob([bytes.buffer])
|
||||||
|
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = (e) => {
|
reader.onload = ({ target }) => {
|
||||||
this.imageSource = e.target.result
|
this.imageSource = target.result
|
||||||
}
|
}
|
||||||
reader.readAsDataURL(blob)
|
reader.readAsDataURL(blob)
|
||||||
},
|
},
|
||||||
@@ -78,7 +78,8 @@ export default {
|
|||||||
const url = URL.createObjectURL(file)
|
const url = URL.createObjectURL(file)
|
||||||
a.href = url
|
a.href = url
|
||||||
// TODO get uri from meta
|
// TODO get uri from meta
|
||||||
a.download = `response on ${Date()}`.replace(/\./g, "[dot]")
|
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.${this.responseType}`
|
||||||
|
// `response on ${Date()}`.replace(/\./g, "[dot]")
|
||||||
document.body.appendChild(a)
|
document.body.appendChild(a)
|
||||||
a.click()
|
a.click()
|
||||||
this.$refs.downloadResponse.innerHTML = this.doneButton
|
this.$refs.downloadResponse.innerHTML = this.doneButton
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { isJSONContentType } from "~/helpers/utils/contenttypes"
|
import { isJSONContentType } from "~/helpers/utils/contenttypes"
|
||||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getSourcePrefix,
|
getSourcePrefix,
|
||||||
},
|
},
|
||||||
updated: function () {
|
updated() {
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
if (this.$refs.log) {
|
if (this.$refs.log) {
|
||||||
this.$refs.log.scrollBy(0, this.$refs.log.scrollHeight + 100)
|
this.$refs.log.scrollBy(0, this.$refs.log.scrollHeight + 100)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ import Paho from "paho-mqtt"
|
|||||||
import { wsValid } from "~/helpers/utils/valid"
|
import { wsValid } from "~/helpers/utils/valid"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: function () {
|
data() {
|
||||||
return {
|
return {
|
||||||
url: "wss://test.mosquitto.org:8081",
|
url: "wss://test.mosquitto.org:8081",
|
||||||
client: null,
|
client: null,
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
lang(value) {
|
lang(value) {
|
||||||
this.editor.getSession().setMode("ace/mode/" + value)
|
this.editor.getSession().setMode(`ace/mode/${value}`)
|
||||||
},
|
},
|
||||||
options(value) {
|
options(value) {
|
||||||
this.editor.setOptions(value)
|
this.editor.setOptions(value)
|
||||||
|
|||||||
@@ -196,12 +196,11 @@ export default {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
this.source
|
this.source
|
||||||
.filter((entry) => {
|
.filter(
|
||||||
return (
|
(entry) =>
|
||||||
entry.toLowerCase().startsWith(input.toLowerCase()) &&
|
entry.toLowerCase().startsWith(input.toLowerCase()) &&
|
||||||
input.toLowerCase() !== entry.toLowerCase()
|
input.toLowerCase() !== entry.toLowerCase()
|
||||||
)
|
)
|
||||||
})
|
|
||||||
// Cut off the part that's already been typed.
|
// Cut off the part that's already been typed.
|
||||||
.map((entry) => entry.substring(this.selectionStart))
|
.map((entry) => entry.substring(this.selectionStart))
|
||||||
// We only want the top 6 suggestions.
|
// We only want the top 6 suggestions.
|
||||||
|
|||||||
107
nuxt.config.js
107
nuxt.config.js
@@ -1,5 +1,4 @@
|
|||||||
// Some helpful application constants.
|
// Common options
|
||||||
// TODO: Use these when rendering the pages (rather than just for head/meta tags...)
|
|
||||||
export const options = {
|
export const options = {
|
||||||
name: "Hoppscotch",
|
name: "Hoppscotch",
|
||||||
shortDescription: "A free, fast and beautiful API request builder",
|
shortDescription: "A free, fast and beautiful API request builder",
|
||||||
@@ -15,14 +14,20 @@ export const options = {
|
|||||||
twitter: "@liyasthomas",
|
twitter: "@liyasthomas",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
// Disable server-side rendering (https://go.nuxtjs.dev/ssr-mode)
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
|
||||||
|
// Target (https://go.nuxtjs.dev/config-target)
|
||||||
|
target: "static",
|
||||||
|
|
||||||
|
// Default: localhost
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0", // default: localhost
|
host: "0.0.0.0",
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Headers of the page
|
// Global page headers (https://go.nuxtjs.dev/config-head)
|
||||||
*/
|
|
||||||
head: {
|
head: {
|
||||||
title: `${options.name} • ${options.shortDescription}`,
|
title: `${options.name} • ${options.shortDescription}`,
|
||||||
meta: [
|
meta: [
|
||||||
@@ -81,66 +86,60 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Customize the progress-bar color
|
// Customize the progress-bar color (https://nuxtjs.org/api/configuration-loading/#customizing-the-progress-bar)
|
||||||
*/
|
|
||||||
loading: {
|
loading: {
|
||||||
color: options.loading.color,
|
color: options.loading.color,
|
||||||
continuous: true,
|
continuous: true,
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Customize the loading indicator
|
// Customize the loading indicator (https://nuxtjs.org/api/configuration-loading-indicator)
|
||||||
*/
|
|
||||||
loadingIndicator: {
|
loadingIndicator: {
|
||||||
name: "pulse",
|
name: "pulse",
|
||||||
color: options.loading.color,
|
color: options.loading.color,
|
||||||
background: options.loading.background,
|
background: options.loading.background,
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Global CSS
|
// Global CSS (https://go.nuxtjs.dev/config-css)
|
||||||
*/
|
|
||||||
css: ["~/assets/scss/styles.scss", "~/assets/scss/themes.scss", "~/assets/scss/fonts.scss"],
|
css: ["~/assets/scss/styles.scss", "~/assets/scss/themes.scss", "~/assets/scss/fonts.scss"],
|
||||||
/*
|
|
||||||
** Plugins to load before mounting the App
|
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
|
||||||
*/
|
|
||||||
plugins: ["~/plugins/vuex-persist", "~/plugins/v-tooltip"],
|
plugins: ["~/plugins/vuex-persist", "~/plugins/v-tooltip"],
|
||||||
/*
|
|
||||||
** Auto import components
|
// Auto import components (https://go.nuxtjs.dev/config-components)
|
||||||
** See https://nuxtjs.org/api/configuration-components
|
|
||||||
*/
|
|
||||||
components: true,
|
components: true,
|
||||||
/*
|
|
||||||
** Nuxt.js dev-modules
|
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
|
||||||
*/
|
|
||||||
buildModules: [
|
buildModules: [
|
||||||
// https://pwa.nuxtjs.org
|
// https://github.com/nuxt-community/pwa-module
|
||||||
"@nuxtjs/pwa",
|
"@nuxtjs/pwa",
|
||||||
// Doc: https://github.com/nuxt-community/analytics-module
|
// https://github.com/nuxt-community/analytics-module
|
||||||
"@nuxtjs/google-analytics",
|
"@nuxtjs/google-analytics",
|
||||||
// Doc: https://github.com/nuxt-community/gtm-module
|
// https://github.com/nuxt-community/gtm-module
|
||||||
"@nuxtjs/gtm",
|
"@nuxtjs/gtm",
|
||||||
// Doc: https://github.com/nuxt-community/svg-module
|
// https://github.com/nuxt-community/svg-module
|
||||||
"@nuxtjs/svg",
|
"@nuxtjs/svg",
|
||||||
// Doc: https://tailwindcss.nuxtjs.org
|
// https://github.com/nuxt-community/nuxt-tailwindcss
|
||||||
"@nuxtjs/tailwindcss",
|
"@nuxtjs/tailwindcss",
|
||||||
// Doc: https://color-mode.nuxtjs.org
|
// https://github.com/nuxt-community/color-mode-module
|
||||||
"@nuxtjs/color-mode",
|
"@nuxtjs/color-mode",
|
||||||
],
|
],
|
||||||
/*
|
|
||||||
** Nuxt.js modules
|
// Modules (https://go.nuxtjs.dev/config-modules)
|
||||||
*/
|
|
||||||
modules: [
|
modules: [
|
||||||
// https://axios.nuxtjs.org
|
// https://github.com/nuxt-community/axios-module
|
||||||
"@nuxtjs/axios",
|
"@nuxtjs/axios",
|
||||||
// https://github.com/nuxt-community/modules/tree/master/packages/toast
|
// https://github.com/nuxt-community/modules/tree/master/packages/toast
|
||||||
"@nuxtjs/toast",
|
"@nuxtjs/toast",
|
||||||
// Doc: https://github.com/nuxt-community/nuxt-i18n
|
// https://github.com/nuxt-community/i18n-module
|
||||||
"nuxt-i18n",
|
"nuxt-i18n",
|
||||||
// Doc: https://github.com/nuxt-community/robots-module
|
// https://github.com/nuxt-community/robots-module
|
||||||
"@nuxtjs/robots",
|
"@nuxtjs/robots",
|
||||||
// Doc: https://github.com/nuxt-community/sitemap-module
|
// https://github.com/nuxt-community/sitemap-module
|
||||||
"@nuxtjs/sitemap",
|
"@nuxtjs/sitemap",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// PWA module configuration (https://pwa.nuxtjs.org/setup)
|
||||||
pwa: {
|
pwa: {
|
||||||
meta: {
|
meta: {
|
||||||
ogHost: process.env.BASE_URL,
|
ogHost: process.env.BASE_URL,
|
||||||
@@ -160,32 +159,46 @@ export default {
|
|||||||
},
|
},
|
||||||
workbox: false,
|
workbox: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Toast module configuration (https://github.com/nuxt-community/modules/tree/master/packages/toast)
|
||||||
toast: {
|
toast: {
|
||||||
position: "bottom-center",
|
position: "bottom-center",
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
theme: "bubble",
|
theme: "bubble",
|
||||||
keepOnHover: true,
|
keepOnHover: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Google Analytics module configuration (https://github.com/nuxt-community/analytics-module)
|
||||||
googleAnalytics: {
|
googleAnalytics: {
|
||||||
id: process.env.GA_ID,
|
id: process.env.GA_ID,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Google Tag Manager module configuration (https://github.com/nuxt-community/gtm-module)
|
||||||
gtm: {
|
gtm: {
|
||||||
id: process.env.GTM_ID,
|
id: process.env.GTM_ID,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Sitemap module configuration (https://github.com/nuxt-community/sitemap-module)
|
||||||
sitemap: {
|
sitemap: {
|
||||||
hostname: process.env.BASE_URL || "https://hoppscotch.io/",
|
hostname: process.env.BASE_URL || "https://hoppscotch.io/",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Robots module configuration (https://github.com/nuxt-community/robots-module)
|
||||||
robots: {
|
robots: {
|
||||||
UserAgent: "*",
|
UserAgent: "*",
|
||||||
Disallow: "",
|
Disallow: "",
|
||||||
Allow: "/",
|
Allow: "/",
|
||||||
Sitemap: `${process.env.BASE_URL}sitemap.xml`,
|
Sitemap: `${process.env.BASE_URL}sitemap.xml`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Color Mode module configuration (https://github.com/nuxt-community/color-mode-module)
|
||||||
colorMode: {
|
colorMode: {
|
||||||
classSuffix: "",
|
classSuffix: "",
|
||||||
preference: "dark",
|
preference: "dark",
|
||||||
fallback: "dark",
|
fallback: "dark",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// i18n module configuration (https://github.com/nuxt-community/i18n-module)
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: [
|
locales: [
|
||||||
{
|
{
|
||||||
@@ -296,13 +309,10 @@ export default {
|
|||||||
fallbackLocale: "en",
|
fallbackLocale: "en",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Build configuration
|
// Build Configuration (https://go.nuxtjs.dev/config-build)
|
||||||
*/
|
|
||||||
build: {
|
build: {
|
||||||
/*
|
// You can extend webpack config here
|
||||||
** You can extend webpack config here
|
|
||||||
*/
|
|
||||||
extend(config, ctx) {
|
extend(config, ctx) {
|
||||||
// Sets webpack's mode to development if `isDev` is true.
|
// Sets webpack's mode to development if `isDev` is true.
|
||||||
if (ctx.isDev) {
|
if (ctx.isDev) {
|
||||||
@@ -316,17 +326,20 @@ export default {
|
|||||||
cache: true,
|
cache: true,
|
||||||
// hardSource: true,
|
// hardSource: true,
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
** Generate configuration
|
// Generate configuration (https://nuxtjs.org/api/configuration-generate)
|
||||||
*/
|
|
||||||
generate: {
|
generate: {
|
||||||
fallback: true,
|
fallback: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Public runtime configuration (https://nuxtjs.org/guide/runtime-config)
|
||||||
publicRuntimeConfig: {
|
publicRuntimeConfig: {
|
||||||
GA_ID: process.env.GA_ID || "UA-61422507-4",
|
GA_ID: process.env.GA_ID || "UA-61422507-4",
|
||||||
GTM_ID: process.env.GTM_ID || "GTM-NMKVBMV",
|
GTM_ID: process.env.GTM_ID || "GTM-NMKVBMV",
|
||||||
BASE_URL: process.env.BASE_URL || "https://hoppscotch.io/",
|
BASE_URL: process.env.BASE_URL || "https://hoppscotch.io/",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Private runtime configuration (https://nuxtjs.org/guide/runtime-config)
|
||||||
privateRuntimeConfig: {
|
privateRuntimeConfig: {
|
||||||
API_KEY: process.env.API_KEY,
|
API_KEY: process.env.API_KEY,
|
||||||
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
|
AUTH_DOMAIN: process.env.AUTH_DOMAIN,
|
||||||
|
|||||||
@@ -2390,6 +2390,7 @@ export default {
|
|||||||
switch (name) {
|
switch (name) {
|
||||||
case "bodyParams":
|
case "bodyParams":
|
||||||
this.bodyParams = []
|
this.bodyParams = []
|
||||||
|
this.files = []
|
||||||
break
|
break
|
||||||
case "rawParams":
|
case "rawParams":
|
||||||
this.rawParams = "{}"
|
this.rawParams = "{}"
|
||||||
@@ -2518,7 +2519,6 @@ export default {
|
|||||||
icon: "attach_file",
|
icon: "attach_file",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$refs.attachment.value = ""
|
|
||||||
},
|
},
|
||||||
uploadPayload() {
|
uploadPayload() {
|
||||||
this.rawInput = true
|
this.rawInput = true
|
||||||
|
|||||||
@@ -205,8 +205,8 @@ export const mutations = {
|
|||||||
collections[collectionIndex] = collection
|
collections[collectionIndex] = collection
|
||||||
},
|
},
|
||||||
|
|
||||||
addFolder({collections}, payload) {
|
addFolder({ collections }, payload) {
|
||||||
const {name, folder} = payload;
|
const { name, folder } = payload
|
||||||
|
|
||||||
const newFolder = {
|
const newFolder = {
|
||||||
name: name,
|
name: name,
|
||||||
@@ -218,28 +218,34 @@ export const mutations = {
|
|||||||
|
|
||||||
editFolder({ collections }, payload) {
|
editFolder({ collections }, payload) {
|
||||||
const { collectionIndex, folder, folderIndex, folderName } = payload
|
const { collectionIndex, folder, folderIndex, folderName } = payload
|
||||||
const collection = collections[collectionIndex];
|
const collection = collections[collectionIndex]
|
||||||
|
|
||||||
let parentFolder = findFolder(folderName, collection, true);
|
let parentFolder = findFolder(folderName, collection, true)
|
||||||
if (parentFolder && parentFolder.folders) {
|
if (parentFolder && parentFolder.folders) {
|
||||||
Vue.set(parentFolder.folders, folderIndex, folder);
|
Vue.set(parentFolder.folders, folderIndex, folder)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFolder({ collections }, payload) {
|
removeFolder({ collections }, payload) {
|
||||||
const { collectionIndex, folderIndex, folderName } = payload
|
const { collectionIndex, folderIndex, folderName } = payload
|
||||||
const collection = collections[collectionIndex];
|
const collection = collections[collectionIndex]
|
||||||
|
|
||||||
let parentFolder = findFolder(folderName, collection, true);
|
let parentFolder = findFolder(folderName, collection, true)
|
||||||
if (parentFolder && parentFolder.folders) {
|
if (parentFolder && parentFolder.folders) {
|
||||||
parentFolder.folders.splice(folderIndex, 1)
|
parentFolder.folders.splice(folderIndex, 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
editRequest({ collections }, payload) {
|
editRequest({ collections }, payload) {
|
||||||
const { requestCollectionIndex, requestFolderName, requestFolderIndex, requestNew, requestIndex } = payload
|
const {
|
||||||
|
requestCollectionIndex,
|
||||||
|
requestFolderName,
|
||||||
|
requestFolderIndex,
|
||||||
|
requestNew,
|
||||||
|
requestIndex,
|
||||||
|
} = payload
|
||||||
|
|
||||||
let collection = collections[requestCollectionIndex];
|
let collection = collections[requestCollectionIndex]
|
||||||
|
|
||||||
if (requestFolderIndex === -1) {
|
if (requestFolderIndex === -1) {
|
||||||
Vue.set(collection.requests, requestIndex, requestNew)
|
Vue.set(collection.requests, requestIndex, requestNew)
|
||||||
@@ -277,7 +283,7 @@ export const mutations = {
|
|||||||
|
|
||||||
removeRequest({ collections }, payload) {
|
removeRequest({ collections }, payload) {
|
||||||
const { collectionIndex, folderName, requestIndex } = payload
|
const { collectionIndex, folderName, requestIndex } = payload
|
||||||
let collection = collections[collectionIndex];
|
let collection = collections[collectionIndex]
|
||||||
|
|
||||||
if (collection.name === folderName) {
|
if (collection.name === folderName) {
|
||||||
collection.requests.splice(requestIndex, 1)
|
collection.requests.splice(requestIndex, 1)
|
||||||
@@ -295,11 +301,18 @@ export const mutations = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
moveRequest({ collections }, payload) {
|
moveRequest({ collections }, payload) {
|
||||||
const { oldCollectionIndex, newCollectionIndex, newFolderIndex, newFolderName, oldFolderName, requestIndex } = payload;
|
const {
|
||||||
|
oldCollectionIndex,
|
||||||
|
newCollectionIndex,
|
||||||
|
newFolderIndex,
|
||||||
|
newFolderName,
|
||||||
|
oldFolderName,
|
||||||
|
requestIndex,
|
||||||
|
} = payload
|
||||||
|
|
||||||
const isCollection = newFolderIndex === -1;
|
const isCollection = newFolderIndex === -1
|
||||||
const oldCollection = collections[oldCollectionIndex];
|
const oldCollection = collections[oldCollectionIndex]
|
||||||
const newCollection = collections[newCollectionIndex];
|
const newCollection = collections[newCollectionIndex]
|
||||||
const request = findRequest(oldFolderName, oldCollection, requestIndex)
|
const request = findRequest(oldFolderName, oldCollection, requestIndex)
|
||||||
|
|
||||||
if (isCollection) {
|
if (isCollection) {
|
||||||
@@ -308,7 +321,7 @@ export const mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isCollection) {
|
if (!isCollection) {
|
||||||
const folder = findFolder(newFolderName, newCollection, false);
|
const folder = findFolder(newFolderName, newCollection, false)
|
||||||
if (folder) {
|
if (folder) {
|
||||||
folder.requests.push(request)
|
folder.requests.push(request)
|
||||||
return
|
return
|
||||||
@@ -327,45 +340,43 @@ function testValue(myValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findRequest(folderName, currentFolder, requestIndex) {
|
function findRequest(folderName, currentFolder, requestIndex) {
|
||||||
let selectedFolder, result;
|
let selectedFolder, result
|
||||||
|
|
||||||
if (folderName === currentFolder.name) {
|
if (folderName === currentFolder.name) {
|
||||||
let request = currentFolder.requests[requestIndex];
|
let request = currentFolder.requests[requestIndex]
|
||||||
currentFolder.requests.splice(requestIndex, 1)
|
currentFolder.requests.splice(requestIndex, 1)
|
||||||
return request;
|
return request
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (let i = 0; i < currentFolder.folders.length; i += 1) {
|
for (let i = 0; i < currentFolder.folders.length; i += 1) {
|
||||||
selectedFolder = currentFolder.folders[i];
|
selectedFolder = currentFolder.folders[i]
|
||||||
|
|
||||||
result = findRequest(folderName, selectedFolder, requestIndex);
|
result = findRequest(folderName, selectedFolder, requestIndex)
|
||||||
|
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
return result;
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findFolder(folderName, currentFolder, returnParent, parentFolder) {
|
function findFolder(folderName, currentFolder, returnParent, parentFolder) {
|
||||||
let selectedFolder, result;
|
let selectedFolder, result
|
||||||
|
|
||||||
if (folderName === currentFolder.name && returnParent) {
|
if (folderName === currentFolder.name && returnParent) {
|
||||||
return parentFolder;
|
return parentFolder
|
||||||
} else if (folderName === currentFolder.name && !returnParent) {
|
} else if (folderName === currentFolder.name && !returnParent) {
|
||||||
return currentFolder;
|
return currentFolder
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (let i = 0; i < currentFolder.folders.length; i++) {
|
for (let i = 0; i < currentFolder.folders.length; i++) {
|
||||||
selectedFolder = currentFolder.folders[i];
|
selectedFolder = currentFolder.folders[i]
|
||||||
|
|
||||||
result = findFolder(folderName, selectedFolder, returnParent, currentFolder);
|
result = findFolder(folderName, selectedFolder, returnParent, currentFolder)
|
||||||
|
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
return result;
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user