Commit code with double quotes instead of single quotes
This commit is contained in:
@@ -3,16 +3,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const DEFAULT_THEME = 'twilight'
|
||||
const DEFAULT_THEME = "twilight"
|
||||
|
||||
import ace from 'ace-builds'
|
||||
import 'ace-builds/webpack-resolver'
|
||||
import ace from "ace-builds"
|
||||
import "ace-builds/webpack-resolver"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '',
|
||||
default: "",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
},
|
||||
lang: {
|
||||
type: String,
|
||||
default: 'json',
|
||||
default: "json",
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
cacheValue: '',
|
||||
cacheValue: "",
|
||||
}
|
||||
},
|
||||
|
||||
@@ -43,10 +43,10 @@ export default {
|
||||
}
|
||||
},
|
||||
theme() {
|
||||
this.editor.setTheme('ace/theme/' + this.defineTheme())
|
||||
this.editor.setTheme("ace/theme/" + this.defineTheme())
|
||||
},
|
||||
lang(value) {
|
||||
this.editor.getSession().setMode('ace/mode/' + value)
|
||||
this.editor.getSession().setMode("ace/mode/" + value)
|
||||
},
|
||||
options(value) {
|
||||
this.editor.setOptions(value)
|
||||
@@ -65,9 +65,9 @@ export default {
|
||||
this.editor = editor
|
||||
this.cacheValue = this.value
|
||||
|
||||
editor.on('change', () => {
|
||||
editor.on("change", () => {
|
||||
const content = editor.getValue()
|
||||
this.$emit('input', content)
|
||||
this.$emit("input", content)
|
||||
this.cacheValue = content
|
||||
})
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
display: block;
|
||||
padding: 8px 16px;
|
||||
font-size: 16px;
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
font-family: "Roboto Mono", monospace;
|
||||
font-weight: 400;
|
||||
|
||||
&:last-child {
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '',
|
||||
default: "",
|
||||
required: false,
|
||||
},
|
||||
|
||||
@@ -103,14 +103,14 @@ export default {
|
||||
|
||||
value: {
|
||||
type: String,
|
||||
default: '',
|
||||
default: "",
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
text() {
|
||||
this.$emit('input', this.text)
|
||||
this.$emit("input", this.text)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -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
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('new_environment') }}</h3>
|
||||
<h3 class="title">{{ $t("new_environment") }}</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="addNewEnvironment">
|
||||
{{ $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,7 +67,7 @@ export default {
|
||||
},
|
||||
addNewEnvironment() {
|
||||
if (!this.$data.name) {
|
||||
this.$toast.info(this.$t('invalid_environment_name'))
|
||||
this.$toast.info(this.$t("invalid_environment_name"))
|
||||
return
|
||||
}
|
||||
let newEnvironment = [
|
||||
@@ -76,16 +76,16 @@ export default {
|
||||
variables: [],
|
||||
},
|
||||
]
|
||||
this.$store.commit('postwoman/importAddEnvironments', {
|
||||
this.$store.commit("postwoman/importAddEnvironments", {
|
||||
environments: newEnvironment,
|
||||
confirmation: 'Environment added',
|
||||
confirmation: "Environment added",
|
||||
})
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
this.syncEnvironments()
|
||||
},
|
||||
hideModal() {
|
||||
this.$data.name = undefined
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<h3 class="title">{{ $t('edit_environment') }}</h3>
|
||||
<h3 class="title">{{ $t("edit_environment") }}</h3>
|
||||
<div>
|
||||
<button class="icon" @click="hideModal">
|
||||
<i class="material-icons">close</i>
|
||||
@@ -28,7 +28,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
<label for="variableList">{{ $t('env_variable_list') }}</label>
|
||||
<label for="variableList">{{ $t("env_variable_list") }}</label>
|
||||
<div>
|
||||
<button class="icon" @click="clearContent($event)" v-tooltip.bottom="$t('clear')">
|
||||
<i class="material-icons">clear_all</i>
|
||||
@@ -92,7 +92,7 @@
|
||||
<li>
|
||||
<button class="icon" @click="addEnvironmentVariable">
|
||||
<i class="material-icons">add</i>
|
||||
<span>{{ $t('add_new') }}</span>
|
||||
<span>{{ $t("add_new") }}</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -102,10 +102,10 @@
|
||||
<span></span>
|
||||
<span>
|
||||
<button class="icon" @click="hideModal">
|
||||
{{ $t('cancel') }}
|
||||
{{ $t("cancel") }}
|
||||
</button>
|
||||
<button class="icon primary" @click="saveEnvironment">
|
||||
{{ $t('save') }}
|
||||
{{ $t("save") }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import textareaAutoHeight from '../../directives/textareaAutoHeight'
|
||||
import textareaAutoHeight from "../../directives/textareaAutoHeight"
|
||||
|
||||
export default {
|
||||
directives: {
|
||||
@@ -126,7 +126,7 @@ export default {
|
||||
editingEnvironmentIndex: Number,
|
||||
},
|
||||
components: {
|
||||
modal: () => import('../../components/modal'),
|
||||
modal: () => import("../../components/modal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -139,7 +139,7 @@ export default {
|
||||
this.$props.editingEnvironment && this.$props.editingEnvironment.name
|
||||
? this.$props.editingEnvironment.name
|
||||
: undefined
|
||||
this.$store.commit('postwoman/setEditingEnvironment', this.$props.editingEnvironment)
|
||||
this.$store.commit("postwoman/setEditingEnvironment", this.$props.editingEnvironment)
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
@@ -148,21 +148,21 @@ export default {
|
||||
},
|
||||
variableString() {
|
||||
const result = this.editingEnvCopy.variables
|
||||
return result === '' ? '' : JSON.stringify(result)
|
||||
return result === "" ? "" : JSON.stringify(result)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clearContent(e) {
|
||||
this.$store.commit('postwoman/removeVariables', [])
|
||||
this.$store.commit("postwoman/removeVariables", [])
|
||||
e.target.innerHTML = this.doneButton
|
||||
this.$toast.info(this.$t('cleared'), {
|
||||
icon: 'clear_all',
|
||||
this.$toast.info(this.$t("cleared"), {
|
||||
icon: "clear_all",
|
||||
})
|
||||
setTimeout(() => (e.target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
|
||||
},
|
||||
addEnvironmentVariable() {
|
||||
let value = { key: '', value: '' }
|
||||
this.$store.commit('postwoman/addVariable', value)
|
||||
let value = { key: "", value: "" }
|
||||
this.$store.commit("postwoman/addVariable", value)
|
||||
},
|
||||
removeEnvironmentVariable(index) {
|
||||
let variableIndex = index
|
||||
@@ -171,13 +171,13 @@ export default {
|
||||
(variable, index) => variableIndex !== index
|
||||
)
|
||||
|
||||
this.$store.commit('postwoman/removeVariable', newVariables)
|
||||
this.$toast.error(this.$t('deleted'), {
|
||||
icon: 'delete',
|
||||
this.$store.commit("postwoman/removeVariable", newVariables)
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
action: {
|
||||
text: this.$t('undo'),
|
||||
text: this.$t("undo"),
|
||||
onClick: (e, toastObject) => {
|
||||
this.$store.commit('postwoman/removeVariable', oldVariables)
|
||||
this.$store.commit("postwoman/removeVariable", oldVariables)
|
||||
toastObject.remove()
|
||||
},
|
||||
},
|
||||
@@ -185,22 +185,22 @@ export default {
|
||||
},
|
||||
saveEnvironment() {
|
||||
if (!this.$data.name) {
|
||||
this.$toast.info(this.$t('invalid_environment_name'))
|
||||
this.$toast.info(this.$t("invalid_environment_name"))
|
||||
return
|
||||
}
|
||||
const environmentUpdated = {
|
||||
...this.editingEnvCopy,
|
||||
name: this.$data.name,
|
||||
}
|
||||
this.$store.commit('postwoman/saveEnvironment', {
|
||||
this.$store.commit("postwoman/saveEnvironment", {
|
||||
environment: environmentUpdated,
|
||||
environmentIndex: this.$props.editingEnvironmentIndex,
|
||||
})
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
hideModal() {
|
||||
this.$data.name = undefined
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<div>
|
||||
<button class="icon" @click="$emit('edit-environment')" v-close-popover>
|
||||
<i class="material-icons">create</i>
|
||||
<span>{{ $t('edit') }}</span>
|
||||
<span>{{ $t("edit") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="removeEnvironment" v-close-popover>
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t('delete') }}</span>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,8 +49,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
removeEnvironment() {
|
||||
if (!confirm('Are you sure you want to remove this environment?')) return
|
||||
this.$store.commit('postwoman/removeEnvironment', this.environmentIndex)
|
||||
if (!confirm("Are you sure you want to remove this environment?")) return
|
||||
this.$store.commit("postwoman/removeEnvironment", this.environmentIndex)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
>
|
||||
<button :disabled="!fb.currentUser" class="icon" @click="syncEnvironments">
|
||||
<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: {
|
||||
environmentJson() {
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
hideModal() {
|
||||
this.$emit('hide-modal')
|
||||
this.$emit("hide-modal")
|
||||
},
|
||||
openDialogChooseFileToReplaceWith() {
|
||||
this.$refs.inputChooseFileToReplaceWith.click()
|
||||
@@ -110,7 +110,7 @@ export default {
|
||||
reader.onload = event => {
|
||||
let content = event.target.result
|
||||
let environments = JSON.parse(content)
|
||||
this.$store.commit('postwoman/replaceEnvironments', environments)
|
||||
this.$store.commit("postwoman/replaceEnvironments", environments)
|
||||
}
|
||||
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0])
|
||||
this.fileImported()
|
||||
@@ -120,8 +120,8 @@ export default {
|
||||
reader.onload = event => {
|
||||
let content = event.target.result
|
||||
let environments = JSON.parse(content)
|
||||
let confirmation = this.$t('file_imported')
|
||||
this.$store.commit('postwoman/importAddEnvironments', {
|
||||
let confirmation = this.$t("file_imported")
|
||||
this.$store.commit("postwoman/importAddEnvironments", {
|
||||
environments,
|
||||
confirmation,
|
||||
})
|
||||
@@ -130,29 +130,29 @@ export default {
|
||||
},
|
||||
exportJSON() {
|
||||
let text = this.environmentJson
|
||||
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-environment.json'
|
||||
let anchor = document.createElement("a")
|
||||
anchor.download = "postwoman-environment.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",
|
||||
})
|
||||
},
|
||||
syncEnvironments() {
|
||||
this.$store.commit('postwoman/replaceEnvironments', fb.currentEnvironments)
|
||||
this.$store.commit("postwoman/replaceEnvironments", fb.currentEnvironments)
|
||||
this.fileImported()
|
||||
},
|
||||
fileImported() {
|
||||
this.$toast.info(this.$t('file_imported'), {
|
||||
icon: 'folder_shared',
|
||||
this.$toast.info(this.$t("file_imported"), {
|
||||
icon: "folder_shared",
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,8 +62,8 @@ ul {
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import environment from './environment'
|
||||
import { fb } from '../../functions/fb'
|
||||
import environment from "./environment"
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
const updateOnLocalStorage = (propertyName, property) =>
|
||||
window.localStorage.setItem(propertyName, JSON.stringify(property))
|
||||
@@ -71,11 +71,11 @@ const updateOnLocalStorage = (propertyName, property) =>
|
||||
export default {
|
||||
components: {
|
||||
environment,
|
||||
'pw-section': () => import('../section'),
|
||||
addEnvironment: () => import('./addEnvironment'),
|
||||
editEnvironment: () => import('./editEnvironment'),
|
||||
importExportEnvironment: () => import('./importExportEnvironment'),
|
||||
VirtualList: () => import('vue-virtual-scroll-list'),
|
||||
"pw-section": () => import("../section"),
|
||||
addEnvironment: () => import("./addEnvironment"),
|
||||
editEnvironment: () => import("./editEnvironment"),
|
||||
importExportEnvironment: () => import("./importExportEnvironment"),
|
||||
VirtualList: () => import("vue-virtual-scroll-list"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -93,12 +93,12 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
this._keyListener = function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault()
|
||||
this.showModalImportExport = false
|
||||
}
|
||||
}
|
||||
document.addEventListener('keydown', this._keyListener.bind(this))
|
||||
document.addEventListener("keydown", this._keyListener.bind(this))
|
||||
},
|
||||
methods: {
|
||||
displayModalAdd(shouldDisplay) {
|
||||
@@ -131,7 +131,7 @@ export default {
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('keydown', this._keyListener)
|
||||
document.removeEventListener("keydown", this._keyListener)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="show-on-large-screen">
|
||||
<li class="info">
|
||||
<label>
|
||||
{{ feed.label || $t('no_label') }}
|
||||
{{ feed.label || $t("no_label") }}
|
||||
</label>
|
||||
</li>
|
||||
<button class="icon" @click="deleteFeed(feed)">
|
||||
@@ -19,14 +19,14 @@
|
||||
</div>
|
||||
<div class="show-on-large-screen">
|
||||
<li class="info clamb-3">
|
||||
<label>{{ feed.message || $t('empty') }}</label>
|
||||
<label>{{ feed.message || $t("empty") }}</label>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</virtual-list>
|
||||
<ul v-else>
|
||||
<li>
|
||||
<label class="info">{{ $t('empty') }}</label>
|
||||
<label class="info">{{ $t("empty") }}</label>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
@@ -55,11 +55,11 @@ ol {
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { fb } from '../../functions/fb'
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
VirtualList: () => import('vue-virtual-scroll-list'),
|
||||
VirtualList: () => import("vue-virtual-scroll-list"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -69,8 +69,8 @@ export default {
|
||||
methods: {
|
||||
deleteFeed(feed) {
|
||||
fb.deleteFeed(feed.id)
|
||||
this.$toast.error(this.$t('deleted'), {
|
||||
icon: 'delete',
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@ ol {
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { fb } from '../../functions/fb'
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import firebase from 'firebase/app'
|
||||
import { fb } from '../../functions/fb'
|
||||
import firebase from "firebase/app"
|
||||
import { fb } from "../../functions/fb"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -59,16 +59,16 @@ export default {
|
||||
.signInWithPopup(provider)
|
||||
.then(({ additionalUserInfo }) => {
|
||||
if (additionalUserInfo.isNewUser) {
|
||||
this.$toast.info(`${this.$t('turn_on')} ${this.$t('sync')}`, {
|
||||
icon: 'sync',
|
||||
this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, {
|
||||
icon: "sync",
|
||||
duration: null,
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t('yes'),
|
||||
text: this.$t("yes"),
|
||||
onClick: (e, toastObject) => {
|
||||
fb.writeSettings('syncHistory', false)
|
||||
fb.writeSettings('syncCollections', true)
|
||||
this.$router.push({ path: '/settings' })
|
||||
fb.writeSettings("syncHistory", false)
|
||||
fb.writeSettings("syncCollections", true)
|
||||
this.$router.push({ path: "/settings" })
|
||||
toastObject.remove()
|
||||
},
|
||||
},
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
})
|
||||
.catch(err => {
|
||||
this.$toast.show(err.message || err, {
|
||||
icon: 'error',
|
||||
icon: "error",
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -88,16 +88,16 @@ export default {
|
||||
.signInWithPopup(provider)
|
||||
.then(({ additionalUserInfo }) => {
|
||||
if (additionalUserInfo.isNewUser) {
|
||||
this.$toast.info(`${this.$t('turn_on')} ${this.$t('sync')}`, {
|
||||
icon: 'sync',
|
||||
this.$toast.info(`${this.$t("turn_on")} ${this.$t("sync")}`, {
|
||||
icon: "sync",
|
||||
duration: null,
|
||||
closeOnSwipe: false,
|
||||
action: {
|
||||
text: this.$t('yes'),
|
||||
text: this.$t("yes"),
|
||||
onClick: (e, toastObject) => {
|
||||
fb.writeSettings('syncHistory', false)
|
||||
fb.writeSettings('syncCollections', true)
|
||||
this.$router.push({ path: '/settings' })
|
||||
fb.writeSettings("syncHistory", false)
|
||||
fb.writeSettings("syncCollections", true)
|
||||
this.$router.push({ path: "/settings" })
|
||||
toastObject.remove()
|
||||
},
|
||||
},
|
||||
@@ -106,7 +106,7 @@ export default {
|
||||
})
|
||||
.catch(err => {
|
||||
this.$toast.show(err.message || err, {
|
||||
icon: 'error',
|
||||
icon: "error",
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
<script>
|
||||
import typelink from './typelink'
|
||||
import typelink from "./typelink"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
|
||||
<div class="field-deprecated" v-if="gqlField.isDeprecated">
|
||||
{{ $t('deprecated') }}
|
||||
{{ $t("deprecated") }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -50,7 +50,7 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import typelink from './typelink'
|
||||
import typelink from "./typelink"
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -68,11 +68,11 @@ export default {
|
||||
return (
|
||||
acc +
|
||||
`${arg.name}: ${arg.type.toString()}${
|
||||
index !== this.gqlField.args.length - 1 ? ', ' : ''
|
||||
index !== this.gqlField.args.length - 1 ? ", " : ""
|
||||
}`
|
||||
)
|
||||
}, '')
|
||||
const argsString = args.length > 0 ? `(${args})` : ''
|
||||
}, "")
|
||||
const argsString = args.length > 0 ? `(${args})` : ""
|
||||
return `${this.gqlField.name}${argsString}: ${this.gqlField.type.toString()}`
|
||||
},
|
||||
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const DEFAULT_THEME = 'twilight'
|
||||
const DEFAULT_THEME = "twilight"
|
||||
|
||||
import ace from 'ace-builds'
|
||||
import * as gql from 'graphql'
|
||||
import { getAutocompleteSuggestions } from 'graphql-language-service-interface'
|
||||
import 'ace-builds/webpack-resolver'
|
||||
import 'ace-builds/src-noconflict/ext-language_tools'
|
||||
import debounce from '../../functions/utils/debounce'
|
||||
import ace from "ace-builds"
|
||||
import * as gql from "graphql"
|
||||
import { getAutocompleteSuggestions } from "graphql-language-service-interface"
|
||||
import "ace-builds/webpack-resolver"
|
||||
import "ace-builds/src-noconflict/ext-language_tools"
|
||||
import debounce from "../../functions/utils/debounce"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '',
|
||||
default: "",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
},
|
||||
lang: {
|
||||
type: String,
|
||||
default: 'json',
|
||||
default: "json",
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
cacheValue: '',
|
||||
cacheValue: "",
|
||||
validationSchema: null,
|
||||
}
|
||||
},
|
||||
@@ -59,7 +59,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted() {
|
||||
let langTools = ace.require('ace/ext/language_tools')
|
||||
let langTools = ace.require("ace/ext/language_tools")
|
||||
|
||||
const editor = ace.edit(this.$refs.editor, {
|
||||
theme: `ace/theme/${this.defineTheme()}`,
|
||||
@@ -99,9 +99,9 @@ export default {
|
||||
this.editor = editor
|
||||
this.cacheValue = this.value
|
||||
|
||||
editor.on('change', () => {
|
||||
editor.on("change", () => {
|
||||
const content = editor.getValue()
|
||||
this.$emit('input', content)
|
||||
this.$emit("input", content)
|
||||
this.parseContents(content)
|
||||
this.cacheValue = content
|
||||
})
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
},
|
||||
|
||||
parseContents: debounce(function(content) {
|
||||
if (content !== '') {
|
||||
if (content !== "") {
|
||||
try {
|
||||
const doc = gql.parse(content)
|
||||
|
||||
@@ -134,7 +134,7 @@ export default {
|
||||
row: locations[0].line - 1,
|
||||
column: locations[0].column - 1,
|
||||
text: message,
|
||||
type: 'error',
|
||||
type: "error",
|
||||
}))
|
||||
)
|
||||
}
|
||||
@@ -144,7 +144,7 @@ export default {
|
||||
row: e.locations[0].line - 1,
|
||||
column: e.locations[0].column - 1,
|
||||
text: e.message,
|
||||
type: 'error',
|
||||
type: "error",
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
|
||||
<div v-if="gqlType.getFields">
|
||||
<h5>{{ $t('fields') }}</h5>
|
||||
<h5>{{ $t("fields") }}</h5>
|
||||
<div v-for="field in gqlType.getFields()" :key="field.name">
|
||||
<gql-field :gqlField="field" :jumpTypeCallback="jumpTypeCallback" />
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
'gql-field': () => import('./field'),
|
||||
"gql-field": () => import("./field"),
|
||||
},
|
||||
|
||||
props: {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<style scoped lang="scss">
|
||||
.typelink {
|
||||
color: var(--ac-color);
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
font-family: "Roboto Mono", monospace;
|
||||
font-weight: 400;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
}"
|
||||
>
|
||||
<i class="material-icons">
|
||||
{{ entry.star ? 'star' : 'star_border' }}
|
||||
{{ entry.star ? "star" : "star_border" }}
|
||||
</i>
|
||||
</button>
|
||||
<li>
|
||||
@@ -73,7 +73,7 @@
|
||||
v-close-popover
|
||||
>
|
||||
<i class="material-icons">restore</i>
|
||||
<span>{{ $t('restore') }}</span>
|
||||
<span>{{ $t("restore") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
@@ -85,7 +85,7 @@
|
||||
v-close-popover
|
||||
>
|
||||
<i class="material-icons">delete</i>
|
||||
<span>{{ $t('delete') }}</span>
|
||||
<span>{{ $t("delete") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -164,11 +164,11 @@
|
||||
</virtual-list>
|
||||
<ul :class="{ hidden: filteredHistory.length != 0 || history.length === 0 }">
|
||||
<li>
|
||||
<label>{{ $t('nothing_found') }} "{{ filterText }}"</label>
|
||||
<label>{{ $t("nothing_found") }} "{{ filterText }}"</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-if="history.length === 0" class="info">
|
||||
{{ $t('history_empty') }}
|
||||
{{ $t("history_empty") }}
|
||||
</p>
|
||||
<div v-if="history.length !== 0">
|
||||
<div class="flex-wrap" v-if="!isClearingHistory">
|
||||
@@ -179,7 +179,7 @@
|
||||
@click="enableHistoryClearing"
|
||||
>
|
||||
<i class="material-icons">clear_all</i>
|
||||
<span>{{ $t('clear_all') }}</span>
|
||||
<span>{{ $t("clear_all") }}</span>
|
||||
</button>
|
||||
<v-popover>
|
||||
<button class="tooltip-target icon" v-tooltip="$t('sort')">
|
||||
@@ -189,45 +189,45 @@
|
||||
<div>
|
||||
<button class="icon" @click="sort_by_label()" v-close-popover>
|
||||
<i class="material-icons">sort_by_alpha</i>
|
||||
<span>{{ $t('label') }}</span>
|
||||
<span>{{ $t("label") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="sort_by_time()" v-close-popover>
|
||||
<i class="material-icons">access_time</i>
|
||||
<span>{{ $t('time') }}</span>
|
||||
<span>{{ $t("time") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="sort_by_status_code()" v-close-popover>
|
||||
<i class="material-icons">assistant</i>
|
||||
<span>{{ $t('status') }}</span>
|
||||
<span>{{ $t("status") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="sort_by_url()" v-close-popover>
|
||||
<i class="material-icons">language</i>
|
||||
<span>{{ $t('url') }}</span>
|
||||
<span>{{ $t("url") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="sort_by_path()" v-close-popover>
|
||||
<i class="material-icons">timeline</i>
|
||||
<span>{{ $t('path') }}</span>
|
||||
<span>{{ $t("path") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="showMore">
|
||||
<button class="icon" @click="sort_by_duration()" v-close-popover>
|
||||
<i class="material-icons">timer</i>
|
||||
<span>{{ $t('duration') }}</span>
|
||||
<span>{{ $t("duration") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="icon" @click="toggleCollapse()">
|
||||
<i class="material-icons">
|
||||
{{ !showMore ? 'first_page' : 'last_page' }}
|
||||
{{ !showMore ? "first_page" : "last_page" }}
|
||||
</i>
|
||||
<span>{{ !showMore ? $t('show_more') : $t('hide_more') }}</span>
|
||||
<span>{{ !showMore ? $t("show_more") : $t("hide_more") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -235,7 +235,7 @@
|
||||
</div>
|
||||
<div class="flex-wrap" v-else>
|
||||
<label for="clear-history-button" class="info">
|
||||
{{ $t('are_you_sure') }}
|
||||
{{ $t("are_you_sure") }}
|
||||
</label>
|
||||
<div>
|
||||
<button
|
||||
@@ -295,7 +295,7 @@ ol {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-family: 'Roboto Mono', monospace;
|
||||
font-family: "Roboto Mono", monospace;
|
||||
font-weight: 400;
|
||||
background-color: transparent;
|
||||
padding: 2px 6px;
|
||||
@@ -320,24 +320,24 @@ ol {
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { findStatusGroup } from '../pages/index'
|
||||
import { fb } from '../functions/fb'
|
||||
import { findStatusGroup } from "../pages/index"
|
||||
import { fb } from "../functions/fb"
|
||||
|
||||
const updateOnLocalStorage = (propertyName, property) =>
|
||||
window.localStorage.setItem(propertyName, JSON.stringify(property))
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'pw-section': () => import('./section'),
|
||||
VirtualList: () => import('vue-virtual-scroll-list'),
|
||||
"pw-section": () => import("./section"),
|
||||
VirtualList: () => import("vue-virtual-scroll-list"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
history:
|
||||
fb.currentUser !== null
|
||||
? fb.currentHistory
|
||||
: JSON.parse(window.localStorage.getItem('history')) || [],
|
||||
filterText: '',
|
||||
: JSON.parse(window.localStorage.getItem("history")) || [],
|
||||
filterText: "",
|
||||
showFilter: false,
|
||||
isClearingHistory: false,
|
||||
reverse_sort_label: false,
|
||||
@@ -353,12 +353,12 @@ export default {
|
||||
this.history =
|
||||
fb.currentUser !== null
|
||||
? fb.currentHistory
|
||||
: JSON.parse(window.localStorage.getItem('history')) || []
|
||||
: JSON.parse(window.localStorage.getItem("history")) || []
|
||||
return this.history.filter(entry => {
|
||||
const filterText = this.filterText.toLowerCase()
|
||||
return Object.keys(entry).some(key => {
|
||||
let value = entry[key]
|
||||
value = typeof value !== 'string' ? value.toString() : value
|
||||
value = typeof value !== "string" ? value.toString() : value
|
||||
return value.toLowerCase().includes(filterText)
|
||||
})
|
||||
})
|
||||
@@ -370,21 +370,21 @@ export default {
|
||||
fb.clearHistory()
|
||||
}
|
||||
this.history = []
|
||||
this.filterText = ''
|
||||
this.filterText = ""
|
||||
this.disableHistoryClearing()
|
||||
updateOnLocalStorage('history', this.history)
|
||||
this.$toast.error(this.$t('history_deleted'), {
|
||||
icon: 'delete',
|
||||
updateOnLocalStorage("history", this.history)
|
||||
this.$toast.error(this.$t("history_deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
},
|
||||
useHistory(entry) {
|
||||
this.$emit('useHistory', entry)
|
||||
this.$emit("useHistory", entry)
|
||||
},
|
||||
findEntryStatus(entry) {
|
||||
const foundStatusGroup = findStatusGroup(entry.status)
|
||||
return (
|
||||
foundStatusGroup || {
|
||||
className: '',
|
||||
className: "",
|
||||
}
|
||||
)
|
||||
},
|
||||
@@ -394,16 +394,16 @@ export default {
|
||||
}
|
||||
this.history.splice(this.history.indexOf(entry), 1)
|
||||
if (this.history.length === 0) {
|
||||
this.filterText = ''
|
||||
this.filterText = ""
|
||||
}
|
||||
updateOnLocalStorage('history', this.history)
|
||||
this.$toast.error(this.$t('deleted'), {
|
||||
icon: 'delete',
|
||||
updateOnLocalStorage("history", this.history)
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
},
|
||||
addEntry(entry) {
|
||||
this.history.push(entry)
|
||||
updateOnLocalStorage('history', this.history)
|
||||
updateOnLocalStorage("history", this.history)
|
||||
},
|
||||
enableHistoryClearing() {
|
||||
if (!this.history || !this.history.length) return
|
||||
@@ -415,10 +415,10 @@ export default {
|
||||
sort_by_time() {
|
||||
let byDate = this.history.slice(0)
|
||||
byDate.sort((a, b) => {
|
||||
let date_a = a.date.split('/')
|
||||
let date_b = b.date.split('/')
|
||||
let time_a = a.time.split(':')
|
||||
let time_b = b.time.split(':')
|
||||
let date_a = a.date.split("/")
|
||||
let date_b = b.date.split("/")
|
||||
let time_a = a.time.split(":")
|
||||
let time_b = b.time.split(":")
|
||||
let final_a = new Date(date_a[2], date_a[1], date_a[0], time_a[0], time_a[1], time_a[2])
|
||||
let final_b = new Date(date_b[2], date_b[1], date_b[0], time_b[0], time_b[1], time_b[2])
|
||||
if (this.reverse_sort_time) return final_b - final_a
|
||||
@@ -481,7 +481,7 @@ export default {
|
||||
fb.toggleStar(entry, !entry.star)
|
||||
}
|
||||
entry.star = !entry.star
|
||||
updateOnLocalStorage('history', this.history)
|
||||
updateOnLocalStorage("history", this.history)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<legend @click.prevent="collapse">
|
||||
<span>{{ label }}</span>
|
||||
<i class="material-icons">
|
||||
{{ isCollapsed ? 'expand_more' : 'expand_less' }}
|
||||
{{ isCollapsed ? "expand_more" : "expand_less" }}
|
||||
</i>
|
||||
</legend>
|
||||
<div class="collapsible" :class="{ hidden: collapsed }">
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
default: 'Section',
|
||||
default: "Section",
|
||||
},
|
||||
collapsed: {
|
||||
type: Boolean,
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
methods: {
|
||||
collapse({ target }) {
|
||||
const parent = target.parentNode.parentNode
|
||||
parent.querySelector('.collapsible').classList.toggle('hidden')
|
||||
parent.querySelector(".collapsible").classList.toggle("hidden")
|
||||
this.isCollapsed = !this.isCollapsed
|
||||
},
|
||||
},
|
||||
|
||||
@@ -90,8 +90,8 @@ export default {
|
||||
|
||||
methods: {
|
||||
toggle() {
|
||||
const containsOnClass = this.$refs.toggle.classList.toggle('on')
|
||||
this.$emit('change', containsOnClass)
|
||||
const containsOnClass = this.$refs.toggle.classList.toggle("on")
|
||||
this.$emit("change", containsOnClass)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user