From 1ac3a8b31b4498b2094ca63145b6c0a489eb9e64 Mon Sep 17 00:00:00 2001 From: Alex H Date: Thu, 13 Apr 2023 07:13:17 +0000 Subject: [PATCH] import-generic view and route added --- ui/src/locales/de.json | 2 +- ui/src/locales/en.json | 6 +++++- ui/src/router/routes.js | 9 +++++++++ ui/src/router/views/import-generic.unit.js | 7 +++++++ ui/src/router/views/import-generic.vue | 18 ++++++++++++++++++ ui/src/router/views/import.vue | 21 ++++++++++++++++----- 6 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 ui/src/router/views/import-generic.unit.js create mode 100644 ui/src/router/views/import-generic.vue diff --git a/ui/src/locales/de.json b/ui/src/locales/de.json index c2e2ac7..fa62964 100644 --- a/ui/src/locales/de.json +++ b/ui/src/locales/de.json @@ -137,7 +137,7 @@ "dontimportagain": "Achte darauf, dass du die Datei nicht erneut importierst, da dies zu mehrfachen Einträgen führen würde.", "checkpointsimportcsv": "Wenn du alle diese Punkte überprüft hast kannst du unten die CSV importieren.", "importhintunits": "Vergewissere dich ebenfalls, dass die Kraftstoffeinheit und der Kraftstofftyp im Fahrzeug richtig eingestellt sind.", - "importhintcurrdist": "Stelle sicher, dass die Währung und die Entfernungseinheit in Hammond korrekt eingestellt sind. Der Import erkennt die Währung nicht automatisch aus der CSV-Datei, sondern verwendet die für den Benutzer eingestellte Währung.", + "importhintcurrdist": "Stelle sicher, dass die Währung und die Entfernungseinheit in Hammond korrekt eingestellt sind. Der Import erkennt die Währung nicht automatisch aus der datei, sondern verwendet die für den Benutzer eingestellte Währung.", "importhintnickname": "Vergewissere dich, dass der Fahrzeugname in Hammond genau mit dem Namen in der Fuelly-CSV-Datei übereinstimmt, sonst funktioniert der Import nicht.", "importhintvehiclecreated": "Vergewissere dich, dass du die Fahrzeuge bereits in Hammond erstellt hast.", "importhintcreatecsv": "Exportiere deine Daten aus {name} im CSV-Format. Die Schritte dazu findest du", diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 0bb7fc0..f5d4b0a 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -130,6 +130,8 @@ "importdatadesc": "Choose from the following options to import data into Hammond", "import": "Import", "importcsv": "If you have been using {name} to store your vehicle data, export the CSV file from {name} and click here to import.", + "importgeneric": "Generic Import", + "importgenericdesc": "Generic csv and json import.", "choosecsv": "Choose CSV", "choosephoto": "Choose Photo", "importsuccessfull": "Data Imported Successfully", @@ -137,13 +139,15 @@ "importfrom": "Import from {0}", "stepstoimport": "Steps to import data from {name}", "choosecsvimport": "Choose the {name} CSV and press the import button.", + "choosedatafile": "Choose the CSV or JSON file and then press the import button.", "dontimportagain": "Make sure that you do not import the file again because that will create repeat entries.", "checkpointsimportcsv": "Once you have checked all these points, just import the CSV below.", "importhintunits": "Similiarly, make sure that the Fuel Unit and Fuel Type are correctly set in the Vehicle.", - "importhintcurrdist": "Make sure that the Currency and Distance Unit are set correctly in Hammond. Import will not autodetect Currency from the CSV but use the one set for the user.", + "importhintcurrdist": "Make sure that the Currency and Distance Unit are set correctly in Hammond. Import will not autodetect Currency from the file but use the one set for the user.", "importhintnickname": "Make sure that the Vehicle nickname in Hammond is exactly the same as the name on Fuelly CSV or the import will not work.", "importhintvehiclecreated": "Make sure that you have already created the vehicles in Hammond platform.", "importhintcreatecsv": "Export your data from {name} in the CSV format. Steps to do that can be found", + "importgenerichintdata": "Data must be in either CSV or JSON format.", "here": "here", "unprocessedquickentries": "You have one quick entry to be processed. | You have {0} quick entries pending to be processed.", "show": "Show", diff --git a/ui/src/router/routes.js b/ui/src/router/routes.js index 011de78..c5d01c4 100644 --- a/ui/src/router/routes.js +++ b/ui/src/router/routes.js @@ -419,6 +419,15 @@ export default [ }, props: (route) => ({ user: store.state.auth.currentUser || {} }), }, + { + path: '/import/generic', + name: 'import-generic', + component: () => lazyLoadView(import('@views/import-generic.vue')), + meta: { + authRequired: true, + }, + props: (route) => ({ user: store.state.auth.currentUser || {} }), + }, { path: '/logout', name: 'logout', diff --git a/ui/src/router/views/import-generic.unit.js b/ui/src/router/views/import-generic.unit.js new file mode 100644 index 0000000..51d032e --- /dev/null +++ b/ui/src/router/views/import-generic.unit.js @@ -0,0 +1,7 @@ +import ImportGeneric from './import-generic' + +describe('@views/import-generic', () => { + it('is a valid view', () => { + expect(ImportGeneric).toBeAViewComponent() + }) +}) diff --git a/ui/src/router/views/import-generic.vue b/ui/src/router/views/import-generic.vue new file mode 100644 index 0000000..6d6b5a9 --- /dev/null +++ b/ui/src/router/views/import-generic.vue @@ -0,0 +1,18 @@ + + + + diff --git a/ui/src/router/views/import.vue b/ui/src/router/views/import.vue index 40597e6..6a31b92 100644 --- a/ui/src/router/views/import.vue +++ b/ui/src/router/views/import.vue @@ -18,18 +18,19 @@ export default {