1
0
Fork 0
mirror of synced 2024-09-11 23:16:00 +12:00

Merge remote-tracking branch 'origin/develop' into feature/user-side-panel-ux-updates

This commit is contained in:
Dean 2023-05-02 09:20:08 +01:00
commit 530c4fb00f
31 changed files with 145 additions and 110 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": ["packages/*"],

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": {
"@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.5.6-alpha.35",
"@budibase/types": "2.5.6-alpha.41",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View file

@ -3,7 +3,6 @@ import {
Event,
LicenseActivatedEvent,
LicensePlanChangedEvent,
LicenseTierChangedEvent,
PlanType,
Account,
LicensePortalOpenedEvent,
@ -11,22 +10,22 @@ import {
LicenseCheckoutOpenedEvent,
LicensePaymentFailedEvent,
LicensePaymentRecoveredEvent,
PriceDuration,
} from "@budibase/types"
async function tierChanged(account: Account, from: number, to: number) {
const properties: LicenseTierChangedEvent = {
accountId: account.accountId,
to,
from,
}
await publishEvent(Event.LICENSE_TIER_CHANGED, properties)
}
async function planChanged(account: Account, from: PlanType, to: PlanType) {
async function planChanged(
account: Account,
from: PlanType,
to: PlanType,
quantity: number | undefined,
duration: PriceDuration | undefined
) {
const properties: LicensePlanChangedEvent = {
accountId: account.accountId,
to,
from,
quantity,
duration,
}
await publishEvent(Event.LICENSE_PLAN_CHANGED, properties)
}
@ -74,7 +73,6 @@ async function paymentRecovered(account: Account) {
}
export default {
tierChanged,
planChanged,
activated,
checkoutOpened,

View file

@ -123,7 +123,6 @@ beforeAll(async () => {
jest.spyOn(events.plugin, "imported")
jest.spyOn(events.plugin, "deleted")
jest.spyOn(events.license, "tierChanged")
jest.spyOn(events.license, "planChanged")
jest.spyOn(events.license, "activated")
jest.spyOn(events.license, "checkoutOpened")

View file

@ -7,16 +7,30 @@ import {
PlanType,
PriceDuration,
PurchasedPlan,
PurchasedPrice,
Quotas,
Subscription,
} from "@budibase/types"
export function price(): PurchasedPrice {
return {
amount: 10000,
amountMonthly: 10000,
currency: "usd",
duration: PriceDuration.MONTHLY,
priceId: "price_123",
dayPasses: undefined,
isPerUser: true,
}
}
export const plan = (type: PlanType = PlanType.FREE): PurchasedPlan => {
return {
type,
usesInvoicing: false,
minUsers: 1,
model: PlanModel.PER_USER,
price: price(),
}
}

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/shared-core": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,10 +58,10 @@
}
},
"dependencies": {
"@budibase/bbui": "2.5.6-alpha.35",
"@budibase/frontend-core": "2.5.6-alpha.35",
"@budibase/shared-core": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/bbui": "2.5.6-alpha.41",
"@budibase/frontend-core": "2.5.6-alpha.41",
"@budibase/shared-core": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",

View file

@ -43,12 +43,18 @@
}
$: quotaUsage = $licensing.quotaUsage
$: license = $auth.user?.license
$: plan = license?.plan
$: usesInvoicing = plan?.usesInvoicing
$: accountPortalAccess = $auth?.user?.accountPortalAccess
$: quotaReset = quotaUsage?.quotaReset
$: canManagePlan =
($admin.cloud && accountPortalAccess) || (!$admin.cloud && $auth.isAdmin)
$: showButton = !usesInvoicing && accountPortalAccess
const setMonthlyUsage = () => {
monthlyUsage = []
if (quotaUsage.monthly) {
@ -121,7 +127,7 @@
const setTextRows = () => {
textRows = []
if (cancelAt) {
if (cancelAt && !usesInvoicing) {
textRows.push({ message: "Subscription has been cancelled" })
textRows.push({
message: `${getDaysRemaining(cancelAt)} days remaining`,
@ -213,7 +219,7 @@
description="YOUR CURRENT PLAN"
title={planTitle()}
{primaryActionText}
primaryAction={accountPortalAccess ? goToAccountPortal : undefined}
primaryAction={showButton ? goToAccountPortal : undefined}
{textRows}
>
<div class="content">
@ -224,33 +230,23 @@
<Usage {usage} warnWhenFull={WARN_USAGE.includes(usage.name)} />
</div>
{/each}
<Layout gap="XS" noPadding>
<Heading size="S">Monthly limits</Heading>
<div class="detail">
<TooltipWrapper tooltip={new Date(quotaReset)}>
<Detail size="M">
Resets in {daysRemainingInMonth} days
</Detail>
</TooltipWrapper>
</div>
</Layout>
<Layout noPadding gap="M">
{#each monthlyUsage as usage}
<Usage {usage} warnWhenFull={WARN_USAGE.includes(usage.name)} />
{/each}
</Layout>
</Layout>
</div>
{#if monthlyUsage.length}
<div class="column">
<Layout noPadding gap="M">
<Layout gap="XS" noPadding>
<Heading size="S">Monthly limits</Heading>
<div class="detail">
<TooltipWrapper tooltip={new Date(quotaReset)}>
<Detail size="M">
Resets in {daysRemainingInMonth} days
</Detail>
</TooltipWrapper>
</div>
</Layout>
<Layout noPadding gap="M">
{#each monthlyUsage as usage}
<Usage
{usage}
warnWhenFull={WARN_USAGE.includes(usage.name)}
/>
{/each}
</Layout>
</Layout>
</div>
{/if}
</div>
</DashCard>
</Layout>

View file

@ -176,7 +176,7 @@
<Heading>Backups</Heading>
{#if !$licensing.backupsEnabled}
<Tags>
<Tag icon="LockClosed">Pro plan</Tag>
<Tag icon="LockClosed">Premium</Tag>
</Tags>
{/if}
</div>

View file

@ -378,7 +378,7 @@
</div>
{#if !$licensing.enforceableSSO}
<Tags>
<Tag icon="LockClosed">Enterprise plan</Tag>
<Tag icon="LockClosed">Enterprise</Tag>
</Tags>
{/if}
</div>

View file

@ -213,7 +213,7 @@
{/if}
{#if isCloud && !brandingEnabled}
<Tags>
<Tag icon="LockClosed">Pro</Tag>
<Tag icon="LockClosed">Premium</Tag>
</Tags>
{/if}
</div>

View file

@ -94,7 +94,7 @@
<Heading size="M">Groups</Heading>
{#if !$licensing.groupsEnabled}
<Tags>
<Tag icon="LockClosed">Pro plan</Tag>
<Tag icon="LockClosed">Business</Tag>
</Tags>
{/if}
</div>

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js",
"bin": {
@ -29,9 +29,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/types": "2.5.6-alpha.35",
"@budibase/backend-core": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@budibase/types": "2.5.6-alpha.41",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.5.6-alpha.35",
"@budibase/frontend-core": "2.5.6-alpha.35",
"@budibase/shared-core": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/types": "2.5.6-alpha.35",
"@budibase/bbui": "2.5.6-alpha.41",
"@budibase/frontend-core": "2.5.6-alpha.41",
"@budibase/shared-core": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@budibase/types": "2.5.6-alpha.41",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View file

@ -1,13 +1,13 @@
{
"name": "@budibase/frontend-core",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.5.6-alpha.35",
"@budibase/shared-core": "2.5.6-alpha.35",
"@budibase/bbui": "2.5.6-alpha.41",
"@budibase/shared-core": "2.5.6-alpha.41",
"dayjs": "^1.11.7",
"lodash": "^4.17.21",
"socket.io-client": "^4.6.1",

View file

@ -1,5 +1,6 @@
<script>
import { onMount, tick } from "svelte"
import { clickOutside } from "@budibase/bbui"
export let value
export let focused = false
@ -60,6 +61,7 @@
on:change={handleChange}
on:wheel|stopPropagation
spellcheck="false"
use:clickOutside={close}
/>
{:else}
<div class="long-form-cell" on:click={editable ? open : null} class:editable>

View file

@ -2,6 +2,13 @@
import TextCell from "./TextCell.svelte"
export let api
export let onChange
const numberOnChange = value => {
const float = parseFloat(value)
const newValue = isNaN(float) ? null : float
onChange(newValue)
}
</script>
<TextCell {...$$props} bind:api type="number" />
<TextCell {...$$props} onChange={numberOnChange} bind:api type="number" />

View file

@ -1,5 +1,5 @@
<script>
import { Icon } from "@budibase/bbui"
import { Icon, clickOutside } from "@budibase/bbui"
import { getColor } from "../lib/utils"
import { onMount } from "svelte"
@ -118,6 +118,7 @@
class:invertX
class:invertY
on:wheel={e => e.stopPropagation()}
use:clickOutside={close}
>
{#each options as option, idx}
{@const color = getOptionColor(option)}

View file

@ -18,7 +18,7 @@
<script>
import { getColor } from "../lib/utils"
import { onMount, getContext } from "svelte"
import { Icon, Input, ProgressCircle } from "@budibase/bbui"
import { Icon, Input, ProgressCircle, clickOutside } from "@budibase/bbui"
import { debounce } from "../../../utils/utils"
export let value
@ -284,7 +284,13 @@
</div>
{#if isOpen}
<div class="dropdown" class:invertX class:invertY on:wheel|stopPropagation>
<div
class="dropdown"
class:invertX
class:invertY
on:wheel|stopPropagation
use:clickOutside={close}
>
<div class="search">
<Input
autofocus

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -45,12 +45,12 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.5.6-alpha.35",
"@budibase/client": "2.5.6-alpha.35",
"@budibase/pro": "2.5.6-alpha.35",
"@budibase/shared-core": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/types": "2.5.6-alpha.35",
"@budibase/backend-core": "2.5.6-alpha.41",
"@budibase/client": "2.5.6-alpha.41",
"@budibase/pro": "2.5.6-alpha.41",
"@budibase/shared-core": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@budibase/types": "2.5.6-alpha.41",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View file

@ -27,6 +27,7 @@ export const isProdAppID = dbCore.isProdAppID
export const USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${dbCore.InternalTable.USER_METADATA}${SEPARATOR}`
export const LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${dbCore.InternalTable.USER_METADATA}${SEPARATOR}`
export const TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`
export const AUTOMATION_LOG_PREFIX = `${DocumentType.AUTOMATION_LOG}${SEPARATOR}`
export const ViewName = dbCore.ViewName
export const InternalTables = dbCore.InternalTable
export const UNICODE_MAX = dbCore.UNICODE_MAX

View file

@ -3,6 +3,7 @@ import { budibaseTempDir } from "../../../utilities/budibaseDir"
import { streamFile, createTempFolder } from "../../../utilities/fileSystem"
import { ObjectStoreBuckets } from "../../../constants"
import {
AUTOMATION_LOG_PREFIX,
LINK_USER_METADATA_PREFIX,
TABLE_ROW_PREFIX,
USER_METDATA_PREFIX,
@ -20,11 +21,15 @@ const uuid = require("uuid/v4")
const tar = require("tar")
const MemoryStream = require("memorystream")
type ExportOpts = {
interface DBDumpOpts {
filter?: any
exportPath?: string
}
interface ExportOpts extends DBDumpOpts {
tar?: boolean
excludeRows?: boolean
excludeLogs?: boolean
}
function tarFilesToTmp(tmpDir: string, files: string[]) {
@ -49,7 +54,7 @@ function tarFilesToTmp(tmpDir: string, files: string[]) {
* a filter function or the name of the export.
* @return {*} either a readable stream or a string
*/
export async function exportDB(dbName: string, opts: ExportOpts = {}) {
export async function exportDB(dbName: string, opts: DBDumpOpts = {}) {
const exportOpts = {
filter: opts?.filter,
batch_size: 1000,
@ -76,11 +81,14 @@ export async function exportDB(dbName: string, opts: ExportOpts = {}) {
})
}
function defineFilter(excludeRows?: boolean) {
function defineFilter(excludeRows?: boolean, excludeLogs?: boolean) {
const ids = [USER_METDATA_PREFIX, LINK_USER_METADATA_PREFIX]
if (excludeRows) {
ids.push(TABLE_ROW_PREFIX)
}
if (excludeLogs) {
ids.push(AUTOMATION_LOG_PREFIX)
}
return (doc: any) =>
!ids.map(key => doc._id.includes(key)).reduce((prev, curr) => prev || curr)
}
@ -130,8 +138,7 @@ export async function exportApp(appId: string, config?: ExportOpts) {
// enforce an export of app DB to the tmp path
const dbPath = join(tmpPath, DB_EXPORT_FILE)
await exportDB(appId, {
...config,
filter: defineFilter(config?.excludeRows),
filter: defineFilter(config?.excludeRows, config?.excludeLogs),
exportPath: dbPath,
})
// if tar requested, return where the tarball is
@ -155,6 +162,10 @@ export async function exportApp(appId: string, config?: ExportOpts) {
* @returns {*} a readable stream of the backup which is written in real time
*/
export async function streamExportApp(appId: string, excludeRows: boolean) {
const tmpPath = await exportApp(appId, { excludeRows, tar: true })
const tmpPath = await exportApp(appId, {
excludeRows,
excludeLogs: true,
tar: true,
})
return streamFile(tmpPath)
}

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/shared-core",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Shared data utils",
"main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
},
"dependencies": {
"@budibase/types": "2.5.6-alpha.35"
"@budibase/types": "2.5.6-alpha.41"
},
"devDependencies": {
"concurrently": "^7.6.0",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase types",
"main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts",

View file

@ -39,6 +39,7 @@ export interface Account extends CreateAccount {
// licensing
tier: string // deprecated
planType?: PlanType
/** @deprecated */
planTier?: number
license?: License
installId?: string
@ -47,6 +48,7 @@ export interface Account extends CreateAccount {
stripeCustomerId?: string
licenseKey?: string
licenseKeyActivatedAt?: number
licenseRequestedAt?: number
licenseOverrides?: LicenseOverrides
quotaUsage?: QuotaUsage
}

View file

@ -138,7 +138,6 @@ export enum Event {
// LICENSE
LICENSE_PLAN_CHANGED = "license:plan:changed",
LICENSE_TIER_CHANGED = "license:tier:changed",
LICENSE_ACTIVATED = "license:activated",
LICENSE_PAYMENT_FAILED = "license:payment:failed",
LICENSE_PAYMENT_RECOVERED = "license:payment:recovered",
@ -328,7 +327,6 @@ export const AuditedEventFriendlyName: Record<Event, string | undefined> = {
// LICENSE - NOT AUDITED
[Event.LICENSE_PLAN_CHANGED]: undefined,
[Event.LICENSE_TIER_CHANGED]: undefined,
[Event.LICENSE_ACTIVATED]: undefined,
[Event.LICENSE_PAYMENT_FAILED]: undefined,
[Event.LICENSE_PAYMENT_RECOVERED]: undefined,

View file

@ -1,15 +1,15 @@
import { PlanType } from "../licensing"
export interface LicenseTierChangedEvent {
accountId: string
from: number
to: number
}
import { PlanType, PriceDuration } from "../licensing"
export interface LicensePlanChangedEvent {
accountId: string
from: PlanType
to: PlanType
// may not be on historical events
// free plans won't have a duration
duration: PriceDuration | undefined
// may not be on historical events
// free plans won't have a quantity
quantity: number | undefined
}
export interface LicenseActivatedEvent {

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.5.6-alpha.35",
"version": "2.5.6-alpha.41",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -37,10 +37,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.5.6-alpha.35",
"@budibase/pro": "2.5.6-alpha.35",
"@budibase/string-templates": "2.5.6-alpha.35",
"@budibase/types": "2.5.6-alpha.35",
"@budibase/backend-core": "2.5.6-alpha.41",
"@budibase/pro": "2.5.6-alpha.41",
"@budibase/string-templates": "2.5.6-alpha.41",
"@budibase/types": "2.5.6-alpha.41",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View file

@ -1486,15 +1486,15 @@
pouchdb-promise "^6.0.4"
through2 "^2.0.0"
"@budibase/pro@2.5.6-alpha.34":
version "2.5.6-alpha.34"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.34.tgz#b992dd7830479e1e869c03fedc11b552d0cea2ca"
integrity sha512-mK/gVZuR+3USPQidTq+xSm0H5VRX2/DgWNOoDp2b8XzrHeTDPV/Qy7yJd3Cxidemk25+ddwbU/VRrPMa+6PKSw==
"@budibase/pro@2.5.6-alpha.40":
version "2.5.6-alpha.40"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.40.tgz#96e85d22b61425bfd055377864938245c6ef17ec"
integrity sha512-hWKPVbGbjWcO3evIViICOL6g4hsv051lwUqCLRdZnSIiKCPlrr5JSsiINFinMHof55rHK5LALbGzJL4Ju82UeQ==
dependencies:
"@budibase/backend-core" "2.5.6-alpha.34"
"@budibase/backend-core" "2.5.6-alpha.40"
"@budibase/shared-core" "2.4.44-alpha.1"
"@budibase/string-templates" "2.4.44-alpha.1"
"@budibase/types" "2.5.6-alpha.34"
"@budibase/types" "2.5.6-alpha.40"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"