Merge branch 'develop' of github.com:Budibase/budibase into cheeks-fixes
This commit is contained in:
commit
43a8efc24d
|
@ -0,0 +1,9 @@
|
|||
packages/server/node_modules
|
||||
packages/builder
|
||||
packages/frontend-core
|
||||
packages/backend-core
|
||||
packages/worker/node_modules
|
||||
packages/cli
|
||||
packages/client
|
||||
packages/bbui
|
||||
packages/string-templates
|
|
@ -1894,9 +1894,9 @@ minimist-options@4.1.0:
|
|||
kind-of "^6.0.3"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
minipass-collect@^1.0.2:
|
||||
version "1.0.2"
|
||||
|
|
|
@ -117,7 +117,6 @@ services:
|
|||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=false"
|
||||
|
||||
|
||||
volumes:
|
||||
couchdb3_data:
|
||||
driver: local
|
||||
|
|
|
@ -43,7 +43,7 @@ http {
|
|||
ignore_invalid_headers off;
|
||||
proxy_buffering off;
|
||||
|
||||
set $csp_default "default-src 'self'"
|
||||
set $csp_default "default-src 'self'";
|
||||
set $csp_script "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.budi.live https://js.intercomcdn.com https://widget.intercom.io";
|
||||
set $csp_style "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com https://rsms.me https://maxcdn.bootstrapcdn.com";
|
||||
set $csp_object "object-src 'none'";
|
||||
|
@ -60,7 +60,7 @@ http {
|
|||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Content-Security-Policy ${csp_default}; ${csp_script}; ${csp_style}; ${csp_object}; ${csp_base_uri}; ${csp_connect}; ${csp_font}; ${csp_frame}; ${csp_img}; ${csp_manifest}; ${csp_media}; ${csp_worker};" always;
|
||||
add_header Content-Security-Policy "${csp_default}; ${csp_script}; ${csp_style}; ${csp_object}; ${csp_base_uri}; ${csp_connect}; ${csp_font}; ${csp_frame}; ${csp_img}; ${csp_manifest}; ${csp_media}; ${csp_worker};" always;
|
||||
|
||||
# upstreams
|
||||
set $apps {{ apps }};
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"version": "2",
|
||||
"templates": [
|
||||
{
|
||||
"type": 3,
|
||||
"title": "Budibase",
|
||||
"categories": ["Tools"],
|
||||
"description": "Build modern business apps in minutes",
|
||||
"logo": "https://budibase.com/favicon.ico",
|
||||
"platform": "linux",
|
||||
"repository": {
|
||||
"url": "https://github.com/Budibase/budibase",
|
||||
"stackfile": "hosting/docker-compose.yaml"
|
||||
},
|
||||
"env": [
|
||||
{
|
||||
"name": "MAIN_PORT",
|
||||
"label": "Main port",
|
||||
"default": "10000"
|
||||
},
|
||||
{
|
||||
"name": "JWT_SECRET",
|
||||
"label": "JWT secret",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "MINIO_ACCESS_KEY",
|
||||
"label": "MinIO access key",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "MINIO_SECRET_KEY",
|
||||
"label": "MinIO secret key",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "COUCH_DB_USER",
|
||||
"default": "budibase",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "COUCH_DB_PASSWORD",
|
||||
"label": "Couch DB password",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "REDIS_PASSWORD",
|
||||
"label": "Redis password",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "INTERNAL_API_KEY",
|
||||
"label": "Internal API key",
|
||||
"default": "change-me"
|
||||
},
|
||||
{
|
||||
"name": "APP_PORT",
|
||||
"default": "4002",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "WORKER_PORT",
|
||||
"default": "4003",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "MINIO_PORT",
|
||||
"default": "4004",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "COUCH_DB_PORT",
|
||||
"default": "4005",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "REDIS_PORT",
|
||||
"default": "6379",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "WATCHTOWER_PORT",
|
||||
"default": "6161",
|
||||
"preset": true
|
||||
},
|
||||
{
|
||||
"name": "BUDIBASE_ENVIRONMENT",
|
||||
"default": "PRODUCTION",
|
||||
"preset": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
FROM couchdb
|
||||
|
||||
ENV COUCHDB_PASSWORD=budibase
|
||||
ENV COUCHDB_USER=budibase
|
||||
ENV COUCH_DB_URL=http://budibase:budibase@localhost:5984
|
||||
ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||
ENV MINIO_URL=http://localhost:9000
|
||||
ENV REDIS_URL=localhost:6379
|
||||
ENV WORKER_URL=http://localhost:4002
|
||||
ENV INTERNAL_API_KEY=budibase
|
||||
ENV JWT_SECRET=testsecret
|
||||
ENV MINIO_ACCESS_KEY=budibase
|
||||
ENV MINIO_SECRET_KEY=budibase
|
||||
ENV SELF_HOSTED=1
|
||||
ENV CLUSTER_PORT=10000
|
||||
ENV REDIS_PASSWORD=budibase
|
||||
ENV ARCHITECTURE=amd
|
||||
ENV APP_PORT=4001
|
||||
ENV WORKER_PORT=4002
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install software-properties-common wget nginx -y
|
||||
RUN apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main'
|
||||
RUN apt-get update
|
||||
|
||||
# setup nginx
|
||||
ADD hosting/single/nginx.conf /etc/nginx
|
||||
RUN mkdir /etc/nginx/logs
|
||||
RUN useradd www
|
||||
RUN touch /etc/nginx/logs/error.log
|
||||
RUN touch /etc/nginx/logs/nginx.pid
|
||||
|
||||
# install java
|
||||
RUN apt-get install openjdk-8-jdk -y
|
||||
|
||||
# setup nodejs
|
||||
WORKDIR /nodejs
|
||||
RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
|
||||
RUN bash /tmp/nodesource_setup.sh
|
||||
RUN apt-get install nodejs
|
||||
RUN npm install --global yarn
|
||||
RUN npm install --global pm2
|
||||
|
||||
# setup redis
|
||||
RUN apt install redis-server -y
|
||||
|
||||
# setup server
|
||||
WORKDIR /app
|
||||
ADD packages/server .
|
||||
RUN ls -al
|
||||
RUN yarn
|
||||
RUN yarn build
|
||||
# Install client for oracle datasource
|
||||
RUN apt-get install unzip libaio1
|
||||
RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh
|
||||
|
||||
# setup worker
|
||||
WORKDIR /worker
|
||||
ADD packages/worker .
|
||||
RUN yarn
|
||||
RUN yarn build
|
||||
|
||||
# setup clouseau
|
||||
WORKDIR /
|
||||
RUN wget https://github.com/cloudant-labs/clouseau/releases/download/2.21.0/clouseau-2.21.0-dist.zip
|
||||
RUN unzip clouseau-2.21.0-dist.zip
|
||||
RUN mv clouseau-2.21.0 /opt/clouseau
|
||||
RUN rm clouseau-2.21.0-dist.zip
|
||||
|
||||
WORKDIR /opt/clouseau
|
||||
RUN mkdir ./bin
|
||||
ADD hosting/single/clouseau ./bin/
|
||||
ADD hosting/single/log4j.properties .
|
||||
ADD hosting/single/clouseau.ini .
|
||||
RUN chmod +x ./bin/clouseau
|
||||
|
||||
# setup CouchDB
|
||||
WORKDIR /opt/couchdb
|
||||
ADD hosting/single/vm.args ./etc/
|
||||
|
||||
# setup minio
|
||||
WORKDIR /minio
|
||||
RUN wget https://dl.min.io/server/minio/release/linux-${ARCHITECTURE}64/minio
|
||||
RUN chmod +x minio
|
||||
|
||||
# setup runner file
|
||||
WORKDIR /
|
||||
ADD hosting/single/runner.sh .
|
||||
RUN chmod +x ./runner.sh
|
||||
|
||||
EXPOSE 10000
|
||||
VOLUME /opt/couchdb/data
|
||||
VOLUME /minio
|
||||
|
||||
# must set this just before running
|
||||
ENV NODE_ENV=production
|
||||
CMD ["./runner.sh"]
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
/usr/bin/java -server \
|
||||
-Xmx2G \
|
||||
-Dsun.net.inetaddr.ttl=30 \
|
||||
-Dsun.net.inetaddr.negative.ttl=30 \
|
||||
-Dlog4j.configuration=file:/opt/clouseau/log4j.properties \
|
||||
-XX:OnOutOfMemoryError="kill -9 %p" \
|
||||
-XX:+UseConcMarkSweepGC \
|
||||
-XX:+CMSParallelRemarkEnabled \
|
||||
-classpath '/opt/clouseau/*' \
|
||||
com.cloudant.clouseau.Main \
|
||||
/opt/clouseau/clouseau.ini
|
|
@ -0,0 +1,13 @@
|
|||
[clouseau]
|
||||
|
||||
; the name of the Erlang node created by the service, leave this unchanged
|
||||
name=clouseau@127.0.0.1
|
||||
|
||||
; set this to the same distributed Erlang cookie used by the CouchDB nodes
|
||||
cookie=monster
|
||||
|
||||
; the path where you would like to store the search index files
|
||||
dir=/opt/couchdb/data/search
|
||||
|
||||
; the number of search indexes that can be open simultaneously
|
||||
max_indexes_open=500
|
|
@ -0,0 +1,4 @@
|
|||
log4j.rootLogger=debug, CONSOLE
|
||||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %c [%p] %m%n
|
|
@ -0,0 +1,116 @@
|
|||
user www www;
|
||||
error_log /etc/nginx/logs/error.log;
|
||||
pid /etc/nginx/logs/nginx.pid;
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 8192;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=20r/s;
|
||||
proxy_set_header Host $host;
|
||||
charset utf-8;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
server_tokens off;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
# buffering
|
||||
client_header_buffer_size 1k;
|
||||
client_max_body_size 20M;
|
||||
ignore_invalid_headers off;
|
||||
proxy_buffering off;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default "upgrade";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 10000 default_server;
|
||||
listen [::]:10000 default_server;
|
||||
server_name _;
|
||||
client_max_body_size 1000m;
|
||||
ignore_invalid_headers off;
|
||||
proxy_buffering off;
|
||||
# port_in_redirect off;
|
||||
|
||||
location /app {
|
||||
proxy_pass http://127.0.0.1:4001;
|
||||
}
|
||||
|
||||
location = / {
|
||||
proxy_pass http://127.0.0.1:4001;
|
||||
}
|
||||
|
||||
location ~ ^/(builder|app_) {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:4001;
|
||||
}
|
||||
|
||||
location ~ ^/api/(system|admin|global)/ {
|
||||
proxy_pass http://127.0.0.1:4002;
|
||||
}
|
||||
|
||||
location /worker/ {
|
||||
proxy_pass http://127.0.0.1:4002;
|
||||
rewrite ^/worker/(.*)$ /$1 break;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
# calls to the API are rate limited with bursting
|
||||
limit_req zone=ratelimit burst=20 nodelay;
|
||||
|
||||
# 120s timeout on API requests
|
||||
proxy_read_timeout 120s;
|
||||
proxy_connect_timeout 120s;
|
||||
proxy_send_timeout 120s;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_pass http://127.0.0.1:4001;
|
||||
}
|
||||
|
||||
location /db/ {
|
||||
proxy_pass http://127.0.0.1:5984;
|
||||
rewrite ^/db/(.*)$ /$1 break;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
chunked_transfer_encoding off;
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
}
|
||||
|
||||
client_header_timeout 60;
|
||||
client_body_timeout 60;
|
||||
keepalive_timeout 60;
|
||||
|
||||
# gzip
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
redis-server --requirepass $REDIS_PASSWORD &
|
||||
/opt/clouseau/bin/clouseau &
|
||||
/minio/minio server /minio &
|
||||
/docker-entrypoint.sh /opt/couchdb/bin/couchdb &
|
||||
/etc/init.d/nginx restart
|
||||
pushd app
|
||||
pm2 start --name app "yarn run:docker"
|
||||
popd
|
||||
pushd worker
|
||||
pm2 start --name worker "yarn run:docker"
|
||||
popd
|
||||
sleep 10
|
||||
URL=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@localhost:5984
|
||||
curl -X PUT ${URL}/_users
|
||||
curl -X PUT ${URL}/_replicator
|
||||
sleep infinity
|
|
@ -0,0 +1,32 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
# erlang cookie for clouseau security
|
||||
-name couchdb@127.0.0.1
|
||||
-setcookie monster
|
||||
|
||||
# Ensure that the Erlang VM listens on a known port
|
||||
-kernel inet_dist_listen_min 9100
|
||||
-kernel inet_dist_listen_max 9100
|
||||
|
||||
# Tell kernel and SASL not to log anything
|
||||
-kernel error_logger silent
|
||||
-sasl sasl_error_logger false
|
||||
|
||||
# Use kernel poll functionality if supported by emulator
|
||||
+K true
|
||||
|
||||
# Start a pool of asynchronous IO threads
|
||||
+A 16
|
||||
|
||||
# Comment this line out to enable the interactive Erlang shell on startup
|
||||
+Bd -noinput
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
"build:docker:develop": "node scripts/pinVersions && lerna run build:docker && npm run build:docker:proxy:compose && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -",
|
||||
"build:docker:airgap": "node hosting/scripts/airgapped/airgappedDockerBuild",
|
||||
"build:digitalocean": "cd hosting/digitalocean && ./build.sh && cd -",
|
||||
"build:docker:single:image": "docker build -f hosting/single/Dockerfile -t budibase:latest .",
|
||||
"build:docker:single": "lerna run build && lerna run predocker && npm run build:docker:single:image",
|
||||
"build:docs": "lerna run build:docs",
|
||||
"release:helm": "node scripts/releaseHelmChart",
|
||||
"env:multi:enable": "lerna run env:multi:enable",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Budibase backend core libraries used in server and worker",
|
||||
"main": "src/index.js",
|
||||
"author": "Budibase",
|
||||
|
|
|
@ -15,6 +15,9 @@ function makeSessionID(userId, sessionId) {
|
|||
}
|
||||
|
||||
exports.createASession = async (userId, session) => {
|
||||
// invalidate all other sessions
|
||||
await this.invalidateSessions(userId)
|
||||
|
||||
const client = await redis.getSessionClient()
|
||||
const sessionId = session.sessionId
|
||||
if (!session.csrfToken) {
|
||||
|
|
|
@ -3338,9 +3338,9 @@ mimic-fn@^2.1.0:
|
|||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
mixin-deep@^1.2.0:
|
||||
version "1.3.2"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"module": "dist/bbui.es.js",
|
||||
|
@ -38,7 +38,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||
"@budibase/string-templates": "^1.0.104-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.105-alpha.7",
|
||||
"@spectrum-css/actionbutton": "^1.0.1",
|
||||
"@spectrum-css/actiongroup": "^1.0.1",
|
||||
"@spectrum-css/avatar": "^3.0.2",
|
||||
|
|
|
@ -19,18 +19,33 @@
|
|||
const dispatch = createEventDispatcher()
|
||||
const flatpickrId = `${uuid()}-wrapper`
|
||||
let open = false
|
||||
let flatpickr, flatpickrOptions, isTimeOnly
|
||||
let flatpickr, flatpickrOptions
|
||||
|
||||
const resolveTimeStamp = timestamp => {
|
||||
let maskedDate = new Date(`0-${timestamp}`)
|
||||
|
||||
if (maskedDate instanceof Date && !isNaN(maskedDate.getTime())) {
|
||||
return maskedDate
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
$: isTimeOnly = !timeOnly && value ? !isNaN(new Date(`0-${value}`)) : timeOnly
|
||||
$: flatpickrOptions = {
|
||||
element: `#${flatpickrId}`,
|
||||
enableTime: isTimeOnly || enableTime || false,
|
||||
noCalendar: isTimeOnly || false,
|
||||
enableTime: timeOnly || enableTime || false,
|
||||
noCalendar: timeOnly || false,
|
||||
altInput: true,
|
||||
altFormat: isTimeOnly ? "H:i" : enableTime ? "F j Y, H:i" : "F j, Y",
|
||||
altFormat: timeOnly ? "H:i" : enableTime ? "F j Y, H:i" : "F j, Y",
|
||||
wrap: true,
|
||||
appendTo,
|
||||
disableMobile: "true",
|
||||
onReady: () => {
|
||||
let timestamp = resolveTimeStamp(value)
|
||||
if (timeOnly && timestamp) {
|
||||
dispatch("change", timestamp.toISOString())
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
const handleChange = event => {
|
||||
|
@ -39,10 +54,9 @@
|
|||
if (newValue) {
|
||||
newValue = newValue.toISOString()
|
||||
}
|
||||
// if time only set date component to today
|
||||
// if time only set date component to 2000-01-01
|
||||
if (timeOnly) {
|
||||
const todayDate = new Date().toISOString().split("T")[0]
|
||||
newValue = `${todayDate}T${newValue.split("T")[1]}`
|
||||
newValue = `2000-01-01T${newValue.split("T")[1]}`
|
||||
}
|
||||
dispatch("change", newValue)
|
||||
}
|
||||
|
@ -76,10 +90,13 @@
|
|||
return null
|
||||
}
|
||||
let date
|
||||
let time = new Date(`0-${val}`)
|
||||
let time
|
||||
|
||||
// it is a string like 00:00:00, just time
|
||||
if (timeOnly || (typeof val === "string" && !isNaN(time))) {
|
||||
date = time
|
||||
let ts = resolveTimeStamp(val)
|
||||
|
||||
if (timeOnly && ts) {
|
||||
date = ts
|
||||
} else if (val instanceof Date) {
|
||||
// Use real date obj if already parsed
|
||||
date = val
|
||||
|
@ -101,7 +118,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{#key isTimeOnly}
|
||||
{#key timeOnly}
|
||||
<Flatpickr
|
||||
bind:flatpickr
|
||||
value={parseDate(value)}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,10 +6,6 @@ filterTests(['all'], () => {
|
|||
cy.login()
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.deleteAllApps()
|
||||
})
|
||||
|
||||
it("should change the icon and colour for an application", () => {
|
||||
// Search for test application
|
||||
cy.applicationInAppTable("Cypress Tests")
|
||||
|
|
|
@ -3,25 +3,32 @@ import filterTests from '../support/filterTests'
|
|||
filterTests(['smoke', 'all'], () => {
|
||||
context("Create an Application", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.deleteApp("Cypress Tests")
|
||||
})
|
||||
|
||||
it("should show the new user UI/UX", () => {
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.get(`[data-cy="create-app-btn"]`).contains('Start from scratch').should("exist")
|
||||
cy.get(`[data-cy="import-app-btn"]`).should("exist")
|
||||
|
||||
cy.get(".template-category-filters").should("exist")
|
||||
cy.get(".template-categories").should("exist")
|
||||
|
||||
cy.get(".appTable").should("not.exist")
|
||||
})
|
||||
if (!(Cypress.env("TEST_ENV"))) {
|
||||
it("should show the new user UI/UX", () => {
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.get(`[data-cy="create-app-btn"]`).contains('Start from scratch').should("exist")
|
||||
cy.get(`[data-cy="import-app-btn"]`).should("exist")
|
||||
|
||||
cy.get(".template-category-filters").should("exist")
|
||||
cy.get(".template-categories").should("exist")
|
||||
|
||||
cy.get(".appTable").should("not.exist")
|
||||
})
|
||||
}
|
||||
|
||||
it("should provide filterable templates", () => {
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
||||
if (Cypress.env("TEST_ENV")) {
|
||||
cy.get(".spectrum-Button").contains("Templates").click({force: true})
|
||||
}
|
||||
|
||||
cy.get(".template-category-filters").should("exist")
|
||||
cy.get(".template-categories").should("exist")
|
||||
|
||||
|
@ -39,14 +46,22 @@ filterTests(['smoke', 'all'], () => {
|
|||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
||||
const appName = "A New App"
|
||||
|
||||
cy.get(`[data-cy="create-app-btn"]`).contains('Start from scratch').click({force: true})
|
||||
// Start create app process. If apps already exist, click second button
|
||||
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length > 0) {
|
||||
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||
}
|
||||
})
|
||||
|
||||
const appName = "Cypress Tests"
|
||||
cy.get(".spectrum-Modal").within(() => {
|
||||
|
||||
//Auto fill
|
||||
cy.get("input").eq(0).type(appName).should("have.value", appName).blur()
|
||||
cy.get("input").eq(1).should("have.value", "/a-new-app")
|
||||
cy.get("input").eq(1).should("have.value", "/cypress-tests")
|
||||
cy.get(".spectrum-ButtonGroup").contains("Create app").should('not.be.disabled')
|
||||
|
||||
//Empty the app url - disabled create
|
||||
|
@ -69,8 +84,7 @@ filterTests(['smoke', 'all'], () => {
|
|||
|
||||
it("should create the first application from scratch", () => {
|
||||
const appName = "Cypress Tests"
|
||||
cy.deleteApp(appName)
|
||||
cy.createApp(appName, "This app is used for Cypress testing.")
|
||||
cy.createApp(appName)
|
||||
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(1000)
|
||||
|
@ -83,10 +97,19 @@ filterTests(['smoke', 'all'], () => {
|
|||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
||||
// Navigate to Create new app section if apps already exist
|
||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length > 0) {
|
||||
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||
}
|
||||
})
|
||||
|
||||
cy.get(".template-category-filters").should("exist")
|
||||
cy.get(".template-categories").should("exist")
|
||||
|
||||
//### Select nth template and choose to create?
|
||||
// Select template
|
||||
cy.get('.template-category').eq(0).within(() => {
|
||||
const card = cy.get('.template-card').eq(0).should("exist");
|
||||
const cardOverlay = card.get('.template-thumbnail-action-overlay').should("exist")
|
||||
|
@ -94,7 +117,7 @@ filterTests(['smoke', 'all'], () => {
|
|||
cardOverlay.get("button").contains("Use template").should("exist").click({force: true})
|
||||
})
|
||||
|
||||
//### CMD Create app from theme card
|
||||
// CMD Create app from theme card
|
||||
cy.get(".spectrum-Modal").should('be.visible')
|
||||
|
||||
const templateName = cy.get(".spectrum-Modal .template-thumbnail-text")
|
||||
|
@ -111,27 +134,22 @@ filterTests(['smoke', 'all'], () => {
|
|||
cy.wait(1000)
|
||||
|
||||
cy.applicationInAppTable(templateNameText)
|
||||
cy.deleteAllApps()
|
||||
cy.deleteApp(templateNameText)
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
it("should display a second application and app filtering", () => {
|
||||
// Create first app
|
||||
const appName = "Cypress Tests"
|
||||
cy.deleteApp(appName)
|
||||
cy.createApp(appName, "This app is used for Cypress testing.")
|
||||
cy.createApp(appName)
|
||||
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
||||
// Create second app
|
||||
const secondAppName = "Second App Demo"
|
||||
cy.deleteApp(secondAppName)
|
||||
|
||||
cy.get(`[data-cy="create-app-btn"]`).contains('Create new app').click({force: true})
|
||||
cy.wait(500)
|
||||
cy.url().should('include', '/builder/portal/apps/create')
|
||||
|
||||
cy.createAppFromScratch(secondAppName)
|
||||
cy.createApp(secondAppName)
|
||||
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
@ -140,7 +158,7 @@ filterTests(['smoke', 'all'], () => {
|
|||
cy.searchForApplication(appName)
|
||||
cy.searchForApplication(secondAppName)
|
||||
|
||||
cy.deleteAllApps()
|
||||
cy.deleteApp(secondAppName)
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -7,10 +7,6 @@ filterTests(["smoke", "all"], () => {
|
|||
cy.createTestApp()
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.deleteAllApps()
|
||||
})
|
||||
|
||||
it("should create a new Table", () => {
|
||||
cy.createTable("dog")
|
||||
cy.wait(1000)
|
||||
|
|
|
@ -4,9 +4,6 @@ filterTests(["smoke", "all"], () => {
|
|||
context("Create a User and Assign Roles", () => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
cy.createAppFromScratch("Initial App")
|
||||
})
|
||||
|
||||
it("should create a user", () => {
|
||||
|
|
|
@ -4,7 +4,6 @@ filterTests(['smoke', 'all'], () => {
|
|||
context("Create a View", () => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.deleteAllApps()
|
||||
|
||||
cy.createTestApp()
|
||||
cy.createTable("data")
|
||||
|
|
|
@ -4,7 +4,6 @@ filterTests(["smoke", "all"], () => {
|
|||
context("REST Datasource Testing", () => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.deleteAllApps()
|
||||
cy.createTestApp()
|
||||
})
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ filterTests(["smoke", "all"], () => {
|
|||
context("Query Level Transformers", () => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.deleteAllApps()
|
||||
cy.createApp("Cypress Tests")
|
||||
cy.createTestApp()
|
||||
})
|
||||
|
||||
it("should write a transformer function", () => {
|
||||
|
|
|
@ -11,10 +11,12 @@ filterTests(['all'], () => {
|
|||
const appName = "Cypress Tests"
|
||||
const appRename = "Cypress Renamed"
|
||||
// Rename app, Search for app, Confirm name was changed
|
||||
cy.get(".home-logo").click()
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
renameApp(appName, appRename)
|
||||
cy.reload()
|
||||
cy.wait(1000)
|
||||
cy.searchForApplication(appRename)
|
||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||
cy.applicationInAppTable(appRename)
|
||||
// Set app name back to Cypress Tests
|
||||
|
@ -36,7 +38,8 @@ filterTests(['all'], () => {
|
|||
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
|
||||
})
|
||||
// Rename app, Search for app, Confirm name was changed
|
||||
cy.get(".home-logo").click()
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
renameApp(appName, appRename, true)
|
||||
cy.get(".appTable").find(".wrapper").should("have.length", 1)
|
||||
cy.applicationInAppTable(appRename)
|
||||
|
@ -44,7 +47,8 @@ filterTests(['all'], () => {
|
|||
|
||||
it("Should try to rename an application to have no name", () => {
|
||||
const appName = "Cypress Tests"
|
||||
cy.get(".home-logo").click()
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
renameApp(appName, " ", false, true)
|
||||
cy.wait(500)
|
||||
// Close modal and confirm name has not been changed
|
||||
|
@ -52,8 +56,6 @@ filterTests(['all'], () => {
|
|||
cy.reload()
|
||||
cy.wait(1000)
|
||||
cy.applicationInAppTable(appName)
|
||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||
|
||||
})
|
||||
|
||||
xit("Should create two applications with the same name", () => {
|
||||
|
@ -77,12 +79,12 @@ filterTests(['all'], () => {
|
|||
const appName = "Cypress Tests"
|
||||
const numberName = 12345
|
||||
const specialCharName = "£$%^"
|
||||
cy.get(".home-logo").click()
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
renameApp(appName, numberName)
|
||||
cy.reload()
|
||||
cy.wait(1000)
|
||||
cy.applicationInAppTable(numberName)
|
||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||
cy.reload()
|
||||
cy.wait(1000)
|
||||
renameApp(numberName, specialCharName)
|
||||
|
@ -94,40 +96,33 @@ filterTests(['all'], () => {
|
|||
})
|
||||
|
||||
const renameApp = (originalName, changedName, published, noName) => {
|
||||
cy.applicationInAppTable(originalName)
|
||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length > 0) {
|
||||
cy.get(".appTable")
|
||||
.within(() => {
|
||||
cy.get(".spectrum-Icon").eq(1).click()
|
||||
})
|
||||
// Check for when an app is published
|
||||
if (published == true) {
|
||||
// Should not have Edit as option, will unpublish app
|
||||
cy.should("not.have.value", "Edit")
|
||||
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
||||
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click()
|
||||
cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click()
|
||||
cy.searchForApplication(originalName)
|
||||
cy.get(".appTable")
|
||||
.within(() => {
|
||||
cy.get(".spectrum-Icon").eq(1).click()
|
||||
})
|
||||
// Check for when an app is published
|
||||
if (published == true) {
|
||||
// Should not have Edit as option, will unpublish app
|
||||
cy.should("not.have.value", "Edit")
|
||||
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
||||
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click()
|
||||
cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click()
|
||||
}
|
||||
cy.contains("Edit").click()
|
||||
cy.get(".spectrum-Modal")
|
||||
.within(() => {
|
||||
if (noName == true) {
|
||||
cy.get("input").clear()
|
||||
cy.get(".spectrum-Dialog-grid").click()
|
||||
.contains("App name must be letters, numbers and spaces only")
|
||||
return cy
|
||||
}
|
||||
cy.contains("Edit").click()
|
||||
cy.get(".spectrum-Modal")
|
||||
.within(() => {
|
||||
if (noName == true) {
|
||||
cy.get("input").clear()
|
||||
cy.get(".spectrum-Dialog-grid").click()
|
||||
.contains("App name must be letters, numbers and spaces only")
|
||||
return cy
|
||||
}
|
||||
cy.get("input").clear()
|
||||
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur()
|
||||
cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true })
|
||||
cy.wait(500)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
cy.get("input").clear()
|
||||
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur()
|
||||
cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true })
|
||||
cy.wait(500)
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -35,9 +35,17 @@ Cypress.Commands.add("login", () => {
|
|||
Cypress.Commands.add("createApp", name => {
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(500)
|
||||
|
||||
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||
|
||||
// If apps already exist
|
||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length > 0) {
|
||||
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||
}
|
||||
})
|
||||
|
||||
cy.get(".spectrum-Modal").within(() => {
|
||||
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
||||
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
|
||||
|
@ -53,23 +61,30 @@ Cypress.Commands.add("deleteApp", name => {
|
|||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length > 0) {
|
||||
const appId = val.reduce((acc, app) => {
|
||||
if (name === app.name) {
|
||||
acc = app.appId
|
||||
if (Cypress.env("TEST_ENV")) {
|
||||
cy.searchForApplication(name)
|
||||
cy.get(".appTable").within(() => {
|
||||
cy.get(".spectrum-Icon").eq(1).click()
|
||||
})
|
||||
} else {
|
||||
const appId = val.reduce((acc, app) => {
|
||||
if (name === app.name) {
|
||||
acc = app.appId
|
||||
}
|
||||
return acc
|
||||
}, "")
|
||||
|
||||
if (appId == "") {
|
||||
return
|
||||
}
|
||||
return acc
|
||||
}, "")
|
||||
|
||||
if (appId == "") {
|
||||
return
|
||||
const appIdParsed = appId.split("_").pop()
|
||||
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
|
||||
cy.get(actionEleId).within(() => {
|
||||
cy.get(".spectrum-Icon").eq(0).click()
|
||||
})
|
||||
}
|
||||
|
||||
const appIdParsed = appId.split("_").pop()
|
||||
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
|
||||
cy.get(actionEleId).within(() => {
|
||||
cy.get(".spectrum-Icon").eq(0).click()
|
||||
})
|
||||
|
||||
cy.get(".spectrum-Menu").then($menu => {
|
||||
if ($menu.text().includes("Unpublish")) {
|
||||
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
||||
|
@ -327,16 +342,25 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
|
|||
|
||||
//Filters visible with 1 or more
|
||||
Cypress.Commands.add("searchForApplication", appName => {
|
||||
cy.wait(1000)
|
||||
// Searches for the app
|
||||
cy.get(".filter").then(() => {
|
||||
cy.get(".spectrum-Textfield").within(() => {
|
||||
cy.get("input").eq(0).clear()
|
||||
cy.get("input").eq(0).type(appName)
|
||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||
cy.wait(2000)
|
||||
|
||||
// No app filter functionality if only 1 app exists
|
||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||
.its("body")
|
||||
.then(val => {
|
||||
if (val.length < 2) {
|
||||
return
|
||||
} else {
|
||||
// Searches for the app
|
||||
cy.get(".filter").then(() => {
|
||||
cy.get(".spectrum-Textfield").within(() => {
|
||||
cy.get("input").eq(0).clear()
|
||||
cy.get("input").eq(0).type(appName)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// Confirms app exists after search
|
||||
cy.applicationInAppTable(appName)
|
||||
})
|
||||
|
||||
//Assumes there are no others
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -65,10 +65,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.104-alpha.0",
|
||||
"@budibase/client": "^1.0.104-alpha.0",
|
||||
"@budibase/frontend-core": "^1.0.104-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.104-alpha.0",
|
||||
"@budibase/bbui": "^1.0.105-alpha.7",
|
||||
"@budibase/client": "^1.0.105-alpha.7",
|
||||
"@budibase/frontend-core": "^1.0.105-alpha.7",
|
||||
"@budibase/string-templates": "^1.0.105-alpha.7",
|
||||
"@sentry/browser": "5.19.1",
|
||||
"@spectrum-css/page": "^3.0.1",
|
||||
"@spectrum-css/vars": "^3.0.1",
|
||||
|
|
|
@ -7,7 +7,11 @@ import {
|
|||
getComponentSettings,
|
||||
} from "./componentUtils"
|
||||
import { store } from "builderStore"
|
||||
import { queries as queriesStores, tables as tablesStore } from "stores/backend"
|
||||
import {
|
||||
queries as queriesStores,
|
||||
tables as tablesStore,
|
||||
roles as rolesStore,
|
||||
} from "stores/backend"
|
||||
import {
|
||||
makePropSafe,
|
||||
isJSBinding,
|
||||
|
@ -33,6 +37,7 @@ export const getBindableProperties = (asset, componentId) => {
|
|||
const deviceBindings = getDeviceBindings()
|
||||
const stateBindings = getStateBindings()
|
||||
const selectedRowsBindings = getSelectedRowsBindings(asset)
|
||||
const roleBindings = getRoleBindings()
|
||||
return [
|
||||
...contextBindings,
|
||||
...urlBindings,
|
||||
|
@ -40,6 +45,7 @@ export const getBindableProperties = (asset, componentId) => {
|
|||
...userBindings,
|
||||
...deviceBindings,
|
||||
...selectedRowsBindings,
|
||||
...roleBindings,
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -391,6 +397,16 @@ const getUrlBindings = asset => {
|
|||
}))
|
||||
}
|
||||
|
||||
const getRoleBindings = () => {
|
||||
return (get(rolesStore) || []).map(role => {
|
||||
return {
|
||||
type: "context",
|
||||
runtimeBinding: `trim "${role._id}"`,
|
||||
readableBinding: `Role.${role.name}`,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all bindable properties exposed in a button actions flow up until
|
||||
* the specified action ID, as well as context provided for the action
|
||||
|
|
|
@ -19,10 +19,22 @@
|
|||
export let value = defaultValue || (meta.type === "boolean" ? false : "")
|
||||
export let readonly
|
||||
|
||||
const resolveTimeStamp = timestamp => {
|
||||
let maskedDate = new Date(`0-${timestamp}`)
|
||||
if (maskedDate instanceof Date && !isNaN(maskedDate.getTime())) {
|
||||
return maskedDate
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
$: stringVal =
|
||||
typeof value === "object" ? JSON.stringify(value, null, 2) : value
|
||||
$: type = meta?.type
|
||||
$: label = meta.name ? capitalise(meta.name) : ""
|
||||
|
||||
const timeStamp = resolveTimeStamp(value)
|
||||
const isTimeStamp = timeStamp ? true : false
|
||||
</script>
|
||||
|
||||
{#if type === "options"}
|
||||
|
@ -34,7 +46,7 @@
|
|||
sort
|
||||
/>
|
||||
{:else if type === "datetime"}
|
||||
<DatePicker {label} bind:value />
|
||||
<DatePicker {label} timeOnly={isTimeStamp} bind:value />
|
||||
{:else if type === "attachment"}
|
||||
<Dropzone {label} bind:value />
|
||||
{:else if type === "boolean"}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div class="control">
|
||||
<div class="control" class:disabled>
|
||||
<Combobox
|
||||
{label}
|
||||
{disabled}
|
||||
|
@ -121,4 +121,8 @@
|
|||
background-color: var(--spectrum-global-color-gray-50);
|
||||
border-color: var(--spectrum-alias-border-color-hover);
|
||||
}
|
||||
|
||||
.control:not(.disabled) :global(.spectrum-Textfield-input) {
|
||||
padding-right: 40px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div class="control">
|
||||
<div class="control" class:disabled>
|
||||
<Input
|
||||
{label}
|
||||
{disabled}
|
||||
|
@ -103,4 +103,8 @@
|
|||
background-color: var(--spectrum-global-color-gray-50);
|
||||
border-color: var(--spectrum-alias-border-color-hover);
|
||||
}
|
||||
|
||||
.control:not(.disabled) :global(.spectrum-Textfield-input) {
|
||||
padding-right: 40px;
|
||||
}
|
||||
</style>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||
"main": "src/index.js",
|
||||
"bin": {
|
||||
|
|
|
@ -1123,9 +1123,9 @@ minimatch@^3.0.4:
|
|||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
|
||||
version "0.5.3"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"license": "MPL-2.0",
|
||||
"module": "dist/budibase-client.js",
|
||||
"main": "dist/budibase-client.js",
|
||||
|
@ -19,9 +19,9 @@
|
|||
"dev:builder": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.104-alpha.0",
|
||||
"@budibase/frontend-core": "^1.0.104-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.104-alpha.0",
|
||||
"@budibase/bbui": "^1.0.105-alpha.7",
|
||||
"@budibase/frontend-core": "^1.0.105-alpha.7",
|
||||
"@budibase/string-templates": "^1.0.105-alpha.7",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -66,6 +66,11 @@
|
|||
newTop = deviceBottom - 44
|
||||
}
|
||||
|
||||
//If element is at the very top of the screen, put the bar below the element
|
||||
if (elBounds.top < elBounds.height) {
|
||||
newTop = elBounds.bottom + verticalOffset
|
||||
}
|
||||
|
||||
// Horizontally, try to center first.
|
||||
// Failing that, render to left edge of component.
|
||||
// Failing that, render to right edge of component,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Budibase frontend core libraries used in builder and client",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.104-alpha.0",
|
||||
"@budibase/bbui": "^1.0.105-alpha.7",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -68,9 +68,9 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "^10.0.3",
|
||||
"@budibase/backend-core": "^1.0.104-alpha.0",
|
||||
"@budibase/client": "^1.0.104-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.104-alpha.0",
|
||||
"@budibase/backend-core": "^1.0.105-alpha.7",
|
||||
"@budibase/client": "^1.0.105-alpha.7",
|
||||
"@budibase/string-templates": "^1.0.105-alpha.7",
|
||||
"@bull-board/api": "^3.7.0",
|
||||
"@bull-board/koa": "^3.7.0",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
|
|
@ -14,6 +14,7 @@ CREATE TABLE Tasks (
|
|||
TaskID int NOT NULL AUTO_INCREMENT,
|
||||
PersonID INT,
|
||||
TaskName varchar(255),
|
||||
CreatedAt DATE,
|
||||
PRIMARY KEY (TaskID),
|
||||
CONSTRAINT fkPersons
|
||||
FOREIGN KEY(PersonID)
|
||||
|
@ -25,6 +26,6 @@ CREATE TABLE Products (
|
|||
updated time
|
||||
);
|
||||
INSERT INTO Persons (FirstName, LastName, Age, Address, City, CreatedAt) VALUES ('Mike', 'Hughes', 28.2, '123 Fake Street', 'Belfast', '2021-01-19 03:14:07');
|
||||
INSERT INTO Tasks (PersonID, TaskName) VALUES (1, 'assembling');
|
||||
INSERT INTO Tasks (PersonID, TaskName) VALUES (1, 'processing');
|
||||
INSERT INTO Tasks (PersonID, TaskName, CreatedAt) VALUES (1, 'assembling', '2020-01-01');
|
||||
INSERT INTO Tasks (PersonID, TaskName, CreatedAt) VALUES (2, 'processing', '2019-12-31');
|
||||
INSERT INTO Products (name, updated) VALUES ('Meat', '11:00:22'), ('Fruit', '10:00:00');
|
||||
|
|
|
@ -28,7 +28,7 @@ let inThread = false
|
|||
|
||||
module.exports = {
|
||||
// important
|
||||
PORT: process.env.PORT,
|
||||
PORT: process.env.PORT || process.env.APP_PORT,
|
||||
JWT_SECRET: process.env.JWT_SECRET,
|
||||
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
||||
MINIO_URL: process.env.MINIO_URL,
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
finaliseExternalTables,
|
||||
} from "./utils"
|
||||
import { DatasourcePlus } from "./base/datasourcePlus"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
module MySQLModule {
|
||||
const mysql = require("mysql2/promise")
|
||||
|
@ -86,10 +87,16 @@ module MySQLModule {
|
|||
if (typeof binding !== "string") {
|
||||
continue
|
||||
}
|
||||
const matches = binding.match(/^\d*/g)
|
||||
const matches = binding.match(/^\d*$/g)
|
||||
// check if number first
|
||||
if (matches && matches[0] !== "" && !isNaN(Number(matches[0]))) {
|
||||
bindings[i] = parseFloat(binding)
|
||||
}
|
||||
// if not a number, see if it is a date - important to do in this order as any
|
||||
// integer will be considered a valid date
|
||||
else if (dayjs(binding).isValid()) {
|
||||
bindings[i] = dayjs(binding).toDate()
|
||||
}
|
||||
}
|
||||
return bindings
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.0.104-alpha.0",
|
||||
"version": "1.0.105-alpha.7",
|
||||
"description": "Budibase background service",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -31,8 +31,8 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "^1.0.104-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.104-alpha.0",
|
||||
"@budibase/backend-core": "^1.0.105-alpha.7",
|
||||
"@budibase/string-templates": "^1.0.105-alpha.7",
|
||||
"@koa/router": "^8.0.0",
|
||||
"@sentry/node": "^6.0.0",
|
||||
"@techpass/passport-openidconnect": "^0.3.0",
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!LOADED && isDev() && !isTest()) {
|
|||
module.exports = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED),
|
||||
PORT: process.env.PORT,
|
||||
PORT: process.env.PORT || process.env.WORKER_PORT,
|
||||
CLUSTER_PORT: process.env.CLUSTER_PORT,
|
||||
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
||||
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
||||
|
|
|
@ -286,10 +286,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/backend-core@^1.0.98-alpha.2":
|
||||
version "1.0.98"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.98.tgz#8845bca2438408483374a74088332bdaae70771c"
|
||||
integrity sha512-aWKZBS/72w4PuTUCBl4Ogq0Vp0GPbn0Od/XL8CwrpXwuAlpqt1Bm5DOMGfG8iBmkC5uZRCwfhhzsoZruBpBTTQ==
|
||||
"@budibase/backend-core@^1.0.104":
|
||||
version "1.0.104"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.104.tgz#eb435c27327a1f2ea5e83b3cf242b9f85b7a5f8a"
|
||||
integrity sha512-YXI8R/bdWDO5RhcMdqu88DQ7Dn26v3SUTs5FuHvXG4b2mKDTHduecqTuhIhrbqQ5KjnTYuhAEz2iG0sP2rj5rg==
|
||||
dependencies:
|
||||
"@techpass/passport-openidconnect" "^0.3.0"
|
||||
aws-sdk "^2.901.0"
|
||||
|
@ -335,10 +335,10 @@
|
|||
to-gfm-code-block "^0.1.1"
|
||||
year "^0.2.1"
|
||||
|
||||
"@budibase/string-templates@^1.0.98-alpha.2":
|
||||
version "1.0.98"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.98.tgz#a00f97b7a899ac1f5a4efbe39c0ac6ee99e1ab59"
|
||||
integrity sha512-8u9WQAm+EVfTfb75bn8n0d86EtSevwkEEm7e7vaLPnq7vFHB7IjHyRiBiV4TuyVPXeq4qSlCdXYDosECaG3gLg==
|
||||
"@budibase/string-templates@^1.0.104":
|
||||
version "1.0.104"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.104.tgz#f812700f2b21f638fd1e48dde065ae693fae2897"
|
||||
integrity sha512-3caq3qwpIieyb9m8eSl8OhcE0ppzuyJ/0ubDlWmtpbmwmG2v3ynI+DwxpbG4CcVQFuebD2yxU0CZfioU76vKCQ==
|
||||
dependencies:
|
||||
"@budibase/handlebars-helpers" "^0.11.8"
|
||||
dayjs "^1.10.4"
|
||||
|
@ -4821,9 +4821,9 @@ mimic-response@^3.1.0:
|
|||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.2.0, minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
mixin-deep@^1.2.0:
|
||||
version "1.3.2"
|
||||
|
|
|
@ -3936,9 +3936,9 @@ minimist-options@^3.0.1:
|
|||
is-plain-obj "^1.1.0"
|
||||
|
||||
minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
|
||||
|
||||
minipass@^2.3.5, minipass@^2.6.0, minipass@^2.9.0:
|
||||
version "2.9.0"
|
||||
|
|
Loading…
Reference in New Issue