🎨 Fixes
This commit is contained in:
@@ -258,7 +258,15 @@
|
|||||||
v-tooltip="$t('upload_file')"
|
v-tooltip="$t('upload_file')"
|
||||||
>
|
>
|
||||||
<i class="material-icons">attach_file</i>
|
<i class="material-icons">attach_file</i>
|
||||||
<span>{{ file_choosen || "No file choosen" }}</span>
|
<span>
|
||||||
|
{{
|
||||||
|
files.length === 0
|
||||||
|
? "No files"
|
||||||
|
: files.length == 1
|
||||||
|
? "1 file"
|
||||||
|
: files.length + " files"
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@@ -266,6 +274,7 @@
|
|||||||
name="attachment"
|
name="attachment"
|
||||||
type="file"
|
type="file"
|
||||||
@change="uploadAttachment"
|
@change="uploadAttachment"
|
||||||
|
multiple
|
||||||
/>
|
/>
|
||||||
<label for="payload">
|
<label for="payload">
|
||||||
<button
|
<button
|
||||||
@@ -517,7 +526,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="testReport in testReports">
|
<div v-for="(testReport, index) in testReports" :key="index">
|
||||||
<div v-if="testReport.startBlock" class="info">
|
<div v-if="testReport.startBlock" class="info">
|
||||||
<h4>{{ testReport.startBlock }}</h4>
|
<h4>{{ testReport.startBlock }}</h4>
|
||||||
</div>
|
</div>
|
||||||
@@ -1617,7 +1626,7 @@ export default {
|
|||||||
activeSidebar: true,
|
activeSidebar: true,
|
||||||
fb,
|
fb,
|
||||||
customMethod: false,
|
customMethod: false,
|
||||||
file_choosen: null
|
files: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -2180,12 +2189,25 @@ export default {
|
|||||||
return getEnvironmentVariablesFromScript(this.preRequestScript);
|
return getEnvironmentVariablesFromScript(this.preRequestScript);
|
||||||
},
|
},
|
||||||
async makeRequest(auth, headers, requestBody, preRequestScript) {
|
async makeRequest(auth, headers, requestBody, preRequestScript) {
|
||||||
|
if (this.files !== undefined && this.files !== null) {
|
||||||
|
var formData = new FormData();
|
||||||
|
for (var i = 0; i < this.files.length; i++) {
|
||||||
|
let file = this.files[i];
|
||||||
|
formData.append("files[" + i + "]", file);
|
||||||
|
}
|
||||||
|
console.log("form", formData.entries());
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(requestBody, formData)
|
||||||
|
|
||||||
|
console.log("req", requestBody);
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: this.method,
|
method: this.method,
|
||||||
url: this.url + this.pathName + this.queryString,
|
url: this.url + this.pathName + this.queryString,
|
||||||
auth,
|
auth,
|
||||||
headers,
|
headers,
|
||||||
data: requestBody ? requestBody.toString() : null,
|
data: requestBody ? requestBody : null,
|
||||||
credentials: true
|
credentials: true
|
||||||
};
|
};
|
||||||
if (preRequestScript) {
|
if (preRequestScript) {
|
||||||
@@ -2809,15 +2831,8 @@ export default {
|
|||||||
this.setRouteQueryState();
|
this.setRouteQueryState();
|
||||||
},
|
},
|
||||||
uploadAttachment() {
|
uploadAttachment() {
|
||||||
const file = this.$refs.attachment.files[0];
|
this.files = this.$refs.attachment.files;
|
||||||
if (file !== undefined && file !== null) {
|
if (this.files !== undefined && this.files !== null) {
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = ({ target }) => {
|
|
||||||
console.log(target);
|
|
||||||
this.file_choosen = file.name;
|
|
||||||
console.log(target.result);
|
|
||||||
};
|
|
||||||
reader.readAsText(file);
|
|
||||||
this.$toast.info(this.$t("file_imported"), {
|
this.$toast.info(this.$t("file_imported"), {
|
||||||
icon: "attach_file"
|
icon: "attach_file"
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user