Merge branch 'master' into qa-core-changes

This commit is contained in:
Mitch-Budibase 2024-02-02 15:28:44 +00:00
commit abe4e57961
29 changed files with 89 additions and 58 deletions

View File

@ -45,6 +45,16 @@
"no-prototype-builtins": "off",
"local-rules/no-budibase-imports": "error"
}
},
{
"files": [
"packages/builder/**/*",
"packages/client/**/*",
"packages/frontend-core/**/*"
],
"rules": {
"no-console": ["error", { "allow": ["warn", "error", "debug"] } ]
}
}
],
"rules": {

View File

@ -1,5 +1,5 @@
{
"version": "2.16.1",
"version": "2.17.2",
"npmClient": "yarn",
"packages": [
"packages/*",

@ -1 +1 @@
Subproject commit 485ec16a9eed48c548a5f1239772139f3319f028
Subproject commit 52f51dcfb96d3fe58c8cc7a905e7d733f7cd84c2

View File

@ -7,7 +7,7 @@ import tar from "tar-fs"
import zlib from "zlib"
import { promisify } from "util"
import { join } from "path"
import fs from "fs"
import fs, { ReadStream } from "fs"
import env from "../environment"
import { budibaseTempDir } from "./utils"
import { v4 } from "uuid"
@ -184,7 +184,7 @@ export async function upload({
export async function streamUpload(
bucketName: string,
filename: string,
stream: any,
stream: ReadStream | ReadableStream,
extra = {}
) {
const objectStore = ObjectStore(bucketName)

View File

@ -364,7 +364,6 @@ const getContextBindings = (asset, componentId) => {
* Generates a set of bindings for a given component context
*/
const generateComponentContextBindings = (asset, componentContext) => {
console.log("Hello ")
const { component, definition, contexts } = componentContext
if (!component || !definition || !contexts?.length) {
return []

View File

@ -158,6 +158,7 @@ export const getFrontendStore = () => {
...INITIAL_FRONTEND_STATE.features,
...application.features,
},
automations: application.automations || {},
icon: application.icon || {},
initialised: true,
}))

View File

@ -21,7 +21,7 @@ export const createBuilderWebsocket = appId => {
})
})
socket.on("connect_error", err => {
console.log("Failed to connect to builder websocket:", err.message)
console.error("Failed to connect to builder websocket:", err.message)
})
socket.on("disconnect", () => {
userStore.actions.reset()

View File

@ -157,6 +157,7 @@
let bindings = []
let loopBlockCount = 0
const addBinding = (name, value, icon, idx, isLoopBlock, bindingName) => {
if (!name) return
const runtimeBinding = determineRuntimeBinding(name, idx, isLoopBlock)
const categoryName = determineCategoryName(idx, isLoopBlock, bindingName)
@ -291,7 +292,6 @@
loopBlockCount++
continue
}
Object.entries(schema).forEach(([name, value]) =>
addBinding(name, value, icon, idx, isLoopBlock, bindingName)
)

View File

@ -312,7 +312,7 @@ export const insertBinding = (view, from, to, text, mode) => {
} else if (mode.name == "handlebars") {
parsedInsert = hbInsert(view.state.doc?.toString(), from, to, text)
} else {
console.log("Unsupported")
console.warn("Unsupported")
return
}

View File

@ -67,7 +67,7 @@
}))
navigateStep(target)
} else {
console.log("Could not retrieve step")
console.warn("Could not retrieve step")
}
} else {
if (typeof tourStep.onComplete === "function") {

View File

@ -3,11 +3,11 @@ import { get } from "svelte/store"
const registerNode = async (node, tourStepKey) => {
if (!node) {
console.log("Tour Handler - an anchor node is required")
console.warn("Tour Handler - an anchor node is required")
}
if (!get(store).tourKey) {
console.log("Tour Handler - No active tour ", tourStepKey, node)
console.error("Tour Handler - No active tour ", tourStepKey, node)
return
}

View File

@ -45,7 +45,7 @@ const endUserOnboarding = async ({ skipped = false } = {}) => {
onboarding: false,
}))
} catch (e) {
console.log("Onboarding failed", e)
console.error("Onboarding failed", e)
return false
}
return true

View File

@ -52,7 +52,7 @@ export const syncURLToState = options => {
let cachedPage = get(routify.page)
let previousParamsHash = null
let debug = false
const log = (...params) => debug && console.log(`[${urlParam}]`, ...params)
const log = (...params) => debug && console.debug(`[${urlParam}]`, ...params)
// Navigate to a certain URL
const gotoUrl = (url, params) => {

View File

@ -107,7 +107,7 @@
return
}
if (!prodAppId) {
console.log("Application id required")
console.error("Application id required")
return
}
await usersFetch.update({

View File

@ -66,7 +66,7 @@
try {
await store.actions.screens.updateSetting(get(selectedScreen), key, value)
} catch (error) {
console.log(error)
console.error(error)
notifications.error("Error saving screen settings")
}
}

View File

@ -71,7 +71,7 @@
$goto(`./${screenId}`)
store.actions.screens.select(screenId)
} catch (error) {
console.log(error)
console.error(error)
notifications.error("Error creating screens")
}
}

View File

@ -36,15 +36,12 @@
let status = null
let timeRange = null
let loaded = false
$: app = $apps.find(app => app.devId === $store.appId?.includes(app.appId))
$: app = $apps.find(app => $store.appId?.includes(app.appId))
$: licensePlan = $auth.user?.license?.plan
$: page = $pageInfo.page
$: fetchLogs(automationId, status, page, timeRange)
$: isCloud = $admin.cloud
$: chainAutomations = app?.automations?.chainAutomations ?? !isCloud
const timeOptions = [
{ value: "90-d", label: "Past 90 days" },
{ value: "30-d", label: "Past 30 days" },

View File

@ -13,6 +13,7 @@
import CreateRestoreModal from "./CreateRestoreModal.svelte"
import { createEventDispatcher } from "svelte"
import { isOnlyUser } from "builderStore"
import { BackupType } from "constants/backend/backups"
export let row
@ -42,12 +43,11 @@
</script>
<div class="cell">
{#if row.type !== BackupType.RESTORE}
<ActionMenu align="right">
<div slot="control">
<Icon size="M" hoverable name="MoreSmallList" />
</div>
{#if row.type !== "restore"}
<AbsTooltip
position={TooltipPosition.Left}
text="Unavailable - another user is editing this app"
@ -62,8 +62,8 @@
</AbsTooltip>
<MenuItem on:click={deleteDialog.show} icon="Delete">Delete</MenuItem>
<MenuItem on:click={downloadExport} icon="Download">Download</MenuItem>
{/if}
</ActionMenu>
{/if}
</div>
<Modal bind:this={restoreBackupModal}>

View File

@ -31,7 +31,7 @@
async function login() {
form.validate()
if (Object.keys(errors).length > 0) {
console.log("errors", errors)
console.error("errors", errors)
return
}
try {

View File

@ -307,7 +307,7 @@
// Reset view
resetView()
} catch (e) {
console.log("There was a problem with the map", e)
console.error("There was a problem with the map", e)
}
}

View File

@ -61,7 +61,7 @@
resolve({ initialised: true })
})
.catch(err => {
console.log("There was a problem scanning the image", err)
console.error("There was a problem scanning the image", err)
resolve({ initialised: false })
})
})

View File

@ -28,6 +28,7 @@ import { fetchDatasourceSchema } from "./utils/schema.js"
import { getAPIKey } from "./utils/api.js"
import { enrichButtonActions } from "./utils/buttonActions.js"
import { processStringSync, makePropSafe } from "@budibase/string-templates"
import { fetchData, LuceneUtils } from "@budibase/frontend-core"
export default {
API,
@ -54,6 +55,8 @@ export default {
linkable,
getAction,
fetchDatasourceSchema,
fetchData,
LuceneUtils,
ContextScopes,
getAPIKey,
enrichButtonActions,

View File

@ -14,7 +14,7 @@ const createOrgStore = () => {
const settingsConfigDoc = await API.getTenantConfig(tenantId)
set({ logoUrl: settingsConfigDoc.config.logoUrl })
} catch (e) {
console.log("Could not init org ", e)
console.error("Could not init org ", e)
}
}

View File

@ -211,7 +211,6 @@ const deleteRowHandler = async action => {
const triggerAutomationHandler = async action => {
const { fields, notificationOverride, timeout } = action.parameters
if (fields) {
try {
const result = await API.triggerAutomation({
automationId: action.parameters.automationId,
@ -234,7 +233,6 @@ const triggerAutomationHandler = async action => {
// Abort next actions
return false
}
}
}
const navigationHandler = action => {
const { url, peek, externalNewTab } = action.parameters

View File

@ -29,7 +29,7 @@ export const createGridWebsocket = context => {
connectToDatasource(get(datasource))
})
socket.on("connect_error", err => {
console.log("Failed to connect to grid websocket:", err.message)
console.error("Failed to connect to grid websocket:", err.message)
})
// User events

@ -1 +1 @@
Subproject commit eb9565f568cfef14b336b14eee753119acfdd43b
Subproject commit 4f9616f163039a0eea81319d8e2288340a2ebc79

View File

@ -1,7 +1,13 @@
import fs from "fs"
import { join } from "path"
module AwsMock {
const aws: any = {}
const response = (body: any) => () => ({ promise: () => body })
const response = (body: any, extra?: any) => () => ({
promise: () => body,
...extra,
})
function DocumentClient() {
// @ts-ignore
@ -73,9 +79,18 @@ module AwsMock {
// @ts-ignore
this.getObject = jest.fn(
response({
response(
{
Body: "",
})
},
{
createReadStream: jest
.fn()
.mockReturnValue(
fs.createReadStream(join(__dirname, "aws-sdk.ts"))
),
}
)
)
}

View File

@ -445,6 +445,9 @@ export async function update(ctx: UserCtx) {
name: app.name,
url: app.url,
icon: app.icon,
automations: {
chainAutomations: app.automations?.chainAutomations,
},
})
}

View File

@ -165,8 +165,9 @@ export async function importApp(
const isTar = template.file && template?.file?.type?.endsWith("gzip")
const isDirectory =
template.file && fs.lstatSync(template.file.path).isDirectory()
let tmpPath: string | undefined = undefined
if (template.file && (isTar || isDirectory)) {
const tmpPath = isTar ? await untarFile(template.file) : template.file.path
tmpPath = isTar ? await untarFile(template.file) : template.file.path
if (isTar && template.file.password) {
await decryptFiles(tmpPath, template.file.password)
}
@ -208,5 +209,9 @@ export async function importApp(
}
await updateAttachmentColumns(prodAppId, db)
await updateAutomations(prodAppId, db)
// clear up afterward
if (tmpPath) {
fs.rmSync(tmpPath, { recursive: true, force: true })
}
return ok
}