🚨 Lint

This commit is contained in:
Liyas Thomas
2019-11-12 10:22:50 +05:30
parent 3b6c8247c5
commit 653e42c2b9
17 changed files with 690 additions and 350 deletions

View File

@@ -3,17 +3,16 @@
</template> </template>
<script> <script>
const DEFAULT_THEME = 'dracula'; const DEFAULT_THEME = "dracula";
import ace from 'ace-builds'; import ace from "ace-builds";
import "ace-builds/webpack-resolver"; import "ace-builds/webpack-resolver";
export default { export default {
props: { props: {
value: { value: {
type: String, type: String,
default: '' default: ""
}, },
theme: { theme: {
type: String, type: String,
@@ -21,7 +20,7 @@ export default {
}, },
lang: { lang: {
type: String, type: String,
default: 'json', default: "json"
}, },
options: { options: {
type: Object, type: Object,
@@ -32,22 +31,22 @@ export default {
data() { data() {
return { return {
editor: null, editor: null,
cacheValue: '' cacheValue: ""
} };
}, },
watch: { watch: {
value(value) { value(value) {
if(value !== this.cacheValue) { if (value !== this.cacheValue) {
this.editor.session.setValue(value,1); this.editor.session.setValue(value, 1);
this.cacheValue = value; this.cacheValue = value;
} }
}, },
theme() { theme() {
this.editor.setTheme('ace/theme/' + this.defineTheme()) this.editor.setTheme("ace/theme/" + this.defineTheme());
}, },
lang(value) { lang(value) {
this.editor.getSession().setMode('ace/mode/' + value); this.editor.getSession().setMode("ace/mode/" + value);
}, },
options(value) { options(value) {
this.editor.setOptions(value); this.editor.setOptions(value);
@@ -56,10 +55,10 @@ export default {
mounted() { mounted() {
const editor = ace.edit(this.$refs.editor, { const editor = ace.edit(this.$refs.editor, {
theme: 'ace/theme/'+ this.defineTheme(), theme: "ace/theme/" + this.defineTheme(),
mode: "ace/mode/" + this.lang, mode: "ace/mode/" + this.lang,
...this.options ...this.options
}) });
editor.setValue(this.value); editor.setValue(this.value);
@@ -69,10 +68,12 @@ export default {
methods: { methods: {
defineTheme() { defineTheme() {
if(this.theme) { if (this.theme) {
return this.theme; return this.theme;
} else { } else {
return this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME return (
this.$store.state.postwoman.settings.THEME_ACE_EDITOR || DEFAULT_THEME
);
} }
} }
}, },
@@ -81,5 +82,5 @@ export default {
this.editor.destroy(); this.editor.destroy();
this.editor.container.remove(); this.editor.container.remove();
} }
} };
</script> </script>

View File

@@ -23,7 +23,9 @@
@click.prevent="forceSuggestion(suggestion)" @click.prevent="forceSuggestion(suggestion)"
:class="{ active: currentSuggestionIndex === index }" :class="{ active: currentSuggestionIndex === index }"
:key="index" :key="index"
>{{ suggestion }}</li> >
{{ suggestion }}
</li>
</ul> </ul>
</div> </div>
</template> </template>

View File

@@ -6,17 +6,29 @@
<i class="material-icons" v-show="!showChildren">arrow_right</i> <i class="material-icons" v-show="!showChildren">arrow_right</i>
<i class="material-icons" v-show="showChildren">arrow_drop_down</i> <i class="material-icons" v-show="showChildren">arrow_drop_down</i>
<i class="material-icons">folder</i> <i class="material-icons">folder</i>
<span>{{collection.name}}</span> <span>{{ collection.name }}</span>
</button> </button>
</div> </div>
<div> <div>
<button class="icon" @click="removeCollection" v-tooltip="'Delete collection'"> <button
class="icon"
@click="removeCollection"
v-tooltip="'Delete collection'"
>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
<button class="icon" @click="$emit('edit-collection')" v-tooltip="'Edit collection'"> <button
class="icon"
@click="$emit('edit-collection')"
v-tooltip="'Edit collection'"
>
<i class="material-icons">create</i> <i class="material-icons">create</i>
</button> </button>
<button class="icon" @click="$emit('add-folder')" v-tooltip="'New Folder'"> <button
class="icon"
@click="$emit('add-folder')"
v-tooltip="'New Folder'"
>
<i class="material-icons">create_new_folder</i> <i class="material-icons">create_new_folder</i>
</button> </button>
</div> </div>
@@ -33,7 +45,11 @@
v-on:edit-request="$emit('edit-request', $event)" v-on:edit-request="$emit('edit-request', $event)"
/> />
</li> </li>
<li v-if="(collection.folders.length === 0) && (collection.requests.length === 0)"> <li
v-if="
collection.folders.length === 0 && collection.requests.length === 0
"
>
<label>Collection is empty</label> <label>Collection is empty</label>
</li> </li>
</ul> </ul>
@@ -44,7 +60,14 @@
v-bind:collection-index="collectionIndex" v-bind:collection-index="collectionIndex"
v-bind:folder-index="-1" v-bind:folder-index="-1"
v-bind:request-index="index" v-bind:request-index="index"
v-on:edit-request="$emit('edit-request', { request, collectionIndex, folderIndex: undefined, requestIndex: index })" v-on:edit-request="
$emit('edit-request', {
request,
collectionIndex,
folderIndex: undefined,
requestIndex: index
})
"
></request> ></request>
</li> </li>
</ul> </ul>

View File

@@ -17,7 +17,12 @@
<div slot="body"> <div slot="body">
<ul> <ul>
<li> <li>
<input type="text" v-model="name" v-bind:placeholder="editingCollection.name" @keyup.enter="saveCollection" /> <input
type="text"
v-model="name"
v-bind:placeholder="editingCollection.name"
@keyup.enter="saveCollection"
/>
</li> </li>
</ul> </ul>
</div> </div>

View File

@@ -17,7 +17,12 @@
<div slot="body"> <div slot="body">
<ul> <ul>
<li> <li>
<input type="text" v-model="name" v-bind:placeholder="folder.name" @keyup.enter="editFolder" /> <input
type="text"
v-model="name"
v-bind:placeholder="folder.name"
@keyup.enter="editFolder"
/>
</li> </li>
</ul> </ul>
</div> </div>

View File

@@ -18,20 +18,42 @@
<ul> <ul>
<li> <li>
<label for="selectLabel">Label</label> <label for="selectLabel">Label</label>
<input type="text" id="selectLabel" v-model="requestUpdateData.name" @keyup.enter="saveRequest" :placeholder="request.name" /> <input
type="text"
id="selectLabel"
v-model="requestUpdateData.name"
@keyup.enter="saveRequest"
:placeholder="request.name"
/>
<label for="selectCollection">Collection</label> <label for="selectCollection">Collection</label>
<select type="text" id="selectCollection" v-model="requestUpdateData.collectionIndex"> <select
<option :key="undefined" :value="undefined" hidden disabled selected>Current Collection</option> type="text"
id="selectCollection"
v-model="requestUpdateData.collectionIndex"
>
<option :key="undefined" :value="undefined" hidden disabled selected
>Current Collection</option
>
<option <option
v-for="(collection, index) in $store.state.postwoman.collections" v-for="(collection, index) in $store.state.postwoman.collections"
:key="index" :key="index"
:value="index" :value="index"
>{{ collection.name }}</option> >{{ collection.name }}</option
>
</select> </select>
<label for="selectFolder">Folder</label> <label for="selectFolder">Folder</label>
<select type="text" id="selectFolder" v-model="requestUpdateData.folderIndex"> <select
type="text"
id="selectFolder"
v-model="requestUpdateData.folderIndex"
>
<option :key="undefined" :value="undefined">/</option> <option :key="undefined" :value="undefined">/</option>
<option v-for="(folder, index) in folders" :key="index" :value="index">{{ folder.name }}</option> <option
v-for="(folder, index) in folders"
:key="index"
:value="index"
>{{ folder.name }}</option
>
</select> </select>
</li> </li>
</ul> </ul>

View File

@@ -6,7 +6,7 @@
<i class="material-icons" v-show="!showChildren">arrow_right</i> <i class="material-icons" v-show="!showChildren">arrow_right</i>
<i class="material-icons" v-show="showChildren">arrow_drop_down</i> <i class="material-icons" v-show="showChildren">arrow_drop_down</i>
<i class="material-icons">folder_open</i> <i class="material-icons">folder_open</i>
<span>{{folder.name}}</span> <span>{{ folder.name }}</span>
</button> </button>
</div> </div>
<div> <div>
@@ -27,7 +27,14 @@
v-bind:collection-index="collectionIndex" v-bind:collection-index="collectionIndex"
v-bind:folder-index="folderIndex" v-bind:folder-index="folderIndex"
v-bind:request-index="index" v-bind:request-index="index"
v-on:edit-request="$emit('edit-request', { request, collectionIndex, folderIndex, requestIndex: index })" v-on:edit-request="
$emit('edit-request', {
request,
collectionIndex,
folderIndex,
requestIndex: index
})
"
></request> ></request>
</li> </li>
<li v-if="folder.requests.length === 0"> <li v-if="folder.requests.length === 0">

View File

@@ -5,7 +5,10 @@ TODO:
<template> <template>
<div class="collections-wrapper"> <div class="collections-wrapper">
<addCollection v-bind:show="showModalAdd" v-on:hide-modal="displayModalAdd(false)"></addCollection> <addCollection
v-bind:show="showModalAdd"
v-on:hide-modal="displayModalAdd(false)"
></addCollection>
<editCollection <editCollection
v-bind:show="showModalEdit" v-bind:show="showModalEdit"
v-bind:editingCollection="editingCollection" v-bind:editingCollection="editingCollection"

View File

@@ -3,14 +3,18 @@
<div> <div>
<button class="icon" @click="selectRequest()" v-tooltip="'Use request'"> <button class="icon" @click="selectRequest()" v-tooltip="'Use request'">
<i class="material-icons">insert_drive_file</i> <i class="material-icons">insert_drive_file</i>
<span>{{request.name}}</span> <span>{{ request.name }}</span>
</button> </button>
</div> </div>
<div> <div>
<button class="icon" @click="removeRequest" v-tooltip="'Delete request'"> <button class="icon" @click="removeRequest" v-tooltip="'Delete request'">
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
<button class="icon" @click="$emit('edit-request')" v-tooltip="'Edit request'"> <button
class="icon"
@click="$emit('edit-request')"
v-tooltip="'Edit request'"
>
<i class="material-icons">edit</i> <i class="material-icons">edit</i>
</button> </button>
</div> </div>

View File

@@ -26,27 +26,48 @@
@keyup.enter="saveRequestAs" @keyup.enter="saveRequestAs"
/> />
<label for="selectCollection">Collection</label> <label for="selectCollection">Collection</label>
<select type="text" id="selectCollection" v-model="requestData.collectionIndex"> <select
<option :key="undefined" :value="undefined" hidden disabled selected>Select a Collection</option> type="text"
id="selectCollection"
v-model="requestData.collectionIndex"
>
<option :key="undefined" :value="undefined" hidden disabled selected
>Select a Collection</option
>
<option <option
v-for="(collection, index) in $store.state.postwoman.collections" v-for="(collection, index) in $store.state.postwoman.collections"
:key="index" :key="index"
:value="index" :value="index"
>{{ collection.name }}</option> >{{ collection.name }}</option
>
</select> </select>
<label for="selectFolder">Folder</label> <label for="selectFolder">Folder</label>
<select type="text" id="selectFolder" v-model="requestData.folderIndex"> <select
type="text"
id="selectFolder"
v-model="requestData.folderIndex"
>
<option :key="undefined" :value="undefined">/</option> <option :key="undefined" :value="undefined">/</option>
<option v-for="(folder, index) in folders" :key="index" :value="index">{{ folder.name }}</option> <option
v-for="(folder, index) in folders"
:key="index"
:value="index"
>{{ folder.name }}</option
>
</select> </select>
<label for="selectRequest">Request</label> <label for="selectRequest">Request</label>
<select type="text" id="selectRequest" v-model="requestData.requestIndex"> <select
type="text"
id="selectRequest"
v-model="requestData.requestIndex"
>
<option :key="undefined" :value="undefined">/</option> <option :key="undefined" :value="undefined">/</option>
<option <option
v-for="(folder, index) in requests" v-for="(folder, index) in requests"
:key="index" :key="index"
:value="index" :value="index"
>{{ folder.name }}</option> >{{ folder.name }}</option
>
</select> </select>
</li> </li>
</ul> </ul>

View File

@@ -2,7 +2,12 @@
<pw-section class="green" icon="history" label="History" ref="history"> <pw-section class="green" icon="history" label="History" ref="history">
<ul> <ul>
<li id="filter-history"> <li id="filter-history">
<input aria-label="Search" type="text" placeholder="search history" v-model="filterText" /> <input
aria-label="Search"
type="text"
placeholder="search history"
v-model="filterText"
/>
</li> </li>
</ul> </ul>
<ul v-if="history.length !== 0" class="labels"> <ul v-if="history.length !== 0" class="labels">
@@ -61,29 +66,54 @@
</transition> </transition>
<div class="show-on-small-screen"> <div class="show-on-small-screen">
<li> <li>
<button class="icon" @click="enableHistoryClearing" v-tooltip="'Clear History'"> <button
class="icon"
@click="enableHistoryClearing"
v-tooltip="'Clear History'"
>
<i class="material-icons">clear_all</i> <i class="material-icons">clear_all</i>
</button> </button>
</li> </li>
<li> <li>
<button class="icon" @click="toggleCollapse()" v-tooltip="{ content: !show ? 'Show more' : 'Hide more'}"> <button
class="icon"
@click="toggleCollapse()"
v-tooltip="{ content: !show ? 'Show more' : 'Hide more' }"
>
<i class="material-icons" v-if="!show">first_page</i> <i class="material-icons" v-if="!show">first_page</i>
<i class="material-icons" v-else>last_page</i> <i class="material-icons" v-else>last_page</i>
</button> </button>
</li> </li>
</div> </div>
</ul> </ul>
<virtual-list class="virtual-list" :class="{filled: filteredHistory.length}" :size="56" :remain="Math.min(5, filteredHistory.length)"> <virtual-list
class="virtual-list"
:class="{ filled: filteredHistory.length }"
:size="56"
:remain="Math.min(5, filteredHistory.length)"
>
<ul v-for="(entry, index) in filteredHistory" :key="index" class="entry"> <ul v-for="(entry, index) in filteredHistory" :key="index" class="entry">
<div class="show-on-small-screen"> <div class="show-on-small-screen">
<li> <li>
<button class="icon" :class="{ stared: entry.star }" @click="toggleStar(index)" v-tooltip="{ content: !entry.star ? 'Add star' : 'Remove star'}"> <button
class="icon"
:class="{ stared: entry.star }"
@click="toggleStar(index)"
v-tooltip="{ content: !entry.star ? 'Add star' : 'Remove star' }"
>
<i class="material-icons" v-if="entry.star">star</i> <i class="material-icons" v-if="entry.star">star</i>
<i class="material-icons" v-else>star_border</i> <i class="material-icons" v-else>star_border</i>
</button> </button>
</li> </li>
<li> <li>
<button class="icon" v-tooltip="{ content: !entry.usesScripts ? 'No pre-request script' : 'Used pre-request script'}"> <button
class="icon"
v-tooltip="{
content: !entry.usesScripts
? 'No pre-request script'
: 'Used pre-request script'
}"
>
<i class="material-icons" v-if="!entry.usesScripts">http</i> <i class="material-icons" v-if="!entry.usesScripts">http</i>
<i class="material-icons" v-else>code</i> <i class="material-icons" v-else>code</i>
</button> </button>
@@ -91,51 +121,113 @@
</div> </div>
<div class="show-on-small-screen"> <div class="show-on-small-screen">
<li> <li>
<input aria-label="Label" type="text" readonly :value="entry.label" placeholder="No label" /> <input
aria-label="Label"
type="text"
readonly
:value="entry.label"
placeholder="No label"
/>
</li> </li>
<li> <li>
<input aria-label="Time" type="text" readonly :value="entry.time" v-tooltip="entry.date" /> <input
aria-label="Time"
type="text"
readonly
:value="entry.time"
v-tooltip="entry.date"
/>
</li> </li>
</div> </div>
<li class="method-list-item"> <li class="method-list-item">
<input aria-label="Method" type="text" readonly :value="entry.method" :class="findEntryStatus(entry).className" :style="{'--status-code': entry.status}" /> <input
<span class="entry-status-code" :class="findEntryStatus(entry).className" :style="{'--status-code': entry.status}">{{entry.status}}</span> aria-label="Method"
type="text"
readonly
:value="entry.method"
:class="findEntryStatus(entry).className"
:style="{ '--status-code': entry.status }"
/>
<span
class="entry-status-code"
:class="findEntryStatus(entry).className"
:style="{ '--status-code': entry.status }"
>{{ entry.status }}</span
>
</li> </li>
<div class="show-on-small-screen"> <div class="show-on-small-screen">
<li> <li>
<input aria-label="URL" type="text" readonly :value="entry.url" placeholder="No URL" /> <input
aria-label="URL"
type="text"
readonly
:value="entry.url"
placeholder="No URL"
/>
</li> </li>
<li> <li>
<input aria-label="Path" type="text" readonly :value="entry.path" placeholder="No path" /> <input
aria-label="Path"
type="text"
readonly
:value="entry.path"
placeholder="No path"
/>
</li> </li>
</div> </div>
<transition name="smooth"> <transition name="smooth">
<div v-if="show" class="show-on-small-screen"> <div v-if="show" class="show-on-small-screen">
<li> <li>
<input aria-label="Duration" type="text" readonly :value="entry.duration" placeholder="No duration" /> <input
aria-label="Duration"
type="text"
readonly
:value="entry.duration"
placeholder="No duration"
/>
</li> </li>
<li> <li>
<input aria-label="Pre Request Script" type="text" readonly :value="entry.preRequestScript" placeholder="No pre request script" /> <input
aria-label="Pre Request Script"
type="text"
readonly
:value="entry.preRequestScript"
placeholder="No pre request script"
/>
</li> </li>
</div> </div>
</transition> </transition>
<div class="show-on-small-screen"> <div class="show-on-small-screen">
<li> <li>
<button v-tooltip="'Delete entry'" class="icon" :id="'delete-button#'+index" @click="deleteHistory(entry)" aria-label="Delete"> <button
v-tooltip="'Delete entry'"
class="icon"
:id="'delete-button#' + index"
@click="deleteHistory(entry)"
aria-label="Delete"
>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
</li> </li>
<li> <li>
<button v-tooltip="'Edit entry'" class="icon" :id="'use-button#'+index" @click="useHistory(entry)" aria-label="Edit"> <button
v-tooltip="'Edit entry'"
class="icon"
:id="'use-button#' + index"
@click="useHistory(entry)"
aria-label="Edit"
>
<i class="material-icons">edit</i> <i class="material-icons">edit</i>
</button> </button>
</li> </li>
</div> </div>
</ul> </ul>
</virtual-list> </virtual-list>
<ul :class="{hidden: filteredHistory.length != 0 || history.length === 0 }"> <ul
:class="{ hidden: filteredHistory.length != 0 || history.length === 0 }"
>
<li> <li>
<label>Nothing found "{{filterText}}"</label> <label>Nothing found "{{ filterText }}"</label>
</li> </li>
</ul> </ul>
<ul v-if="history.length === 0"> <ul v-if="history.length === 0">
@@ -145,7 +237,12 @@
</ul> </ul>
<ul v-if="history.length !== 0"> <ul v-if="history.length !== 0">
<li v-if="!isClearingHistory"> <li v-if="!isClearingHistory">
<button class="icon" id="clear-history-button" :disabled="history.length === 0" @click="enableHistoryClearing"> <button
class="icon"
id="clear-history-button"
:disabled="history.length === 0"
@click="enableHistoryClearing"
>
<i class="material-icons">clear_all</i> <i class="material-icons">clear_all</i>
<span>Clear All</span> <span>Clear All</span>
</button> </button>
@@ -154,8 +251,20 @@
<div class="flex-wrap"> <div class="flex-wrap">
<label for="clear-history-button">Are you sure?</label> <label for="clear-history-button">Are you sure?</label>
<div> <div>
<button class="icon" id="confirm-clear-history-button" @click="clearHistory">Yes</button> <button
<button class="icon" id="reject-clear-history-button" @click="disableHistoryClearing">No</button> class="icon"
id="confirm-clear-history-button"
@click="clearHistory"
>
Yes
</button>
<button
class="icon"
id="reject-clear-history-button"
@click="disableHistoryClearing"
>
No
</button>
</div> </div>
</div> </div>
</li> </li>
@@ -164,223 +273,223 @@
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.virtual-list { .virtual-list {
min-height: 90px; min-height: 90px;
[readonly] { [readonly] {
cursor: default; cursor: default;
} }
}
label {
&:hover {
cursor: pointer;
color: var(--fg-color);
}
}
.smooth-enter-active,
.smooth-leave-active {
transition: all 0.2s;
}
.smooth-enter,
.smooth-leave-to {
opacity: 0;
}
.stared {
color: #f8e81c !important;
}
@media (max-width: 720px) {
.virtual-list.filled {
min-height: 320px;
} }
label { .labels {
display: none;
&:hover {
cursor: pointer;
color: var(--fg-color);
}
} }
.smooth-enter-active, .entry {
.smooth-leave-active { border-bottom: 1px solid var(--brd-color);
transition: all 0.2s;
} }
}
.smooth-enter,
.smooth-leave-to {
opacity: 0;
}
.stared {
color: #F8E81C !important;
}
@media (max-width: 720px) {
.virtual-list.filled {
min-height: 320px;
}
.labels {
display: none;
}
.entry {
border-bottom: 1px solid var(--brd-color);
}
}
</style> </style>
<script> <script>
import VirtualList from "vue-virtual-scroll-list"; import VirtualList from "vue-virtual-scroll-list";
import section from "./section"; import section from "./section";
import { import { findStatusGroup } from "../pages/index";
findStatusGroup
} from "../pages/index";
const updateOnLocalStorage = (propertyName, property) => const updateOnLocalStorage = (propertyName, property) =>
window.localStorage.setItem(propertyName, JSON.stringify(property)); window.localStorage.setItem(propertyName, JSON.stringify(property));
export default { export default {
components: { components: {
"pw-section": section, "pw-section": section,
VirtualList VirtualList
}, },
data() { data() {
const localStorageHistory = JSON.parse( const localStorageHistory = JSON.parse(
window.localStorage.getItem("history") window.localStorage.getItem("history")
); );
return { return {
history: localStorageHistory || [], history: localStorageHistory || [],
filterText: "", filterText: "",
showFilter: false, showFilter: false,
isClearingHistory: false, isClearingHistory: false,
reverse_sort_label: false, reverse_sort_label: false,
reverse_sort_time: false, reverse_sort_time: false,
reverse_sort_status_code: false, reverse_sort_status_code: false,
reverse_sort_url: false, reverse_sort_url: false,
reverse_sort_path: false, reverse_sort_path: false,
show: false show: false
}; };
}, },
computed: { computed: {
filteredHistory() { filteredHistory() {
return this.history.filter(entry => { return this.history.filter(entry => {
const filterText = this.filterText.toLowerCase(); const filterText = this.filterText.toLowerCase();
return Object.keys(entry).some(key => { return Object.keys(entry).some(key => {
let value = entry[key]; let value = entry[key];
value = typeof value !== "string" ? value.toString() : value; value = typeof value !== "string" ? value.toString() : value;
return value.toLowerCase().includes(filterText); return value.toLowerCase().includes(filterText);
});
}); });
} });
},
methods: {
clearHistory() {
this.history = [];
this.filterText = "";
this.disableHistoryClearing();
updateOnLocalStorage("history", this.history);
this.$toast.error("History Deleted", {
icon: "delete"
});
},
useHistory(entry) {
this.$emit("useHistory", entry);
},
findEntryStatus(entry) {
const foundStatusGroup = findStatusGroup(entry.status);
return (
foundStatusGroup || {
className: ""
}
);
},
deleteHistory(entry) {
this.history.splice(this.history.indexOf(entry), 1);
if (this.history.length === 0) {
this.filterText = "";
}
updateOnLocalStorage("history", this.history);
this.$toast.error("Deleted", {
icon: "delete"
});
},
addEntry(entry) {
this.history.push(entry);
updateOnLocalStorage("history", this.history);
},
enableHistoryClearing() {
if (!this.history || !this.history.length) return;
this.isClearingHistory = true;
},
disableHistoryClearing() {
this.isClearingHistory = false;
},
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 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;
else return final_a - final_b;
});
this.history = byDate;
this.reverse_sort_time = !this.reverse_sort_time;
},
sort_by_status_code() {
let byCode = this.history.slice(0);
byCode.sort((a, b) => {
if (this.reverse_sort_status_code) return b.status - a.status;
else return a.status - b.status;
});
this.history = byCode;
this.reverse_sort_status_code = !this.reverse_sort_status_code;
},
sort_by_url() {
let byUrl = this.history.slice(0);
byUrl.sort((a, b) => {
if (this.reverse_sort_url)
return a.url == b.url ? 0 : +(a.url < b.url) || -1;
else return a.url == b.url ? 0 : +(a.url > b.url) || -1;
});
this.history = byUrl;
this.reverse_sort_url = !this.reverse_sort_url;
},
sort_by_label() {
let byLabel = this.history.slice(0);
byLabel.sort((a, b) => {
if (this.reverse_sort_label)
return a.label == b.label ? 0 : +(a.label < b.label) || -1;
else return a.label == b.label ? 0 : +(a.label > b.label) || -1;
});
this.history = byLabel;
this.reverse_sort_label = !this.reverse_sort_label;
},
sort_by_path() {
let byPath = this.history.slice(0);
byPath.sort((a, b) => {
if (this.reverse_sort_path)
return a.path == b.path ? 0 : +(a.path < b.path) || -1;
else return a.path == b.path ? 0 : +(a.path > b.path) || -1;
});
this.history = byPath;
this.reverse_sort_path = !this.reverse_sort_path;
},
sort_by_duration() {
let byDuration = this.history.slice(0);
byDuration.sort((a, b) => {
if (this.reverse_sort_duration)
return a.duration == b.duration ? 0 : +(a.duration < b.duration) || -1;
else return a.duration == b.duration ? 0 : +(a.duration > b.duration) || -1;
});
this.history = byDuration;
this.reverse_sort_duration = !this.reverse_sort_duration;
},
toggleCollapse() {
this.show = !this.show
},
toggleStar(index) {
this.history[index]["star"] = !this.history[index]["star"];
updateOnLocalStorage("history", this.history);
}
} }
}; },
methods: {
clearHistory() {
this.history = [];
this.filterText = "";
this.disableHistoryClearing();
updateOnLocalStorage("history", this.history);
this.$toast.error("History Deleted", {
icon: "delete"
});
},
useHistory(entry) {
this.$emit("useHistory", entry);
},
findEntryStatus(entry) {
const foundStatusGroup = findStatusGroup(entry.status);
return (
foundStatusGroup || {
className: ""
}
);
},
deleteHistory(entry) {
this.history.splice(this.history.indexOf(entry), 1);
if (this.history.length === 0) {
this.filterText = "";
}
updateOnLocalStorage("history", this.history);
this.$toast.error("Deleted", {
icon: "delete"
});
},
addEntry(entry) {
this.history.push(entry);
updateOnLocalStorage("history", this.history);
},
enableHistoryClearing() {
if (!this.history || !this.history.length) return;
this.isClearingHistory = true;
},
disableHistoryClearing() {
this.isClearingHistory = false;
},
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 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;
else return final_a - final_b;
});
this.history = byDate;
this.reverse_sort_time = !this.reverse_sort_time;
},
sort_by_status_code() {
let byCode = this.history.slice(0);
byCode.sort((a, b) => {
if (this.reverse_sort_status_code) return b.status - a.status;
else return a.status - b.status;
});
this.history = byCode;
this.reverse_sort_status_code = !this.reverse_sort_status_code;
},
sort_by_url() {
let byUrl = this.history.slice(0);
byUrl.sort((a, b) => {
if (this.reverse_sort_url)
return a.url == b.url ? 0 : +(a.url < b.url) || -1;
else return a.url == b.url ? 0 : +(a.url > b.url) || -1;
});
this.history = byUrl;
this.reverse_sort_url = !this.reverse_sort_url;
},
sort_by_label() {
let byLabel = this.history.slice(0);
byLabel.sort((a, b) => {
if (this.reverse_sort_label)
return a.label == b.label ? 0 : +(a.label < b.label) || -1;
else return a.label == b.label ? 0 : +(a.label > b.label) || -1;
});
this.history = byLabel;
this.reverse_sort_label = !this.reverse_sort_label;
},
sort_by_path() {
let byPath = this.history.slice(0);
byPath.sort((a, b) => {
if (this.reverse_sort_path)
return a.path == b.path ? 0 : +(a.path < b.path) || -1;
else return a.path == b.path ? 0 : +(a.path > b.path) || -1;
});
this.history = byPath;
this.reverse_sort_path = !this.reverse_sort_path;
},
sort_by_duration() {
let byDuration = this.history.slice(0);
byDuration.sort((a, b) => {
if (this.reverse_sort_duration)
return a.duration == b.duration
? 0
: +(a.duration < b.duration) || -1;
else
return a.duration == b.duration
? 0
: +(a.duration > b.duration) || -1;
});
this.history = byDuration;
this.reverse_sort_duration = !this.reverse_sort_duration;
},
toggleCollapse() {
this.show = !this.show;
},
toggleStar(index) {
this.history[index]["star"] = !this.history[index]["star"];
updateOnLocalStorage("history", this.history);
}
}
};
</script> </script>

View File

@@ -1,5 +1,8 @@
<template> <template>
<fieldset :id="label.toLowerCase()" :class="{ 'no-colored-frames': !frameColorsEnabled }"> <fieldset
:id="label.toLowerCase()"
:class="{ 'no-colored-frames': !frameColorsEnabled }"
>
<legend @click.prevent="collapse"> <legend @click.prevent="collapse">
<span>{{ label }}</span> <span>{{ label }}</span>
<i class="material-icons" v-if="isCollapsed">expand_more</i> <i class="material-icons" v-if="isCollapsed">expand_more</i>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div @click="toggle()"> <div @click="toggle()">
<label class="toggle" :class="{on: on}" ref="toggle"> <label class="toggle" :class="{ on: on }" ref="toggle">
<span class="handle"></span> <span class="handle"></span>
</label> </label>
<label class="caption"> <label class="caption">

View File

@@ -1,7 +1,7 @@
export default function parseTemplateString(string, variables) { export default function parseTemplateString(string, variables) {
if(!variables || !string) { if (!variables || !string) {
return string; return string;
} }
const searchTerm = /<<([^>]*)>>/g; // "<<myVariable>>" const searchTerm = /<<([^>]*)>>/g; // "<<myVariable>>"
return string.replace(searchTerm, (match, p1) => variables[p1] || ''); return string.replace(searchTerm, (match, p1) => variables[p1] || '');
} }

View File

@@ -24,7 +24,12 @@
<div slot="body"> <div slot="body">
<ul> <ul>
<li> <li>
<textarea id="import-text" autofocus rows="8" placeholder="Enter cURL"></textarea> <textarea
id="import-text"
autofocus
rows="8"
placeholder="Enter cURL"
></textarea>
</li> </li>
</ul> </ul>
</div> </div>
@@ -40,7 +45,12 @@
</div> </div>
</pw-modal> </pw-modal>
<pw-section v-if="showPreRequestScript" class="orange" label="Pre-Request" ref="preRequest"> <pw-section
v-if="showPreRequestScript"
class="orange"
label="Pre-Request"
ref="preRequest"
>
<ul> <ul>
<li> <li>
<div class="flex-wrap"> <div class="flex-wrap">
@@ -107,11 +117,22 @@
</li> </li>
<li> <li>
<label for="label">Label</label> <label for="label">Label</label>
<input id="label" name="label" type="text" v-model="label" placeholder="(optional)" /> <input
id="label"
name="label"
type="text"
v-model="label"
placeholder="(optional)"
/>
</li> </li>
<li> <li>
<label class="hide-on-small-screen" for="send">&nbsp;</label> <label class="hide-on-small-screen" for="send">&nbsp;</label>
<button :disabled="!isValidURL" @click="sendRequest" id="send" ref="sendButton"> <button
:disabled="!isValidURL"
@click="sendRequest"
id="send"
ref="sendButton"
>
Send Send
<span id="hidden-message">Again</span> <span id="hidden-message">Again</span>
<span> <span>
@@ -132,16 +153,16 @@
:source="validContentTypes" :source="validContentTypes"
:spellcheck="false" :spellcheck="false"
v-model="contentType" v-model="contentType"
>Content Type</autocomplete> >Content Type</autocomplete
>
</li> </li>
</ul> </ul>
<ul> <ul>
<li> <li>
<span> <span>
<pw-toggle <pw-toggle :on="rawInput" @change="rawInput = $event"
:on="rawInput" >Raw Input {{ rawInput ? "Enabled" : "Disabled" }}</pw-toggle
@change="rawInput = $event" >
>Raw Input {{ rawInput ? "Enabled" : "Disabled" }}</pw-toggle>
</span> </span>
</li> </li>
</ul> </ul>
@@ -162,27 +183,41 @@
<ul v-for="(param, index) in bodyParams" :key="index"> <ul v-for="(param, index) in bodyParams" :key="index">
<li> <li>
<input <input
:placeholder="'key '+(index+1)" :placeholder="'key ' + (index + 1)"
:name="'bparam'+index" :name="'bparam' + index"
:value="param.key" :value="param.key"
@change="$store.commit('setKeyBodyParams', { index, value: $event.target.value })" @change="
$store.commit('setKeyBodyParams', {
index,
value: $event.target.value
})
"
@keyup.prevent="setRouteQueryState" @keyup.prevent="setRouteQueryState"
autofocus autofocus
/> />
</li> </li>
<li> <li>
<input <input
:placeholder="'value '+(index+1)" :placeholder="'value ' + (index + 1)"
:id="'bvalue'+index" :id="'bvalue' + index"
:name="'bvalue'+index" :name="'bvalue' + index"
:value="param.value" :value="param.value"
@change="$store.commit('setValueBodyParams', { index, value: $event.target.value })" @change="
$store.commit('setValueBodyParams', {
index,
value: $event.target.value
})
"
@keyup.prevent="setRouteQueryState" @keyup.prevent="setRouteQueryState"
/> />
</li> </li>
<div> <div>
<li> <li>
<button class="icon" @click="removeRequestBodyParam(index)" id="delParam"> <button
class="icon"
@click="removeRequestBodyParam(index)"
id="delParam"
>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
</li> </li>
@@ -190,7 +225,11 @@
</ul> </ul>
<ul> <ul>
<li> <li>
<button class="icon" @click="addRequestBodyParam" name="addrequest"> <button
class="icon"
@click="addRequestBodyParam"
name="addrequest"
>
<i class="material-icons">add</i> <i class="material-icons">add</i>
<span>Add New</span> <span>Add New</span>
</button> </button>
@@ -227,7 +266,7 @@
id="code" id="code"
v-on:click="isHidden = !isHidden" v-on:click="isHidden = !isHidden"
:disabled="!isValidURL" :disabled="!isValidURL"
v-tooltip.bottom="{ content: isHidden ? 'Show Code' : 'Hide Code'}" v-tooltip.bottom="{ content: isHidden ? 'Show Code' : 'Hide Code' }"
> >
<i class="material-icons" v-if="isHidden">flash_on</i> <i class="material-icons" v-if="isHidden">flash_on</i>
<i class="material-icons" v-else>flash_off</i> <i class="material-icons" v-else>flash_off</i>
@@ -235,19 +274,22 @@
<button <button
:class="'icon' + (showPreRequestScript ? ' info-response' : '')" :class="'icon' + (showPreRequestScript ? ' info-response' : '')"
id="preRequestScriptButton" id="preRequestScriptButton"
v-tooltip.bottom="{ content: !showPreRequestScript ? 'Show Pre-Request Script' : 'Hide Pre-Request Script'}" v-tooltip.bottom="{
content: !showPreRequestScript
? 'Show Pre-Request Script'
: 'Hide Pre-Request Script'
}"
@click="showPreRequestScript = !showPreRequestScript" @click="showPreRequestScript = !showPreRequestScript"
> >
<i <i
class="material-icons" class="material-icons"
:class="showPreRequestScript" :class="showPreRequestScript"
v-if="!showPreRequestScript" v-if="!showPreRequestScript"
>code</i> >code</i
<i >
class="material-icons" <i class="material-icons" :class="showPreRequestScript" v-else
:class="showPreRequestScript" >close</i
v-else >
>close</i>
</button> </button>
</div> </div>
<div style="text-align: center;"> <div style="text-align: center;">
@@ -272,7 +314,11 @@
> >
<i class="material-icons">save</i> <i class="material-icons">save</i>
</button> </button>
<button class="icon" @click="clearContent('', $event)" v-tooltip.bottom="'Clear All'"> <button
class="icon"
@click="clearContent('', $event)"
v-tooltip.bottom="'Clear All'"
>
<i class="material-icons">clear_all</i> <i class="material-icons">clear_all</i>
</button> </button>
</div> </div>
@@ -349,7 +395,11 @@
</ul> </ul>
<ul v-if="auth === 'Basic'"> <ul v-if="auth === 'Basic'">
<li> <li>
<input placeholder="User" name="http_basic_user" v-model="httpUser" /> <input
placeholder="User"
name="http_basic_user"
v-model="httpUser"
/>
</li> </li>
<li> <li>
<input <input
@@ -367,19 +417,31 @@
ref="switchVisibility" ref="switchVisibility"
@click="switchVisibility" @click="switchVisibility"
> >
<i class="material-icons" v-if="passwordFieldType === 'text'">visibility</i> <i class="material-icons" v-if="passwordFieldType === 'text'"
<i class="material-icons" v-if="passwordFieldType !== 'text'">visibility_off</i> >visibility</i
>
<i class="material-icons" v-if="passwordFieldType !== 'text'"
>visibility_off</i
>
</button> </button>
</li> </li>
</div> </div>
</ul> </ul>
<ul v-else-if="auth === 'Bearer Token'"> <ul v-else-if="auth === 'Bearer Token'">
<li> <li>
<input placeholder="Token" name="bearer_token" v-model="bearerToken" /> <input
placeholder="Token"
name="bearer_token"
v-model="bearerToken"
/>
</li> </li>
</ul> </ul>
<div class="flex-wrap"> <div class="flex-wrap">
<pw-toggle :on="!urlExcludes.auth" @change="setExclude('auth', !$event)">Include in URL</pw-toggle> <pw-toggle
:on="!urlExcludes.auth"
@change="setExclude('auth', !$event)"
>Include in URL</pw-toggle
>
</div> </div>
</pw-section> </pw-section>
</div> </div>
@@ -416,26 +478,40 @@
<ul v-for="(header, index) in headers" :key="index"> <ul v-for="(header, index) in headers" :key="index">
<li> <li>
<input <input
:placeholder="'header '+(index+1)" :placeholder="'header ' + (index + 1)"
:name="'header'+index" :name="'header' + index"
:value="header.key" :value="header.key"
@change="$store.commit('setKeyHeader', { index, value: $event.target.value })" @change="
$store.commit('setKeyHeader', {
index,
value: $event.target.value
})
"
@keyup.prevent="setRouteQueryState" @keyup.prevent="setRouteQueryState"
autofocus autofocus
/> />
</li> </li>
<li> <li>
<input <input
:placeholder="'value '+(index+1)" :placeholder="'value ' + (index + 1)"
:name="'value'+index" :name="'value' + index"
:value="header.value" :value="header.value"
@change="$store.commit('setValueHeader', { index, value: $event.target.value })" @change="
$store.commit('setValueHeader', {
index,
value: $event.target.value
})
"
@keyup.prevent="setRouteQueryState" @keyup.prevent="setRouteQueryState"
/> />
</li> </li>
<div> <div>
<li> <li>
<button class="icon" @click="removeRequestHeader(index)" id="header"> <button
class="icon"
@click="removeRequestHeader(index)"
id="header"
>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
</li> </li>
@@ -484,24 +560,38 @@
<ul v-for="(param, index) in params" :key="index"> <ul v-for="(param, index) in params" :key="index">
<li> <li>
<input <input
:placeholder="'parameter '+(index+1)" :placeholder="'parameter ' + (index + 1)"
:name="'param'+index" :name="'param' + index"
:value="param.key" :value="param.key"
@change="$store.commit('setKeyParams', { index, value: $event.target.value })" @change="
$store.commit('setKeyParams', {
index,
value: $event.target.value
})
"
autofocus autofocus
/> />
</li> </li>
<li> <li>
<input <input
:placeholder="'value '+(index+1)" :placeholder="'value ' + (index + 1)"
:name="'value'+index" :name="'value' + index"
:value="param.value" :value="param.value"
@change="$store.commit('setValueParams', { index, value: $event.target.value })" @change="
$store.commit('setValueParams', {
index,
value: $event.target.value
})
"
/> />
</li> </li>
<div> <div>
<li> <li>
<button class="icon" @click="removeRequestParam(index)" id="param"> <button
class="icon"
@click="removeRequestParam(index)"
id="param"
>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</button> </button>
</li> </li>
@@ -538,7 +628,7 @@
</ul> </ul>
<ul v-for="(value, key) in response.headers" :key="key"> <ul v-for="(value, key) in response.headers" :key="key">
<li> <li>
<label :for="key">{{key}}</label> <label :for="key">{{ key }}</label>
<input :id="key" :value="value" :name="key" readonly /> <input :id="key" :value="value" :name="key" readonly />
</li> </li>
</ul> </ul>
@@ -579,20 +669,25 @@
readOnly: true, readOnly: true,
showPrintMargin: false, showPrintMargin: false,
useWorker: false useWorker: false
}" }"
/> />
<iframe <iframe
:class="{hidden: !previewEnabled}" :class="{ hidden: !previewEnabled }"
class="covers-response" class="covers-response"
ref="previewFrame" ref="previewFrame"
src="about:blank" src="about:blank"
></iframe> ></iframe>
</div> </div>
<div class="align-right" v-if="response.body && responseType === 'text/html'"> <div
class="align-right"
v-if="response.body && responseType === 'text/html'"
>
<button class="icon" @click.prevent="togglePreview"> <button class="icon" @click.prevent="togglePreview">
<i class="material-icons" v-if="!previewEnabled">visibility</i> <i class="material-icons" v-if="!previewEnabled">visibility</i>
<i class="material-icons" v-else>visibility_off</i> <i class="material-icons" v-else>visibility_off</i>
<span>{{ previewEnabled ? 'Hide Preview' : 'Preview HTML' }}</span> <span>{{
previewEnabled ? "Hide Preview" : "Preview HTML"
}}</span>
</button> </button>
</div> </div>
</li> </li>
@@ -622,7 +717,7 @@ import modal from "../components/modal";
import collections from "../components/collections"; import collections from "../components/collections";
import saveRequestAs from "../components/collections/saveRequestAs"; import saveRequestAs from "../components/collections/saveRequestAs";
import parseCurlCommand from "../assets/js/curlparser.js"; import parseCurlCommand from "../assets/js/curlparser.js";
import AceEditor from '../components/ace-editor'; import AceEditor from "../components/ace-editor";
import getEnvironmentVariablesFromScript from "../functions/preRequest"; import getEnvironmentVariablesFromScript from "../functions/preRequest";
import parseTemplateString from "../functions/templating"; import parseTemplateString from "../functions/templating";
@@ -732,8 +827,8 @@ export default {
editRequest: {}, editRequest: {},
urlExcludes: {}, urlExcludes: {},
responseBodyText: '', responseBodyText: "",
responseBodyType: 'text' responseBodyType: "text"
}; };
}, },
watch: { watch: {
@@ -759,19 +854,20 @@ export default {
this.response.body === "Loading..." this.response.body === "Loading..."
) { ) {
this.responseBodyText = this.response.body; this.responseBodyText = this.response.body;
this.responseBodyType = 'text'; this.responseBodyType = "text";
} else { } else {
if(this.responseType === "application/json" || if (
this.responseType === "application/hal+json" this.responseType === "application/json" ||
this.responseType === "application/hal+json"
) { ) {
this.responseBodyText = JSON.stringify(this.response.body, null, 2) this.responseBodyText = JSON.stringify(this.response.body, null, 2);
this.responseBodyType = 'json' this.responseBodyType = "json";
} else if (this.responseType === "text/html") { } else if (this.responseType === "text/html") {
this.responseBodyText = this.response.body; this.responseBodyText = this.response.body;
this.responseBodyType = 'html' this.responseBodyType = "html";
} else { } else {
this.responseBodyText = this.response.body; this.responseBodyText = this.response.body;
this.responseBodyType = 'text'; this.responseBodyType = "text";
} }
} }
}, },
@@ -1183,7 +1279,14 @@ export default {
behavior: "smooth" behavior: "smooth"
}); });
}, },
handleUseHistory({ label, method, url, path, usesScripts, preRequestScript }) { handleUseHistory({
label,
method,
url,
path,
usesScripts,
preRequestScript
}) {
this.label = label; this.label = label;
this.method = method; this.method = method;
this.url = url; this.url = url;

View File

@@ -46,7 +46,11 @@
<pw-toggle <pw-toggle
:on="settings.FRAME_COLORS_ENABLED" :on="settings.FRAME_COLORS_ENABLED"
@change="toggleSetting('FRAME_COLORS_ENABLED')" @change="toggleSetting('FRAME_COLORS_ENABLED')"
>Multi-color {{ settings.FRAME_COLORS_ENABLED ? "Enabled" : "Disabled" }}</pw-toggle> >Multi-color
{{
settings.FRAME_COLORS_ENABLED ? "Enabled" : "Disabled"
}}</pw-toggle
>
</span> </span>
</li> </li>
</ul> </ul>
@@ -62,9 +66,15 @@
<pw-toggle <pw-toggle
:on="settings.PROXY_ENABLED" :on="settings.PROXY_ENABLED"
@change="toggleSetting('PROXY_ENABLED')" @change="toggleSetting('PROXY_ENABLED')"
>Proxy {{ settings.PROXY_ENABLED ? "enabled" : "disabled" }}</pw-toggle> >Proxy
{{ settings.PROXY_ENABLED ? "enabled" : "disabled" }}</pw-toggle
>
</span> </span>
<a href="https://github.com/liyasthomas/postwoman/wiki/Proxy" target="_blank" rel="noopener"> <a
href="https://github.com/liyasthomas/postwoman/wiki/Proxy"
target="_blank"
rel="noopener"
>
<button class="icon" v-tooltip="'Wiki'"> <button class="icon" v-tooltip="'Wiki'">
<i class="material-icons">help</i> <i class="material-icons">help</i>
</button> </button>
@@ -77,7 +87,10 @@
<p> <p>
Postwoman's Proxy is hosted by ApolloTV. Postwoman's Proxy is hosted by ApolloTV.
<br /> <br />
Read the <a href="https://apollotv.xyz/legal" target="_blank" rel="noopener">ApolloTV privacy policy</a>. Read the
<a href="https://apollotv.xyz/legal" target="_blank" rel="noopener"
>ApolloTV privacy policy</a
>.
</p> </p>
</li> </li>
</ul> </ul>
@@ -149,7 +162,9 @@ export default {
name: "Auto (system)", name: "Auto (system)",
vibrant: window.matchMedia("(prefers-color-scheme: light)").matches, vibrant: window.matchMedia("(prefers-color-scheme: light)").matches,
class: "auto", class: "auto",
aceEditor: window.matchMedia("(prefers-color-scheme: light)").matches ? 'xcode' : 'dracula' aceEditor: window.matchMedia("(prefers-color-scheme: light)").matches
? "xcode"
: "dracula"
} }
], ],
// You can define a new color here! It will simply store the color value. // You can define a new color here! It will simply store the color value.
@@ -224,7 +239,7 @@ export default {
}, },
methods: { methods: {
applyTheme({class:name, color, aceEditor}) { applyTheme({ class: name, color, aceEditor }) {
this.applySetting("THEME_CLASS", name); this.applySetting("THEME_CLASS", name);
this.applySetting("THEME_ACE_EDITOR", aceEditor); this.applySetting("THEME_ACE_EDITOR", aceEditor);
document document

View File

@@ -14,7 +14,12 @@
</li> </li>
<li> <li>
<label for="connect" class="hide-on-small-screen">&nbsp;</label> <label for="connect" class="hide-on-small-screen">&nbsp;</label>
<button :disabled="!urlValid" id="connect" name="connect" @click="toggleConnection"> <button
:disabled="!urlValid"
id="connect"
name="connect"
@click="toggleConnection"
>
{{ toggleConnectionVerb }} {{ toggleConnectionVerb }}
<span> <span>
<i class="material-icons" v-if="!connectionState">sync</i> <i class="material-icons" v-if="!connectionState">sync</i>
@@ -27,7 +32,12 @@
<br /> <br />
<pw-section class="purple" label="Communication" id="response" ref="response"> <pw-section
class="purple"
label="Communication"
id="response"
ref="response"
>
<ul> <ul>
<li> <li>
<label for="log">Log</label> <label for="log">Log</label>
@@ -37,7 +47,9 @@
v-for="(logEntry, index) in communication.log" v-for="(logEntry, index) in communication.log"
:style="{ color: logEntry.color }" :style="{ color: logEntry.color }"
:key="index" :key="index"
>@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }} {{ logEntry.payload }}</span> >@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }}
{{ logEntry.payload }}</span
>
</span> </span>
<span v-else>(waiting for connection)</span> <span v-else>(waiting for connection)</span>
</div> </div>
@@ -57,7 +69,12 @@
</li> </li>
<li> <li>
<label for="send" class="hide-on-small-screen">&nbsp;</label> <label for="send" class="hide-on-small-screen">&nbsp;</label>
<button id="send" name="send" :disabled="!connectionState" @click="sendMessage"> <button
id="send"
name="send"
:disabled="!connectionState"
@click="sendMessage"
>
Send Send
<span> <span>
<i class="material-icons">send</i> <i class="material-icons">send</i>