Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a query per file - FOUR-7233 #1304

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions src/components/renderer/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export default {
}
},
computed: {
hasVariableName () {
return this.name && typeof this.$parent[this.name] !== 'undefined';
},
filesFromGlobalRequestFiles() {
if (!this.value) {
return [];
Expand Down Expand Up @@ -222,33 +225,33 @@ export default {
},
name: {
handler() {
this.options.query.data_name = this.fileDataName;
this.staticQuery.data_name = this.fileDataName;
},
immediate: true,
},
parent: {
handler() {
this.options.query.parent = this.parent;
this.staticQuery.parent = this.parent;
},
immediate: true,
},
prefix: {
handler() {
this.options.query.data_name = this.fileDataName;
this.staticQuery.data_name = this.fileDataName;
},
immediate: true,
},
row_id: {
handler() {
this.options.query.row_id = this.row_id;
this.options.query.data_name = this.prefix + this.name + (this.row_id ? '.' + this.row_id : '');
this.staticQuery.row_id = this.row_id;
this.staticQuery.data_name = this.prefix + this.name + (this.row_id ? '.' + this.row_id : '');
},
immediate: true,
},
multipleUpload: {
handler() {
// Add the multiple parameter for the endpoint call that will be executed by vue-simple-uploader
this.options.query.multiple = this.multipleUpload;
this.staticQuery.multiple = this.multipleUpload;
},
immediate: true,
},
Expand All @@ -263,16 +266,23 @@ export default {
},
prefix: '',
row_id: null,
staticQuery: {
chunk: true,
data_name: this.name,
parent: null,
row_id: null,
},
options: {
query: (file) => {
const query = Object.assign({}, this.staticQuery);
if (!this.hasVariableName) {
query.data_name = file.name;
}
return query;
},
target: this.getTargetUrl,
// We cannot increase this until laravel chunk uploader handles this gracefully
simultaneousUploads: 1,
query: {
chunk: true,
data_name: this.name,
parent: null,
row_id: null,
},
testChunks: false,
// Setup our headers to deal with API calls
headers: {
Expand Down Expand Up @@ -462,9 +472,6 @@ export default {
}
}
file.ignored = false;
if (!this.name) {
this.options.query.data_name = file.name;
}
return true;
},
removeDefaultClasses() {
Expand Down