diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 50780b45dd..0380f92253 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -35,6 +35,12 @@ jobs: env: CI: true name: Budibase CI + - uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + files: ./packages/server/coverage/clover.xml + name: codecov-umbrella + verbose: true - run: yarn test:e2e:ci - name: Build and Push Staging Docker Image diff --git a/README.md b/README.md index 7aa5146b9a..75b48a6107 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,10 @@ Follow @budibase - Code of conduct + Code of conduct + + +

diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js index 54a066af9c..c999c22647 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js @@ -82,7 +82,7 @@ const createScreen = table => { theme: "alpine", height: "540", pagination: true, - detailUrl: `${table.name.toLowerCase()}/:id`, + detailUrl: `${rowListUrl(table)}/:id`, }) .instanceName("Grid") diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index ae19489575..598bcdaad2 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -11,12 +11,17 @@ import { cloneDeep } from "lodash/fp" import { backendUiStore } from "builderStore" import { TableNames, UNEDITABLE_USER_FIELDS } from "constants" - import { FIELDS, AUTO_COLUMN_SUB_TYPES } from "constants/backend" + import { + FIELDS, + AUTO_COLUMN_SUB_TYPES, + RelationshipTypes, + } from "constants/backend" import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils" import { notifier } from "builderStore/store/notifications" import ValuesList from "components/common/ValuesList.svelte" import DatePicker from "components/common/DatePicker.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte" + import { truncate } from "lodash" const AUTO_COL = "auto" const LINK_TYPE = FIELDS.LINK.type @@ -36,16 +41,7 @@ $backendUiStore.selectedTable.primaryDisplay == null || $backendUiStore.selectedTable.primaryDisplay === field.name - let relationshipTypes = [ - { text: "Many to many (N:N)", value: "many-to-many" }, - { text: "One to many (1:N)", value: "one-to-many" }, - ] - let types = ["Many to many (N:N)", "One to many (1:N)"] - - let selectedRelationshipType = - relationshipTypes.find(type => type.value === field.relationshipType) - ?.text || "Many to many (N:N)" - + let table = $backendUiStore.selectedTable let indexes = [...($backendUiStore.selectedTable.indexes || [])] let confirmDeleteDialog let deletion @@ -57,7 +53,7 @@ $: uneditable = $backendUiStore.selectedTable?._id === TableNames.USERS && UNEDITABLE_USER_FIELDS.includes(field.name) - $: invalid = field.type === FIELDS.LINK.type && !field.tableId + $: invalid = field.type === LINK_TYPE && !field.tableId // used to select what different options can be displayed for column type $: canBeSearched = @@ -67,15 +63,9 @@ $: canBeDisplay = field.type !== LINK_TYPE && field.type !== AUTO_COL $: canBeRequired = field.type !== LINK_TYPE && !uneditable && field.type !== AUTO_COL + $: relationshipOptions = getRelationshipOptions(field) async function saveColumn() { - // Set relationship type if it's - if (field.type === "link") { - field.relationshipType = relationshipTypes.find( - type => type.text === selectedRelationshipType - ).value - } - if (field.type === AUTO_COL) { field = buildAutoColumn( $backendUiStore.draftTable.name, @@ -110,12 +100,18 @@ if (!definition) { return } - field.type = definition.type - field.constraints = definition.constraints // remove any extra fields that may not be related to this type delete field.autocolumn delete field.subtype delete field.tableId + delete field.relationshipType + // add in defaults and initial definition + field.type = definition.type + field.constraints = definition.constraints + // default relationships many to many + if (field.type === LINK_TYPE) { + field.relationshipType = RelationshipTypes.MANY_TO_MANY + } } function onChangeRequired(e) { @@ -153,6 +149,32 @@ confirmDeleteDialog.hide() deletion = false } + + function getRelationshipOptions(field) { + if (!field || !field.tableId) { + return null + } + const linkTable = tableOptions.find(table => table._id === field.tableId) + if (!linkTable) { + return null + } + const thisName = truncate(table.name, { length: 15 }), + linkName = truncate(linkTable.name, { length: 15 }) + return [ + { + name: `Many ${thisName} rows has many ${linkName} rows`, + value: RelationshipTypes.MANY_TO_MANY, + }, + { + name: `One ${thisName} row has many ${linkName} rows`, + value: RelationshipTypes.ONE_TO_MANY, + }, + { + name: `Many ${thisName} rows has one ${linkName} row`, + value: RelationshipTypes.MANY_TO_ONE, + }, + ] + }
@@ -231,26 +253,32 @@ label="Max Value" bind:value={field.constraints.numericality.lessThanOrEqualTo} /> {:else if field.type === 'link'} -
- -
- {#each types as type} - - - - {/each} -
-
+ {#if relationshipOptions && relationshipOptions.length > 0} +
+ +
+ {#each relationshipOptions as { value, name }} + +
+ + + +
+
+ {/each} +
+
+ {/if} diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte index 9980b6712a..38f6b521fa 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertiesPanel.svelte @@ -49,8 +49,8 @@ {categories} {selectedCategory} /> -{#if showDisplayName} -
{$selectedComponent._instanceName}
+{#if definition && definition.name} +
{definition.name}
{/if}
diff --git a/packages/builder/src/components/design/PropertiesPanel/SettingsView.svelte b/packages/builder/src/components/design/PropertiesPanel/SettingsView.svelte index 771c78948b..447a4f71fc 100644 --- a/packages/builder/src/components/design/PropertiesPanel/SettingsView.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/SettingsView.svelte @@ -162,16 +162,16 @@ {#if componentDefinition?.component?.endsWith('/fieldgroup')} {/if}
+ title="Confirm Form Field Update" />