Lint and minor UI improvements

This commit is contained in:
Liyas Thomas
2019-12-29 06:17:00 +05:30
parent 9ff02eefb8
commit d40de785b7
6 changed files with 51 additions and 30 deletions

View File

@@ -5,10 +5,7 @@ TODO:
<template> <template>
<div class="collections-wrapper"> <div class="collections-wrapper">
<addCollection <addCollection :show="showModalAdd" @hide-modal="displayModalAdd(false)" />
:show="showModalAdd"
@hide-modal="displayModalAdd(false)"
/>
<editCollection <editCollection
:show="showModalEdit" :show="showModalEdit"
:editingCollection="editingCollection" :editingCollection="editingCollection"
@@ -68,7 +65,9 @@ TODO:
</a> --> </a> -->
</div> </div>
</div> </div>
<p v-if="collections.length === 0" class="info">
Create new collection
</p>
<virtual-list <virtual-list
class="virtual-list" class="virtual-list"
:class="{ filled: collections.length }" :class="{ filled: collections.length }"

View File

@@ -162,11 +162,9 @@
<label>Nothing found "{{ filterText }}"</label> <label>Nothing found "{{ filterText }}"</label>
</li> </li>
</ul> </ul>
<ul v-if="history.length === 0"> <p v-if="history.length === 0" class="info">
<li> History is empty
<label>History is empty</label> </p>
</li>
</ul>
<div v-if="history.length !== 0"> <div v-if="history.length !== 0">
<div class="flex-wrap" v-if="!isClearingHistory"> <div class="flex-wrap" v-if="!isClearingHistory">
<button <button
@@ -450,8 +448,8 @@ export default {
let byUrl = this.history.slice(0); let byUrl = this.history.slice(0);
byUrl.sort((a, b) => { byUrl.sort((a, b) => {
if (this.reverse_sort_url) if (this.reverse_sort_url)
return a.url == b.url ? 0 : +(a.url < b.url) || -1; return a.url === b.url ? 0 : +(a.url < b.url) || -1;
else 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.history = byUrl;
this.reverse_sort_url = !this.reverse_sort_url; this.reverse_sort_url = !this.reverse_sort_url;
@@ -460,8 +458,8 @@ export default {
let byLabel = this.history.slice(0); let byLabel = this.history.slice(0);
byLabel.sort((a, b) => { byLabel.sort((a, b) => {
if (this.reverse_sort_label) if (this.reverse_sort_label)
return a.label == b.label ? 0 : +(a.label < b.label) || -1; return a.label === b.label ? 0 : +(a.label < b.label) || -1;
else 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.history = byLabel;
this.reverse_sort_label = !this.reverse_sort_label; this.reverse_sort_label = !this.reverse_sort_label;
@@ -470,8 +468,8 @@ export default {
let byPath = this.history.slice(0); let byPath = this.history.slice(0);
byPath.sort((a, b) => { byPath.sort((a, b) => {
if (this.reverse_sort_path) if (this.reverse_sort_path)
return a.path == b.path ? 0 : +(a.path < b.path) || -1; return a.path === b.path ? 0 : +(a.path < b.path) || -1;
else 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.history = byPath;
this.reverse_sort_path = !this.reverse_sort_path; this.reverse_sort_path = !this.reverse_sort_path;
@@ -480,11 +478,11 @@ export default {
let byDuration = this.history.slice(0); let byDuration = this.history.slice(0);
byDuration.sort((a, b) => { byDuration.sort((a, b) => {
if (this.reverse_sort_duration) if (this.reverse_sort_duration)
return a.duration == b.duration return a.duration === b.duration
? 0 ? 0
: +(a.duration < b.duration) || -1; : +(a.duration < b.duration) || -1;
else else
return a.duration == b.duration return a.duration === b.duration
? 0 ? 0
: +(a.duration > b.duration) || -1; : +(a.duration > b.duration) || -1;
}); });

View File

@@ -1,9 +1,9 @@
<template> <template>
<div class="page"> <div class="page">
<pw-section class="blue" label="Collections" ref="collections"> <pw-section class="blue" label="Collections" ref="collections">
<ul class="info"> <ul>
<li> <li>
<p> <p class="info">
Import any Postwoman Collection to Generate Documentation on-the-go. Import any Postwoman Collection to Generate Documentation on-the-go.
</p> </p>
</li> </li>
@@ -17,7 +17,7 @@
v-tooltip="'JSON'" v-tooltip="'JSON'"
> >
<i class="material-icons">folder</i> <i class="material-icons">folder</i>
<span>Import Collections</span> <span>Import collections</span>
</button> </button>
</label> </label>
<input <input
@@ -55,6 +55,9 @@
</pw-section> </pw-section>
<pw-section class="green" label="Documentation" ref="documentation"> <pw-section class="green" label="Documentation" ref="documentation">
<p v-if="this.items.length === 0" class="info">
Generate documentation first
</p>
<div> <div>
<span <span
class="collection" class="collection"
@@ -111,7 +114,8 @@
</p> </p>
<p class="doc-desc" v-if="request.httpPassword"> <p class="doc-desc" v-if="request.httpPassword">
<span> <span>
Password: <code>{{ request.httpPassword || "None" }}</code> Password:
<code>{{ request.httpPassword || "None" }}</code>
</span> </span>
</p> </p>
<p class="doc-desc" v-if="request.bearerToken"> <p class="doc-desc" v-if="request.bearerToken">
@@ -165,12 +169,14 @@
</p> </p>
<p class="doc-desc" v-if="request.contentType"> <p class="doc-desc" v-if="request.contentType">
<span> <span>
Content Type: <code>{{ request.contentType || "None" }}</code> Content Type:
<code>{{ request.contentType || "None" }}</code>
</span> </span>
</p> </p>
<p class="doc-desc" v-if="request.requestType"> <p class="doc-desc" v-if="request.requestType">
<span> <span>
Request Type: <code>{{ request.requestType || "None" }}</code> Request Type:
<code>{{ request.requestType || "None" }}</code>
</span> </span>
</p> </p>
</span> </span>
@@ -266,12 +272,14 @@
</p> </p>
<p class="doc-desc" v-if="request.contentType"> <p class="doc-desc" v-if="request.contentType">
<span> <span>
Content Type: <code>{{ request.contentType || "None" }}</code> Content Type:
<code>{{ request.contentType || "None" }}</code>
</span> </span>
</p> </p>
<p class="doc-desc" v-if="request.requestType"> <p class="doc-desc" v-if="request.requestType">
<span> <span>
Request Type: <code>{{ request.requestType || "None" }}</code> Request Type:
<code>{{ request.requestType || "None" }}</code>
</span> </span>
</p> </p>
</span> </span>

View File

@@ -152,6 +152,7 @@
}" }"
/> />
</pw-section> </pw-section>
<pw-section class="cyan" label="Query" ref="query"> <pw-section class="cyan" label="Query" ref="query">
<div class="flex-wrap"> <div class="flex-wrap">
<label for="gqlQuery">{{ $t("query") }}</label> <label for="gqlQuery">{{ $t("query") }}</label>
@@ -185,6 +186,7 @@
}" }"
/> />
</pw-section> </pw-section>
<pw-section class="purple" label="Response" ref="response"> <pw-section class="purple" label="Response" ref="response">
<div class="flex-wrap"> <div class="flex-wrap">
<label for="responseField">{{ $t("response") }}</label> <label for="responseField">{{ $t("response") }}</label>
@@ -281,7 +283,19 @@
</div> </div>
</div> </div>
</section> </section>
</pw-section>
<p
v-if="
queryFields.length === 0 &&
mutationFields.length === 0 &&
subscriptionFields.length === 0 &&
gqlTypes.length === 0
"
class="info"
>
Send a request first
</p></pw-section
>
</aside> </aside>
</div> </div>
</div> </div>

View File

@@ -1408,7 +1408,7 @@ export default {
requestString.push("xhr.send()"); requestString.push("xhr.send()");
} }
return requestString.join("\n"); return requestString.join("\n");
} else if (this.requestType == "Fetch") { } else if (this.requestType === "Fetch") {
const requestString = []; const requestString = [];
let headers = []; let headers = [];
requestString.push( requestString.push(
@@ -1868,7 +1868,7 @@ export default {
}); });
const aux = document.createElement("textarea"); const aux = document.createElement("textarea");
const copy = const copy =
this.responseType == "application/json" this.responseType === "application/json"
? JSON.stringify(this.response.body) ? JSON.stringify(this.response.body)
: this.response.body; : this.response.body;
aux.innerText = copy; aux.innerText = copy;
@@ -2010,7 +2010,7 @@ export default {
let parsedCurl = parseCurlCommand(text); let parsedCurl = parseCurlCommand(text);
this.url = parsedCurl.url.replace(/"/g, "").replace(/'/g, ""); this.url = parsedCurl.url.replace(/"/g, "").replace(/'/g, "");
this.url = this.url =
this.url.slice(-1).pop() == "/" ? this.url.slice(0, -1) : this.url; this.url.slice(-1).pop() === "/" ? this.url.slice(0, -1) : this.url;
this.path = ""; this.path = "";
this.headers = []; this.headers = [];
for (const key of Object.keys(parsedCurl.headers)) { for (const key of Object.keys(parsedCurl.headers)) {

View File

@@ -36,6 +36,7 @@
</div> </div>
</ul> </ul>
</pw-section> </pw-section>
<pw-section <pw-section
class="purple" class="purple"
label="Communication" label="Communication"
@@ -125,6 +126,7 @@
</div> </div>
</ul> </ul>
</pw-section> </pw-section>
<pw-section <pw-section
class="purple" class="purple"
label="Communication" label="Communication"