Merge pull request #11950 from Budibase/backmerge-20231002
Backmerge 2023-10-02
This commit is contained in:
commit
3f43ce6f5f
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.10.16-alpha.20",
|
||||
"version": "2.11.4",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
import { Select, Checkbox } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import RowSelectorTypes from "./RowSelectorTypes.svelte"
|
||||
import DrawerBindableSlot from "../../common/bindings/DrawerBindableSlot.svelte"
|
||||
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -108,6 +110,20 @@
|
|||
<div class="schema-fields">
|
||||
{#each schemaFields as [field, schema]}
|
||||
{#if !schema.autocolumn && schema.type !== "attachment"}
|
||||
<DrawerBindableSlot
|
||||
fillWidth
|
||||
title={value.title}
|
||||
label={field}
|
||||
panel={AutomationBindingPanel}
|
||||
type={schema.type}
|
||||
{schema}
|
||||
value={value[field]}
|
||||
on:change={e => onChange(e, field)}
|
||||
{bindings}
|
||||
allowJS={true}
|
||||
updateOnChange={false}
|
||||
drawerLeft="260px"
|
||||
>
|
||||
<RowSelectorTypes
|
||||
{isTestModal}
|
||||
{field}
|
||||
|
@ -116,6 +132,7 @@
|
|||
{value}
|
||||
{onChange}
|
||||
/>
|
||||
</DrawerBindableSlot>
|
||||
{/if}
|
||||
{#if isUpdateRow && schema.type === "link"}
|
||||
<div class="checkbox-field">
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
} from "@budibase/bbui"
|
||||
import LinkedRowSelector from "components/common/LinkedRowSelector.svelte"
|
||||
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
|
||||
import DrawerBindableSlot from "../../common/bindings/DrawerBindableSlot.svelte"
|
||||
import ModalBindableInput from "../../common/bindings/ModalBindableInput.svelte"
|
||||
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
|
||||
import Editor from "components/integration/QueryEditor.svelte"
|
||||
|
@ -31,20 +30,6 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<DrawerBindableSlot
|
||||
fillWidth
|
||||
title={value.title}
|
||||
label={field}
|
||||
panel={AutomationBindingPanel}
|
||||
type={schema.type}
|
||||
{schema}
|
||||
value={value[field]}
|
||||
on:change={e => onChange(e, field)}
|
||||
{bindings}
|
||||
allowJS={true}
|
||||
updateOnChange={false}
|
||||
drawerLeft="260px"
|
||||
>
|
||||
{#if schemaHasOptions(schema) && schema.type !== "array"}
|
||||
<Select
|
||||
on:change={e => onChange(e, field)}
|
||||
|
@ -115,4 +100,3 @@
|
|||
updateOnChange={false}
|
||||
/>
|
||||
{/if}
|
||||
</DrawerBindableSlot>
|
||||
|
|
|
@ -277,10 +277,7 @@
|
|||
dispatch("updatecolumns")
|
||||
gridDispatch("close-edit-column")
|
||||
|
||||
if (
|
||||
saveColumn.type === LINK_TYPE &&
|
||||
saveColumn.relationshipType === RelationshipType.MANY_TO_MANY
|
||||
) {
|
||||
if (saveColumn.type === LINK_TYPE) {
|
||||
// Fetching the new tables
|
||||
tables.fetch()
|
||||
// Fetching the new relationships
|
||||
|
@ -312,6 +309,11 @@
|
|||
confirmDeleteDialog.hide()
|
||||
dispatch("updatecolumns")
|
||||
gridDispatch("close-edit-column")
|
||||
|
||||
if (editableColumn.type === LINK_TYPE) {
|
||||
// Updating the relationships
|
||||
datasources.fetch()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
notifications.error(`Error deleting column: ${error.message}`)
|
||||
|
|
|
@ -57,7 +57,8 @@
|
|||
label: table.name,
|
||||
value: table._id,
|
||||
}))
|
||||
$: valid = getErrorCount(errors) === 0 && allRequiredAttributesSet()
|
||||
$: valid =
|
||||
getErrorCount(errors) === 0 && allRequiredAttributesSet(relationshipType)
|
||||
$: isManyToMany = relationshipType === RelationshipType.MANY_TO_MANY
|
||||
$: isManyToOne = relationshipType === RelationshipType.MANY_TO_ONE
|
||||
|
||||
|
@ -114,7 +115,7 @@
|
|||
return Object.entries(errors).filter(entry => !!entry[1]).length
|
||||
}
|
||||
|
||||
function allRequiredAttributesSet() {
|
||||
function allRequiredAttributesSet(relationshipType) {
|
||||
const base = getTable(fromId) && getTable(toId) && fromColumn && toColumn
|
||||
if (relationshipType === RelationshipType.MANY_TO_ONE) {
|
||||
return base && fromPrimary && fromForeign
|
||||
|
@ -124,9 +125,10 @@
|
|||
}
|
||||
|
||||
function validate() {
|
||||
if (!allRequiredAttributesSet() && !hasValidated) {
|
||||
if (!allRequiredAttributesSet(relationshipType) && !hasValidated) {
|
||||
return
|
||||
}
|
||||
|
||||
hasValidated = true
|
||||
errorChecker.setType(relationshipType)
|
||||
const fromTable = getTable(fromId),
|
||||
|
|
|
@ -21,15 +21,22 @@
|
|||
function getRelationships(tables) {
|
||||
const relatedColumns = {}
|
||||
|
||||
tables.forEach(({ name: tableName, schema }) => {
|
||||
tables.forEach(({ name: tableName, schema, _id: tableId }) => {
|
||||
Object.values(schema).forEach(column => {
|
||||
if (column.type !== "link") return
|
||||
|
||||
relatedColumns[column._id] ??= {}
|
||||
relatedColumns[column._id].through =
|
||||
relatedColumns[column._id].through || column.through
|
||||
const columnId =
|
||||
column.through ||
|
||||
column._id ||
|
||||
(column.main
|
||||
? `${tableId}_${column.fieldName}__${column.tableId}_${column.foreignKey}`
|
||||
: `${column.tableId}_${column.foreignKey}__${tableId}_${column.fieldName}`)
|
||||
|
||||
relatedColumns[column._id][column.main ? "from" : "to"] = {
|
||||
relatedColumns[columnId] ??= {}
|
||||
relatedColumns[columnId].through =
|
||||
relatedColumns[columnId].through || column.through
|
||||
|
||||
relatedColumns[columnId][column.main ? "from" : "to"] = {
|
||||
...column,
|
||||
tableName,
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
import RelationshipCell from "./RelationshipCell.svelte"
|
||||
import { FieldSubtype } from "@budibase/types"
|
||||
|
||||
export let api
|
||||
|
||||
const { API } = getContext("grid")
|
||||
const { subtype } = $$props.schema
|
||||
|
||||
|
@ -17,8 +19,11 @@
|
|||
throw `Search for '${subtype}' not implemented`
|
||||
}
|
||||
|
||||
// As we are overriding the search function from RelationshipCell, we want to map one shape to the expected one for the specific API
|
||||
const email = Object.values(searchParams.query.string)[0]
|
||||
|
||||
const results = await API.searchUsers({
|
||||
...searchParams,
|
||||
email,
|
||||
})
|
||||
|
||||
// Mapping to the expected data within RelationshipCell
|
||||
|
@ -31,6 +36,7 @@
|
|||
</script>
|
||||
|
||||
<RelationshipCell
|
||||
bind:api
|
||||
{...$$props}
|
||||
{schema}
|
||||
{searchFunction}
|
||||
|
|
|
@ -19,7 +19,7 @@ docker run --rm \
|
|||
-v ${PWD}/generated:/generated \
|
||||
-v ${PWD}/config.json:/config.json \
|
||||
-u $(id -u):$(id -g) \
|
||||
swaggerapi/swagger-codegen-cli-v3 generate \
|
||||
swaggerapi/swagger-codegen-cli-v3:3.0.46 generate \
|
||||
-i /openapi.yml \
|
||||
-l javascript \
|
||||
-o /generated \
|
||||
|
|
Loading…
Reference in New Issue