duplicate identifier for requests fixed (#1346)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Hari Narayanan
2020-11-27 17:12:33 +05:30
committed by GitHub
parent a5a812d3f4
commit 57627367f5
5 changed files with 30 additions and 30 deletions

View File

@@ -17,12 +17,11 @@
<div slot="body">
<ul>
<li>
<label for="selectLabel">{{ $t("label") }}</label>
<label for="selectLabel">{{ $t("token_req_name") }}</label>
<input
type="text"
id="selectLabel"
v-model="requestData.name"
:placeholder="defaultRequestName"
@keyup.enter="saveRequestAs"
/>
<label for="selectCollection">{{ $t("collection") }}</label>
@@ -89,7 +88,7 @@ export default {
},
data() {
return {
defaultRequestName: "My Request",
defaultRequestName: "Untitled Request",
requestData: {
name: undefined,
collectionIndex: undefined,
@@ -108,8 +107,8 @@ export default {
"requestData.folderName": function resetRequestIndex() {
this.$data.requestData.requestIndex = undefined
},
editingRequest({ label }) {
this.defaultRequestName = label || "My Request"
editingRequest({ name }) {
this.$data.requestData.name = name || this.$data.defaultRequestName
},
},
computed: {
@@ -168,10 +167,16 @@ export default {
})
return
}
if (this.$data.requestData.name.length === 0) {
this.$toast.error(this.$t("empty_req_name"), {
icon: "error",
})
return
}
const requestUpdated = {
...this.$props.editingRequest,
name: this.$data.requestData.name || this.$data.defaultRequestName,
name: this.$data.requestData.name,
collection: this.$data.requestData.collectionIndex,
}

View File

@@ -23,11 +23,11 @@
</button>
<li>
<input
:aria-label="$t('label')"
:aria-label="$t('token_req_name')"
type="text"
readonly
:value="entry.label"
:placeholder="$t('no_label')"
:value="entry.name"
:placeholder="$t('empty_req_name')"
class="bg-color"
/>
</li>

View File

@@ -103,6 +103,7 @@
"manage_token_req": "Manage Token Request",
"use_token_req": "Use Token Request",
"token_req_name": "Request Name",
"empty_req_name": "Empty Request Name",
"token_req_details": "Request Details",
"token_name": "Token Name",
"oidc_discovery_url": "OIDC Discovery URL",
@@ -294,4 +295,4 @@
"experiments": "Experiments",
"experiments_notice": "This is a collection of experiments we're working on that might turn out to be useful, fun, both, or neither. They're not final and may not be stable, so if something overly weird happens, don't panic. Just turn the dang thing off. Jokes aside, ",
"use_experimental_url_bar": "Use experimental URL bar with environment highlighting"
}
}

View File

@@ -178,14 +178,8 @@
</li>
</ul>
<div class="blue">
<label for="label">{{ $t("label") }}</label>
<input
id="label"
name="label"
type="text"
v-model="label"
:placeholder="$t('optional')"
/>
<label for="name">{{ $t("token_req_name") }}</label>
<input id="name" name="name" type="text" v-model="name" />
</div>
<div
class="blue"
@@ -1461,7 +1455,7 @@ export default {
this.testsEnabled = true
this.testScript = newValue.testScript
}
this.label = newValue.label
this.name = newValue.name
},
editingRequest(newValue) {
this.editRequest = newValue
@@ -1528,12 +1522,12 @@ export default {
this.$store.commit("setState", { value, attribute: "path" })
},
},
label: {
name: {
get() {
return this.$store.state.request.label
return this.$store.state.request.name
},
set(value) {
this.$store.commit("setState", { value, attribute: "label" })
this.$store.commit("setState", { value, attribute: "name" })
},
},
auth: {
@@ -1739,7 +1733,7 @@ export default {
return this.$store.state.postwoman.editingRequest
},
requestName() {
return this.label
return this.name
},
statusCategory() {
return findStatusGroup(this.response.status)
@@ -1878,7 +1872,7 @@ export default {
})
},
handleUseHistory(entry) {
this.label = entry.label
this.name = entry.name
this.method = entry.method
this.uri = entry.url + entry.path
this.url = entry.url
@@ -2021,7 +2015,7 @@ export default {
this.response.body = payload.data
// Addition of an entry to the history component.
const entry = {
label: this.requestName,
name: this.requestName,
status: this.response.status,
date: new Date().toLocaleDateString(),
time: new Date().toLocaleTimeString(),
@@ -2076,7 +2070,7 @@ export default {
this.response.body = error.response.data
// Addition of an entry to the history component.
const entry = {
label: this.requestName,
name: this.requestName,
status: this.response.status,
date: new Date().toLocaleDateString(),
time: new Date().toLocaleTimeString(),
@@ -2427,7 +2421,7 @@ export default {
this.url = "https://httpbin.org"
this.path = "/get"
this.uri = this.url + this.path
this.label = ""
this.name = "Untitled request"
this.bodyParams = []
this.rawParams = "{}"
this.files = []
@@ -2480,7 +2474,7 @@ export default {
requestType: this.requestType,
preRequestScript: this.showPreRequestScript == true ? this.preRequestScript : null,
testScript: this.testsEnabled == true ? this.testScript : null,
label: this.requestName,
name: this.requestName,
}
if (this.selectedRequest.url) {
this.editRequest = Object.assign({}, this.selectedRequest, this.editRequest)
@@ -2701,7 +2695,7 @@ export default {
if (Object.keys(this.$route.query).length) this.setRouteQueries(this.$route.query)
this.$watch(
(vm) => [
vm.label,
vm.name,
vm.method,
vm.url,
vm.auth,

View File

@@ -1,10 +1,10 @@
export default () => ({
request: {
name: "Untitled request",
method: "GET",
uri: "",
url: "https://httpbin.org",
path: "/get",
label: "",
auth: "None",
httpUser: "",
httpPassword: "",