Merge branch 'develop' into account-portal-auth-api-testing-2
This commit is contained in:
commit
27ce59eaa2
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.9.39-alpha.5",
|
"version": "2.9.39-alpha.9",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -2,3 +2,5 @@
|
||||||
!dist/**/*
|
!dist/**/*
|
||||||
dist/tsconfig.build.tsbuildinfo
|
dist/tsconfig.build.tsbuildinfo
|
||||||
!package.json
|
!package.json
|
||||||
|
!src/**
|
||||||
|
!tests/**
|
|
@ -4,13 +4,6 @@
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
"typesVersions": {
|
|
||||||
"*": {
|
|
||||||
"tests": [
|
|
||||||
"./dist/tests/index.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./dist/index.js",
|
".": "./dist/index.js",
|
||||||
"./tests": "./dist/tests/index.js",
|
"./tests": "./dist/tests/index.js",
|
||||||
|
@ -21,7 +14,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist/",
|
"prebuild": "rimraf dist/",
|
||||||
"prepack": "cp package.json dist",
|
"prepack": "cp package.json dist",
|
||||||
"build": "node ./scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly --paths null",
|
"build": "tsc -p tsconfig.build.json --paths null && node ./scripts/build.js",
|
||||||
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
||||||
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
|
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
|
||||||
"test": "bash scripts/test.sh",
|
"test": "bash scripts/test.sh",
|
||||||
|
|
|
@ -1,22 +1,4 @@
|
||||||
#!/usr/bin/node
|
#!/usr/bin/node
|
||||||
|
|
||||||
const coreBuild = require("../../../scripts/build")
|
const coreBuild = require("../../../scripts/build")
|
||||||
|
|
||||||
coreBuild("./src/plugin/index.ts", "./dist/plugins.js")
|
|
||||||
coreBuild("./src/index.ts", "./dist/index.js")
|
coreBuild("./src/index.ts", "./dist/index.js")
|
||||||
|
|
||||||
const glob = require("glob")
|
|
||||||
const inputFiles = [
|
|
||||||
...glob.sync("./src/**/*.[tj]s", { nodir: true }),
|
|
||||||
...glob.sync("./tests/**/*.[tj]s", { nodir: true }),
|
|
||||||
]
|
|
||||||
|
|
||||||
const path = require("path")
|
|
||||||
for (const file of inputFiles) {
|
|
||||||
coreBuild(file, `./${path.join("dist", file.replace(/\.ts$/, ".js"))}`, {
|
|
||||||
skipMeta: true,
|
|
||||||
bundle: false,
|
|
||||||
forcedFormat: "cjs",
|
|
||||||
silent: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
bind:this={button}
|
bind:this={button}
|
||||||
>
|
>
|
||||||
{#if fieldIcon}
|
{#if fieldIcon}
|
||||||
{#if !useOptionIconImage}x
|
{#if !useOptionIconImage}
|
||||||
<span class="option-extra icon">
|
<span class="option-extra icon">
|
||||||
<Icon size="S" name={fieldIcon} />
|
<Icon size="S" name={fieldIcon} />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -955,7 +955,9 @@ export const buildFormSchema = (component, asset) => {
|
||||||
const patched = convertOldFieldFormat(component.fields || [])
|
const patched = convertOldFieldFormat(component.fields || [])
|
||||||
patched?.forEach(({ field, active }) => {
|
patched?.forEach(({ field, active }) => {
|
||||||
if (!active) return
|
if (!active) return
|
||||||
schema[field] = { type: info?.schema[field].type }
|
if (info?.schema[field]) {
|
||||||
|
schema[field] = { type: info?.schema[field].type }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -627,6 +627,7 @@ export const getFrontendStore = () => {
|
||||||
component[setting.key] = {
|
component[setting.key] = {
|
||||||
label: defaultDS.name,
|
label: defaultDS.name,
|
||||||
tableId: defaultDS._id,
|
tableId: defaultDS._id,
|
||||||
|
resourceId: defaultDS._id,
|
||||||
type: "table",
|
type: "table",
|
||||||
}
|
}
|
||||||
} else if (setting.type === "dataProvider") {
|
} else if (setting.type === "dataProvider") {
|
||||||
|
@ -1245,6 +1246,13 @@ export const getFrontendStore = () => {
|
||||||
const settings = getComponentSettings(component._component)
|
const settings = getComponentSettings(component._component)
|
||||||
const updatedSetting = settings.find(setting => setting.key === name)
|
const updatedSetting = settings.find(setting => setting.key === name)
|
||||||
|
|
||||||
|
const resetFields = settings.filter(
|
||||||
|
setting => name === setting.resetOn
|
||||||
|
)
|
||||||
|
resetFields?.forEach(setting => {
|
||||||
|
component[setting.key] = null
|
||||||
|
})
|
||||||
|
|
||||||
if (
|
if (
|
||||||
updatedSetting?.type === "dataSource" ||
|
updatedSetting?.type === "dataSource" ||
|
||||||
updatedSetting?.type === "table"
|
updatedSetting?.type === "table"
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default function (datasources) {
|
||||||
}
|
}
|
||||||
return datasources.map(datasource => {
|
return datasources.map(datasource => {
|
||||||
return {
|
return {
|
||||||
name: `${datasource.name} - List`,
|
name: `${datasource.label} - List`,
|
||||||
create: () => createScreen(datasource),
|
create: () => createScreen(datasource),
|
||||||
id: ROW_LIST_TEMPLATE,
|
id: ROW_LIST_TEMPLATE,
|
||||||
resourceId: datasource.resourceId,
|
resourceId: datasource.resourceId,
|
||||||
|
@ -17,13 +17,13 @@ export default function (datasources) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ROW_LIST_TEMPLATE = "ROW_LIST_TEMPLATE"
|
export const ROW_LIST_TEMPLATE = "ROW_LIST_TEMPLATE"
|
||||||
export const rowListUrl = datasource => sanitizeUrl(`/${datasource.name}`)
|
export const rowListUrl = datasource => sanitizeUrl(`/${datasource.label}`)
|
||||||
|
|
||||||
const generateTableBlock = datasource => {
|
const generateTableBlock = datasource => {
|
||||||
const tableBlock = new Component("@budibase/standard-components/tableblock")
|
const tableBlock = new Component("@budibase/standard-components/tableblock")
|
||||||
tableBlock
|
tableBlock
|
||||||
.customProps({
|
.customProps({
|
||||||
title: datasource.name,
|
title: datasource.label,
|
||||||
dataSource: datasource,
|
dataSource: datasource,
|
||||||
sortOrder: "Ascending",
|
sortOrder: "Ascending",
|
||||||
size: "spectrum--medium",
|
size: "spectrum--medium",
|
||||||
|
@ -34,14 +34,14 @@ const generateTableBlock = datasource => {
|
||||||
titleButtonText: "Create row",
|
titleButtonText: "Create row",
|
||||||
titleButtonClickBehaviour: "new",
|
titleButtonClickBehaviour: "new",
|
||||||
})
|
})
|
||||||
.instanceName(`${datasource.name} - Table block`)
|
.instanceName(`${datasource.label} - Table block`)
|
||||||
return tableBlock
|
return tableBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
const createScreen = datasource => {
|
const createScreen = datasource => {
|
||||||
return new Screen()
|
return new Screen()
|
||||||
.route(rowListUrl(datasource))
|
.route(rowListUrl(datasource))
|
||||||
.instanceName(`${datasource.name} - List`)
|
.instanceName(`${datasource.label} - List`)
|
||||||
.addChild(generateTableBlock(datasource))
|
.addChild(generateTableBlock(datasource))
|
||||||
.json()
|
.json()
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
let fieldList
|
let fieldList
|
||||||
let schema
|
let schema
|
||||||
let cachedValue
|
let cachedValue
|
||||||
|
let options
|
||||||
|
let sanitisedValue
|
||||||
|
let unconfigured
|
||||||
|
|
||||||
$: bindings = getBindableProperties($selectedScreen, componentInstance._id)
|
$: bindings = getBindableProperties($selectedScreen, componentInstance._id)
|
||||||
$: actionType = componentInstance.actionType
|
$: actionType = componentInstance.actionType
|
||||||
|
@ -34,16 +37,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
||||||
|
$: resourceId = datasource.resourceId || datasource.tableId
|
||||||
|
|
||||||
$: if (!isEqual(value, cachedValue)) {
|
$: if (!isEqual(value, cachedValue)) {
|
||||||
cachedValue = value
|
cachedValue = cloneDeep(value)
|
||||||
schema = getSchema($currentAsset, datasource)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$: options = Object.keys(schema || {})
|
const updateState = value => {
|
||||||
$: sanitisedValue = getValidColumns(convertOldFieldFormat(value), options)
|
schema = getSchema($currentAsset, datasource)
|
||||||
$: updateSanitsedFields(sanitisedValue)
|
options = Object.keys(schema || {})
|
||||||
$: unconfigured = buildUnconfiguredOptions(schema, sanitisedFields)
|
sanitisedValue = getValidColumns(convertOldFieldFormat(value), options)
|
||||||
|
updateSanitsedFields(sanitisedValue)
|
||||||
|
unconfigured = buildUnconfiguredOptions(schema, sanitisedFields)
|
||||||
|
fieldList = [...sanitisedFields, ...unconfigured]
|
||||||
|
.map(buildSudoInstance)
|
||||||
|
.filter(x => x != null)
|
||||||
|
}
|
||||||
|
|
||||||
|
$: updateState(cachedValue, resourceId)
|
||||||
|
|
||||||
// Builds unused ones only
|
// Builds unused ones only
|
||||||
const buildUnconfiguredOptions = (schema, selected) => {
|
const buildUnconfiguredOptions = (schema, selected) => {
|
||||||
|
@ -97,7 +108,6 @@
|
||||||
if (instance._component) {
|
if (instance._component) {
|
||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = getComponentForField(instance.field, schema)
|
const type = getComponentForField(instance.field, schema)
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return null
|
return null
|
||||||
|
@ -118,12 +128,6 @@
|
||||||
return { ...instance, ...pseudoComponentInstance }
|
return { ...instance, ...pseudoComponentInstance }
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (sanitisedFields) {
|
|
||||||
fieldList = [...sanitisedFields, ...unconfigured]
|
|
||||||
.map(buildSudoInstance)
|
|
||||||
.filter(x => x != null)
|
|
||||||
}
|
|
||||||
|
|
||||||
const processItemUpdate = e => {
|
const processItemUpdate = e => {
|
||||||
const updatedField = e.detail
|
const updatedField = e.detail
|
||||||
const parentFieldsUpdated = fieldList ? cloneDeep(fieldList) : []
|
const parentFieldsUpdated = fieldList ? cloneDeep(fieldList) : []
|
||||||
|
|
|
@ -8,15 +8,16 @@
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
$: tables = $tablesStore.list.map(table => ({
|
$: tables = $tablesStore.list.map(table => ({
|
||||||
...table,
|
|
||||||
type: "table",
|
type: "table",
|
||||||
label: table.name,
|
label: table.name,
|
||||||
|
tableId: table._id,
|
||||||
resourceId: table._id,
|
resourceId: table._id,
|
||||||
}))
|
}))
|
||||||
$: views = $viewsV2.list.map(view => ({
|
$: views = $viewsV2.list.map(view => ({
|
||||||
...view,
|
|
||||||
type: "viewV2",
|
type: "viewV2",
|
||||||
|
id: view.id,
|
||||||
label: view.name,
|
label: view.name,
|
||||||
|
tableId: view.tableId,
|
||||||
resourceId: view.id,
|
resourceId: view.id,
|
||||||
}))
|
}))
|
||||||
$: options = [...(tables || []), ...(views || [])]
|
$: options = [...(tables || []), ...(views || [])]
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
// Migrate old values before "resourceId" existed
|
// Migrate old values before "resourceId" existed
|
||||||
if (value && !value.resourceId) {
|
if (value && !value.resourceId) {
|
||||||
const view = views.find(x => x.resourceId === value.id)
|
const view = views.find(x => x.resourceId === value.id)
|
||||||
const table = tables.find(x => x.resourceId === value._id)
|
const table = tables.find(x => x.resourceId === value.tableId)
|
||||||
dispatch("change", view || table)
|
dispatch("change", view || table)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -75,43 +75,37 @@
|
||||||
{@const views = Object.values(table.views || {}).filter(
|
{@const views = Object.values(table.views || {}).filter(
|
||||||
view => view.version === 2
|
view => view.version === 2
|
||||||
)}
|
)}
|
||||||
{@const datasource = {
|
{@const tableDS = {
|
||||||
...table,
|
|
||||||
// Legacy properties
|
|
||||||
tableId: table._id,
|
tableId: table._id,
|
||||||
label: table.name,
|
label: table.name,
|
||||||
// New consistent properties
|
|
||||||
resourceId: table._id,
|
resourceId: table._id,
|
||||||
name: table.name,
|
|
||||||
type: "table",
|
type: "table",
|
||||||
}}
|
}}
|
||||||
{@const selected = selectedScreens.find(
|
{@const selected = selectedScreens.find(
|
||||||
screen => screen.resourceId === datasource.resourceId
|
screen => screen.resourceId === tableDS.resourceId
|
||||||
)}
|
)}
|
||||||
<DatasourceTemplateRow
|
<DatasourceTemplateRow
|
||||||
on:click={() => toggleSelection(datasource)}
|
on:click={() => toggleSelection(tableDS)}
|
||||||
{selected}
|
{selected}
|
||||||
{datasource}
|
datasource={tableDS}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- List all views inside this table -->
|
<!-- List all views inside this table -->
|
||||||
{#each views as view}
|
{#each views as view}
|
||||||
{@const datasource = {
|
{@const viewDS = {
|
||||||
...view,
|
|
||||||
// Legacy properties
|
|
||||||
label: view.name,
|
label: view.name,
|
||||||
// New consistent properties
|
id: view.id,
|
||||||
resourceId: view.id,
|
resourceId: view.id,
|
||||||
name: view.name,
|
tableId: view.tableId,
|
||||||
type: "viewV2",
|
type: "viewV2",
|
||||||
}}
|
}}
|
||||||
{@const selected = selectedScreens.find(
|
{@const selected = selectedScreens.find(
|
||||||
x => x.resourceId === datasource.resourceId
|
x => x.resourceId === viewDS.resourceId
|
||||||
)}
|
)}
|
||||||
<DatasourceTemplateRow
|
<DatasourceTemplateRow
|
||||||
on:click={() => toggleSelection(datasource)}
|
on:click={() => toggleSelection(viewDS)}
|
||||||
{selected}
|
{selected}
|
||||||
{datasource}
|
datasource={viewDS}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<div class="data-source-entry" class:selected on:click>
|
<div class="data-source-entry" class:selected on:click>
|
||||||
<Icon name={icon} color="var(--spectrum-global-color-gray-600)" />
|
<Icon name={icon} color="var(--spectrum-global-color-gray-600)" />
|
||||||
{datasource.name}
|
{datasource.label}
|
||||||
{#if selected}
|
{#if selected}
|
||||||
<span class="data-source-check">
|
<span class="data-source-check">
|
||||||
<Icon size="S" name="CheckmarkCircle" />
|
<Icon size="S" name="CheckmarkCircle" />
|
||||||
|
|
|
@ -4745,7 +4745,8 @@
|
||||||
"dependsOn": {
|
"dependsOn": {
|
||||||
"setting": "clickBehaviour",
|
"setting": "clickBehaviour",
|
||||||
"value": "details"
|
"value": "details"
|
||||||
}
|
},
|
||||||
|
"resetOn": "dataSource"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Save button",
|
"label": "Save button",
|
||||||
|
@ -5397,6 +5398,7 @@
|
||||||
"type": "fieldConfiguration",
|
"type": "fieldConfiguration",
|
||||||
"key": "fields",
|
"key": "fields",
|
||||||
"nested": true,
|
"nested": true,
|
||||||
|
"resetOn": "dataSource",
|
||||||
"selectAllFields": true
|
"selectAllFields": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -275,7 +275,7 @@
|
||||||
dataSource,
|
dataSource,
|
||||||
showSaveButton: true,
|
showSaveButton: true,
|
||||||
showDeleteButton: false,
|
showDeleteButton: false,
|
||||||
saveButtonLabel: sidePanelSaveLabel,
|
saveButtonLabel: sidePanelSaveLabel || "Save", //always show
|
||||||
actionType: "Create",
|
actionType: "Create",
|
||||||
fields: sidePanelFields || normalFields,
|
fields: sidePanelFields || normalFields,
|
||||||
title: "Create Row",
|
title: "Create Row",
|
||||||
|
|
|
@ -211,17 +211,19 @@
|
||||||
{/if}
|
{/if}
|
||||||
</BlockComponent>
|
</BlockComponent>
|
||||||
{/if}
|
{/if}
|
||||||
<BlockComponent type="fieldgroup" props={{ labelPosition }} order={1}>
|
{#key fields}
|
||||||
{#each fields as field, idx}
|
<BlockComponent type="fieldgroup" props={{ labelPosition }} order={1}>
|
||||||
{#if getComponentForField(field) && field.active}
|
{#each fields as field, idx}
|
||||||
<BlockComponent
|
{#if getComponentForField(field) && field.active}
|
||||||
type={getComponentForField(field)}
|
<BlockComponent
|
||||||
props={getPropsForField(field)}
|
type={getComponentForField(field)}
|
||||||
order={idx}
|
props={getPropsForField(field)}
|
||||||
/>
|
order={idx}
|
||||||
{/if}
|
/>
|
||||||
{/each}
|
{/if}
|
||||||
</BlockComponent>
|
{/each}
|
||||||
|
</BlockComponent>
|
||||||
|
{/key}
|
||||||
</BlockComponent>
|
</BlockComponent>
|
||||||
</BlockComponent>
|
</BlockComponent>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
Loading…
Reference in New Issue