From 19bbce998ef06cab767736ee50807a87580a3995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D5=A1=C9=A8=D5=BC=C9=A2=D3=84=D5=A1=D6=85=D5=BC=C9=A2?= Date: Sat, 14 May 2022 21:39:43 +0800 Subject: [PATCH] feat: quick import (#2042) * wip: basic add / import layout * chore: move excel from create project options to project tabs * chore: move drag attributes & rm unused methods * chore: remove create project logic * chore: rm project title text field * fix: import excel into an existing project logic * refactor: add / import menu ui * feat: integrate with import-csv logic * wip: new csv import logic * feat: import csv basic ui * refactor: use excel adapter for csv import * chore: merge excel & csv together * fix: accept csv for import * i18n: add csv to excelSupport * fix: empty map & extract error msg * fix: duplicate columns with system fields during import * chore: rename excel import -> quick import * chore: separate csv & excel for better tele * chore: pass quickImportType * i18n: remove .csv from the message * fix: wrong import type * chore: hide gradient generator * fix: file type validation * i18n: add importCSV * fix: import button text * fix: set modal to false after importing * fix: header text in quick import * chore: show error message in parseAndExtractData * i18n: add csvURL * fix: import url label * fix: wrong import type * fix: failed to execute 'insertBefore' on 'Node' * fix: delete logic & add pv to first column * feat: set default primary value * chore: disable virtual columns in dropdown * fix: set pk & rqd to ID by default * docs: remove creating project from excel * docs: add quick import * feat: add loadFirstCreatedTableTab * feat: open the tab automatically after import * test/cypress: UI corrections for quick-import Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: add UI permission to Add / Import * fix: remove unnecessary drop handler * fix: wrong class name in cypress test * fix: use v-if instead of v-show * fix: move _isUIAllowed to parent v-menu Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../nc-gui/components/ProjectTreeView.vue | 18 +- .../{excelImport.vue => quickImport.vue} | 60 +++- .../importExport/columnMappingModal.vue | 17 +- packages/nc-gui/components/projectTabs.vue | 311 +++++++++++------- .../createProjectFromTemplateBtn.vue | 139 +++++--- .../nc-gui/components/templates/editor.vue | 60 ++-- packages/nc-gui/lang/da.json | 2 + packages/nc-gui/lang/de.json | 2 + packages/nc-gui/lang/en.json | 2 + packages/nc-gui/lang/es.json | 2 + packages/nc-gui/lang/fa.json | 2 + packages/nc-gui/lang/fi.json | 2 + packages/nc-gui/lang/fr.json | 4 +- packages/nc-gui/lang/hr.json | 2 + packages/nc-gui/lang/id.json | 2 + packages/nc-gui/lang/it_IT.json | 2 + packages/nc-gui/lang/iw.json | 2 + packages/nc-gui/lang/ja.json | 2 + packages/nc-gui/lang/ko.json | 2 + packages/nc-gui/lang/lv.json | 2 + packages/nc-gui/lang/nl.json | 2 + packages/nc-gui/lang/no.json | 2 + packages/nc-gui/lang/pl.json | 2 + packages/nc-gui/lang/pt.json | 2 + packages/nc-gui/lang/pt_BR.json | 2 + packages/nc-gui/lang/ru.json | 2 + packages/nc-gui/lang/sl.json | 2 + packages/nc-gui/lang/sv.json | 2 + packages/nc-gui/lang/th.json | 2 + packages/nc-gui/lang/tr.json | 2 + packages/nc-gui/lang/uk.json | 2 + packages/nc-gui/lang/vi.json | 2 + packages/nc-gui/lang/zh_CN.json | 2 + packages/nc-gui/lang/zh_HK.json | 2 + packages/nc-gui/lang/zh_TW.json | 2 + packages/nc-gui/pages/projects/index.vue | 46 +-- packages/nc-gui/store/tabs.js | 17 + .../content/en/setup-and-usages/dashboard.md | 29 +- .../en/setup-and-usages/table-operations.md | 46 ++- .../nocodb/src/lib/noco/meta/NcMetaMgr.ts | 2 +- .../integration/spec/roleValidation.spec.js | 2 +- scripts/cypress/support/commands.js | 1 + 42 files changed, 513 insertions(+), 295 deletions(-) rename packages/nc-gui/components/import/{excelImport.vue => quickImport.vue} (83%) diff --git a/packages/nc-gui/components/ProjectTreeView.vue b/packages/nc-gui/components/ProjectTreeView.vue index 7da30e6573..f074bd2c27 100644 --- a/packages/nc-gui/components/ProjectTreeView.vue +++ b/packages/nc-gui/components/ProjectTreeView.vue @@ -769,12 +769,12 @@ :heading="selectedNodeForDelete.heading" type="error" /> - @@ -795,7 +795,7 @@ import DlgTableCreate from "@/components/utils/dlgTableCreate"; import DlgViewCreate from "@/components/utils/dlgViewCreate"; import SponsorMini from "@/components/sponsorMini"; import {validateTableName} from "~/helpers"; -import ExcelImport from "~/components/import/excelImport"; +import QuickImport from "~/components/import/quickImport"; import draggable from "vuedraggable"; import GithubStarBtn from "~/components/githubStarBtn"; @@ -810,7 +810,7 @@ export default { SettingsModal, GithubStarBtn, draggable, - ExcelImport, + QuickImport, SponsorMini, DlgViewCreate, DlgTableCreate, @@ -864,7 +864,7 @@ export default { open: [], search: null, menuVisible: false, - excelImportDialog: false, + quickImportDialog: false, x: 0, y: 0, menuItem: null, @@ -1162,7 +1162,7 @@ export default { this.miniExpanded = false; } }, - onExcelImport() { + onQuickImport() { if (!this.menuItem || this.menuItem.type !== "tableDir") { this.menuItem = this.listViewArr.find((n) => n.type === "tableDir"); } @@ -1437,7 +1437,7 @@ export default { await this.loadViews(this.menuItem); this.$toast.success("Views refreshed").goAway(1000); } else if (action === "IMPORT_EXCEL") { - this.excelImportDialog = true; + this.quickImportDialog = true; } else if (action === "ENV_DB_FUNCTIONS_REFRESH") { await this.loadFunctions(this.menuItem); this.$toast.success("Functions refreshed").goAway(1000); diff --git a/packages/nc-gui/components/import/excelImport.vue b/packages/nc-gui/components/import/quickImport.vue similarity index 83% rename from packages/nc-gui/components/import/excelImport.vue rename to packages/nc-gui/components/import/quickImport.vue index c9f172bb26..e1c9ae8ecf 100644 --- a/packages/nc-gui/components/import/excelImport.vue +++ b/packages/nc-gui/components/import/quickImport.vue @@ -43,8 +43,8 @@ {{ $t('msg.info.upload_sub') }}

-

- +

+ {{ $t('msg.info.excelSupport') }}

@@ -60,7 +60,7 @@ v-model="url" hide-details="auto" type="url" - :label="$t('msg.info.excelURL')" + :label="quickImportType == 'excel' ? $t('msg.info.excelURL') : $t('msg.info.csvURL') " class="caption" outlined dense @@ -106,6 +106,7 @@