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 63564 additions and 27 deletions

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;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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"
}

52911
build/vue.js

File diff suppressed because one or more lines are too long

Binary file not shown.

BIN
public/js/dist/all.js vendored

Binary file not shown.

View file

@ -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

View file

@ -36,9 +36,6 @@ th {
};
},
/**
* Prepare the component (Vue 2.x).
*/
mounted() {
window.eventHub.$on('importErrors', this.updateImportErrors);
this.fetchFiles();

View file

@ -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>