Add Request name label for every requests (#184)
Add Request name label for every requests Co-authored-by: Gopishankar Haridas <gopih@thoughtworks.com>
This commit is contained in:
@@ -6,6 +6,9 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li @click="sort_by_label()">
|
||||||
|
<label for="" class="flex-wrap">Name<i class="material-icons">sort</i></label>
|
||||||
|
</li>
|
||||||
<li @click="sort_by_time()">
|
<li @click="sort_by_time()">
|
||||||
<label for="" class="flex-wrap">Time<i class="material-icons">sort</i></label>
|
<label for="" class="flex-wrap">Time<i class="material-icons">sort</i></label>
|
||||||
</li>
|
</li>
|
||||||
@@ -21,6 +24,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<virtual-list class="virtual-list" :class="{filled: filteredHistory.length}" :size="54" :remain="Math.min(5, filteredHistory.length)">
|
<virtual-list class="virtual-list" :class="{filled: filteredHistory.length}" :size="54" :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">
|
||||||
|
<li>
|
||||||
|
<input aria-label="Label" type="text" readonly :value="entry.label" :title="entry.label">
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input aria-label="Time" type="text" readonly :value="entry.time" :title="entry.date">
|
<input aria-label="Time" type="text" readonly :value="entry.time" :title="entry.date">
|
||||||
</li>
|
</li>
|
||||||
@@ -101,6 +107,7 @@
|
|||||||
filterText: '',
|
filterText: '',
|
||||||
showFilter: false,
|
showFilter: false,
|
||||||
isClearingHistory: false,
|
isClearingHistory: 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,
|
||||||
@@ -198,6 +205,17 @@
|
|||||||
this.history = byUrl;
|
this.history = byUrl;
|
||||||
this.reverse_sort_url = !this.reverse_sort_url;
|
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() {
|
sort_by_path() {
|
||||||
let byPath = this.history.slice(0);
|
let byPath = this.history.slice(0);
|
||||||
byPath.sort((a, b)=>{
|
byPath.sort((a, b)=>{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
|
<input @keyup.enter="requestName" id="label" name="label" type="label" v-model="label">
|
||||||
<pw-modal v-if="showModal" @close="showModal = false">
|
<pw-modal v-if="showModal" @close="showModal = false">
|
||||||
<div slot="header">
|
<div slot="header">
|
||||||
<ul>
|
<ul>
|
||||||
@@ -419,6 +420,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
label:'Enter request name',
|
||||||
showModal: false,
|
showModal: false,
|
||||||
copyButton: '<i class="material-icons">file_copy</i>',
|
copyButton: '<i class="material-icons">file_copy</i>',
|
||||||
copiedButton: '<i class="material-icons">done</i>',
|
copiedButton: '<i class="material-icons">done</i>',
|
||||||
@@ -523,6 +525,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
requestName() {
|
||||||
|
return this.label
|
||||||
|
},
|
||||||
statusCategory() {
|
statusCategory() {
|
||||||
return findStatusGroup(this.response.status);
|
return findStatusGroup(this.response.status);
|
||||||
},
|
},
|
||||||
@@ -776,6 +781,7 @@
|
|||||||
|
|
||||||
// Addition of an entry to the history component.
|
// Addition of an entry to the history component.
|
||||||
const entry = {
|
const entry = {
|
||||||
|
label: this.requestName,
|
||||||
status,
|
status,
|
||||||
date,
|
date,
|
||||||
time,
|
time,
|
||||||
@@ -793,6 +799,7 @@
|
|||||||
|
|
||||||
// Addition of an entry to the history component.
|
// Addition of an entry to the history component.
|
||||||
const entry = {
|
const entry = {
|
||||||
|
label: this.requestName,
|
||||||
status: this.response.status,
|
status: this.response.status,
|
||||||
date: new Date().toLocaleDateString(),
|
date: new Date().toLocaleDateString(),
|
||||||
time: new Date().toLocaleTimeString(),
|
time: new Date().toLocaleTimeString(),
|
||||||
@@ -1046,6 +1053,7 @@
|
|||||||
this.params = [];
|
this.params = [];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
this.label = '',
|
||||||
this.method= 'GET',
|
this.method= 'GET',
|
||||||
this.url = 'https://reqres.in',
|
this.url = 'https://reqres.in',
|
||||||
this.auth = 'None',
|
this.auth = 'None',
|
||||||
@@ -1069,6 +1077,7 @@
|
|||||||
created() {
|
created() {
|
||||||
if (Object.keys(this.$route.query).length) this.setRouteQueries(this.$route.query);
|
if (Object.keys(this.$route.query).length) this.setRouteQueries(this.$route.query);
|
||||||
this.$watch(vm => [
|
this.$watch(vm => [
|
||||||
|
vm.label,
|
||||||
vm.method,
|
vm.method,
|
||||||
vm.url,
|
vm.url,
|
||||||
vm.auth,
|
vm.auth,
|
||||||
|
|||||||
Reference in New Issue
Block a user