diff --git a/components/history.vue b/components/history.vue
index 88ebf3bb3..fbc08ae8c 100644
--- a/components/history.vue
+++ b/components/history.vue
@@ -6,6 +6,9 @@
+ -
+
+
-
@@ -21,6 +24,9 @@
+ -
+
+
-
@@ -104,7 +110,8 @@
reverse_sort_time: false,
reverse_sort_status_code: false,
reverse_sort_url: false,
- reverse_sort_path: false
+ reverse_sort_path: false,
+ reverse_sort_label: false
}
},
computed: {
@@ -191,13 +198,24 @@
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;
+ return a.url === b.url ? 0 : +(a.url < b.url) || -1;
else
- return a.url == b.url ? 0 : +(a.url > b.url) || -1;
+ 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)=>{
diff --git a/pages/index.vue b/pages/index.vue
index 60f7df3c6..3dffebc31 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1,5 +1,6 @@
+
@@ -416,6 +417,7 @@
},
data() {
return {
+ label:'Enter request name',
showModal: false,
copyButton: 'file_copy',
copiedButton: 'done',
@@ -520,6 +522,9 @@
}
},
computed: {
+ requestName() {
+ return this.label.match(/^([^?]*)\??/)[1]
+ },
statusCategory() {
return findStatusGroup(this.response.status);
},
@@ -686,6 +691,13 @@
behavior: 'smooth'
});
},
+ async validRequestName() {
+ if (!this.requestName) {
+ this.$toast.error('Request Name is not valid', {
+ icon: 'error'
+ });
+ return;
+ }},
async sendRequest() {
if (!this.isValidURL) {
this.$toast.error('URL is not formatted properly', {
@@ -773,6 +785,7 @@
// Addition of an entry to the history component.
const entry = {
+ label: this.requestName,
status,
date,
time,
@@ -790,6 +803,7 @@
// Addition of an entry to the history component.
const entry = {
+ label: this.requestName,
status: this.response.status,
date: new Date().toLocaleDateString(),
time: new Date().toLocaleTimeString(),
@@ -1043,6 +1057,7 @@
this.params = [];
break;
default:
+ this.label = '',
this.method= 'GET',
this.url = 'https://reqres.in',
this.auth = 'None',
@@ -1066,6 +1081,7 @@
created() {
if (Object.keys(this.$route.query).length) this.setRouteQueries(this.$route.query);
this.$watch(vm => [
+ vm.label,
vm.method,
vm.url,
vm.auth,