Added Expand/Collapse response button. Fixes #320

This commit is contained in:
Liyas Thomas
2019-11-21 20:28:06 +05:30
parent 5d011b09ae
commit 463ef82255

View File

@@ -588,6 +588,20 @@
<div class="flex-wrap">
<label for="body">response</label>
<div>
<button
class="icon"
@click="ToggleExpandResponse"
ref="ToggleExpandResponse"
v-if="response.body"
v-tooltip="{
content: !expandResponse
? 'Expand response'
: 'Collapse response'
}"
>
<i class="material-icons" v-if="!expandResponse">unfold_more</i>
<i class="material-icons" v-else>unfold_less</i>
</button>
<button
class="icon"
@click="copyResponse"
@@ -613,7 +627,7 @@
:value="responseBodyText"
:lang="responseBodyType"
:options="{
maxLines: '16',
maxLines: responseBodyMaxLines,
minLines: '16',
fontSize: '16px',
autoScrollEditorIntoView: true,
@@ -861,6 +875,7 @@ export default {
},
previewEnabled: false,
paramsWatchEnabled: true,
expandResponse: false,
/**
* These are content types that can be automatically
@@ -887,7 +902,8 @@ export default {
urlExcludes: {},
responseBodyText: "",
responseBodyType: "text"
responseBodyType: "text",
responseBodyMaxLines: 16
};
},
watch: {
@@ -1686,6 +1702,10 @@ export default {
1000
);
},
ToggleExpandResponse() {
this.expandResponse = !this.expandResponse;
this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity;
},
copyResponse() {
this.$refs.copyResponse.innerHTML = this.doneButton;
this.$toast.success("Copied to clipboard", {