From 233a7a8d69f7346b2a2954b20a5115a2b35ca68d Mon Sep 17 00:00:00 2001 From: xiangming0305 Date: Wed, 3 Jun 2020 07:48:34 -0700 Subject: [PATCH 1/4] push test --- app/Http/Controllers/Auth/ConfirmPasswordController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php index 938c8e319..0af1e710a 100644 --- a/app/Http/Controllers/Auth/ConfirmPasswordController.php +++ b/app/Http/Controllers/Auth/ConfirmPasswordController.php @@ -8,6 +8,7 @@ class ConfirmPasswordController extends Controller { + use ConfirmsPasswords; protected $redirectTo = RouteServiceProvider::HOME; From 537e1c5104431d20db0f9d487a76b8264273b2bd Mon Sep 17 00:00:00 2001 From: xiangming0305 Date: Wed, 3 Jun 2020 21:04:14 -0700 Subject: [PATCH 2/4] no message --- client/src/js/pages/gedcom/Index.vue | 39 ++++++++++++++++++++++++---- client/vue.config.js | 1 + 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/client/src/js/pages/gedcom/Index.vue b/client/src/js/pages/gedcom/Index.vue index aab70e341..d49ebf3c1 100644 --- a/client/src/js/pages/gedcom/Index.vue +++ b/client/src/js/pages/gedcom/Index.vue @@ -1,12 +1,23 @@ @@ -15,6 +26,7 @@ export default { data() { return { file: null, + uploadPercentage: 0, }; }, @@ -29,11 +41,28 @@ export default { methods: { selectedFile(event) { this.file = event.target.files[0]; + this.uploadPercentage = 0; + console.log(this.uploadPercentage); }, uploadFile() { const fd = new FormData(); fd.append('file', this.file, 'file.ged'); - axios.post(this.uploadLink, fd).then(res => console.log(res)); + axios.post( this.uploadLink, + fd, + { + headers: { + 'Content-Type': 'multipart/form-data' + }, + onUploadProgress: function( progressEvent ) { + this.uploadPercentage = parseInt( Math.round( ( progressEvent.loaded / progressEvent.total ) * 100 )); + }.bind(this) + }, + ).then(function(){ + + }) + .catch(function(){ + + }); }, }, }; diff --git a/client/vue.config.js b/client/vue.config.js index cadde957f..eeabf4f5b 100644 --- a/client/vue.config.js +++ b/client/vue.config.js @@ -22,6 +22,7 @@ module.exports = { target: process.env.API_URL, }, }, + port: 8081, }, outputDir: '../public/', configureWebpack: { From 2edc7c8c7061a174aa3fc6e8714aad8dd715d9ad Mon Sep 17 00:00:00 2001 From: jyyblue Date: Thu, 4 Jun 2020 11:22:12 -0700 Subject: [PATCH 3/4] fix eslint issue fix store --- app/Http/Controllers/Gedcom/Store.php | 30 ++++++++------ client/src/js/pages/gedcom/Index.vue | 59 ++++++++++++--------------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/app/Http/Controllers/Gedcom/Store.php b/app/Http/Controllers/Gedcom/Store.php index 883b311a1..597df9bfd 100644 --- a/app/Http/Controllers/Gedcom/Store.php +++ b/app/Http/Controllers/Gedcom/Store.php @@ -10,7 +10,7 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Asdfx\LaravelGedcom\Facades\GedcomParserFacade; - +use Asdfx\LaravelGedcom\Utils\GedcomParser; class Store extends Controller { /* @@ -20,18 +20,24 @@ class Store extends Controller public function __invoke(Request $request) { - if ($request->hasFile('file')) { - if ($request->file('file')->isValid()) { - $request->file->storeAs('gedcom', 'file.ged'); - GedcomParserFacade::parse($request->file('file'), true); - - return ['File uploaded']; + + if ($request->hasFile('file')) { + if ($request->file('file')->isValid()) { + try{ + $request->file->storeAs('gedcom', 'file.ged'); + $parser = new GedcomParser(); + $parser->parse($request->file('file'), true); + + return ['File uploaded']; + }catch(Exception $e){ + abort(500, 'Could not create office or assign it to administrator'); + // return ['Not uploaded']; + } + } + + return ['File corrupted']; } - - return ['File corrupted']; - } - + return ['Not uploaded']; } - } diff --git a/client/src/js/pages/gedcom/Index.vue b/client/src/js/pages/gedcom/Index.vue index d49ebf3c1..bc5c4313d 100644 --- a/client/src/js/pages/gedcom/Index.vue +++ b/client/src/js/pages/gedcom/Index.vue @@ -1,22 +1,20 @@ @@ -32,7 +30,7 @@ export default { computed: { uploadLink() { - return window.location.origin + '/api/gedcom/store'; + return '/api/gedcom/store'; }, }, @@ -40,33 +38,28 @@ export default { methods: { selectedFile(event) { - this.file = event.target.files[0]; + [this.file] = event.target.files; this.uploadPercentage = 0; - console.log(this.uploadPercentage); + // console.log(this.uploadPercentage); }, uploadFile() { const fd = new FormData(); fd.append('file', this.file, 'file.ged'); - axios.post( this.uploadLink, - fd, - { + axios + .post(this.uploadLink, fd, { headers: { - 'Content-Type': 'multipart/form-data' + 'Content-Type': 'multipart/form-data', }, - onUploadProgress: function( progressEvent ) { - this.uploadPercentage = parseInt( Math.round( ( progressEvent.loaded / progressEvent.total ) * 100 )); - }.bind(this) - }, - ).then(function(){ - - }) - .catch(function(){ - - }); + onUploadProgress: function (progressEvent) { + const pe = Math.round((progressEvent.loaded / progressEvent.total) * 100); + this.uploadPercentage = parseInt(pe, 10); + }.bind(this), + }) + .then() + .catch(); }, }, }; - + From 3b7993c60674c86ef59dbae5660a398824cf1bea Mon Sep 17 00:00:00 2001 From: jyyblue Date: Fri, 5 Jun 2020 04:39:54 -0700 Subject: [PATCH 4/4] clean --- app/Http/Controllers/Gedcom/Store.php | 3 +-- client/vue.config.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Http/Controllers/Gedcom/Store.php b/app/Http/Controllers/Gedcom/Store.php index 597df9bfd..1723f9e1c 100644 --- a/app/Http/Controllers/Gedcom/Store.php +++ b/app/Http/Controllers/Gedcom/Store.php @@ -30,8 +30,7 @@ public function __invoke(Request $request) return ['File uploaded']; }catch(Exception $e){ - abort(500, 'Could not create office or assign it to administrator'); - // return ['Not uploaded']; + return ['Not uploaded']; } } diff --git a/client/vue.config.js b/client/vue.config.js index eeabf4f5b..cadde957f 100644 --- a/client/vue.config.js +++ b/client/vue.config.js @@ -22,7 +22,6 @@ module.exports = { target: process.env.API_URL, }, }, - port: 8081, }, outputDir: '../public/', configureWebpack: {