Commit code with double quotes instead of single quotes
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('new_collection') }}</h3>
|
||||
<h3 class="title">{{ $t("new_collection") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -31,10 +31,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="addNewCollection">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -43,14 +43,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fb } from '../../functions/fb'
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
show: Boolean,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -67,17 +67,17 @@ export default {
|
||||
},
|
||||
addNewCollection() {
|
||||
if (!this.$data.name) {
|
||||
this.$toast.info($t('invalid_collection_name'))
|
||||
this.$toast.info($t("invalid_collection_name"))
|
||||
return
|
||||
}
|
||||
this.$store.commit('postwoman/addNewCollection', {
|
||||
this.$store.commit("postwoman/addNewCollection", {
|
||||
name: this.$data.name,
|
||||
})
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
this.syncCollections()
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('new_folder') }}</h3>
|
||||
<h3 class="title">{{ $t("new_folder") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -31,10 +31,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="addNewFolder">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
collectionIndex: Number,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -59,14 +59,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
addNewFolder() {
|
||||
this.$store.commit('postwoman/addNewFolder', {
|
||||
this.$store.commit("postwoman/addNewFolder", {
|
||||
folder: { name: this.$data.name },
|
||||
collectionIndex: this.$props.collectionIndex,
|
||||
})
|
||||
this.hideModal()
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -17,19 +17,19 @@
|
||||
<div>
|
||||
<button class="icon" @click="$emit('add-folder')" v-close-popover>
|
||||
<i class="material-icons">create_new_folder</i>
|
||||
<span>{{ $t('new_folder') }}</span>
|
||||
<span>{{ $t("new_folder") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="$emit('edit-collection')" v-close-popover>
|
||||
<i class="material-icons">create</i>
|
||||
<span>{{ $t('edit') }}</span>
|
||||
<span>{{ $t("edit") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="removeCollection" v-close-popover>
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t('delete') }}</span>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -48,7 +48,7 @@
|
||||
/>
|
||||
</li>
|
||||
<li v-if="collection.folders.length === 0 && collection.requests.length === 0">
|
||||
<label>{{ $t('collection_empty') }}</label>
|
||||
<label>{{ $t("collection_empty") }}</label>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
@@ -89,8 +89,8 @@ ul li {
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
folder: () => import('./folder'),
|
||||
request: () => import('./request'),
|
||||
folder: () => import("./folder"),
|
||||
request: () => import("./request"),
|
||||
},
|
||||
props: {
|
||||
collectionIndex: Number,
|
||||
@@ -107,13 +107,13 @@ export default {
|
||||
this.showChildren = !this.showChildren
|
||||
},
|
||||
removeCollection() {
|
||||
if (!confirm('Are you sure you want to remove this Collection?')) return
|
||||
this.$store.commit('postwoman/removeCollection', {
|
||||
if (!confirm("Are you sure you want to remove this Collection?")) return
|
||||
this.$store.commit("postwoman/removeCollection", {
|
||||
collectionIndex: this.collectionIndex,
|
||||
})
|
||||
},
|
||||
editFolder(collectionIndex, folder, folderIndex) {
|
||||
this.$emit('edit-folder', { collectionIndex, folder, folderIndex })
|
||||
this.$emit("edit-folder", { collectionIndex, folder, folderIndex })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('edit_collection') }}</h3>
|
||||
<h3 class="title">{{ $t("edit_collection") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -31,10 +31,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="saveCollection">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
editingCollectionIndex: Number,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -60,21 +60,21 @@ export default {
|
||||
methods: {
|
||||
saveCollection() {
|
||||
if (!this.$data.name) {
|
||||
this.$toast.info($t('invalid_collection_name'))
|
||||
this.$toast.info($t("invalid_collection_name"))
|
||||
return
|
||||
}
|
||||
const collectionUpdated = {
|
||||
...this.$props.editingCollection,
|
||||
name: this.$data.name,
|
||||
}
|
||||
this.$store.commit('postwoman/editCollection', {
|
||||
this.$store.commit("postwoman/editCollection", {
|
||||
collection: collectionUpdated,
|
||||
collectionIndex: this.$props.editingCollectionIndex,
|
||||
})
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('edit_folder') }}</h3>
|
||||
<h3 class="title">{{ $t("edit_folder") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -26,10 +26,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="editFolder">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -47,7 +47,7 @@ export default {
|
||||
folderIndex: Number,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -56,7 +56,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
editFolder() {
|
||||
this.$store.commit('postwoman/editFolder', {
|
||||
this.$store.commit("postwoman/editFolder", {
|
||||
collectionIndex: this.$props.collectionIndex,
|
||||
folder: { ...this.$props.folder, name: this.$data.name },
|
||||
folderIndex: this.$props.folderIndex,
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
this.hideModal()
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('edit_request') }}</h3>
|
||||
<h3 class="title">{{ $t("edit_request") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -17,7 +17,7 @@
|
||||
<div slot="body">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="selectLabel">{{ $t('label') }}</label>
|
||||
<label for="selectLabel">{{ $t("label") }}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="selectLabel"
|
||||
@@ -25,11 +25,11 @@
|
||||
@keyup.enter="saveRequest"
|
||||
:placeholder="request.name"
|
||||
/>
|
||||
<label for="selectCollection">{{ $t('collection') }}</label>
|
||||
<label for="selectCollection">{{ $t("collection") }}</label>
|
||||
<span class="select-wrapper">
|
||||
<select type="text" id="selectCollection" v-model="requestUpdateData.collectionIndex">
|
||||
<option :key="undefined" :value="undefined" hidden disabled selected>{{
|
||||
$t('current_collection')
|
||||
$t("current_collection")
|
||||
}}</option>
|
||||
<option
|
||||
v-for="(collection, index) in $store.state.postwoman.collections"
|
||||
@@ -40,7 +40,7 @@
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
<label for="selectFolder">{{ $t('folder') }}</label>
|
||||
<label for="selectFolder">{{ $t("folder") }}</label>
|
||||
<span class="select-wrapper">
|
||||
<select type="text" id="selectFolder" v-model="requestUpdateData.folderIndex">
|
||||
<option :key="undefined" :value="undefined">/</option>
|
||||
@@ -57,10 +57,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="saveRequest">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
requestIndex: Number,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'requestUpdateData.collectionIndex': function resetFolderIndex() {
|
||||
"requestUpdateData.collectionIndex": function resetFolderIndex() {
|
||||
// if user choosen some folder, than selected other collection, which doesn't have any folders
|
||||
// than `requestUpdateData.folderIndex` won't be reseted
|
||||
this.$data.requestUpdateData.folderIndex = undefined
|
||||
@@ -120,7 +120,7 @@ export default {
|
||||
|
||||
// pass data separately to don't depend on request's collection, folder fields
|
||||
// probably, they should be deprecated because they don't describe request itself
|
||||
this.$store.commit('postwoman/editRequest', {
|
||||
this.$store.commit("postwoman/editRequest", {
|
||||
requestOldCollectionIndex: this.$props.collectionIndex,
|
||||
requestOldFolderIndex: this.$props.folderIndex,
|
||||
requestOldIndex: this.$props.requestIndex,
|
||||
@@ -132,7 +132,7 @@ export default {
|
||||
this.hideModal()
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<div>
|
||||
<button class="icon" @click="editFolder" v-close-popover>
|
||||
<i class="material-icons">edit</i>
|
||||
<span>{{ $t('edit') }}</span>
|
||||
<span>{{ $t("edit") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="removeFolder" v-close-popover>
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t('delete') }}</span>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,7 +49,7 @@
|
||||
/>
|
||||
</li>
|
||||
<li v-if="folder.requests.length === 0">
|
||||
<label>{{ $t('folder_empty') }}</label>
|
||||
<label>{{ $t("folder_empty") }}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
folderIndex: Number,
|
||||
},
|
||||
components: {
|
||||
request: () => import('./request'),
|
||||
request: () => import("./request"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -89,17 +89,17 @@ export default {
|
||||
this.showChildren = !this.showChildren
|
||||
},
|
||||
selectRequest(request) {
|
||||
this.$store.commit('postwoman/selectRequest', { request })
|
||||
this.$store.commit("postwoman/selectRequest", { request })
|
||||
},
|
||||
removeFolder() {
|
||||
if (!confirm('Are you sure you want to remove this folder?')) return
|
||||
this.$store.commit('postwoman/removeFolder', {
|
||||
if (!confirm("Are you sure you want to remove this folder?")) return
|
||||
this.$store.commit("postwoman/removeFolder", {
|
||||
collectionIndex: this.collectionIndex,
|
||||
folderIndex: this.folderIndex,
|
||||
})
|
||||
},
|
||||
editFolder() {
|
||||
this.$emit('edit-folder')
|
||||
this.$emit("edit-folder")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
>
|
||||
<button :disabled="!fb.currentUser" class="icon" @click="syncCollections">
|
||||
<i class="material-icons">folder_shared</i>
|
||||
<span>{{ $t('import_from_sync') }}</span>
|
||||
<span>{{ $t("import_from_sync") }}</span>
|
||||
</button>
|
||||
</span>
|
||||
<button
|
||||
@@ -28,7 +28,7 @@
|
||||
v-tooltip="$t('replace_current')"
|
||||
>
|
||||
<i class="material-icons">create_new_folder</i>
|
||||
<span>{{ $t('replace_json') }}</span>
|
||||
<span>{{ $t("replace_json") }}</span>
|
||||
<input
|
||||
type="file"
|
||||
@change="replaceWithJSON"
|
||||
@@ -43,7 +43,7 @@
|
||||
v-tooltip="$t('preserve_current')"
|
||||
>
|
||||
<i class="material-icons">folder_special</i>
|
||||
<span>{{ $t('import_json') }}</span>
|
||||
<span>{{ $t("import_json") }}</span>
|
||||
<input
|
||||
type="file"
|
||||
@change="importFromJSON"
|
||||
@@ -64,10 +64,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="exportJSON" v-tooltip="$t('download_file')">
|
||||
{{ $t('export') }}
|
||||
{{ $t("export") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fb } from '../../functions/fb'
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -88,7 +88,7 @@ export default {
|
||||
show: Boolean,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
computed: {
|
||||
collectionJson() {
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
openDialogChooseFileToReplaceWith() {
|
||||
this.$refs.inputChooseFileToReplaceWith.click()
|
||||
@@ -112,15 +112,15 @@ export default {
|
||||
let collections = JSON.parse(content)
|
||||
if (collections[0]) {
|
||||
let [name, folders, requests] = Object.keys(collections[0])
|
||||
if (name === 'name' && folders === 'folders' && requests === 'requests') {
|
||||
if (name === "name" && folders === "folders" && requests === "requests") {
|
||||
// Do nothing
|
||||
}
|
||||
} else if (collections.info && collections.info.schema.includes('v2.1.0')) {
|
||||
} else if (collections.info && collections.info.schema.includes("v2.1.0")) {
|
||||
collections = this.parsePostmanCollection(collections)
|
||||
} else {
|
||||
return this.failedImport()
|
||||
}
|
||||
this.$store.commit('postwoman/importCollections', collections)
|
||||
this.$store.commit("postwoman/importCollections", collections)
|
||||
this.fileImported()
|
||||
}
|
||||
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0])
|
||||
@@ -132,71 +132,71 @@ export default {
|
||||
let collections = JSON.parse(content)
|
||||
if (collections[0]) {
|
||||
let [name, folders, requests] = Object.keys(collections[0])
|
||||
if (name === 'name' && folders === 'folders' && requests === 'requests') {
|
||||
if (name === "name" && folders === "folders" && requests === "requests") {
|
||||
// Do nothing
|
||||
}
|
||||
} else if (collections.info && collections.info.schema.includes('v2.1.0')) {
|
||||
} else if (collections.info && collections.info.schema.includes("v2.1.0")) {
|
||||
collections = this.parsePostmanCollection(collections)
|
||||
} else {
|
||||
return this.failedImport()
|
||||
}
|
||||
this.$store.commit('postwoman/importCollections', collections)
|
||||
this.$store.commit("postwoman/importCollections", collections)
|
||||
this.fileImported()
|
||||
}
|
||||
reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0])
|
||||
},
|
||||
exportJSON() {
|
||||
let text = this.collectionJson
|
||||
text = text.replace(/\n/g, '\r\n')
|
||||
text = text.replace(/\n/g, "\r\n")
|
||||
let blob = new Blob([text], {
|
||||
type: 'text/json',
|
||||
type: "text/json",
|
||||
})
|
||||
let anchor = document.createElement('a')
|
||||
anchor.download = 'postwoman-collection.json'
|
||||
let anchor = document.createElement("a")
|
||||
anchor.download = "postwoman-collection.json"
|
||||
anchor.href = window.URL.createObjectURL(blob)
|
||||
anchor.target = '_blank'
|
||||
anchor.style.display = 'none'
|
||||
anchor.target = "_blank"
|
||||
anchor.style.display = "none"
|
||||
document.body.appendChild(anchor)
|
||||
anchor.click()
|
||||
document.body.removeChild(anchor)
|
||||
this.$toast.success(this.$t('download_started'), {
|
||||
icon: 'done',
|
||||
this.$toast.success(this.$t("download_started"), {
|
||||
icon: "done",
|
||||
})
|
||||
},
|
||||
syncCollections() {
|
||||
this.$store.commit('postwoman/replaceCollections', fb.currentCollections)
|
||||
this.$store.commit("postwoman/replaceCollections", fb.currentCollections)
|
||||
this.fileImported()
|
||||
},
|
||||
fileImported() {
|
||||
this.$toast.info(this.$t('file_imported'), {
|
||||
icon: 'folder_shared',
|
||||
this.$toast.info(this.$t("file_imported"), {
|
||||
icon: "folder_shared",
|
||||
})
|
||||
},
|
||||
failedImport() {
|
||||
this.$toast.error(this.$t('import_failed'), {
|
||||
icon: 'error',
|
||||
this.$toast.error(this.$t("import_failed"), {
|
||||
icon: "error",
|
||||
})
|
||||
},
|
||||
parsePostmanCollection(collection, folders = true) {
|
||||
let postwomanCollection = folders
|
||||
? [
|
||||
{
|
||||
name: '',
|
||||
name: "",
|
||||
folders: [],
|
||||
requests: [],
|
||||
},
|
||||
]
|
||||
: {
|
||||
name: '',
|
||||
name: "",
|
||||
requests: [],
|
||||
}
|
||||
for (let collectionItem of collection.item) {
|
||||
if (collectionItem.request) {
|
||||
if (postwomanCollection[0]) {
|
||||
postwomanCollection[0].name = collection.info ? collection.info.name : ''
|
||||
postwomanCollection[0].name = collection.info ? collection.info.name : ""
|
||||
postwomanCollection[0].requests.push(this.parsePostmanRequest(collectionItem))
|
||||
} else {
|
||||
postwomanCollection.name = collection.name ? collection.name : ''
|
||||
postwomanCollection.name = collection.name ? collection.name : ""
|
||||
postwomanCollection.requests.push(this.parsePostmanRequest(collectionItem))
|
||||
}
|
||||
} else if (collectionItem.item) {
|
||||
@@ -209,22 +209,22 @@ export default {
|
||||
},
|
||||
parsePostmanRequest(requestObject) {
|
||||
let pwRequest = {
|
||||
url: '',
|
||||
path: '',
|
||||
method: '',
|
||||
auth: '',
|
||||
httpUser: '',
|
||||
httpPassword: '',
|
||||
passwordFieldType: 'password',
|
||||
bearerToken: '',
|
||||
url: "",
|
||||
path: "",
|
||||
method: "",
|
||||
auth: "",
|
||||
httpUser: "",
|
||||
httpPassword: "",
|
||||
passwordFieldType: "password",
|
||||
bearerToken: "",
|
||||
headers: [],
|
||||
params: [],
|
||||
bodyParams: [],
|
||||
rawParams: '',
|
||||
rawParams: "",
|
||||
rawInput: false,
|
||||
contentType: '',
|
||||
requestType: '',
|
||||
name: '',
|
||||
contentType: "",
|
||||
requestType: "",
|
||||
name: "",
|
||||
}
|
||||
|
||||
pwRequest.name = requestObject.name
|
||||
@@ -232,24 +232,24 @@ export default {
|
||||
/^(.+:\/\/[^\/]+|{[^\/]+})(\/[^\?]+|).*$/
|
||||
)
|
||||
pwRequest.url = requestObjectUrl[1]
|
||||
pwRequest.path = requestObjectUrl[2] ? requestObjectUrl[2] : ''
|
||||
pwRequest.path = requestObjectUrl[2] ? requestObjectUrl[2] : ""
|
||||
pwRequest.method = requestObject.request.method
|
||||
let itemAuth = requestObject.request.auth ? requestObject.request.auth : ''
|
||||
let authType = itemAuth ? itemAuth.type : ''
|
||||
if (authType === 'basic') {
|
||||
pwRequest.auth = 'Basic Auth'
|
||||
let itemAuth = requestObject.request.auth ? requestObject.request.auth : ""
|
||||
let authType = itemAuth ? itemAuth.type : ""
|
||||
if (authType === "basic") {
|
||||
pwRequest.auth = "Basic Auth"
|
||||
pwRequest.httpUser =
|
||||
itemAuth.basic[0].key === 'username' ? itemAuth.basic[0].value : itemAuth.basic[1].value
|
||||
itemAuth.basic[0].key === "username" ? itemAuth.basic[0].value : itemAuth.basic[1].value
|
||||
pwRequest.httpPassword =
|
||||
itemAuth.basic[0].key === 'password' ? itemAuth.basic[0].value : itemAuth.basic[1].value
|
||||
} else if (authType === 'oauth2') {
|
||||
pwRequest.auth = 'OAuth 2.0'
|
||||
itemAuth.basic[0].key === "password" ? itemAuth.basic[0].value : itemAuth.basic[1].value
|
||||
} else if (authType === "oauth2") {
|
||||
pwRequest.auth = "OAuth 2.0"
|
||||
pwRequest.bearerToken =
|
||||
itemAuth.oauth2[0].key === 'accessToken'
|
||||
itemAuth.oauth2[0].key === "accessToken"
|
||||
? itemAuth.oauth2[0].value
|
||||
: itemAuth.oauth2[1].value
|
||||
} else if (authType === 'bearer') {
|
||||
pwRequest.auth = 'Bearer Token'
|
||||
} else if (authType === "bearer") {
|
||||
pwRequest.auth = "Bearer Token"
|
||||
pwRequest.bearerToken = itemAuth.bearer[0].value
|
||||
}
|
||||
let requestObjectHeaders = requestObject.request.header
|
||||
@@ -268,13 +268,13 @@ export default {
|
||||
}
|
||||
}
|
||||
if (requestObject.request.body) {
|
||||
if (requestObject.request.body.mode === 'urlencoded') {
|
||||
if (requestObject.request.body.mode === "urlencoded") {
|
||||
let params = requestObject.request.body.urlencoded
|
||||
pwRequest.bodyParams = params ? params : []
|
||||
for (let param of pwRequest.bodyParams) {
|
||||
delete param.type
|
||||
}
|
||||
} else if (requestObject.request.body.mode === 'raw') {
|
||||
} else if (requestObject.request.body.mode === "raw") {
|
||||
pwRequest.rawInput = true
|
||||
pwRequest.rawParams = requestObject.request.body.raw
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ TODO:
|
||||
<div>
|
||||
<button class="icon" @click="displayModalAdd(true)">
|
||||
<i class="material-icons">add</i>
|
||||
<span>{{ $t('new') }}</span>
|
||||
<span>{{ $t("new") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="displayModalImportExport(true)">
|
||||
{{ $t('import_export') }}
|
||||
{{ $t("import_export") }}
|
||||
</button>
|
||||
<!-- <a
|
||||
href="https://github.com/liyasthomas/postwoman/wiki/Collections"
|
||||
@@ -89,7 +89,7 @@ TODO:
|
||||
<nuxt-link :to="localePath('doc')" :aria-label="$t('documentation')">
|
||||
<button class="icon">
|
||||
<i class="material-icons">books</i>
|
||||
<span>{{ $t('generate_docs') }}</span>
|
||||
<span>{{ $t("generate_docs") }}</span>
|
||||
</button>
|
||||
</nuxt-link>
|
||||
</pw-section>
|
||||
@@ -107,20 +107,20 @@ ul {
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import collection from './collection'
|
||||
import { fb } from '../../functions/fb'
|
||||
import collection from "./collection"
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
collection,
|
||||
'pw-section': () => import('../section'),
|
||||
addCollection: () => import('./addCollection'),
|
||||
addFolder: () => import('./addFolder'),
|
||||
editCollection: () => import('./editCollection'),
|
||||
editFolder: () => import('./editFolder'),
|
||||
editRequest: () => import('./editRequest'),
|
||||
importExportCollections: () => import('./importExportCollections'),
|
||||
VirtualList: () => import('vue-virtual-scroll-list'),
|
||||
"pw-section": () => import("../section"),
|
||||
addCollection: () => import("./addCollection"),
|
||||
addFolder: () => import("./addFolder"),
|
||||
editCollection: () => import("./editCollection"),
|
||||
editFolder: () => import("./editFolder"),
|
||||
editRequest: () => import("./editRequest"),
|
||||
importExportCollections: () => import("./importExportCollections"),
|
||||
VirtualList: () => import("vue-virtual-scroll-list"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -145,12 +145,12 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
this._keyListener = function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
this.showModalAdd = this.showModalEdit = this.showModalImportExport = this.showModalAddFolder = this.showModalEditFolder = this.showModalEditRequest = false
|
||||
}
|
||||
}
|
||||
document.addEventListener('keydown', this._keyListener.bind(this))
|
||||
document.addEventListener("keydown", this._keyListener.bind(this))
|
||||
},
|
||||
methods: {
|
||||
displayModalAdd(shouldDisplay) {
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('keydown', this._keyListener)
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<div>
|
||||
<button class="icon" @click="$emit('edit-request')" v-close-popover>
|
||||
<i class="material-icons">edit</i>
|
||||
<span>{{ $t('edit') }}</span>
|
||||
<span>{{ $t("edit") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="removeRequest" v-close-popover>
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t('delete') }}</span>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -51,11 +51,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
selectRequest() {
|
||||
this.$store.commit('postwoman/selectRequest', { request: this.request })
|
||||
this.$store.commit("postwoman/selectRequest", { request: this.request })
|
||||
},
|
||||
removeRequest() {
|
||||
if (!confirm('Are you sure you want to remove this request?')) return
|
||||
this.$store.commit('postwoman/removeRequest', {
|
||||
if (!confirm("Are you sure you want to remove this request?")) return
|
||||
this.$store.commit("postwoman/removeRequest", {
|
||||
collectionIndex: this.collectionIndex,
|
||||
folderIndex: this.folderIndex,
|
||||
requestIndex: this.requestIndex,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('save_request_as') }}</h3>
|
||||
<h3 class="title">{{ $t("save_request_as") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -17,7 +17,7 @@
|
||||
<div slot="body">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="selectLabel">{{ $t('label') }}</label>
|
||||
<label for="selectLabel">{{ $t("label") }}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="selectLabel"
|
||||
@@ -25,11 +25,11 @@
|
||||
:placeholder="defaultRequestName"
|
||||
@keyup.enter="saveRequestAs"
|
||||
/>
|
||||
<label for="selectCollection">{{ $t('collection') }}</label>
|
||||
<label for="selectCollection">{{ $t("collection") }}</label>
|
||||
<span class="select-wrapper">
|
||||
<select type="text" id="selectCollection" v-model="requestData.collectionIndex">
|
||||
<option :key="undefined" :value="undefined" hidden disabled selected>{{
|
||||
$t('select_collection')
|
||||
$t("select_collection")
|
||||
}}</option>
|
||||
<option
|
||||
v-for="(collection, index) in $store.state.postwoman.collections"
|
||||
@@ -40,7 +40,7 @@
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
<label for="selectFolder">{{ $t('folder') }}</label>
|
||||
<label for="selectFolder">{{ $t("folder") }}</label>
|
||||
<span class="select-wrapper">
|
||||
<select type="text" id="selectFolder" v-model="requestData.folderIndex">
|
||||
<option :key="undefined" :value="undefined">/</option>
|
||||
@@ -49,7 +49,7 @@
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
<label for="selectRequest">{{ $t('request') }}</label>
|
||||
<label for="selectRequest">{{ $t("request") }}</label>
|
||||
<span class="select-wrapper">
|
||||
<select type="text" id="selectRequest" v-model="requestData.requestIndex">
|
||||
<option :key="undefined" :value="undefined">/</option>
|
||||
@@ -66,10 +66,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="saveRequestAs">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fb } from '../../functions/fb'
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -86,11 +86,11 @@ export default {
|
||||
editingRequest: Object,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultRequestName: 'My Request',
|
||||
defaultRequestName: "My Request",
|
||||
requestData: {
|
||||
name: undefined,
|
||||
collectionIndex: undefined,
|
||||
@@ -100,13 +100,13 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'requestData.collectionIndex': function resetFolderAndRequestIndex() {
|
||||
"requestData.collectionIndex": function resetFolderAndRequestIndex() {
|
||||
// if user choosen some folder, than selected other collection, which doesn't have any folders
|
||||
// than `requestUpdateData.folderIndex` won't be reseted
|
||||
this.$data.requestData.folderIndex = undefined
|
||||
this.$data.requestData.requestIndex = undefined
|
||||
},
|
||||
'requestData.folderIndex': function resetRequestIndex() {
|
||||
"requestData.folderIndex": function resetRequestIndex() {
|
||||
this.$data.requestData.requestIndex = undefined
|
||||
},
|
||||
},
|
||||
@@ -159,8 +159,8 @@ export default {
|
||||
saveRequestAs() {
|
||||
const userDidntSpecifyCollection = this.$data.requestData.collectionIndex === undefined
|
||||
if (userDidntSpecifyCollection) {
|
||||
this.$toast.error(this.$t('select_collection'), {
|
||||
icon: 'error',
|
||||
this.$toast.error(this.$t("select_collection"), {
|
||||
icon: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
collection: this.$data.requestData.collectionIndex,
|
||||
}
|
||||
|
||||
this.$store.commit('postwoman/saveRequestAs', {
|
||||
this.$store.commit("postwoman/saveRequestAs", {
|
||||
request: requestUpdated,
|
||||
collectionIndex: this.$data.requestData.collectionIndex,
|
||||
folderIndex: this.$data.requestData.folderIndex,
|
||||
@@ -182,8 +182,8 @@ export default {
|
||||
this.syncCollections()
|
||||
},
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit('hide-model') // for backward compatibility // TODO: use fixed event
|
||||
this.$emit("hide-modal")
|
||||
this.$emit("hide-model") // for backward compatibility // TODO: use fixed event
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user