diff --git a/.env.development b/.env.development index d91a12f..ab8671b 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ VITE_APPLICATION_NAME="FANTools - Development" -VITE_API_URL="https://pocketbase-test.fatools.site" +VITE_API_URL="https://pocketbase.fatools.site" VITE_LOCALE_DEFAULT="en" VITE_LOCALE_FALLBACK="en" VITE_TOKEN_SECRET="#12223Secret123!456" \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8fde094..a132dec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fantools", - "version": "1.0.3", + "version": "1.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fantools", - "version": "1.0.3", + "version": "1.1.1", "license": "BSD-3-Clause", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.2.1", @@ -22,6 +22,7 @@ "bootstrap": "^5.2.3", "bootstrap-vue": "^2.23.1", "bootstrap-vue-3": "^0.1.13", + "csv-parser": "^3.0.0", "electron-is-dev": "^2.0.0", "electron-updater": "^5.3.0", "install": "^0.13.0", @@ -50,6 +51,7 @@ "@vue/compiler-sfc": "^3.1.0", "electron": "^22.0.2", "electron-builder": "^23.6.0", + "papaparse": "^5.4.1", "sass": "^1.52.3", "sass-loader": "^13.0.0", "vite": "^2.9.9", @@ -1915,6 +1917,20 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" }, + "node_modules/csv-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", + "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "csv-parser": "bin/csv-parser" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3999,6 +4015,12 @@ "node": ">=8" } }, + "node_modules/papaparse": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz", + "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==", + "dev": true + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -6888,6 +6910,14 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" }, + "csv-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", + "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", + "requires": { + "minimist": "^1.2.0" + } + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -8366,6 +8396,12 @@ "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", "dev": true }, + "papaparse": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz", + "integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", diff --git a/package.json b/package.json index 3dfb8b2..73b87f0 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "bootstrap": "^5.2.3", "bootstrap-vue": "^2.23.1", "bootstrap-vue-3": "^0.1.13", + "csv-parser": "^3.0.0", "electron-is-dev": "^2.0.0", "electron-updater": "^5.3.0", "install": "^0.13.0", @@ -71,6 +72,7 @@ "@vue/compiler-sfc": "^3.1.0", "electron": "^22.0.2", "electron-builder": "^23.6.0", + "papaparse": "^5.4.1", "sass": "^1.52.3", "sass-loader": "^13.0.0", "vite": "^2.9.9", diff --git a/src/App.vue b/src/App.vue index 08f85c2..5fb9cc3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -56,6 +56,9 @@ User Panel + + Upload Migrations + Logout diff --git a/src/router/admin.routes.js b/src/router/admin.routes.js index 6c9df42..2559e99 100644 --- a/src/router/admin.routes.js +++ b/src/router/admin.routes.js @@ -1,8 +1,9 @@ -import { Dashboard } from '@/views/admin'; +import { Dashboard, UploadMigration } from '@/views/admin'; export default { path: '/admin', children: [ - { path: 'dashboard', name: 'admin-userpanel', component: Dashboard } + { path: 'dashboard', name: 'admin-userpanel', component: Dashboard }, + { path: 'upload-migrations', name: 'admin-upload-migrations', component: UploadMigration } ] }; diff --git a/src/stores/database.store.js b/src/stores/database.store.js index c42b595..7e3d6f0 100644 --- a/src/stores/database.store.js +++ b/src/stores/database.store.js @@ -17,7 +17,29 @@ export const useDatabaseStore = defineStore({ }, async create (values, collection) { - return await db.collection(collection).create(values) + return await db.collection(collection).create(values, { + "$autoCancel": false, + }) + }, + + async firstItem (collection, filter) { + return await db.collection(collection).getList(1, 1, { + filter: filter + }); + }, + + async fullList (collection) { + return await db.collection(collection).getFullList() + }, + + async getDuplicatedRows(rows) { + + let dslams = rows.data.map(v => v.Dslam) + + const filter = dslams.map((id) => `dslam="${id}"`).join("||"); + + const records = await db.collection("migrations_duplicate").getFullList({ filter }); + console.log(records) } } }); diff --git a/src/views/admin/UploadMigration.vue b/src/views/admin/UploadMigration.vue new file mode 100644 index 0000000..e93d732 --- /dev/null +++ b/src/views/admin/UploadMigration.vue @@ -0,0 +1,143 @@ + + diff --git a/src/views/admin/index.js b/src/views/admin/index.js index f5e03e3..319e0dd 100644 --- a/src/views/admin/index.js +++ b/src/views/admin/index.js @@ -1 +1,2 @@ -export { default as Dashboard } from './Dashboard.vue'; \ No newline at end of file +export { default as Dashboard } from './Dashboard.vue'; +export { default as UploadMigration } from './UploadMigration.vue'; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index d0d31ba..3300e8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1068,6 +1068,13 @@ csstype@^3.1.0: resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz" integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw== +csv-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz" + integrity sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ== + dependencies: + minimist "^1.2.0" + debug@^2.6.8: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" @@ -2025,6 +2032,11 @@ p-cancelable@^2.0.0: resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz" integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== +papaparse@^5.4.1: + version "5.4.1" + resolved "https://registry.npmjs.org/papaparse/-/papaparse-5.4.1.tgz" + integrity sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"