Merge branch 'master' into grid-tweaks

This commit is contained in:
Mihail Hadzhiev 2023-11-03 10:20:15 +02:00 committed by GitHub
commit bd4c50be31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 182 additions and 160 deletions

View File

@ -11,10 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v2
env:
PAYLOAD_VERSION: ${{ github.sha }}
REF_NAME: ${{ github.ref_name}}
with:
repository: budibase/budibase-deploys
event-type: budicloud-qa-deploy
token: ${{ secrets.GH_ACCESS_TOKEN }}
client-payload: |-
{
"PAYLOAD_VERSION": "${{ github.sha }}",
"REF_NAME": "${{ github.ref_name}}"
}

View File

@ -165,17 +165,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the current budibase release version
id: version
run: |
release_version=$(cat lerna.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- uses: passeidireto/trigger-external-workflow-action@main
env:
PAYLOAD_VERSION: ${{ env.RELEASE_VERSION }}
REF_NAME: ${{ github.ref_name}}
- uses: peter-evans/repository-dispatch@v2
with:
repository: budibase/budibase-deploys
event: budicloud-qa-deploy
event-type: budicloud-qa-deploy
github_pat: ${{ secrets.GH_ACCESS_TOKEN }}
client-payload: |-
{
"PAYLOAD_VERSION": "${{ github.ref_name }}",
"REF_NAME": "${{ github.ref_name}}"
}

View File

@ -66,7 +66,7 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: BUDIBASE_VERSION=$BUDIBASE_VERSION
build-args: BUDIBASE_VERSION=${{ env.BUDIBASE_VERSION }}
tags: budibase/budibase,budibase/budibase:${{ env.RELEASE_VERSION }}
file: ./hosting/single/Dockerfile.v2
env:
@ -79,7 +79,7 @@ jobs:
platforms: linux/amd64
build-args: |
TARGETBUILD=aas
BUDIBASE_VERSION=$BUDIBASE_VERSION
BUDIBASE_VERSION=${{ env.BUDIBASE_VERSION }}
tags: budibase/budibase-aas,budibase/budibase-aas:${{ env.RELEASE_VERSION }}
file: ./hosting/single/Dockerfile.v2
env:

View File

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

View File

@ -30,15 +30,15 @@
part2: PrettyRelationshipDefinitions.MANY,
},
[RelationshipType.MANY_TO_ONE]: {
part1: PrettyRelationshipDefinitions.ONE,
part2: PrettyRelationshipDefinitions.MANY,
part1: PrettyRelationshipDefinitions.MANY,
part2: PrettyRelationshipDefinitions.ONE,
},
}
let relationshipOpts1 = Object.values(PrettyRelationshipDefinitions)
let relationshipOpts2 = Object.values(PrettyRelationshipDefinitions)
let relationshipPart1 = PrettyRelationshipDefinitions.MANY
let relationshipPart2 = PrettyRelationshipDefinitions.ONE
let relationshipPart1 = PrettyRelationshipDefinitions.ONE
let relationshipPart2 = PrettyRelationshipDefinitions.MANY
let originalFromColumnName = toRelationship.name,
originalToColumnName = fromRelationship.name

View File

@ -1,5 +1,5 @@
import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui"
import DataSourceSelect from "./controls/DataSourceSelect.svelte"
import DataSourceSelect from "./controls/DataSourceSelect/DataSourceSelect.svelte"
import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte"
import DataProviderSelect from "./controls/DataProviderSelect.svelte"
import ButtonActionEditor from "./controls/ButtonActionEditor/ButtonActionEditor.svelte"

View File

@ -0,0 +1,55 @@
<script>
import { Divider, Heading } from "@budibase/bbui"
export let dividerState
export let heading
export let dataSet
export let value
export let onSelect
</script>
{#if dividerState}
<Divider />
{/if}
{#if heading}
<div class="title">
<Heading size="XS">{heading}</Heading>
</div>
{/if}
<ul class="spectrum-Menu" role="listbox">
{#each dataSet as data}
<li
class="spectrum-Menu-item"
class:is-selected={value?.label === data.label &&
value?.type === data.type}
role="option"
aria-selected="true"
tabindex="0"
on:click={() => onSelect(data)}
>
<span class="spectrum-Menu-itemLabel">
{data.label}
</span>
<svg
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
focusable="false"
aria-hidden="true"
>
<use xlink:href="#spectrum-css-icon-Checkmark100" />
</svg>
</li>
{/each}
</ul>
<style>
.title {
padding: 0 var(--spacing-m) var(--spacing-s) var(--spacing-m);
}
ul {
list-style: none;
padding-left: 0px;
margin: 0px;
width: 100%;
}
</style>

View File

@ -7,10 +7,8 @@
import {
Button,
Popover,
Divider,
Select,
Layout,
Heading,
Drawer,
DrawerContent,
Icon,
@ -32,6 +30,7 @@
import IntegrationQueryEditor from "components/integration/index.svelte"
import { makePropSafe as safe } from "@budibase/string-templates"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import DataSourceCategory from "components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte"
import { API } from "api"
export let value = {}
@ -279,102 +278,81 @@
</div>
<Popover bind:this={dropdownRight} anchor={anchorRight}>
<div class="dropdown">
<div class="title">
<Heading size="XS">Tables</Heading>
</div>
<ul>
{#each tables as table}
<li on:click={() => handleSelected(table)}>{table.label}</li>
{/each}
</ul>
<DataSourceCategory
heading="Tables"
dataSet={tables}
{value}
onSelect={handleSelected}
/>
{#if views?.length}
<Divider />
<div class="title">
<Heading size="XS">Views</Heading>
</div>
<ul>
{#each views as view}
<li on:click={() => handleSelected(view)}>{view.label}</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="Views"
dataSet={views}
{value}
onSelect={handleSelected}
/>
{/if}
{#if queries?.length}
<Divider />
<div class="title">
<Heading size="XS">Queries</Heading>
</div>
<ul>
{#each queries as query}
<li
class:selected={value === query}
on:click={() => handleSelected(query)}
>
{query.label}
</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="Queries"
dataSet={queries}
{value}
onSelect={handleSelected}
/>
{/if}
{#if links?.length}
<Divider />
<div class="title">
<Heading size="XS">Relationships</Heading>
</div>
<ul>
{#each links as link}
<li on:click={() => handleSelected(link)}>{link.label}</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="Links"
dataSet={links}
{value}
onSelect={handleSelected}
/>
{/if}
{#if fields?.length}
<Divider />
<div class="title">
<Heading size="XS">Fields</Heading>
</div>
<ul>
{#each fields as field}
<li on:click={() => handleSelected(field)}>{field.label}</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="Fields"
dataSet={fields}
{value}
onSelect={handleSelected}
/>
{/if}
{#if jsonArrays?.length}
<Divider />
<div class="title">
<Heading size="XS">JSON Arrays</Heading>
</div>
<ul>
{#each jsonArrays as field}
<li on:click={() => handleSelected(field)}>{field.label}</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="JSON Arrays"
dataSet={jsonArrays}
{value}
onSelect={handleSelected}
/>
{/if}
{#if showDataProviders && dataProviders?.length}
<Divider />
<div class="title">
<Heading size="XS">Data Providers</Heading>
</div>
<ul>
{#each dataProviders as provider}
<li
class:selected={value === provider}
on:click={() => handleSelected(provider)}
>
{provider.label}
</li>
{/each}
</ul>
<DataSourceCategory
dividerState={true}
heading="Data Providers"
dataSet={dataProviders}
{value}
onSelect={handleSelected}
/>
{/if}
<DataSourceCategory
dividerState={true}
heading="Other"
dataSet={[custom]}
{value}
onSelect={handleSelected}
/>
{#if otherSources?.length}
<DataSourceCategory
dividerState={false}
dataSet={otherSources}
{value}
onSelect={handleSelected}
/>
{/if}
<Divider />
<div class="title">
<Heading size="XS">Other</Heading>
</div>
<ul>
<li on:click={() => handleSelected(custom)}>{custom.label}</li>
{#if otherSources?.length}
{#each otherSources as source}
<li on:click={() => handleSelected(source)}>{source.label}</li>
{/each}
{/if}
</ul>
</div>
</Popover>
@ -398,31 +376,6 @@
.dropdown {
padding: var(--spacing-m) 0;
z-index: 99999999;
overflow-y: scroll;
}
.title {
padding: 0 var(--spacing-m) var(--spacing-s) var(--spacing-m);
}
ul {
list-style: none;
padding-left: 0px;
margin: 0px;
}
li {
cursor: pointer;
margin: 0px;
padding: var(--spacing-s) var(--spacing-m);
font-size: var(--font-size-m);
}
.selected {
color: var(--spectrum-global-color-blue-600);
}
li:hover {
background-color: var(--spectrum-global-color-gray-200);
}
.icon {

View File

@ -1,5 +1,5 @@
<script>
import DataSourceSelect from "./DataSourceSelect.svelte"
import DataSourceSelect from "./DataSourceSelect/DataSourceSelect.svelte"
const otherSources = [{ name: "Custom", label: "Custom" }]
</script>

View File

@ -7,6 +7,7 @@ import {
isBBReferenceField,
isRelationshipField,
LinkDocument,
LinkInfo,
RelationshipFieldMetadata,
RelationshipType,
Row,
@ -125,7 +126,23 @@ abstract class UserColumnMigrator implements ColumnMigrator {
protected newColumn: BBReferenceFieldMetadata
) {}
abstract updateRow(row: Row, link: LinkDocument): void
abstract updateRow(row: Row, linkInfo: LinkInfo): void
pickUserTableLinkSide(link: LinkDocument): LinkInfo {
if (link.doc1.tableId === InternalTable.USER_METADATA) {
return link.doc1
} else {
return link.doc2
}
}
pickOtherTableLinkSide(link: LinkDocument): LinkInfo {
if (link.doc1.tableId === InternalTable.USER_METADATA) {
return link.doc2
} else {
return link.doc1
}
}
async doMigration(): Promise<MigrationResult> {
let oldTable = cloneDeep(this.table)
@ -137,15 +154,17 @@ abstract class UserColumnMigrator implements ColumnMigrator {
let links = await sdk.links.fetchWithDocument(this.table._id!)
for (let link of links) {
const userSide = this.pickUserTableLinkSide(link)
const otherSide = this.pickOtherTableLinkSide(link)
if (
link.doc1.tableId !== this.table._id ||
link.doc1.fieldName !== this.oldColumn.name ||
link.doc2.tableId !== InternalTable.USER_METADATA
otherSide.tableId !== this.table._id ||
otherSide.fieldName !== this.oldColumn.name ||
userSide.tableId !== InternalTable.USER_METADATA
) {
continue
}
let row = rowsById[link.doc1.rowId]
let row = rowsById[otherSide.rowId]
if (!row) {
// This can happen if the row has been deleted but the link hasn't,
// which was a state that was found during the initial testing of this
@ -153,7 +172,7 @@ abstract class UserColumnMigrator implements ColumnMigrator {
continue
}
this.updateRow(row, link)
this.updateRow(row, userSide)
}
let db = context.getAppDB()
@ -175,20 +194,20 @@ abstract class UserColumnMigrator implements ColumnMigrator {
}
class SingleUserColumnMigrator extends UserColumnMigrator {
updateRow(row: Row, link: LinkDocument): void {
updateRow(row: Row, linkInfo: LinkInfo): void {
row[this.newColumn.name] = dbCore.getGlobalIDFromUserMetadataID(
link.doc2.rowId
linkInfo.rowId
)
}
}
class MultiUserColumnMigrator extends UserColumnMigrator {
updateRow(row: Row, link: LinkDocument): void {
updateRow(row: Row, linkInfo: LinkInfo): void {
if (!row[this.newColumn.name]) {
row[this.newColumn.name] = []
}
row[this.newColumn.name].push(
dbCore.getGlobalIDFromUserMetadataID(link.doc2.rowId)
dbCore.getGlobalIDFromUserMetadataID(linkInfo.rowId)
)
}
}

View File

@ -1,17 +1,15 @@
import { Document } from "../document"
export interface LinkInfo {
rowId: string
fieldName: string
tableId: string
}
export interface LinkDocument extends Document {
type: string
doc1: {
rowId: string
fieldName: string
tableId: string
}
doc2: {
rowId: string
fieldName: string
tableId: string
}
doc1: LinkInfo
doc2: LinkInfo
}
export interface LinkDocumentValue {

View File

@ -1,18 +1,16 @@
## Description
_Describe the problem or feature in addition to a link to the relevant github issues._
Addresses:
- `<Enter the Link to the issue(s) this PR addresses>`
- ...more if required
## App Export
- If possible, attach an app export file along with your request template to make QA testing easier, with minimal setup.
## Screenshots
_If a UI facing feature, a short video of the happy path, and some screenshots of the new functionality._
## Documentation
- [ ] I have reviewed the budibase documentatation to verify if this feature requires any changes. If changes or new docs are required I have written them.