✨ Added preRequestScript and request duration to history entry
This commit is contained in:
@@ -37,6 +37,11 @@
|
|||||||
Path
|
Path
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
<li @click="sort_by_duration()">
|
||||||
|
<label>
|
||||||
|
Duration
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
<li></li>
|
<li></li>
|
||||||
</ul>
|
</ul>
|
||||||
<virtual-list
|
<virtual-list
|
||||||
@@ -88,11 +93,17 @@
|
|||||||
>{{entry.status}}</span>
|
>{{entry.status}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input aria-label="URL" type="text" readonly :value="entry.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>
|
||||||
|
<li>
|
||||||
|
<input aria-label="Duration" type="text" readonly :value="entry.duration" placeholder="No duration" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input aria-label="Pre Request Script" type="text" readonly :value="entry.preRequestScript" placeholder="No pre request script" />
|
||||||
|
</li>
|
||||||
<div class="show-on-small-screen">
|
<div class="show-on-small-screen">
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
@@ -327,6 +338,16 @@
|
|||||||
});
|
});
|
||||||
this.history = byPath;
|
this.history = byPath;
|
||||||
this.reverse_sort_path = !this.reverse_sort_path;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1185,11 +1185,12 @@ export default {
|
|||||||
behavior: "smooth"
|
behavior: "smooth"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleUseHistory({ label, method, url, path }) {
|
handleUseHistory({ label, method, url, path, preRequestScript }) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
this.preRequestScript = preRequestScript;
|
||||||
this.scrollInto("request");
|
this.scrollInto("request");
|
||||||
},
|
},
|
||||||
getVariablesFromPreRequestScript() {
|
getVariablesFromPreRequestScript() {
|
||||||
@@ -1348,7 +1349,9 @@ export default {
|
|||||||
method: this.method,
|
method: this.method,
|
||||||
url: this.url,
|
url: this.url,
|
||||||
path: this.path,
|
path: this.path,
|
||||||
usesScripts: Boolean(this.preRequestScript)
|
usesScripts: Boolean(this.preRequestScript),
|
||||||
|
preRequestScript: this.preRequestScript,
|
||||||
|
duration
|
||||||
};
|
};
|
||||||
this.$refs.historyComponent.addEntry(entry);
|
this.$refs.historyComponent.addEntry(entry);
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user