Adjust the import controller to return a url to the process path to enable processing an uploaded file without refresh. (#4080)

This commit is contained in:
Daniel Meltzer
2017-09-29 20:49:35 -04:00
committed by snipe
parent 1e52fb546c
commit 655ca78633
11 changed files with 137341 additions and 59 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ class ImportsTransformer
'header_row' => $import->header_row,
'first_row' => $import->first_row,
'field_map' => $import->field_map,
'process_url'=> route('api.imports.importFile', $import->id),
];
return $array;
+3439 -2
View File
File diff suppressed because one or more lines are too long
+6878 -4
View File
File diff suppressed because one or more lines are too long
+335 -2
View File
File diff suppressed because one or more lines are too long
-4
View File
@@ -3,10 +3,6 @@
"/css/AdminLTE.css": "/css/AdminLTE.css",
"/css/app.css": "/css/app.css",
"/css/overrides.css": "/css/overrides.css",
"/vue.js.map": "/vue.js.map",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map",
"/css/app.css.map": "/css/app.css.map",
"/css/overrides.css.map": "/css/overrides.css.map",
"/public/css/dist/all.css": "/public/css/dist/all.css",
"/public/js/dist/all.js": "/public/js/dist/all.js"
}
+52909 -2
View File
File diff suppressed because one or more lines are too long
+12288 -6
View File
File diff suppressed because one or more lines are too long
+61489 -26
View File
File diff suppressed because one or more lines are too long
@@ -67,7 +67,7 @@ tr {
<script>
export default {
props: ['file', 'customFieldUrl', 'importProcessUrl'],
props: ['file', 'customFieldUrl'],
data() {
return {
activeFile: this.file,
@@ -142,12 +142,6 @@ tr {
this.populateSelect2ActiveItems();
},
computed: {
processUrl() {
// Because we need to pass a parameter to the laravel route function
// We get a url 'http://localhost/api/v1/imports/process/DUMMYTEXT'
// But we want to customize that to /api/v1/imports/process/this_file
return this.importProcessUrl.replace('DUMMYTEXT', this.file.id)
},
columns() {
switch(this.options.importType) {
case 'asset':
@@ -175,7 +169,7 @@ tr {
},
postSave() {
this.statusText = "Processing...";
this.$http.post(this.processUrl, {
this.$http.post(this.file.process_url, {
'import-update': this.options.update,
'import-type': this.options.importType,
'column-mappings': this.columnMappings
@@ -36,9 +36,6 @@ th {
};
},
/**
* Prepare the component (Vue 2.x).
*/
mounted() {
window.eventHub.$on('importErrors', this.updateImportErrors);
this.fetchFiles();
@@ -66,7 +66,6 @@
:key="currentFile.id"
:file="currentFile"
customFieldUrl="{{route('api.customfields.index')}}"
importProcessUrl="{{route('api.imports.importFile','DUMMYTEXT')}}"
@alert="updateAlert(alert)">
</import-file>
</template>