From a66653b9f1cd8ab4f5710db2bf24e2e9dda43222 Mon Sep 17 00:00:00 2001 From: Nigel Gott <nigel@baserow.io> Date: Wed, 24 Nov 2021 13:45:20 +0000 Subject: [PATCH] Resolve "Disable repeat formula function for now" --- README.md | 2 +- backend/Dockerfile | 4 +-- backend/docker/Dockerfile.dev | 4 +-- backend/setup.py | 2 +- backend/src/baserow/config/settings/base.py | 2 +- .../database/formula/ast/function_defs.py | 19 ----------- changelog.md | 2 +- deploy/cloudron/CloudronManifest.json | 2 +- deploy/cloudron/Dockerfile | 2 +- deploy/cloudron/README.md | 4 +-- deploy/cloudron/start.sh | 3 -- docker-compose.dev.yml | 10 +++--- .../installation/install-on-cloudron.md | 4 +-- docs/guides/installation/install-on-ubuntu.md | 9 +++-- docs/plugins/boilerplate.md | 1 - heroku.Dockerfile | 2 +- heroku.yml | 2 +- .../modules/baserow_premium/.eslintrc.js | 34 +++++++++++++++++++ web-frontend/.eslintrc.js | 1 + web-frontend/Dockerfile | 2 +- web-frontend/config/nuxt.config.base.js | 3 +- web-frontend/docker/Dockerfile.dev | 2 +- .../modules/database/formula/functions.js | 21 ------------ web-frontend/modules/database/plugin.js | 2 -- web-frontend/package.json | 2 +- .../database/formula/formulaFunctions.spec.js | 1 - 26 files changed, 65 insertions(+), 77 deletions(-) create mode 100644 premium/web-frontend/modules/baserow_premium/.eslintrc.js diff --git a/README.md b/README.md index 95f2b0de5..a90d5c084 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Created by Baserow B.V. - bram@baserow.io. Distributes under the MIT license. See `LICENSE` for more information. -Version: 1.6.0 +Version: 1.7.0 The official repository can be found at https://gitlab.com/bramw/baserow. diff --git a/backend/Dockerfile b/backend/Dockerfile index 95ce33a5f..3a2a6de0a 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -34,14 +34,14 @@ RUN pip3 install --no-warn-script-location -r /baserow/requirements/base.txt COPY --chown=$UID:$GID ./docs /baserow/docs COPY --chown=$UID:$GID ./backend /baserow/backend -COPY --chown=$UID:$GID ./premium/backend /baserow/backend/plugins/premium +COPY --chown=$UID:$GID ./premium/backend /baserow/premium/backend WORKDIR /baserow/backend # Ensure that Python outputs everything that's printed inside # the application rather than buffering it. ENV PYTHONUNBUFFERED 1 -ENV PYTHONPATH $PYTHONPATH:/baserow/backend/src:/baserow/backend/plugins/premium/src +ENV PYTHONPATH $PYTHONPATH:/baserow/backend/src:/baserow/premium/backend/src ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.base' RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh && \ diff --git a/backend/docker/Dockerfile.dev b/backend/docker/Dockerfile.dev index a2ee3fdec..5946ac3fb 100644 --- a/backend/docker/Dockerfile.dev +++ b/backend/docker/Dockerfile.dev @@ -36,14 +36,14 @@ RUN pip3 install --no-warn-script-location -r /baserow/requirements/base.txt -r COPY --chown=$UID:$GID ./docs /baserow/docs COPY --chown=$UID:$GID ./backend /baserow/backend -COPY --chown=$UID:$GID ./premium/backend /baserow/backend/plugins/premium +COPY --chown=$UID:$GID ./premium/backend /baserow/premium/backend WORKDIR /baserow/backend # Ensure that Python outputs everything that's printed inside # the application rather than buffering it. ENV PYTHONUNBUFFERED 1 -ENV PYTHONPATH $PYTHONPATH:/baserow/backend/src:/baserow/backend/plugins/premium/src +ENV PYTHONPATH $PYTHONPATH:/baserow/backend/src:/baserow/premium/backend/src ENV DJANGO_SETTINGS_MODULE='baserow.config.settings.dev' RUN dos2unix /baserow/backend/docker/docker-entrypoint.sh && \ diff --git a/backend/setup.py b/backend/setup.py index 0528fcee6..819f32b9b 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -6,7 +6,7 @@ from setuptools import find_packages, setup PROJECT_DIR = os.path.dirname(__file__) REQUIREMENTS_DIR = os.path.join(PROJECT_DIR, "requirements") -VERSION = "1.6.0" +VERSION = "1.7.0" def get_requirements(env): diff --git a/backend/src/baserow/config/settings/base.py b/backend/src/baserow/config/settings/base.py index 9afcf73ca..ccf944881 100644 --- a/backend/src/baserow/config/settings/base.py +++ b/backend/src/baserow/config/settings/base.py @@ -218,7 +218,7 @@ SPECTACULAR_SETTINGS = { "name": "MIT", "url": "https://gitlab.com/bramw/baserow/-/blob/master/LICENSE", }, - "VERSION": "1.6.0", + "VERSION": "1.7.0", "SERVE_INCLUDE_SCHEMA": False, "TAGS": [ {"name": "Settings"}, diff --git a/backend/src/baserow/contrib/database/formula/ast/function_defs.py b/backend/src/baserow/contrib/database/formula/ast/function_defs.py index 4da1a6791..daf7b80e8 100644 --- a/backend/src/baserow/contrib/database/formula/ast/function_defs.py +++ b/backend/src/baserow/contrib/database/formula/ast/function_defs.py @@ -38,7 +38,6 @@ from django.db.models.functions import ( Least, Left, Right, - Repeat, ) from baserow.contrib.database.fields.models import ( @@ -109,7 +108,6 @@ def register_formula_functions(registry): registry.register(BaserowRight()) registry.register(BaserowTrim()) registry.register(BaserowRegexReplace()) - registry.register(BaserowRepeat()) # Number functions registry.register(BaserowMultiply()) registry.register(BaserowDivide()) @@ -1431,23 +1429,6 @@ class BaserowTrim(OneArgumentBaserowFunction): raise BaserowToDjangoExpressionGenerationError() -class BaserowRepeat(TwoArgumentBaserowFunction): - type = "repeat" - arg1_type = [BaserowFormulaTextType] - arg2_type = [OnlyIntegerNumberTypes()] - - def type_function( - self, - func_call: BaserowFunctionCall[UnTyped], - arg1: BaserowExpression[BaserowFormulaValidType], - arg2: BaserowExpression[BaserowFormulaNumberType], - ) -> BaserowExpression[BaserowFormulaType]: - return func_call.with_valid_type(arg1.expression_type) - - def to_django_expression(self, arg1: Expression, arg2: Expression) -> Expression: - return Repeat(arg1, arg2, output_field=fields.TextField()) - - class BaserowYear(OneArgumentBaserowFunction): type = "year" arg_type = [BaserowFormulaDateType] diff --git a/changelog.md b/changelog.md index f5b03514d..bea467c69 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## Released (2021-11-24) * Fixed a bug where the frontend would fail hard if a table with no views was accessed. * Tables can now be opened in new browser tabs. diff --git a/deploy/cloudron/CloudronManifest.json b/deploy/cloudron/CloudronManifest.json index 01694e00f..f4b84814b 100644 --- a/deploy/cloudron/CloudronManifest.json +++ b/deploy/cloudron/CloudronManifest.json @@ -8,7 +8,7 @@ "contactEmail": "bram@baserow.io", "icon": "file://logo.png", "tags": ["no-code", "nocode", "database", "data", "collaborate", "airtable"], - "version": "1.6.0", + "version": "1.7.0", "healthCheckPath": "/_health", "httpPort": 80, "addons": { diff --git a/deploy/cloudron/Dockerfile b/deploy/cloudron/Dockerfile index b5aed2b12..d4d610af7 100644 --- a/deploy/cloudron/Dockerfile +++ b/deploy/cloudron/Dockerfile @@ -30,7 +30,7 @@ RUN (mkdir -p /app/code/cloudron/cloudron && \ touch /app/code/cloudron/cloudron/__init__.py) ADD settings.py /app/code/cloudron/cloudron -ENV PYTHONPATH $PYTHONPATH:/app/code/baserow/backend/src:/app/code/cloudron +ENV PYTHONPATH $PYTHONPATH:/app/code/baserow/backend/src:/app/code/baserow/premium/backend/src:/app/code/cloudron ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 ENV TMPDIR=/run/temp diff --git a/deploy/cloudron/README.md b/deploy/cloudron/README.md index a566d51f5..84ea7c4c7 100644 --- a/deploy/cloudron/README.md +++ b/deploy/cloudron/README.md @@ -1,11 +1,11 @@ **Build** ``` -$ docker build -t registry.gitlab.com/bramw/baserow/cloudron:1.6.0 . +$ docker build -t registry.gitlab.com/bramw/baserow/cloudron:1.7.0 . ``` **Push** ``` -$ docker push registry.gitlab.com/bramw/baserow/cloudron:1.6.0 +$ docker push registry.gitlab.com/bramw/baserow/cloudron:1.7.0 ``` diff --git a/deploy/cloudron/start.sh b/deploy/cloudron/start.sh index ebd73a9c9..4fde0e35c 100755 --- a/deploy/cloudron/start.sh +++ b/deploy/cloudron/start.sh @@ -15,9 +15,6 @@ echo "==> Executing database migrations" echo "==> Syncing templates" /app/code/env/bin/python /app/code/baserow/backend/src/baserow/manage.py sync_templates --settings=cloudron.settings -echo "==> Updating formulas" -/app/code/env/bin/python /app/code/baserow/backend/src/baserow/manage.py update_formulas --settings=cloudron.settings - chown -R cloudron:cloudron /app/data echo "==> Starting" diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 3c780eb5f..15efc44a9 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -18,7 +18,7 @@ services: image: baserow_backend_dev:latest volumes: - ./backend:/baserow/backend - - ./premium/backend/:/baserow/backend/plugins/premium + - ./premium/backend/:/baserow/premium/backend - /baserow/backend/plugins # Open stdin and tty so when attaching key input works as expected. stdin_open: true @@ -37,7 +37,7 @@ services: command: celery-dev worker -l INFO -Q celery volumes: - ./backend:/baserow/backend - - ./premium/backend/:/baserow/backend/plugins/premium + - ./premium/backend/:/baserow/premium/backend - /baserow/backend/plugins # Open stdin and tty so when attaching key input works as expected. stdin_open: true @@ -56,7 +56,7 @@ services: command: celery-dev worker -l INFO -Q export volumes: - ./backend:/baserow/backend - - ./premium/backend/:/baserow/backend/plugins/premium + - ./premium/backend/:/baserow/premium/backend - /baserow/backend/plugins # Open stdin and tty so when attaching key input works as expected. stdin_open: true @@ -75,7 +75,7 @@ services: command: celery-dev beat -l INFO -S redbeat.RedBeatScheduler volumes: - ./backend:/baserow/backend - - ./premium/backend/:/baserow/backend/plugins/premium + - ./premium/backend/:/baserow/premium/backend - /baserow/backend/plugins # Open stdin and tty so when attaching key input works as expected. stdin_open: true @@ -96,7 +96,7 @@ services: # Override the above mounts for node_modules so we use the node_modules built # directly into the image instead of whatever is on your local filesystem. - /baserow/web-frontend/node_modules - - ./premium/web-frontend/:/baserow/web-frontend/plugins/premium + - ./premium/web-frontend/:/baserow/premium/web-frontend # Dont copy the plugins folder back to the repo as the premium should never be # committed into the web-frontend/ root folder. - /baserow/web-frontend/plugins diff --git a/docs/guides/installation/install-on-cloudron.md b/docs/guides/installation/install-on-cloudron.md index 02821631a..6fb49d1ef 100644 --- a/docs/guides/installation/install-on-cloudron.md +++ b/docs/guides/installation/install-on-cloudron.md @@ -42,7 +42,7 @@ $ cd baserow/deploy/cloudron After that you can install the Baserow Cloudron app by executing the following commands. ``` -$ cloudron install -l baserow.{YOUR_DOMAIN} --image registry.gitlab.com/bramw/baserow/cloudron:1.6.0 +$ cloudron install -l baserow.{YOUR_DOMAIN} --image registry.gitlab.com/bramw/baserow/cloudron:1.7.0 App is being installed. ... App is installed. @@ -67,7 +67,7 @@ First you need to figure out what your app id is. You can do so by executing the the latest version. ``` -cloudron update --app {YOUR_APP_ID} --image registry.gitlab.com/bramw/baserow/cloudron:1.6.0 +cloudron update --app {YOUR_APP_ID} --image registry.gitlab.com/bramw/baserow/cloudron:1.7.0 ``` > Note that you must replace the image with the most recent image of Baserow. The diff --git a/docs/guides/installation/install-on-ubuntu.md b/docs/guides/installation/install-on-ubuntu.md index c58dfe965..329c918ef 100644 --- a/docs/guides/installation/install-on-ubuntu.md +++ b/docs/guides/installation/install-on-ubuntu.md @@ -129,6 +129,8 @@ $ source env/bin/activate # Install backend dependencies through pip $ pip3 install -e ./baserow/backend +# Install the premium plugin +$ pip3 install -e ./baserow/premium/backend # Deactivate the virtual environment $ deactivate @@ -216,9 +218,6 @@ $ baserow migrate # Sync the template files with the database $ baserow sync_templates -# Ensure formulas are updated to the latest version -$ baserow update_formulas - $ deactivate ``` @@ -373,12 +372,12 @@ $ git pull $ cd /baserow $ source env/bin/activate $ pip3 install -e ./baserow/backend +$ pip3 install -e ./baserow/premium/backend $ export DJANGO_SETTINGS_MODULE='baserow.config.settings.base' $ export DATABASE_PASSWORD='yourpassword' $ export DATABASE_HOST='localhost' $ baserow migrate $ baserow sync_templates -$ baserow update_formulas $ deactivate $ cd baserow/web-frontend $ yarn install @@ -395,12 +394,12 @@ $ cd /baserow $ git pull $ source backend/env/bin/activate $ pip3 install -e ./backend +$ pip3 install -e ./premium/backend $ export DJANGO_SETTINGS_MODULE='baserow.config.settings.base' $ export DATABASE_PASSWORD='yourpassword' $ export DATABASE_HOST='localhost' $ baserow migrate $ baserow sync_templates -$ baserow update_formulas $ deactivate $ cd web-frontend $ yarn install diff --git a/docs/plugins/boilerplate.md b/docs/plugins/boilerplate.md index 06882ae70..8260ad320 100644 --- a/docs/plugins/boilerplate.md +++ b/docs/plugins/boilerplate.md @@ -63,7 +63,6 @@ Django backend development server by executing the following commands. $ docker exec -it my-baserow-plugin-backend bash $ baserow migrate $ baserow sync_templates -$ baserow update_formulas $ baserow runserver 0.0.0.0:8000 ``` diff --git a/heroku.Dockerfile b/heroku.Dockerfile index bf22697a0..cee91e8ea 100644 --- a/heroku.Dockerfile +++ b/heroku.Dockerfile @@ -37,7 +37,7 @@ RUN (mkdir -p /baserow/heroku/heroku && \ touch /baserow/heroku/heroku/__init__.py) ADD deploy/heroku/settings.py /baserow/heroku/heroku -ENV PYTHONPATH $PYTHONPATH:/baserow/baserow/backend/src:/baserow/heroku +ENV PYTHONPATH $PYTHONPATH:/baserow/baserow/backend/src:/baserow/baserow/premium/backend/src:/baserow/heroku ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 ENV TMPDIR=/run/temp diff --git a/heroku.yml b/heroku.yml index b8ba9bbbf..1d945c296 100644 --- a/heroku.yml +++ b/heroku.yml @@ -4,6 +4,6 @@ build: release: image: web command: - - /baserow/env/bin/python /baserow/baserow/backend/src/baserow/manage.py migrate --settings=heroku.settings && /baserow/env/bin/python /baserow/baserow/backend/src/baserow/manage.py sync_templates --settings=heroku.settings && /baserow/env/bin/python /baserow/baserow/backend/src/baserow/manage.py update_formulas --settings=heroku.settings + - /baserow/env/bin/python /baserow/baserow/backend/src/baserow/manage.py migrate --settings=heroku.settings && /baserow/env/bin/python /baserow/baserow/backend/src/baserow/manage.py sync_templates --settings=heroku.settings run: web: . /baserow/entry.sh && /usr/bin/supervisord --configuration /etc/supervisor/conf.d/supervisor.conf diff --git a/premium/web-frontend/modules/baserow_premium/.eslintrc.js b/premium/web-frontend/modules/baserow_premium/.eslintrc.js new file mode 100644 index 000000000..3e392ded7 --- /dev/null +++ b/premium/web-frontend/modules/baserow_premium/.eslintrc.js @@ -0,0 +1,34 @@ +// Please keep in sync with the non premium eslintrc.js +module.exports = { + root: true, + env: { + browser: true, + node: true, + jest: true, + // required as jest uses jasmine's fail method + // https://stackoverflow.com/questions/64413927/jest-eslint-fail-is-not-defined + jasmine: true, + }, + parserOptions: { + parser: 'babel-eslint', + }, + extends: [ + '@nuxtjs', + 'plugin:nuxt/recommended', + 'plugin:prettier/recommended', + 'prettier', + ], + plugins: ['prettier'], + rules: { + 'no-console': 0, + 'vue/no-mutating-props': 0, + 'prettier/prettier': [ + 'error', + { + singleQuote: true, + semi: false, + }, + ], + 'import/order': 'off', + }, +} diff --git a/web-frontend/.eslintrc.js b/web-frontend/.eslintrc.js index 90984566b..737d5b257 100644 --- a/web-frontend/.eslintrc.js +++ b/web-frontend/.eslintrc.js @@ -1,3 +1,4 @@ +// Please keep in sync with the premium eslintrc.js module.exports = { root: true, env: { diff --git a/web-frontend/Dockerfile b/web-frontend/Dockerfile index 57cf273c7..c2d486dc5 100644 --- a/web-frontend/Dockerfile +++ b/web-frontend/Dockerfile @@ -36,7 +36,7 @@ WORKDIR /baserow/web-frontend RUN yarn install COPY --chown=$UID:$GID ./web-frontend /baserow/web-frontend/ -COPY --chown=$UID:$GID ./premium/web-frontend /baserow/web-frontend/plugins/premium +COPY --chown=$UID:$GID ./premium/web-frontend /baserow/premium/web-frontend/ RUN yarn run build-local diff --git a/web-frontend/config/nuxt.config.base.js b/web-frontend/config/nuxt.config.base.js index a7fec023f..7a78092c9 100644 --- a/web-frontend/config/nuxt.config.base.js +++ b/web-frontend/config/nuxt.config.base.js @@ -9,8 +9,9 @@ export default function (base = '@') { const baseModules = [ base + '/modules/core/module.js', base + '/modules/database/module.js', - base + '/plugins/premium/modules/baserow_premium/module.js', + base + '/../premium/web-frontend/modules/baserow_premium/module.js', ] + const modules = baseModules.concat(additionalModules) return { modules, diff --git a/web-frontend/docker/Dockerfile.dev b/web-frontend/docker/Dockerfile.dev index b8dbb0dad..d32db3e0b 100644 --- a/web-frontend/docker/Dockerfile.dev +++ b/web-frontend/docker/Dockerfile.dev @@ -35,7 +35,7 @@ WORKDIR /baserow/web-frontend RUN yarn install COPY --chown=$UID:$GID ./web-frontend /baserow/web-frontend/ -COPY --chown=$UID:$GID ./premium/web-frontend /baserow/web-frontend/plugins/premium +COPY --chown=$UID:$GID ./premium/web-frontend /baserow/premium/web-frontend/ RUN dos2unix /baserow/web-frontend/docker/docker-entrypoint.sh && \ chmod a+x /baserow/web-frontend/docker/docker-entrypoint.sh diff --git a/web-frontend/modules/database/formula/functions.js b/web-frontend/modules/database/formula/functions.js index b843760ea..50f7e7881 100644 --- a/web-frontend/modules/database/formula/functions.js +++ b/web-frontend/modules/database/formula/functions.js @@ -1049,27 +1049,6 @@ export class BaserowRegexReplace extends BaserowFunctionDefinition { } } -export class BaserowRepeat extends BaserowFunctionDefinition { - static getType() { - return 'repeat' - } - - getDescription() { - return 'Repeats the first input the number of times specified by the second input' - } - - getSyntaxUsage() { - return ['repeat(text, number)'] - } - - getExamples() { - return ['repeat("a", 3) = "aaa"'] - } - - getFormulaType() { - return 'text' - } -} export class BaserowGreatest extends BaserowFunctionDefinition { static getType() { return 'greatest' diff --git a/web-frontend/modules/database/plugin.js b/web-frontend/modules/database/plugin.js index 441b800c9..ad4f808ef 100644 --- a/web-frontend/modules/database/plugin.js +++ b/web-frontend/modules/database/plugin.js @@ -118,7 +118,6 @@ import { BaserowMonth, BaserowLeast, BaserowGreatest, - BaserowRepeat, BaserowRegexReplace, BaserowTrim, BaserowRight, @@ -283,7 +282,6 @@ export default (context) => { app.$registry.register('formula_function', new BaserowRight(context)) app.$registry.register('formula_function', new BaserowTrim(context)) app.$registry.register('formula_function', new BaserowRegexReplace(context)) - app.$registry.register('formula_function', new BaserowRepeat(context)) app.$registry.register('formula_function', new BaserowGreatest(context)) app.$registry.register('formula_function', new BaserowLeast(context)) app.$registry.register('formula_function', new BaserowMonth(context)) diff --git a/web-frontend/package.json b/web-frontend/package.json index f51852af5..f692ad131 100644 --- a/web-frontend/package.json +++ b/web-frontend/package.json @@ -1,6 +1,6 @@ { "name": "baserow", - "version": "1.6.0", + "version": "1.7.0", "private": true, "description": "Baserow: open source no-code database web frontend.", "author": "Bram Wiepjes (Baserow)", diff --git a/web-frontend/test/unit/database/formula/formulaFunctions.spec.js b/web-frontend/test/unit/database/formula/formulaFunctions.spec.js index 8df1d9191..85cea34ad 100644 --- a/web-frontend/test/unit/database/formula/formulaFunctions.spec.js +++ b/web-frontend/test/unit/database/formula/formulaFunctions.spec.js @@ -25,7 +25,6 @@ describe('Formula Functions Test', () => { 'right', 'trim', 'regex_replace', - 'repeat', 'multiply', 'divide', 'tonumber',