From 8ab47b11094c3c9cee1df98479c1383649c13134 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 5 Sep 2023 18:10:52 +0300 Subject: [PATCH 1/8] fix: various stuff Signed-off-by: mertmit --- .../nc-gui/assets/nc-icons/plus-square.svg | 7 + packages/nc-gui/assets/style.scss | 31 +- packages/nc-gui/components.d.ts | 1 + .../nc-gui/components/api-client/Params.vue | 6 - .../nc-gui/components/cell/DateTimePicker.vue | 7 +- .../nc-gui/components/dashboard/Sidebar.vue | 162 +- .../components/dashboard/Sidebar/Header.vue | 60 + .../dashboard/Sidebar/TopSection.vue | 90 + .../dashboard/Sidebar/TopSection/Header.vue} | 0 .../components/dashboard/Sidebar/UserInfo.vue | 177 ++ .../nc-gui/components/dashboard/TreeView.vue | 1475 ----------------- .../AddNewTableNode.vue | 0 .../{TreeViewNew => TreeView}/BaseOptions.vue | 0 .../{TreeViewNew => TreeView}/ProjectNode.vue | 30 +- .../ProjectWrapper.vue | 0 .../{TreeViewNew => TreeView}/TableList.vue | 0 .../{TreeViewNew => TreeView}/TableNode.vue | 17 +- .../{TreeViewNew => TreeView}/index.vue | 86 +- .../settings/app-store/AppInstall.vue | 5 +- .../settings/data-sources/CreateBase.vue | 1 + .../nc-gui/components/dlg/AirtableImport.vue | 4 +- .../components/dlg/ProjectDuplicate.vue | 22 +- .../nc-gui/components/dlg/TableDuplicate.vue | 54 +- .../dlg/share-and-collaborate/View.vue | 7 +- .../nc-gui/components/general/EmojiPicker.vue | 4 +- .../nc-gui/components/general/MiniSidebar.vue | 2 +- .../components/general/OpenLeftSidebarBtn.vue | 53 + .../nc-gui/components/general/ReleaseInfo.vue | 8 +- .../nc-gui/components/general/UserIcon.vue | 51 + .../nc-gui/components/general/ViewIcon.vue | 11 +- .../components/general/WorkspaceIcon.vue | 37 + .../components/general/language/index.vue | 2 +- packages/nc-gui/components/nc/Badge.vue | 21 +- packages/nc-gui/components/nc/Button.vue | 17 +- packages/nc-gui/components/nc/Divider.vue | 9 + packages/nc-gui/components/nc/Dropdown.vue | 24 +- packages/nc-gui/components/nc/Menu.vue | 19 + packages/nc-gui/components/nc/MenuItem.vue | 17 + packages/nc-gui/components/nc/Modal.vue | 4 +- packages/nc-gui/components/nc/Tooltip.vue | 18 +- .../components/project/AccessSettings.vue | 15 +- .../nc-gui/components/project/AllTables.vue | 2 +- .../project/InviteProjectCollabSection.vue | 10 +- packages/nc-gui/components/project/View.vue | 3 +- .../nc-gui/components/smartsheet/Gallery.vue | 5 +- .../components/smartsheet/Pagination.vue | 43 +- .../nc-gui/components/smartsheet/Toolbar.vue | 14 +- .../nc-gui/components/smartsheet/Topbar.vue | 11 +- .../smartsheet/column/AdvancedOptions.vue | 13 +- .../smartsheet/expanded-form/Header.vue | 2 +- .../components/smartsheet/grid/Table.vue | 8 +- .../components/smartsheet/header/Cell.vue | 8 +- .../components/smartsheet/sidebar/MenuTop.vue | 2 +- .../smartsheet/sidebar/RenameableMenuItem.vue | 8 + .../components/smartsheet/sidebar/index.vue | 77 +- .../smartsheet/toolbar/ColumnFilterMenu.vue | 2 +- .../components/smartsheet/toolbar/Export.vue | 4 +- .../smartsheet/toolbar/FieldsMenu.vue | 2 +- .../smartsheet/toolbar/GroupByMenu.vue | 8 +- .../smartsheet/toolbar/OpenViewSidebarBtn.vue | 53 + .../smartsheet/toolbar/SortListMenu.vue | 9 +- .../smartsheet/toolbar/ViewInfo.vue | 32 +- .../smartsheet/topbar/SelectMode.vue | 14 +- .../nc-gui/components/tabs/Smartsheet.vue | 2 +- .../components/tabs/SmartsheetResizable.vue | 211 +-- .../workspace/CollaboratorsList.vue | 8 +- .../components/workspace/CreateProjectBtn.vue | 67 +- .../components/workspace/CreateProjectDlg.vue | 18 +- .../nc-gui/components/workspace/Delete.vue | 66 - .../components/workspace/EmptyPlaceholder.vue | 21 +- .../components/workspace/InviteSection.vue | 6 +- packages/nc-gui/components/workspace/Menu.vue | 372 +---- .../nc-gui/components/workspace/Settings.vue | 164 ++ packages/nc-gui/components/workspace/View.vue | 30 +- .../nc-gui/composables/useApi/interceptors.ts | 46 +- .../composables/useCommandPalette/index.ts | 6 +- packages/nc-gui/composables/useData.ts | 3 - .../nc-gui/composables/useGlobal/actions.ts | 49 +- .../nc-gui/composables/useGlobal/state.ts | 1 + .../nc-gui/composables/useGlobal/types.ts | 13 +- packages/nc-gui/composables/useLTARStore.ts | 7 +- packages/nc-gui/composables/useRoles/index.ts | 81 +- packages/nc-gui/composables/useSharedView.ts | 2 + packages/nc-gui/composables/useTableNew.ts | 2 +- packages/nc-gui/composables/useUndoRedo.ts | 22 +- packages/nc-gui/layouts/base.vue | 8 +- packages/nc-gui/layouts/dashboard.vue | 208 +-- packages/nc-gui/layouts/empty.vue | 10 +- packages/nc-gui/layouts/new.vue | 2 +- packages/nc-gui/layouts/shared-view.vue | 32 +- packages/nc-gui/lib/types.ts | 7 +- packages/nc-gui/middleware/auth.global.ts | 5 + packages/nc-gui/package-lock.json | 14 +- packages/nc-gui/package.json | 2 +- packages/nc-gui/pages/account/index.vue | 6 - packages/nc-gui/pages/forgot-password.vue | 4 - packages/nc-gui/pages/index.vue | 16 +- packages/nc-gui/pages/index/[typeOrId].vue | 2 +- .../[typeOrId]/[projectId]/index/index.vue | 52 - .../{[type] => }/[viewId]/[[viewTitle]].vue | 6 +- .../[viewId]/[[viewTitle]]/[...slugs].vue | 1 + .../pages/index/[typeOrId]/form/[viewId].vue | 4 +- .../index/[typeOrId]/form/[viewId]/index.vue | 2 +- .../[typeOrId]/form/[viewId]/index/index.vue | 2 +- packages/nc-gui/pages/signin.vue | 14 +- packages/nc-gui/pages/signup/[[token]].vue | 11 +- packages/nc-gui/store/project.ts | 11 +- packages/nc-gui/store/projects.ts | 2 - packages/nc-gui/store/sidebar.ts | 16 + packages/nc-gui/store/tables.ts | 16 +- packages/nc-gui/store/views.ts | 6 +- packages/nc-gui/store/webhooks.ts | 3 +- packages/nc-gui/store/workspace.ts | 38 +- packages/nc-gui/utils/columnUtils.ts | 16 +- packages/nc-gui/utils/iconUtils.ts | 29 +- packages/nocodb-sdk/src/lib/Api.ts | 13 +- packages/nocodb-sdk/src/lib/enums.ts | 6 + .../nocodb-sdk/src/lib/helperFunctions.ts | 28 +- packages/nocodb/.gitignore | 2 + packages/nocodb/package.json | 2 +- packages/nocodb/src/Noco.ts | 10 +- packages/nocodb/src/app.config.ts | 1 + .../src/controllers/api-tokens.controller.ts | 6 +- .../nocodb/src/controllers/auth.controller.ts | 15 +- .../src/controllers/data-table.controller.ts | 7 +- .../src/controllers/org-lcense.controller.ts | 2 + .../src/controllers/org-tokens.controller.ts | 3 + .../src/controllers/org-users.controller.ts | 9 + .../src/controllers/plugins.controller.ts | 24 +- .../src/controllers/projects.controller.ts | 30 +- .../src/controllers/tables.controller.ts | 3 +- .../src/controllers/users/users.controller.ts | 48 +- .../src/controllers/utils.controller.ts | 4 +- packages/nocodb/src/db/BaseModelSqlv2.ts | 36 +- .../nocodb/src/guards/global/global.guard.ts | 2 +- .../extractProjectIdAndAuthenticate.ts | 151 -- packages/nocodb/src/helpers/ncMetaAclMw.ts | 96 -- .../is-upload-allowed.interceptor.ts | 3 +- packages/nocodb/src/interface/config.ts | 1 + packages/nocodb/src/meta/meta.service.ts | 9 +- .../extract-ids/extract-ids.middleware.ts | 64 +- .../src/middlewares/gui/gui.middleware.ts | 8 +- packages/nocodb/src/models/Project.ts | 10 +- packages/nocodb/src/models/ProjectUser.ts | 11 +- packages/nocodb/src/models/User.ts | 41 +- .../jobs/at-import/at-import.controller.ts | 7 +- .../jobs/at-import/at-import.processor.ts | 3 +- .../export-import/duplicate.controller.ts | 7 +- .../nocodb/src/modules/metas/metas.module.ts | 2 - packages/nocodb/src/nocobuild.ts | 2 +- packages/nocodb/src/run/cloud.ts | 9 +- packages/nocodb/src/run/local.ts | 5 +- packages/nocodb/src/schema/swagger.json | 7 + .../src/services/api-docs/swagger/getPaths.ts | 4 +- .../nocodb/src/services/api-tokens.service.ts | 3 +- packages/nocodb/src/services/auth.service.ts | 2 +- .../src/services/org-tokens-ee.service.ts | 3 +- .../nocodb/src/services/org-tokens.service.ts | 3 +- .../nocodb/src/services/org-users.service.ts | 3 +- .../project-users/project-users.service.ts | 12 +- .../nocodb/src/services/projects.service.ts | 10 +- .../nocodb/src/services/telemetry.service.ts | 6 +- .../src/services/users/users.service.ts | 12 +- packages/nocodb/src/services/utils.service.ts | 1 + .../base-view.strategy/base-view.strategy.ts | 3 +- .../nocodb/src/strategies/jwt.strategy.ts | 45 +- .../nocodb/src/strategies/local.strategy.ts | 2 +- packages/nocodb/src/utils/acl.ts | 398 +++++ packages/nocodb/src/utils/extractRolesObj.ts | 13 - packages/nocodb/src/utils/index.ts | 2 + .../nocodb/src/utils/nc-config/NcConfig.ts | 2 +- packages/nocodb/src/utils/projectAcl.ts | 373 ----- packages/nocodb/src/utils/roleHelper.ts | 25 + packages/nocodb/tests/unit/factory/project.ts | 6 +- packages/nocodb/tests/unit/init/index.ts | 21 +- .../tests/unit/rest/tests/newDataApis.test.ts | 19 +- .../tests/unit/rest/tests/project.test.ts | 34 +- .../pages/Dashboard/Settings/Miscellaneous.ts | 6 +- .../pages/Dashboard/Sidebar/UserMenu/index.ts | 24 + .../pages/Dashboard/Sidebar/index.ts | 6 +- tests/playwright/pages/Dashboard/TreeView.ts | 4 +- .../Dashboard/WorkspaceSettings/index.ts | 36 + .../Dashboard/common/LeftSidebar/index.ts | 14 +- tests/playwright/pages/Dashboard/index.ts | 9 +- .../pages/WorkspacePage/CollaborationPage.ts | 4 +- .../pages/WorkspacePage/ContainerPage.ts | 4 +- tests/playwright/pages/WorkspacePage/index.ts | 2 +- tests/playwright/setup/xcdbProject.ts | 29 +- .../tests/db/features/metaLTAR.spec.ts | 4 +- 189 files changed, 2593 insertions(+), 3864 deletions(-) create mode 100644 packages/nc-gui/assets/nc-icons/plus-square.svg create mode 100644 packages/nc-gui/components/dashboard/Sidebar/Header.vue create mode 100644 packages/nc-gui/components/dashboard/Sidebar/TopSection.vue rename packages/nc-gui/{pages/index/[typeOrId]/[projectId]/index/index/[type]/[viewId]/[[viewTitle]]/[...slugs].vue => components/dashboard/Sidebar/TopSection/Header.vue} (100%) create mode 100644 packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue delete mode 100644 packages/nc-gui/components/dashboard/TreeView.vue rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/AddNewTableNode.vue (100%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/BaseOptions.vue (100%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/ProjectNode.vue (95%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/ProjectWrapper.vue (100%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/TableList.vue (100%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/TableNode.vue (94%) rename packages/nc-gui/components/dashboard/{TreeViewNew => TreeView}/index.vue (81%) create mode 100644 packages/nc-gui/components/general/OpenLeftSidebarBtn.vue create mode 100644 packages/nc-gui/components/general/UserIcon.vue create mode 100644 packages/nc-gui/components/general/WorkspaceIcon.vue create mode 100644 packages/nc-gui/components/nc/Divider.vue create mode 100644 packages/nc-gui/components/nc/Menu.vue create mode 100644 packages/nc-gui/components/nc/MenuItem.vue create mode 100644 packages/nc-gui/components/smartsheet/toolbar/OpenViewSidebarBtn.vue delete mode 100644 packages/nc-gui/components/workspace/Delete.vue create mode 100644 packages/nc-gui/components/workspace/Settings.vue rename packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/{[type] => }/[viewId]/[[viewTitle]].vue (84%) create mode 100644 packages/nc-gui/pages/index/[typeOrId]/[projectId]/index/index/[viewId]/[[viewTitle]]/[...slugs].vue delete mode 100644 packages/nocodb/src/helpers/extractProjectIdAndAuthenticate.ts delete mode 100644 packages/nocodb/src/helpers/ncMetaAclMw.ts create mode 100644 packages/nocodb/src/utils/acl.ts delete mode 100644 packages/nocodb/src/utils/extractRolesObj.ts delete mode 100644 packages/nocodb/src/utils/projectAcl.ts create mode 100644 packages/nocodb/src/utils/roleHelper.ts create mode 100644 tests/playwright/pages/Dashboard/Sidebar/UserMenu/index.ts create mode 100644 tests/playwright/pages/Dashboard/WorkspaceSettings/index.ts diff --git a/packages/nc-gui/assets/nc-icons/plus-square.svg b/packages/nc-gui/assets/nc-icons/plus-square.svg new file mode 100644 index 0000000000..d3750d1bb2 --- /dev/null +++ b/packages/nc-gui/assets/nc-icons/plus-square.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/nc-gui/assets/style.scss b/packages/nc-gui/assets/style.scss index c403043701..ace7cb0740 100644 --- a/packages/nc-gui/assets/style.scss +++ b/packages/nc-gui/assets/style.scss @@ -3,8 +3,8 @@ @import '@vue-flow/core/dist/theme-default.css'; :root { - --sidebar-top-height: 9.75rem; --topbar-height: 3.1rem; + --sidebar-bottom-height: 8.5rem; --new-header-height: 3.5rem; --tw-text-opacity: 1; --navbar-bg: #FAFAFA; @@ -90,6 +90,29 @@ main { } } +.nc-scrollbar-sm-dark { + overflow-y: scroll; + overflow-x: hidden; + + &::-webkit-scrollbar { + width: 2px; + height: 2px; + } + &::-webkit-scrollbar-track-piece { + width: 0px; + } + &::-webkit-scrollbar { + @apply bg-transparent; + } + &::-webkit-scrollbar-thumb { + width: 4px; + @apply bg-gray-300 ; + } + &::-webkit-scrollbar-thumb:hover { + @apply bg-gray-400; + } +} + .nc-scrollbar-x-md { overflow-x: scroll; @@ -505,7 +528,7 @@ a { padding: 0 !important; } .ant-popover-inner-content { - @apply !px-1.5 !py-1 text-xs text-white bg-black; + @apply !px-1.5 !py-1 text-xs; } .ant-tooltip-inner { @apply !px-1.5 !py-1 text-xs text-white bg-black; @@ -515,4 +538,8 @@ a { .ant-skeleton-input { @apply !h-full; +} + +.nc-toolbar-dropdown { + @apply !rounded-2xl; } \ No newline at end of file diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts index 3f0a87fac6..d327aa0029 100644 --- a/packages/nc-gui/components.d.ts +++ b/packages/nc-gui/components.d.ts @@ -50,6 +50,7 @@ declare module '@vue/runtime-core' { AMenuItemGroup: typeof import('ant-design-vue/es')['MenuItemGroup'] AModal: typeof import('ant-design-vue/es')['Modal'] APagination: typeof import('ant-design-vue/es')['Pagination'] + APopover: typeof import('ant-design-vue/es')['Popover'] ARadio: typeof import('ant-design-vue/es')['Radio'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARate: typeof import('ant-design-vue/es')['Rate'] diff --git a/packages/nc-gui/components/api-client/Params.vue b/packages/nc-gui/components/api-client/Params.vue index 49e1eaca74..61aa3f1f2c 100644 --- a/packages/nc-gui/components/api-client/Params.vue +++ b/packages/nc-gui/components/api-client/Params.vue @@ -23,7 +23,6 @@ const deleteParamRow = (i: number) => { - @@ -40,11 +39,6 @@ const deleteParamRow = (i: number) => { -
Parameter Name
- - - - diff --git a/packages/nc-gui/components/cell/DateTimePicker.vue b/packages/nc-gui/components/cell/DateTimePicker.vue index 38c0d1417d..a7dc723f14 100644 --- a/packages/nc-gui/components/cell/DateTimePicker.vue +++ b/packages/nc-gui/components/cell/DateTimePicker.vue @@ -1,5 +1,6 @@ @@ -652,7 +662,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string :key="`sortable-${base.id}-${base.id && base.id in keys ? keys[base.id] : '0'}`" :nc-base="base.id" > - + @@ -726,7 +736,7 @@ const DlgProjectDuplicateOnOk = async (jobData: { id: string; project_id: string } :deep(.ant-collapse-header) { - @apply !mx-0 !pl-8.75 !pr-1 !py-0.75 hover:bg-gray-100 !rounded-md; + @apply !mx-0 !pl-8.75 !pr-1 !py-0.75 hover:bg-gray-200 !rounded-md; } :deep(.ant-collapse-header:hover .nc-sidebar-base-node-btns) { diff --git a/packages/nc-gui/components/dashboard/TreeViewNew/ProjectWrapper.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectWrapper.vue similarity index 100% rename from packages/nc-gui/components/dashboard/TreeViewNew/ProjectWrapper.vue rename to packages/nc-gui/components/dashboard/TreeView/ProjectWrapper.vue diff --git a/packages/nc-gui/components/dashboard/TreeViewNew/TableList.vue b/packages/nc-gui/components/dashboard/TreeView/TableList.vue similarity index 100% rename from packages/nc-gui/components/dashboard/TreeViewNew/TableList.vue rename to packages/nc-gui/components/dashboard/TreeView/TableList.vue diff --git a/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue b/packages/nc-gui/components/dashboard/TreeView/TableNode.vue similarity index 94% rename from packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue rename to packages/nc-gui/components/dashboard/TreeView/TableNode.vue index 4a6b9b6ce2..5acaea2887 100644 --- a/packages/nc-gui/components/dashboard/TreeViewNew/TableNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/TableNode.vue @@ -68,8 +68,11 @@ const setIcon = async (icon: string, table: TableType) => { // Todo: temp const { isSharedBase } = useProject() - // const isMultiBase = computed(() => project.bases && project.bases.length > 1) + +const canUserEditEmote = computed(() => { + return isUIAllowed('tableIconCustomisation', false, projectRole?.value) +})