From 3265042025c5e2471b8e223491dc90a8b34814eb Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 29 Aug 2023 14:27:39 +0100 Subject: [PATCH 1/3] Revert "Merge branch 'develop' into master" This reverts commit 99adc2039b9ed97a605a6a3885f29e7a48cfd328, reversing changes made to fec20e526e4a2b82652787df8b0a50a6046f4427. --- .github/workflows/budibase_ci.yml | 114 +-- .../workflows/check_unreleased_changes.yml | 29 - .github/workflows/release-develop.yml | 2 +- .nvmrc | 2 +- .tool-versions | 4 +- .vscode/launch.json | 71 +- docs/CONTRIBUTING.md | 2 +- hosting/{tests => dependencies}/Dockerfile | 0 hosting/{tests => dependencies}/README.md | 0 hosting/{tests => dependencies}/runner.sh | 0 hosting/docker-compose.test.yaml | 47 ++ hosting/single/Dockerfile | 4 +- jestTestcontainersConfigGenerator.js | 17 +- package.json | 4 +- packages/backend-core/src/cache/user.ts | 14 - packages/backend-core/src/db/lucene.ts | 26 +- .../backend-core/src/db/tests/lucene.spec.ts | 72 +- .../src/{features => featureFlags}/index.ts | 1 - .../tests/featureFlags.spec.ts | 0 .../backend-core/src/features/installation.ts | 17 - packages/backend-core/src/index.ts | 3 +- .../src/middleware/builderOnly.ts | 11 +- .../src/middleware/builderOrAdmin.ts | 11 +- .../backend-core/src/security/permissions.ts | 4 + packages/backend-core/src/users/db.ts | 38 +- .../tests/core/utilities/mocks/licenses.ts | 8 - .../core/utilities/testContainerUtils.ts | 21 +- .../bbui/src/Actions/position_dropdown.js | 3 +- .../bbui/src/ColorPicker/ColorPicker.svelte | 75 +- packages/bbui/src/Popover/Popover.svelte | 8 - packages/builder/src/builderStore/index.js | 10 +- .../src/builderStore/store/frontend.js | 29 +- .../DataTable/modals/CreateEditColumn.svelte | 67 +- .../commandPalette/CommandPalette.svelte | 4 +- .../src/components/common/NavItem.svelte | 17 +- .../src/components/design/Panel.svelte | 9 +- .../actions/ChangeFormStep.svelte | 10 +- .../controls/ColumnEditor/CellDrawer.svelte | 2 + .../controls/FilterEditor/FilterDrawer.svelte | 41 +- packages/builder/src/helpers/urlStateSync.js | 5 - .../_components/Navigation/index.svelte | 225 ------ .../_components/Screen/ThemePanel.svelte | 78 --- .../_components/Screen/index.svelte | 51 -- .../[screenId]/[componentId]/_layout.svelte | 52 -- .../[screenId]/[componentId]/index.svelte | 1 - .../[screenId]/_components/AppPanel.svelte | 47 +- .../[screenId]/_components/AppPreview.svelte | 57 +- .../_components/ComponentList/index.svelte | 163 ----- .../[screenId]/_components/LeftPanel.svelte | 21 - .../_components/ScreenList/index.svelte | 304 -------- .../design/[screenId]/_fallback.svelte | 5 + .../design/[screenId]/_layout.svelte | 78 ++- .../navigation}/ComponentDropdownMenu.svelte | 0 .../navigation}/ComponentKeyHandler.svelte | 20 +- .../navigation/ComponentListPanel.svelte | 90 +++ .../navigation}/ComponentScrollWrapper.svelte | 6 +- .../navigation}/ComponentTree.svelte | 3 +- .../navigation}/DNDPositionIndicator.svelte | 0 .../navigation}/ScreenslotDropdownMenu.svelte | 0 .../_components/navigation}/dndStore.js | 0 .../settings}/ComponentInfoSection.svelte | 0 .../settings}/ComponentSettingsPanel.svelte | 0 .../settings}/ComponentSettingsSection.svelte | 0 .../settings}/ConditionalUIDrawer.svelte | 0 .../settings}/ConditionalUISection.svelte | 0 .../settings}/CustomStylesSection.svelte | 0 .../settings}/DesignSection.svelte | 0 .../_components/settings}/StyleSection.svelte | 0 .../_components/settings}/componentStyles.js | 0 .../components/[componentId]/_layout.svelte | 41 ++ .../components/[componentId]/index.svelte | 4 + .../new/_components/NewComponentPanel.svelte | 4 - .../new/_components/componentStructure.json | 0 .../[componentId]/new/index.svelte | 0 .../design/[screenId]/components/index.svelte | 18 + .../design/[screenId]/index.svelte | 3 +- .../_components/LayoutDropdownMenu.svelte | 41 ++ .../_components/LayoutListPanel.svelte | 29 + .../_components/LayoutSettingsPanel.svelte | 53 ++ .../layouts/[layoutId]/_layout.svelte | 20 + .../layouts/[layoutId]/index.svelte | 7 + .../design/[screenId]/layouts/_layout.svelte | 12 + .../design/[screenId]/layouts/index.svelte | 12 + .../_components/NavigationInfoPanel.svelte | 33 + .../_components/NavigationLinksDrawer.svelte} | 0 .../_components/NavigationLinksEditor.svelte} | 10 +- .../NavigationSettingsPanel.svelte | 110 +++ .../design/[screenId]/navigation/index.svelte | 7 + .../_components}/RoleIndicator.svelte | 8 +- .../_components/ScreenDropdownMenu.svelte} | 2 +- .../_components/ScreenListPanel.svelte | 75 ++ .../_components/ScreenSettingsPanel.svelte} | 68 +- .../design/[screenId]/screens/index.svelte | 12 + .../_components}/AppThemeSelect.svelte | 0 .../_components}/ButtonRoundnessSelect.svelte | 0 .../theme/_components/ThemeInfoPanel.svelte | 12 + .../_components/ThemeSettingsPanel.svelte | 55 ++ .../design/[screenId]/theme/index.svelte | 7 + .../{NewScreen => }/CreateScreenModal.svelte | 15 +- .../{NewScreen => }/DatasourceModal.svelte | 0 .../design/_components/NewScreen/index.svelte | 105 --- .../{NewScreen => }/ScreenRoleModal.svelte | 0 .../{_components/NewScreen => }/blank.png | Bin .../app/[application]/design/new.svelte | 113 ++- .../{_components/NewScreen => }/table.png | Bin .../_components/StatusRenderer.svelte | 10 +- .../settings/automation-history/index.svelte | 4 +- packages/cli/tsconfig.build.json | 16 +- packages/client/manifest.json | 9 - .../client/src/components/Component.svelte | 12 +- packages/client/src/components/Screen.svelte | 2 +- .../client/src/components/app/Layout.svelte | 37 +- .../src/components/app/forms/Form.svelte | 11 +- .../src/components/app/forms/InnerForm.svelte | 2 +- .../src/components/preview/SettingsBar.svelte | 6 +- packages/client/src/stores/builder.js | 3 + .../grid/layout/NewColumnButton.svelte | 2 +- packages/pro | 2 +- packages/server/Dockerfile | 4 +- packages/server/jest.config.ts | 1 - packages/server/package.json | 17 +- packages/server/scripts/test.sh | 5 +- packages/server/specs/openapi.json | 213 +----- packages/server/specs/openapi.yaml | 160 +---- packages/server/specs/resources/index.ts | 2 - packages/server/specs/resources/roles.ts | 65 -- packages/server/specs/resources/user.ts | 8 +- .../server/src/api/controllers/application.ts | 7 +- packages/server/src/api/controllers/auth.ts | 9 +- .../src/api/controllers/deploy/index.ts | 17 +- .../server/src/api/controllers/permission.ts | 27 +- .../api/controllers/public/applications.ts | 18 +- .../api/controllers/public/mapping/types.ts | 4 - .../src/api/controllers/public/queries.ts | 6 +- .../src/api/controllers/public/roles.ts | 33 - .../server/src/api/controllers/public/rows.ts | 13 +- .../src/api/controllers/public/tables.ts | 13 +- .../src/api/controllers/public/users.ts | 30 +- .../server/src/api/controllers/query/index.ts | 4 +- .../src/api/controllers/row/external.ts | 22 +- .../server/src/api/controllers/row/index.ts | 7 +- .../src/api/controllers/row/internal.ts | 23 +- .../server/src/api/controllers/row/utils.ts | 17 +- .../server/src/api/controllers/row/views.ts | 78 ++- .../src/api/controllers/table/external.ts | 20 +- .../server/src/api/controllers/table/index.ts | 4 +- .../src/api/controllers/table/internal.ts | 35 +- .../server/src/api/controllers/table/utils.ts | 2 +- .../server/src/api/routes/public/roles.ts | 56 -- .../src/api/routes/public/tests/users.spec.js | 38 + .../src/api/routes/public/tests/users.spec.ts | 126 ---- packages/server/src/api/routes/row.ts | 170 +++-- ...ermissions.spec.ts => permissions.spec.js} | 109 +-- .../server/src/api/routes/tests/role.spec.js | 5 +- .../server/src/api/routes/tests/row.spec.ts | 656 +++++++++--------- .../src/api/routes/tests/viewV2.spec.ts | 18 +- packages/server/src/api/routes/view.ts | 2 +- packages/server/src/app.ts | 129 +++- packages/server/src/automations/index.ts | 4 - .../server/src/automations/steps/queryRows.ts | 17 +- .../tests/{filter.spec.ts => filter.spec.js} | 23 +- packages/server/src/automations/utils.ts | 13 +- packages/server/src/db/utils.ts | 17 +- packages/server/src/definitions/openapi.ts | 113 +-- packages/server/src/environment.ts | 2 - packages/server/src/features.ts | 24 - .../src/integration-test/postgres.spec.ts | 22 +- .../src/integrations/microsoftSqlServer.ts | 12 +- packages/server/src/integrations/mysql.ts | 66 +- packages/server/src/koa.ts | 102 --- packages/server/src/middleware/noViewData.ts | 9 + .../src/middleware/tests/noViewData.spec.ts | 83 +++ .../middleware/tests/trimViewRowInfo.spec.ts | 27 +- .../server/src/middleware/trimViewRowInfo.ts | 33 +- .../server/src/sdk/app/permissions/index.ts | 37 - .../app/permissions/tests/permissions.spec.ts | 52 -- packages/server/src/sdk/app/rows/search.ts | 16 +- .../src/sdk/app/rows/search/external.ts | 3 +- .../src/sdk/app/rows/search/internal.ts | 4 +- .../app/rows/search/tests/external.spec.ts | 11 +- .../app/rows/search/tests/internal.spec.ts | 3 +- packages/server/src/sdk/app/views/index.ts | 49 +- .../src/sdk/app/views/tests/views.spec.ts | 383 ++-------- packages/server/src/sdk/index.ts | 2 - packages/server/src/startup.ts | 5 +- .../src/tests/utilities/TestConfiguration.ts | 16 +- .../server/src/tests/utilities/api/index.ts | 3 - .../src/tests/utilities/api/permission.ts | 52 -- .../server/src/tests/utilities/api/row.ts | 37 +- .../server/src/tests/utilities/api/viewV2.ts | 74 +- packages/server/src/threads/automation.ts | 6 +- packages/server/src/threads/definitions.ts | 6 - packages/server/src/threads/query.ts | 8 +- packages/server/src/utilities/global.ts | 86 ++- packages/server/src/utilities/security.ts | 8 +- packages/server/src/utilities/users.ts | 17 +- .../server/src/utilities/workerRequests.ts | 31 +- packages/shared-core/package.json | 11 - packages/shared-core/src/filters.ts | 97 ++- packages/shared-core/tsconfig.build.json | 2 +- packages/shared-core/tsconfig.json | 6 - packages/types/src/api/web/app/rows.ts | 13 +- packages/types/src/api/web/app/table.ts | 12 +- packages/types/src/api/web/index.ts | 1 - packages/types/src/api/web/searchFilter.ts | 54 -- .../types/src/documents/app/automation.ts | 5 +- packages/types/src/documents/app/view.ts | 7 +- packages/types/src/documents/document.ts | 6 - .../types/src/documents/global/userGroup.ts | 4 - packages/types/src/sdk/datasources.ts | 6 - packages/types/src/sdk/index.ts | 1 - packages/types/src/sdk/licensing/feature.ts | 2 - packages/types/src/sdk/permissions.ts | 1 + packages/types/src/sdk/row.ts | 16 - packages/types/src/sdk/search.ts | 6 - packages/types/tsconfig.build.json | 2 +- packages/worker/Dockerfile | 2 +- packages/worker/package.json | 15 - .../worker/src/api/controllers/global/self.ts | 4 +- .../src/api/controllers/global/users.ts | 8 +- .../routes/global/tests/appBuilder.spec.ts | 4 +- .../src/api/routes/global/tests/scim.spec.ts | 2 - packages/worker/src/environment.ts | 2 - packages/worker/src/features.ts | 13 - packages/worker/src/tests/jestEnv.ts | 2 +- .../validators/dynamodb.integration.spec.ts | 4 +- scripts/build.js | 6 +- yarn.lock | 30 +- 228 files changed, 2643 insertions(+), 4345 deletions(-) delete mode 100644 .github/workflows/check_unreleased_changes.yml rename hosting/{tests => dependencies}/Dockerfile (100%) rename hosting/{tests => dependencies}/README.md (100%) rename hosting/{tests => dependencies}/runner.sh (100%) create mode 100644 hosting/docker-compose.test.yaml rename packages/backend-core/src/{features => featureFlags}/index.ts (98%) rename packages/backend-core/src/{features => featureFlags}/tests/featureFlags.spec.ts (100%) delete mode 100644 packages/backend-core/src/features/installation.ts delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/ThemePanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/LeftPanel.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/ComponentDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/ComponentKeyHandler.svelte (90%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/ComponentScrollWrapper.svelte (93%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/ComponentTree.svelte (98%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/DNDPositionIndicator.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/ScreenslotDropdownMenu.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ComponentList => components/[componentId]/_components/navigation}/dndStore.js (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/ComponentInfoSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/ComponentSettingsPanel.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/ComponentSettingsSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/ConditionalUIDrawer.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/ConditionalUISection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/CustomStylesSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/DesignSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/StyleSection.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Component => components/[componentId]/_components/settings}/componentStyles.js (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components}/[componentId]/new/_components/NewComponentPanel.svelte (98%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components}/[componentId]/new/_components/componentStructure.json (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{ => components}/[componentId]/new/index.svelte (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Navigation/LinksDrawer.svelte => navigation/_components/NavigationLinksDrawer.svelte} (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Navigation/LinksEditor.svelte => navigation/_components/NavigationLinksEditor.svelte} (75%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ScreenList => screens/_components}/RoleIndicator.svelte (87%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{_components/ScreenList/DropdownMenu.svelte => screens/_components/ScreenDropdownMenu.svelte} (97%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Screen/GeneralPanel.svelte => screens/_components/ScreenSettingsPanel.svelte} (72%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Screen => theme/_components}/AppThemeSelect.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/[screenId]/{[componentId]/_components/Screen => theme/_components}/ButtonRoundnessSelect.svelte (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/ThemeInfoPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/_components/ThemeSettingsPanel.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/design/[screenId]/theme/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/_components/{NewScreen => }/CreateScreenModal.svelte (94%) rename packages/builder/src/pages/builder/app/[application]/design/_components/{NewScreen => }/DatasourceModal.svelte (100%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/index.svelte rename packages/builder/src/pages/builder/app/[application]/design/_components/{NewScreen => }/ScreenRoleModal.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/design/{_components/NewScreen => }/blank.png (100%) rename packages/builder/src/pages/builder/app/[application]/design/{_components/NewScreen => }/table.png (100%) delete mode 100644 packages/server/specs/resources/roles.ts delete mode 100644 packages/server/src/api/controllers/public/roles.ts delete mode 100644 packages/server/src/api/routes/public/roles.ts create mode 100644 packages/server/src/api/routes/public/tests/users.spec.js delete mode 100644 packages/server/src/api/routes/public/tests/users.spec.ts rename packages/server/src/api/routes/tests/{permissions.spec.ts => permissions.spec.js} (57%) rename packages/server/src/automations/tests/{filter.spec.ts => filter.spec.js} (76%) delete mode 100644 packages/server/src/features.ts delete mode 100644 packages/server/src/koa.ts create mode 100644 packages/server/src/middleware/noViewData.ts create mode 100644 packages/server/src/middleware/tests/noViewData.spec.ts delete mode 100644 packages/server/src/sdk/app/permissions/index.ts delete mode 100644 packages/server/src/sdk/app/permissions/tests/permissions.spec.ts delete mode 100644 packages/server/src/tests/utilities/api/permission.ts delete mode 100644 packages/types/src/api/web/searchFilter.ts delete mode 100644 packages/types/src/sdk/row.ts delete mode 100644 packages/worker/src/features.ts diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 3e4b2221d2..9da52f8bc0 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -18,8 +18,6 @@ env: BRANCH: ${{ github.event.pull_request.head.ref }} BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - NX_BASE_BRANCH: origin/${{ github.base_ref }} - USE_NX_AFFECTED: ${{ github.event_name == 'pull_request' && github.base_ref != 'master'}} jobs: lint: @@ -27,20 +25,20 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.repository != 'Budibase/budibase' - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile + - run: yarn - run: yarn lint build: @@ -48,66 +46,45 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - with: - fetch-depth: 0 + if: github.repository != 'Budibase/budibase' - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile - + - run: yarn # Run build all the projects - - name: Build - run: | - yarn build + - run: yarn build # Check the types of the projects built via esbuild - - name: Check types - run: | - if ${{ env.USE_NX_AFFECTED }}; then - yarn check:types --since=${{ env.NX_BASE_BRANCH }} - else - yarn check:types - fi + - run: yarn check:types test-libraries: runs-on: ubuntu-latest steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - with: - fetch-depth: 0 + if: github.repository != 'Budibase/budibase' - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile - - name: Test - run: | - if ${{ env.USE_NX_AFFECTED }}; then - yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - else - yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro - fi + - run: yarn + - run: yarn test --ignore=@budibase/worker --ignore=@budibase/server --ignore=@budibase/pro - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos @@ -119,31 +96,21 @@ jobs: steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - fetch-depth: 0 - name: Checkout repo only uses: actions/checkout@v3 - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' - with: - fetch-depth: 0 + if: github.repository != 'Budibase/budibase' - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile - - name: Test worker and server - run: | - if ${{ env.USE_NX_AFFECTED }}; then - yarn test --scope=@budibase/worker --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} - else - yarn test --scope=@budibase/worker --scope=@budibase/server - fi - + - run: yarn + - run: yarn test --scope=@budibase/worker --scope=@budibase/server - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN || github.token }} # not required for public repos @@ -152,50 +119,42 @@ jobs: test-pro: runs-on: ubuntu-latest - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - fetch-depth: 0 - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile - - name: Test - run: | - if ${{ env.USE_NX_AFFECTED }}; then - yarn test --scope=@budibase/pro --since=${{ env.NX_BASE_BRANCH }} - else - yarn test --scope=@budibase/pro - fi + - run: yarn + - run: yarn test --scope=@budibase/pro integration-test: runs-on: ubuntu-latest steps: - name: Checkout repo and submodules uses: actions/checkout@v3 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' with: submodules: true token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Checkout repo only uses: actions/checkout@v3 - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase' + if: github.repository != 'Budibase/budibase' - - name: Use Node.js 18.x + - name: Use Node.js 14.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 14.x cache: "yarn" - - run: yarn --frozen-lockfile - - name: Build packages - run: yarn build --scope @budibase/server --scope @budibase/worker --scope @budibase/client --scope @budibase/backend-core + - run: yarn + - run: yarn build --projects=@budibase/server,@budibase/worker,@budibase/client - name: Run tests run: | cd qa-core @@ -207,12 +166,13 @@ jobs: check-pro-submodule: runs-on: ubuntu-latest - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase' + if: github.repository == 'Budibase/budibase' steps: - name: Checkout repo and submodules uses: actions/checkout@v3 with: submodules: true + fetch-depth: 0 token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }} - name: Check pro commit diff --git a/.github/workflows/check_unreleased_changes.yml b/.github/workflows/check_unreleased_changes.yml deleted file mode 100644 index d558330545..0000000000 --- a/.github/workflows/check_unreleased_changes.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: check_unreleased_changes - -on: - pull_request: - branches: - - master - -jobs: - check_unreleased: - runs-on: ubuntu-latest - steps: - - name: Check for unreleased changes - env: - REPO: "Budibase/budibase" - TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - RELEASE_TIMESTAMP=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO/releases/latest" | \ - jq -r .published_at) - COMMIT_TIMESTAMP=$(curl -s -H "Authorization: token $TOKEN" \ - "https://api.github.com/repos/$REPO/commits/master" | \ - jq -r .commit.committer.date) - RELEASE_SECONDS=$(date --date="$RELEASE_TIMESTAMP" "+%s") - COMMIT_SECONDS=$(date --date="$COMMIT_TIMESTAMP" "+%s") - if (( COMMIT_SECONDS > RELEASE_SECONDS )); then - echo "There are unreleased changes. Please release these changes before merging." - exit 1 - fi - echo "No unreleased changes detected." diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index bd727b7865..61cb283e28 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -44,7 +44,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: 18.x + node-version: 14.x - run: yarn install --frozen-lockfile - name: Update versions diff --git a/.nvmrc b/.nvmrc index 7950a44576..835d07c442 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.17.0 +v14.20.1 diff --git a/.tool-versions b/.tool-versions index a909d60941..9f2ea77b14 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -nodejs 18.17.0 +nodejs 14.21.3 python 3.10.0 -yarn 1.22.19 +yarn 1.22.19 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index cfd8d7b155..8cb49d5825 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,31 +1,42 @@ - { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Budibase Server", - "type": "node", - "request": "launch", - "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], - "args": ["${workspaceFolder}/packages/server/src/index.ts"], - "cwd": "${workspaceFolder}/packages/server" - }, - { - "name": "Budibase Worker", - "type": "node", - "request": "launch", - "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], - "args": ["${workspaceFolder}/packages/worker/src/index.ts"], - "cwd": "${workspaceFolder}/packages/worker" - } - ], - "compounds": [ - { - "name": "Start Budibase", - "configurations": ["Budibase Server", "Budibase Worker"] - } - ] -} + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Budibase Server", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register/transpile-only" + ], + "args": [ + "${workspaceFolder}/packages/server/src/index.ts" + ], + "cwd": "${workspaceFolder}/packages/server" + }, + { + "name": "Budibase Worker", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register/transpile-only" + ], + "args": [ + "${workspaceFolder}/packages/worker/src/index.ts" + ], + "cwd": "${workspaceFolder}/packages/worker" + }, + ], + "compounds": [ + { + "name": "Start Budibase", + "configurations": ["Budibase Server", "Budibase Worker"] + } + ] +} \ No newline at end of file diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 70f198a84c..2fb4c36fa8 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -90,7 +90,7 @@ Component libraries are collections of components as well as the definition of t #### 1. Prerequisites -- NodeJS version `18.x.x` +- NodeJS version `14.x.x` - Python version `3.x` ### Using asdf (recommended) diff --git a/hosting/tests/Dockerfile b/hosting/dependencies/Dockerfile similarity index 100% rename from hosting/tests/Dockerfile rename to hosting/dependencies/Dockerfile diff --git a/hosting/tests/README.md b/hosting/dependencies/README.md similarity index 100% rename from hosting/tests/README.md rename to hosting/dependencies/README.md diff --git a/hosting/tests/runner.sh b/hosting/dependencies/runner.sh similarity index 100% rename from hosting/tests/runner.sh rename to hosting/dependencies/runner.sh diff --git a/hosting/docker-compose.test.yaml b/hosting/docker-compose.test.yaml new file mode 100644 index 0000000000..f059173d2d --- /dev/null +++ b/hosting/docker-compose.test.yaml @@ -0,0 +1,47 @@ +version: "3" + +# optional ports are specified throughout for more advanced use cases. + +services: + minio-service: + restart: on-failure + # Last version that supports the "fs" backend + image: minio/minio:RELEASE.2022-10-24T18-35-07Z + ports: + - "9000" + - "9001" + environment: + MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} + command: server /data --console-address ":9001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + couchdb-service: + # platform: linux/amd64 + restart: on-failure + image: budibase/couchdb + environment: + - COUCHDB_PASSWORD=${COUCH_DB_PASSWORD} + - COUCHDB_USER=${COUCH_DB_USER} + ports: + - "5984" + - "4369" + - "9100" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5984/_up"] + interval: 30s + timeout: 20s + retries: 3 + + redis-service: + restart: on-failure + image: redis + command: redis-server --requirepass ${REDIS_PASSWORD} + ports: + - "6379" + healthcheck: + test: ["CMD", "redis-cli", "ping"] \ No newline at end of file diff --git a/hosting/single/Dockerfile b/hosting/single/Dockerfile index 9fdf2449d1..e43e5ad10c 100644 --- a/hosting/single/Dockerfile +++ b/hosting/single/Dockerfile @@ -1,7 +1,7 @@ -FROM node:18-slim as build +FROM node:14-slim as build # install node-gyp dependencies -RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python3 +RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python # add pin script WORKDIR / diff --git a/jestTestcontainersConfigGenerator.js b/jestTestcontainersConfigGenerator.js index 1e39ed771f..4b94cf5016 100644 --- a/jestTestcontainersConfigGenerator.js +++ b/jestTestcontainersConfigGenerator.js @@ -1,16 +1,9 @@ module.exports = () => { return { - couchdb: { - image: "budibase/couchdb", - ports: [5984], - env: { - COUCHDB_PASSWORD: "budibase", - COUCHDB_USER: "budibase", - }, - wait: { - type: "ports", - timeout: 20000, - } - } + dockerCompose: { + composeFilePath: "../../hosting", + composeFile: "docker-compose.test.yaml", + startupTimeout: 10000, + }, } } diff --git a/package.json b/package.json index 4e4befb5f2..d27af2e27d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "preinstall": "node scripts/syncProPackage.js", "setup": "git config submodule.recurse true && git submodule update && node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev", "bootstrap": "./scripts/link-dependencies.sh && echo '***BOOTSTRAP ONLY REQUIRED FOR USE WITH ACCOUNT PORTAL***'", - "build": "lerna run build --stream", + "build": "yarn nx run-many -t=build", "build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput", "check:types": "lerna run check:types", "backend:bootstrap": "./scripts/scopeBackend.sh && yarn run bootstrap", @@ -109,7 +109,7 @@ "@budibase/types": "0.0.0" }, "engines": { - "node": ">=18.0.0 <19.0.0" + "node": ">=14.0.0 <15.0.0" }, "dependencies": {} } diff --git a/packages/backend-core/src/cache/user.ts b/packages/backend-core/src/cache/user.ts index e2af78adfd..8281bfca62 100644 --- a/packages/backend-core/src/cache/user.ts +++ b/packages/backend-core/src/cache/user.ts @@ -4,8 +4,6 @@ import * as context from "../context" import * as platform from "../platform" import env from "../environment" import * as accounts from "../accounts" -import { UserDB } from "../users" -import { sdk } from "@budibase/shared-core" const EXPIRY_SECONDS = 3600 @@ -62,18 +60,6 @@ export async function getUser( // make sure the tenant ID is always correct/set user.tenantId = tenantId } - // if has groups, could have builder permissions granted by a group - if (user.userGroups && !sdk.users.isGlobalBuilder(user)) { - await context.doInTenant(tenantId, async () => { - const appIds = await UserDB.getGroupBuilderAppIds(user) - if (appIds.length) { - const existing = user.builder?.apps || [] - user.builder = { - apps: [...new Set(existing.concat(appIds))], - } - } - }) - } return user } diff --git a/packages/backend-core/src/db/lucene.ts b/packages/backend-core/src/db/lucene.ts index 7451d581b5..a491451a62 100644 --- a/packages/backend-core/src/db/lucene.ts +++ b/packages/backend-core/src/db/lucene.ts @@ -1,6 +1,7 @@ import fetch from "node-fetch" import { getCouchInfo } from "./couch" -import { SearchFilters, Row, EmptyFilterOption } from "@budibase/types" +import { SearchFilters, Row } from "@budibase/types" +import { createUserIndex } from "./searchIndexes/searchIndexes" const QUERY_START_REGEX = /\d[0-9]*:/g @@ -64,7 +65,6 @@ export class QueryBuilder { this.#index = index this.#query = { allOr: false, - onEmptyFilter: EmptyFilterOption.RETURN_ALL, string: {}, fuzzy: {}, range: {}, @@ -218,10 +218,6 @@ export class QueryBuilder { this.#query.allOr = true } - setOnEmptyFilter(value: EmptyFilterOption) { - this.#query.onEmptyFilter = value - } - handleSpaces(input: string) { if (this.#noEscaping) { return input @@ -293,9 +289,8 @@ export class QueryBuilder { const builder = this let allOr = this.#query && this.#query.allOr let query = allOr ? "" : "*:*" - let allFiltersEmpty = true const allPreProcessingOpts = { escape: true, lowercase: true, wrap: true } - let tableId: string = "" + let tableId if (this.#query.equal!.tableId) { tableId = this.#query.equal!.tableId delete this.#query.equal!.tableId @@ -310,7 +305,7 @@ export class QueryBuilder { } const contains = (key: string, value: any, mode = "AND") => { - if (!value || (Array.isArray(value) && value.length === 0)) { + if (Array.isArray(value) && value.length === 0) { return null } if (!Array.isArray(value)) { @@ -389,12 +384,6 @@ export class QueryBuilder { built += ` ${mode} ` } built += expression - if ( - (typeof value !== "string" && value != null) || - (typeof value === "string" && value !== tableId && value !== "") - ) { - allFiltersEmpty = false - } } if (opts?.returnBuilt) { return built @@ -474,13 +463,6 @@ export class QueryBuilder { allOr = false build({ tableId }, equal) } - if (allFiltersEmpty) { - if (this.#query.onEmptyFilter === EmptyFilterOption.RETURN_NONE) { - return "" - } else if (this.#query?.allOr) { - return query.replace("()", "(*:*)") - } - } return query } diff --git a/packages/backend-core/src/db/tests/lucene.spec.ts b/packages/backend-core/src/db/tests/lucene.spec.ts index 7716661d88..a82828d8f2 100644 --- a/packages/backend-core/src/db/tests/lucene.spec.ts +++ b/packages/backend-core/src/db/tests/lucene.spec.ts @@ -1,6 +1,6 @@ import { newid } from "../../docIds/newid" import { getDB } from "../db" -import { Database, EmptyFilterOption } from "@budibase/types" +import { Database } from "@budibase/types" import { QueryBuilder, paginatedSearch, fullSearch } from "../lucene" const INDEX_NAME = "main" @@ -156,76 +156,6 @@ describe("lucene", () => { expect(resp.rows.length).toBe(2) }) - describe("empty filters behaviour", () => { - it("should return all rows by default", async () => { - const builder = new QueryBuilder(dbName, INDEX_NAME) - builder.addEqual("property", "") - builder.addEqual("number", null) - builder.addString("property", "") - builder.addFuzzy("property", "") - builder.addNotEqual("number", undefined) - builder.addOneOf("number", null) - builder.addContains("array", undefined) - builder.addNotContains("array", null) - builder.addContainsAny("array", null) - - const resp = await builder.run() - expect(resp.rows.length).toBe(3) - }) - - it("should return all rows when onEmptyFilter is ALL", async () => { - const builder = new QueryBuilder(dbName, INDEX_NAME) - builder.setOnEmptyFilter(EmptyFilterOption.RETURN_ALL) - builder.setAllOr() - builder.addEqual("property", "") - builder.addEqual("number", null) - builder.addString("property", "") - builder.addFuzzy("property", "") - builder.addNotEqual("number", undefined) - builder.addOneOf("number", null) - builder.addContains("array", undefined) - builder.addNotContains("array", null) - builder.addContainsAny("array", null) - - const resp = await builder.run() - expect(resp.rows.length).toBe(3) - }) - - it("should return no rows when onEmptyFilter is NONE", async () => { - const builder = new QueryBuilder(dbName, INDEX_NAME) - builder.setOnEmptyFilter(EmptyFilterOption.RETURN_NONE) - builder.addEqual("property", "") - builder.addEqual("number", null) - builder.addString("property", "") - builder.addFuzzy("property", "") - builder.addNotEqual("number", undefined) - builder.addOneOf("number", null) - builder.addContains("array", undefined) - builder.addNotContains("array", null) - builder.addContainsAny("array", null) - - const resp = await builder.run() - expect(resp.rows.length).toBe(0) - }) - - it("should return all matching rows when onEmptyFilter is NONE, but a filter value is provided", async () => { - const builder = new QueryBuilder(dbName, INDEX_NAME) - builder.setOnEmptyFilter(EmptyFilterOption.RETURN_NONE) - builder.addEqual("property", "") - builder.addEqual("number", 1) - builder.addString("property", "") - builder.addFuzzy("property", "") - builder.addNotEqual("number", undefined) - builder.addOneOf("number", null) - builder.addContains("array", undefined) - builder.addNotContains("array", null) - builder.addContainsAny("array", null) - - const resp = await builder.run() - expect(resp.rows.length).toBe(1) - }) - }) - describe("skip", () => { const skipDbName = `db-${newid()}` let docs: { diff --git a/packages/backend-core/src/features/index.ts b/packages/backend-core/src/featureFlags/index.ts similarity index 98% rename from packages/backend-core/src/features/index.ts rename to packages/backend-core/src/featureFlags/index.ts index 8f5c903e05..877cd60e1a 100644 --- a/packages/backend-core/src/features/index.ts +++ b/packages/backend-core/src/featureFlags/index.ts @@ -1,6 +1,5 @@ import env from "../environment" import * as context from "../context" -export * from "./installation" /** * Read the TENANT_FEATURE_FLAGS env var and return an array of features flags for each tenant. diff --git a/packages/backend-core/src/features/tests/featureFlags.spec.ts b/packages/backend-core/src/featureFlags/tests/featureFlags.spec.ts similarity index 100% rename from packages/backend-core/src/features/tests/featureFlags.spec.ts rename to packages/backend-core/src/featureFlags/tests/featureFlags.spec.ts diff --git a/packages/backend-core/src/features/installation.ts b/packages/backend-core/src/features/installation.ts deleted file mode 100644 index defc8bf987..0000000000 --- a/packages/backend-core/src/features/installation.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function processFeatureEnvVar( - fullList: string[], - featureList?: string -) { - let list - if (!featureList) { - list = fullList - } else { - list = featureList.split(",") - } - for (let feature of list) { - if (!fullList.includes(feature)) { - throw new Error(`Feature: ${feature} is not an allowed option`) - } - } - return list as unknown as T[] -} diff --git a/packages/backend-core/src/index.ts b/packages/backend-core/src/index.ts index ffffd8240a..7b98674788 100644 --- a/packages/backend-core/src/index.ts +++ b/packages/backend-core/src/index.ts @@ -6,8 +6,7 @@ export * as roles from "./security/roles" export * as permissions from "./security/permissions" export * as accounts from "./accounts" export * as installation from "./installation" -export * as featureFlags from "./features" -export * as features from "./features/installation" +export * as featureFlags from "./featureFlags" export * as sessions from "./security/sessions" export * as platform from "./platform" export * as auth from "./auth" diff --git a/packages/backend-core/src/middleware/builderOnly.ts b/packages/backend-core/src/middleware/builderOnly.ts index fafcc524cc..8c1c54a44c 100644 --- a/packages/backend-core/src/middleware/builderOnly.ts +++ b/packages/backend-core/src/middleware/builderOnly.ts @@ -5,12 +5,11 @@ import env from "../environment" export default async (ctx: UserCtx, next: any) => { const appId = getAppId() - const builderFn = - env.isWorker() || !appId - ? hasBuilderPermissions - : env.isApps() - ? isBuilder - : undefined + const builderFn = env.isWorker() + ? hasBuilderPermissions + : env.isApps() + ? isBuilder + : undefined if (!builderFn) { throw new Error("Service name unknown - middleware inactive.") } diff --git a/packages/backend-core/src/middleware/builderOrAdmin.ts b/packages/backend-core/src/middleware/builderOrAdmin.ts index 4b8badec15..c03e856233 100644 --- a/packages/backend-core/src/middleware/builderOrAdmin.ts +++ b/packages/backend-core/src/middleware/builderOrAdmin.ts @@ -5,12 +5,11 @@ import env from "../environment" export default async (ctx: UserCtx, next: any) => { const appId = getAppId() - const builderFn = - env.isWorker() || !appId - ? hasBuilderPermissions - : env.isApps() - ? isBuilder - : undefined + const builderFn = env.isWorker() + ? hasBuilderPermissions + : env.isApps() + ? isBuilder + : undefined if (!builderFn) { throw new Error("Service name unknown - middleware inactive.") } diff --git a/packages/backend-core/src/security/permissions.ts b/packages/backend-core/src/security/permissions.ts index aa0b20a30c..70dae57ae6 100644 --- a/packages/backend-core/src/security/permissions.ts +++ b/packages/backend-core/src/security/permissions.ts @@ -78,6 +78,7 @@ export const BUILTIN_PERMISSIONS = { permissions: [ new Permission(PermissionType.QUERY, PermissionLevel.READ), new Permission(PermissionType.TABLE, PermissionLevel.READ), + new Permission(PermissionType.VIEW, PermissionLevel.READ), ], }, WRITE: { @@ -86,6 +87,7 @@ export const BUILTIN_PERMISSIONS = { permissions: [ new Permission(PermissionType.QUERY, PermissionLevel.WRITE), new Permission(PermissionType.TABLE, PermissionLevel.WRITE), + new Permission(PermissionType.VIEW, PermissionLevel.READ), new Permission(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), ], }, @@ -96,6 +98,7 @@ export const BUILTIN_PERMISSIONS = { new Permission(PermissionType.TABLE, PermissionLevel.WRITE), new Permission(PermissionType.USER, PermissionLevel.READ), new Permission(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), + new Permission(PermissionType.VIEW, PermissionLevel.READ), new Permission(PermissionType.WEBHOOK, PermissionLevel.READ), ], }, @@ -106,6 +109,7 @@ export const BUILTIN_PERMISSIONS = { new Permission(PermissionType.TABLE, PermissionLevel.ADMIN), new Permission(PermissionType.USER, PermissionLevel.ADMIN), new Permission(PermissionType.AUTOMATION, PermissionLevel.ADMIN), + new Permission(PermissionType.VIEW, PermissionLevel.ADMIN), new Permission(PermissionType.WEBHOOK, PermissionLevel.READ), new Permission(PermissionType.QUERY, PermissionLevel.ADMIN), ], diff --git a/packages/backend-core/src/users/db.ts b/packages/backend-core/src/users/db.ts index c288540f35..55cc97bb1c 100644 --- a/packages/backend-core/src/users/db.ts +++ b/packages/backend-core/src/users/db.ts @@ -1,32 +1,30 @@ import env from "../environment" import * as eventHelpers from "./events" import * as accounts from "../accounts" -import * as accountSdk from "../accounts" import * as cache from "../cache" -import { getGlobalDB, getIdentity, getTenantId } from "../context" +import { getIdentity, getTenantId, getGlobalDB } from "../context" import * as dbUtils from "../db" import { EmailUnavailableError, HTTPError } from "../errors" import * as platform from "../platform" import * as sessions from "../security/sessions" import * as usersCore from "./users" import { - Account, AllDocsResponse, BulkUserCreated, BulkUserDeleted, - isSSOAccount, - isSSOUser, RowResponse, SaveUserOpts, User, + Account, + isSSOUser, + isSSOAccount, UserStatus, - UserGroup, - ContextUser, } from "@budibase/types" +import * as accountSdk from "../accounts" import { + validateUniqueUser, getAccountHolderFromUserIds, isAdmin, - validateUniqueUser, } from "./utils" import { searchExistingEmails } from "./lookup" import { hash } from "../utils" @@ -34,14 +32,8 @@ import { hash } from "../utils" type QuotaUpdateFn = (change: number, cb?: () => Promise) => Promise type GroupUpdateFn = (groupId: string, userIds: string[]) => Promise type FeatureFn = () => Promise -type GroupGetFn = (ids: string[]) => Promise -type GroupBuildersFn = (user: User) => Promise type QuotaFns = { addUsers: QuotaUpdateFn; removeUsers: QuotaUpdateFn } -type GroupFns = { - addUsers: GroupUpdateFn - getBulk: GroupGetFn - getGroupBuilderAppIds: GroupBuildersFn -} +type GroupFns = { addUsers: GroupUpdateFn } type FeatureFns = { isSSOEnforced: FeatureFn; isAppBuildersEnabled: FeatureFn } const bulkDeleteProcessing = async (dbUser: User) => { @@ -187,14 +179,6 @@ export class UserDB { return user } - static async bulkGet(userIds: string[]) { - return await usersCore.bulkGetGlobalUsersById(userIds) - } - - static async bulkUpdate(users: User[]) { - return await usersCore.bulkUpdateGlobalUsers(users) - } - static async save(user: User, opts: SaveUserOpts = {}): Promise { // default booleans to true if (opts.hashPassword == null) { @@ -473,12 +457,4 @@ export class UserDB { await cache.user.invalidateUser(userId) await sessions.invalidateSessions(userId, { reason: "deletion" }) } - - static async getGroups(groupIds: string[]) { - return await this.groups.getBulk(groupIds) - } - - static async getGroupBuilderAppIds(user: User) { - return await this.groups.getGroupBuilderAppIds(user) - } } diff --git a/packages/backend-core/tests/core/utilities/mocks/licenses.ts b/packages/backend-core/tests/core/utilities/mocks/licenses.ts index 309f0fd159..6747282040 100644 --- a/packages/backend-core/tests/core/utilities/mocks/licenses.ts +++ b/packages/backend-core/tests/core/utilities/mocks/licenses.ts @@ -86,10 +86,6 @@ export const useAuditLogs = () => { return useFeature(Feature.AUDIT_LOGS) } -export const usePublicApiUserRoles = () => { - return useFeature(Feature.USER_ROLE_PUBLIC_API) -} - export const useScimIntegration = () => { return useFeature(Feature.SCIM) } @@ -102,10 +98,6 @@ export const useAppBuilders = () => { return useFeature(Feature.APP_BUILDERS) } -export const useViewPermissions = () => { - return useFeature(Feature.VIEW_PERMISSIONS) -} - // QUOTAS export const setAutomationLogsQuota = (value: number) => { diff --git a/packages/backend-core/tests/core/utilities/testContainerUtils.ts b/packages/backend-core/tests/core/utilities/testContainerUtils.ts index 7da6cbc777..f6c702f7ef 100644 --- a/packages/backend-core/tests/core/utilities/testContainerUtils.ts +++ b/packages/backend-core/tests/core/utilities/testContainerUtils.ts @@ -32,8 +32,8 @@ function getTestContainerSettings( ): string | null { const entry = Object.entries(global).find( ([k]) => - k.includes(`${serverName.toUpperCase()}`) && - k.includes(`${key.toUpperCase()}`) + k.includes(`_${serverName.toUpperCase()}`) && + k.includes(`_${key.toUpperCase()}__`) ) if (!entry) { return null @@ -67,14 +67,27 @@ function getContainerInfo(containerName: string, port: number) { } function getCouchConfig() { - return getContainerInfo("couchdb", 5984) + return getContainerInfo("couchdb-service", 5984) +} + +function getMinioConfig() { + return getContainerInfo("minio-service", 9000) +} + +function getRedisConfig() { + return getContainerInfo("redis-service", 6379) } export function setupEnv(...envs: any[]) { - const couch = getCouchConfig() + const couch = getCouchConfig(), + minio = getCouchConfig(), + redis = getRedisConfig() const configs = [ { key: "COUCH_DB_PORT", value: couch.port }, { key: "COUCH_DB_URL", value: couch.url }, + { key: "MINIO_PORT", value: minio.port }, + { key: "MINIO_URL", value: minio.url }, + { key: "REDIS_URL", value: redis.url }, ] for (const config of configs.filter(x => !!x.value)) { diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 4a5ef890bf..8fa02bb8f3 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -32,10 +32,11 @@ export default function positionDropdown(element, opts) { left: null, top: null, } + // Determine vertical styles if (align === "right-outside") { styles.top = anchorBounds.top - } else if (window.innerHeight - anchorBounds.bottom < (maxHeight || 100)) { + } else if (window.innerHeight - anchorBounds.bottom < 100) { styles.top = anchorBounds.top - elementBounds.height - offset styles.maxHeight = maxHeight || 240 } else { diff --git a/packages/bbui/src/ColorPicker/ColorPicker.svelte b/packages/bbui/src/ColorPicker/ColorPicker.svelte index 2ba5309860..9a70134fb6 100644 --- a/packages/bbui/src/ColorPicker/ColorPicker.svelte +++ b/packages/bbui/src/ColorPicker/ColorPicker.svelte @@ -1,8 +1,8 @@ -
{ - dropdown.toggle() - }} -> -
-
- - - -
+
+
(open = true)}> +
+
+ {#if open} +
{#each categories as category}
{category.label}
@@ -184,8 +187,8 @@
- - + {/if} +
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/ThemePanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/ThemePanel.svelte deleted file mode 100644 index 13a008fae0..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/ThemePanel.svelte +++ /dev/null @@ -1,78 +0,0 @@ - - -
- - These settings apply to all screens -
- - - - - - - update("buttonBorderRadius", e.detail)} - /> - - update("primaryColor", val)} - props={{ - spectrumTheme: $store.theme, - }} - /> - update("primaryColorHover", val)} - props={{ - spectrumTheme: $store.theme, - }} - /> - - - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/index.svelte deleted file mode 100644 index 778fa303cc..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/index.svelte +++ /dev/null @@ -1,51 +0,0 @@ - - - -
-
- {#each tabs as tab} - { - activeTab = tab - }} - > - {capitalise(tab)} - - {/each} -
-
- - {#if activeTab === "theme"} - - {:else} - - {/if} - -
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte deleted file mode 100644 index 19cb1d8dff..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_layout.svelte +++ /dev/null @@ -1,52 +0,0 @@ - - -{#if routeComponentId === `${$store.selectedScreenId}-screen`} - -{:else if routeComponentId === `${$store.selectedScreenId}-navigation`} - -{:else} - -{/if} - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte deleted file mode 100644 index 0ff63d1ead..0000000000 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/index.svelte +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte index 09f97302fd..785b221239 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPanel.svelte @@ -1,16 +1,32 @@
- + -
- Screens -
-
- -
-
- -
-
-
- {#if filteredScreens?.length} - {#each filteredScreens as screen (screen._id)} - store.actions.screens.select(screen._id)} - rightAlignIcon - showTooltip - selectedBy={$userSelectedResourceMap[screen._id]} - > - -
- -
-
- {/each} - {:else} - -
- There aren't any screens matching that route -
-
- {/if} -
- -
screensHeight.set("210px")} - /> -
- - diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte new file mode 100644 index 0000000000..00165e4ee9 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_fallback.svelte @@ -0,0 +1,5 @@ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte index 0e630b4f39..8bc0dcc3e5 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_layout.svelte @@ -1,10 +1,14 @@ -{#if $selectedScreen} -
-
- - - -
+
+
+ + $goto("./screens")} + /> + $goto("./components")} + /> + $goto("./theme")} + /> + $goto("./navigation")} + /> + {#if $store.layouts?.length} + $goto("./layouts")} + /> + {/if} +
-{/if} + +
+ {#if $selectedScreen} + + + {/if} +
+
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentDropdownMenu.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte similarity index 90% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte index b6957f64f3..4813757727 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte @@ -5,6 +5,7 @@ import { goto, isActive } from "@roxi/routify" import { notifications } from "@budibase/bbui" import ConfirmDialog from "components/common/ConfirmDialog.svelte" + import { isBuilderInputFocused } from "helpers" let confirmDeleteDialog let confirmEjectDialog @@ -36,7 +37,7 @@ confirmEjectDialog.show() }, ["Ctrl+Enter"]: () => { - $goto(`./:componentId/new`) + $goto("./new") }, ["Delete"]: component => { // Don't show confirmation for the screen itself @@ -53,8 +54,8 @@ store.actions.components.selectNext() }, ["Escape"]: () => { - if ($isActive(`./:componentId/new`)) { - $goto(`./${$store.selectedComponentId}`) + if ($isActive("./new")) { + $goto("./") } }, } @@ -84,13 +85,10 @@ const handler = keyHandlers[key] if (!handler) { return false - } - - if (event && key !== "Escape") { + } else if (event) { event.preventDefault() event.stopPropagation() } - return await handler(component) } catch (error) { notifications.error(error || "Error handling key press") @@ -103,13 +101,7 @@ return } // Ignore events when typing - const activeTag = document.activeElement?.tagName.toLowerCase() - const inCodeEditor = - document.activeElement?.classList?.contains("cm-content") - if ( - (inCodeEditor || ["input", "textarea"].indexOf(activeTag) !== -1) && - e.key !== "Escape" - ) { + if (isBuilderInputFocused(e)) { return } // Key events are always for the selected component diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte new file mode 100644 index 0000000000..9513753d76 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte @@ -0,0 +1,90 @@ + + + +
+ +
+ +
    +
  • + { + $store.selectedComponentId = $selectedScreen?.props._id + }} + id={`component-${$selectedScreen?.props._id}`} + selectedBy={$userSelectedResourceMap[$selectedScreen?.props._id]} + > + + + + + + {#if $dndStore.dragging && $dndStore.valid} + + {#if $dndStore.dropPosition !== DropPosition.INSIDE} + + {/if} + {/if} +
  • +
+
+
+ + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentScrollWrapper.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentScrollWrapper.svelte similarity index 93% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentScrollWrapper.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentScrollWrapper.svelte index 484b56f21c..15ba7acecf 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentScrollWrapper.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentScrollWrapper.svelte @@ -9,14 +9,14 @@ if (!bounds) { return } - const sidebarWidth = 310 + const sidebarWidth = 259 const navItemHeight = 32 const { scrollLeft, scrollTop, offsetHeight } = scrollRef let scrollBounds = scrollRef.getBoundingClientRect() let newOffsets = {} // Calculate left offset - const offsetX = bounds.left + bounds.width + scrollLeft + 16 + const offsetX = bounds.left + bounds.width + scrollLeft - 36 if (offsetX > sidebarWidth) { newOffsets.left = offsetX - sidebarWidth } else { @@ -64,7 +64,6 @@
div { + padding: var(--spacing-xl) 0; flex: 1 1 auto; overflow: auto; height: 0; diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentTree.svelte similarity index 98% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentTree.svelte index 0e23f82946..18319e4b33 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentTree.svelte @@ -107,7 +107,6 @@ id={`component-${component._id}`} > + import { syncURLToState } from "helpers/urlStateSync" + import { store, selectedScreen } from "builderStore" + import * as routify from "@roxi/routify" + import { onDestroy } from "svelte" + import { findComponent } from "builderStore/componentUtils" + import ComponentListPanel from "./_components/navigation/ComponentListPanel.svelte" + import ComponentSettingsPanel from "./_components/settings/ComponentSettingsPanel.svelte" + + $: componentId = $store.selectedComponentId + $: store.actions.websocket.selectResource(componentId) + + const cleanUrl = url => { + // Strip trailing slashes + if (url?.endsWith("/index")) { + url = url.replace("/index", "") + } + // Hide new component panel whenever component ID changes + if (url?.endsWith("/new")) { + url = url.replace("/new", "") + } + return { url } + } + + // Keep URL and state in sync for selected component ID + const stopSyncing = syncURLToState({ + urlParam: "componentId", + stateKey: "selectedComponentId", + validate: id => !!findComponent($selectedScreen.props, id), + fallbackUrl: "../", + store, + routify, + beforeNavigate: cleanUrl, + }) + + onDestroy(stopSyncing) + + + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte new file mode 100644 index 0000000000..9b5d05fe57 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/index.svelte @@ -0,0 +1,4 @@ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte similarity index 98% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte index 248bbc8141..7dca5b792b 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/NewComponentPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/NewComponentPanel.svelte @@ -31,10 +31,6 @@ $: orderMap = createComponentOrderMap(componentList) const getAllowedComponents = (allComponents, screen, component) => { - // Default to using the root screen container if no component specified - if (!component) { - component = screen.props - } const path = findComponentPath(screen?.props, component?._id) if (!path?.length) { return [] diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/componentStructure.json b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/componentStructure.json similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/_components/componentStructure.json rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/_components/componentStructure.json diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/index.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/new/index.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/new/index.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte new file mode 100644 index 0000000000..f8c4cc0868 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/index.svelte @@ -0,0 +1,18 @@ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte index c4ed7d949c..f5e3806bd6 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/index.svelte @@ -1,6 +1,5 @@ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte new file mode 100644 index 0000000000..cba68f899d --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutDropdownMenu.svelte @@ -0,0 +1,41 @@ + + + +
+ +
+ Delete +
+ + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte new file mode 100644 index 0000000000..cc895317fd --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutListPanel.svelte @@ -0,0 +1,29 @@ + + + +
+ {#each $store.layouts as layout (layout._id)} + store.actions.layouts.select(layout._id)} + > + + + {/each} +
+
+ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte new file mode 100644 index 0000000000..bfc2f94f43 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_components/LayoutSettingsPanel.svelte @@ -0,0 +1,53 @@ + + + + + + Custom layouts are being deprecated. They will be removed in a future + release. + + + You can save the content of this layout by pressing the button below. + + + This will copy all components inside your layout, which you can then paste + into a screen. + + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte new file mode 100644 index 0000000000..c82fefab3e --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/_layout.svelte @@ -0,0 +1,20 @@ + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte new file mode 100644 index 0000000000..4d39403bc3 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/[layoutId]/index.svelte @@ -0,0 +1,7 @@ + + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte new file mode 100644 index 0000000000..1333c6afe3 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/_layout.svelte @@ -0,0 +1,12 @@ + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte new file mode 100644 index 0000000000..09d45f8fde --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/layouts/index.svelte @@ -0,0 +1,12 @@ + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel.svelte new file mode 100644 index 0000000000..614e1eed80 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel.svelte @@ -0,0 +1,33 @@ + + + + + {#if $selectedScreen.layoutId} + + You can't preview your navigation settings using this screen as it uses + a custom layout, which is deprecated + + {/if} + + Your navigation is configured for all the screens within your app. + + + You can hide and show your navigation for each screen in the screen + settings. + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksDrawer.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte similarity index 100% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksDrawer.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksDrawer.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksEditor.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte similarity index 75% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksEditor.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte index b081ea6d72..895c82495d 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Navigation/LinksEditor.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationLinksEditor.svelte @@ -1,6 +1,6 @@ - - + + Configure the links in your navigation bar. diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte new file mode 100644 index 0000000000..c6d43984b2 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/_components/NavigationSettingsPanel.svelte @@ -0,0 +1,110 @@ + + + + + + + + + update("navigation", "Top")} + /> + update("navigation", "Left")} + /> + + + {#if $store.navigation.navigation === "Top"} + update("sticky", e.detail)} + /> + update("logoUrl", e.detail)} + placeholder="Add logo URL" + updateOnChange={false} + /> + {/if} + + + update("hideTitle", !e.detail)} + /> + {#if !$store.navigation.hideTitle} + update("title", e.detail)} + placeholder="Add title" + updateOnChange={false} + /> + {/if} + + + + update("navBackground", e.detail)} + /> + + + + update("navTextColor", e.detail)} + /> + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte new file mode 100644 index 0000000000..fc2e03d8e8 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte @@ -0,0 +1,7 @@ + + + + diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/RoleIndicator.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/RoleIndicator.svelte similarity index 87% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/RoleIndicator.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/RoleIndicator.svelte index 694abe444a..2555b0b2a2 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/RoleIndicator.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/RoleIndicator.svelte @@ -26,7 +26,7 @@ {#if showTooltip}
- +
{/if}
@@ -38,11 +38,13 @@ .tooltip { z-index: 1; position: absolute; - bottom: -5px; - left: 13px; + top: 50%; + left: calc(50% - 8px); + transform: translateX(-100%) translateY(-50%); display: flex; flex-direction: row; justify-content: flex-end; + width: 200px; pointer-events: none; } .tooltip :global(.spectrum-Tooltip) { diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/DropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte similarity index 97% rename from packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/DropdownMenu.svelte rename to packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte index c117c7e9dd..fd5ddd9459 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ScreenList/DropdownMenu.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenDropdownMenu.svelte @@ -56,7 +56,7 @@ const deleteScreen = async () => { try { await store.actions.screens.delete(screen) - notifications.success("Deleted screen successfully") + notifications.success("Deleted screen successfully.") } catch (err) { notifications.error("Error deleting screen") } diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte new file mode 100644 index 0000000000..6362af3073 --- /dev/null +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenListPanel.svelte @@ -0,0 +1,75 @@ + + + + + + (searchString = e.detail)} + /> +