Removed textareaAutoHeight directive

This commit is contained in:
Liyas Thomas
2020-07-03 11:32:22 +05:30
parent 4490adc36c
commit f3e6a377a9
4 changed files with 34 additions and 66 deletions

View File

@@ -35,14 +35,6 @@
</button> </button>
</div> </div>
</div> </div>
<textarea
id="variableList"
readonly
v-textarea-auto-height="variableString"
v-model="variableString"
:placeholder="$t('add_one_variable')"
rows="1"
></textarea>
</li> </li>
</ul> </ul>
<ul v-for="(variable, index) in this.editingEnvCopy.variables" :key="index"> <ul v-for="(variable, index) in this.editingEnvCopy.variables" :key="index">
@@ -114,13 +106,9 @@
</template> </template>
<script> <script>
import textareaAutoHeight from "~/directives/textareaAutoHeight"
import { fb } from "~/helpers/fb" import { fb } from "~/helpers/fb"
export default { export default {
directives: {
textareaAutoHeight,
},
props: { props: {
show: Boolean, show: Boolean,
editingEnvironment: Object, editingEnvironment: Object,

View File

@@ -1,8 +0,0 @@
export default {
name: "textareaAutoHeight",
update({ scrollHeight, clientHeight, style }) {
if (scrollHeight !== clientHeight) {
style.minHeight = `${scrollHeight}px`
}
},
}

View File

@@ -27,7 +27,7 @@
</pw-section> </pw-section>
<pw-section class="orange" :label="$t('headers')" ref="headers"> <pw-section class="orange" :label="$t('headers')" ref="headers">
<ul> <ul v-if="headers.length !== 0">
<li> <li>
<div class="flex-wrap"> <div class="flex-wrap">
<label for="headerList">{{ $t("header_list") }}</label> <label for="headerList">{{ $t("header_list") }}</label>
@@ -37,14 +37,6 @@
</button> </button>
</div> </div>
</div> </div>
<textarea
id="headerList"
readonly
v-textarea-auto-height="headerString"
v-model="headerString"
:placeholder="$t('add_one_header')"
rows="1"
></textarea>
</li> </li>
</ul> </ul>
<ul v-for="(header, index) in headers" :key="`${header.value}_${index}`"> <ul v-for="(header, index) in headers" :key="`${header.value}_${index}`">
@@ -339,7 +331,6 @@
<script> <script>
import axios from "axios" import axios from "axios"
import * as gql from "graphql" import * as gql from "graphql"
import textareaAutoHeight from "~/directives/textareaAutoHeight"
import { commonHeaders } from "~/helpers/headers" import { commonHeaders } from "~/helpers/headers"
import AceEditor from "~/components/ui/ace-editor" import AceEditor from "~/components/ui/ace-editor"
import QueryEditor from "~/components/graphql/queryeditor" import QueryEditor from "~/components/graphql/queryeditor"
@@ -347,9 +338,6 @@ import { getPlatformSpecialKey } from "~/helpers/platformutils"
import { sendNetworkRequest } from "~/helpers/network" import { sendNetworkRequest } from "~/helpers/network"
export default { export default {
directives: {
textareaAutoHeight,
},
components: { components: {
"pw-section": () => import("~/components/layout/section"), "pw-section": () => import("~/components/layout/section"),
"gql-field": () => import("~/components/graphql/field"), "gql-field": () => import("~/components/graphql/field"),

View File

@@ -264,15 +264,18 @@
<div v-if="!rawInput"> <div v-if="!rawInput">
<ul> <ul>
<li> <li>
<label for="reqParamList">{{ $t("parameter_list") }}</label> <div class="flex-wrap">
<textarea <label for="reqParamList">{{ $t("parameter_list") }}</label>
id="reqParamList" <div>
readonly <button
v-textarea-auto-height="rawRequestBody" class="icon"
v-model="rawRequestBody" @click="clearContent('bodyParams', $event)"
:placeholder="$t('add_one_parameter')" v-tooltip.bottom="$t('clear')"
rows="1" >
></textarea> <i class="material-icons">clear_all</i>
</button>
</div>
</div>
</li> </li>
</ul> </ul>
<ul v-for="(param, index) in bodyParams" :key="index"> <ul v-for="(param, index) in bodyParams" :key="index">
@@ -331,7 +334,18 @@
<div v-else> <div v-else>
<ul> <ul>
<li> <li>
<label for="rawBody">{{ $t("raw_request_body") }}</label> <div class="flex-wrap">
<label for="rawBody">{{ $t("raw_request_body") }}</label>
<div>
<button
class="icon"
@click="clearContent('rawParams', $event)"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
</div>
</div>
<Editor <Editor
v-model="rawParams" v-model="rawParams"
:lang="rawInputEditorLang" :lang="rawInputEditorLang"
@@ -414,7 +428,7 @@
:selected="true" :selected="true"
> >
<pw-section class="pink" label="Parameters" ref="parameters"> <pw-section class="pink" label="Parameters" ref="parameters">
<ul> <ul v-if="params.length !== 0">
<li> <li>
<div class="flex-wrap"> <div class="flex-wrap">
<label for="paramList">{{ $t("parameter_list") }}</label> <label for="paramList">{{ $t("parameter_list") }}</label>
@@ -428,14 +442,6 @@
</button> </button>
</div> </div>
</div> </div>
<textarea
id="paramList"
readonly
v-textarea-auto-height="queryString"
v-model="queryString"
:placeholder="$t('add_one_parameter')"
rows="1"
></textarea>
</li> </li>
</ul> </ul>
<ul v-for="(param, index) in params" :key="index"> <ul v-for="(param, index) in params" :key="index">
@@ -721,7 +727,7 @@
" "
> >
<pw-section class="orange" label="Headers" ref="headers"> <pw-section class="orange" label="Headers" ref="headers">
<ul> <ul v-if="headers.length !== 0">
<li> <li>
<div class="flex-wrap"> <div class="flex-wrap">
<label for="headerList">{{ $t("header_list") }}</label> <label for="headerList">{{ $t("header_list") }}</label>
@@ -735,14 +741,6 @@
</button> </button>
</div> </div>
</div> </div>
<textarea
id="headerList"
readonly
v-textarea-auto-height="headerString"
v-model="headerString"
:placeholder="$t('add_one_header')"
rows="1"
></textarea>
</li> </li>
</ul> </ul>
<ul v-for="(header, index) in headers" :key="`${header.value}_${index}`"> <ul v-for="(header, index) in headers" :key="`${header.value}_${index}`">
@@ -1251,7 +1249,6 @@ import section from "~/components/layout/section"
import url from "url" import url from "url"
import querystring from "querystring" import querystring from "querystring"
import { commonHeaders } from "~/helpers/headers" import { commonHeaders } from "~/helpers/headers"
import textareaAutoHeight from "~/directives/textareaAutoHeight"
import parseCurlCommand from "~/assets/js/curlparser.js" import parseCurlCommand from "~/assets/js/curlparser.js"
import getEnvironmentVariablesFromScript from "~/helpers/preRequest" import getEnvironmentVariablesFromScript from "~/helpers/preRequest"
import runTestScriptWithVariables from "~/helpers/postwomanTesting" import runTestScriptWithVariables from "~/helpers/postwomanTesting"
@@ -1316,9 +1313,6 @@ const parseHeaders = (xhr) => {
export const findStatusGroup = (responseStatus) => export const findStatusGroup = (responseStatus) =>
statusCategories.find(({ statusCodeRegex }) => statusCodeRegex.test(responseStatus)) statusCategories.find(({ statusCodeRegex }) => statusCodeRegex.test(responseStatus))
export default { export default {
directives: {
textareaAutoHeight,
},
components: { components: {
"pw-section": section, "pw-section": section,
"pw-toggle": () => import("~/components/ui/toggle"), "pw-toggle": () => import("~/components/ui/toggle"),
@@ -2439,6 +2433,12 @@ export default {
}, },
clearContent(name, { target }) { clearContent(name, { target }) {
switch (name) { switch (name) {
case "bodyParams":
this.bodyParams = []
break
case "rawParams":
this.rawParams = "{}"
break
case "parameters": case "parameters":
this.params = [] this.params = []
break break
@@ -2475,7 +2475,7 @@ export default {
this.uri = this.url + this.path this.uri = this.url + this.path
this.label = "" this.label = ""
this.bodyParams = [] this.bodyParams = []
this.rawParams = "" this.rawParams = "{}"
this.files = [] this.files = []
this.params = [] this.params = []
this.auth = "None" this.auth = "None"