Merge branch 'develop' of github.com:Budibase/budibase into develop

This commit is contained in:
Andrew Kingston 2022-12-02 10:21:00 +00:00
commit c64a06adee
14 changed files with 353 additions and 303 deletions

View File

@ -158,6 +158,10 @@ spec:
{{ end }} {{ end }}
- name: CDN_URL - name: CDN_URL
value: {{ .Values.globals.cdnUrl }} value: {{ .Values.globals.cdnUrl }}
{{ if .Values.services.tlsRejectUnauthorized }}
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: {{ .Values.services.tlsRejectUnauthorized }}
{{ end }}
image: budibase/apps:{{ .Values.globals.appVersion }} image: budibase/apps:{{ .Values.globals.appVersion }}
imagePullPolicy: Always imagePullPolicy: Always

View File

@ -42,6 +42,7 @@ spec:
secretKeyRef: secretKeyRef:
name: {{ template "budibase.fullname" . }} name: {{ template "budibase.fullname" . }}
key: objectStoreSecret key: objectStoreSecret
image: minio/minio image: minio/minio
imagePullPolicy: "" imagePullPolicy: ""
livenessProbe: livenessProbe:

View File

@ -60,5 +60,6 @@ spec:
- name: redis-data - name: redis-data
persistentVolumeClaim: persistentVolumeClaim:
claimName: redis-data claimName: redis-data
status: {} status: {}
{{- end }} {{- end }}

View File

@ -149,6 +149,10 @@ spec:
{{ end }} {{ end }}
- name: CDN_URL - name: CDN_URL
value: {{ .Values.globals.cdnUrl }} value: {{ .Values.globals.cdnUrl }}
{{ if .Values.services.tlsRejectUnauthorized }}
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: {{ .Values.services.tlsRejectUnauthorized }}
{{ end }}
image: budibase/worker:{{ .Values.globals.appVersion }} image: budibase/worker:{{ .Values.globals.appVersion }}
imagePullPolicy: Always imagePullPolicy: Always

View File

@ -110,6 +110,7 @@ globals:
services: services:
budibaseVersion: latest budibaseVersion: latest
dns: cluster.local dns: cluster.local
# tlsRejectUnauthorized: 0
proxy: proxy:
port: 10000 port: 10000

View File

@ -28,9 +28,9 @@
let loading = false let loading = false
$: confirmDisabled = disabled || loading $: confirmDisabled = disabled || loading
async function secondary() { async function secondary(e) {
loading = true loading = true
if (!secondaryAction || (await secondaryAction()) !== false) { if (!secondaryAction || (await secondaryAction(e)) !== false) {
hide() hide()
} }
loading = false loading = false

View File

@ -4,6 +4,7 @@
import { Table, Modal, Heading, notifications, Layout } from "@budibase/bbui" import { Table, Modal, Heading, notifications, Layout } from "@budibase/bbui"
import { API } from "api" import { API } from "api"
import Spinner from "components/common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import DeleteRowsButton from "./buttons/DeleteRowsButton.svelte" import DeleteRowsButton from "./buttons/DeleteRowsButton.svelte"
import CreateEditRow from "./modals/CreateEditRow.svelte" import CreateEditRow from "./modals/CreateEditRow.svelte"
import CreateEditUser from "./modals/CreateEditUser.svelte" import CreateEditUser from "./modals/CreateEditUser.svelte"
@ -34,8 +35,8 @@
let editRowModal let editRowModal
let editColumnModal let editColumnModal
let customRenderers = [] let customRenderers = []
let confirmDelete
$: isInternal = type !== "external"
$: isUsersTable = tableId === TableNames.USERS $: isUsersTable = tableId === TableNames.USERS
$: data && resetSelectedRows() $: data && resetSelectedRows()
$: editRowComponent = isUsersTable ? CreateEditUser : CreateEditRow $: editRowComponent = isUsersTable ? CreateEditUser : CreateEditRow
@ -89,15 +90,17 @@
) )
} }
const deleteRows = async () => { const deleteRows = async targetRows => {
try { try {
await API.deleteRows({ await API.deleteRows({
tableId, tableId,
rows: selectedRows, rows: targetRows,
}) })
data = data.filter(row => !selectedRows.includes(row))
notifications.success(`Successfully deleted ${selectedRows.length} rows`) const deletedRowIds = targetRows.map(row => row._id)
selectedRows = [] data = data.filter(row => deletedRowIds.indexOf(row._id))
notifications.success(`Successfully deleted ${targetRows.length} rows`)
} catch (error) { } catch (error) {
notifications.error("Error deleting rows") notifications.error("Error deleting rows")
} }
@ -133,7 +136,14 @@
<div class="popovers"> <div class="popovers">
<slot /> <slot />
{#if !isUsersTable && selectedRows.length > 0} {#if !isUsersTable && selectedRows.length > 0}
<DeleteRowsButton on:updaterows {selectedRows} {deleteRows} /> <DeleteRowsButton
on:updaterows
{selectedRows}
deleteRows={async rows => {
await deleteRows(rows)
resetSelectedRows()
}}
/>
{/if} {/if}
</div> </div>
</Layout> </Layout>
@ -164,8 +174,33 @@
</Layout> </Layout>
<Modal bind:this={editRowModal}> <Modal bind:this={editRowModal}>
<svelte:component this={editRowComponent} on:updaterows row={editableRow} /> <svelte:component
this={editRowComponent}
on:updaterows
on:deleteRows={() => {
confirmDelete.show()
}}
row={editableRow}
/>
</Modal> </Modal>
<ConfirmDialog
bind:this={confirmDelete}
okText="Delete"
onOk={async () => {
if (editableRow) {
await deleteRows([editableRow])
}
editableRow = undefined
}}
onCancel={async () => {
editRow(editableRow)
}}
title="Confirm Deletion"
>
Are you sure you want to delete this row?
</ConfirmDialog>
<Modal bind:this={editColumnModal}> <Modal bind:this={editColumnModal}>
<CreateEditColumn <CreateEditColumn
field={editableColumn} field={editableColumn}

View File

@ -11,7 +11,7 @@
let modal let modal
async function confirmDeletion() { async function confirmDeletion() {
await deleteRows() await deleteRows(selectedRows)
modal?.hide() modal?.hide()
dispatch("updaterows") dispatch("updaterows")
} }

View File

@ -50,11 +50,19 @@
} }
</script> </script>
<ModalContent <span class="modal-wrap">
<ModalContent
title={creating ? "Create Row" : "Edit Row"} title={creating ? "Create Row" : "Edit Row"}
confirmText={creating ? "Create Row" : "Save Row"} confirmText={creating ? "Create Row" : "Save Row"}
onConfirm={saveRow} onConfirm={saveRow}
> showCancelButton={creating}
showSecondaryButton={!creating}
secondaryButtonWarning={!creating}
secondaryButtonText="Delete"
secondaryAction={() => {
dispatch("deleteRows", row)
}}
>
{#each tableSchema as [key, meta]} {#each tableSchema as [key, meta]}
{#if !meta.autocolumn && meta.type !== FORMULA_TYPE} {#if !meta.autocolumn && meta.type !== FORMULA_TYPE}
<div> <div>
@ -62,10 +70,14 @@
</div> </div>
{/if} {/if}
{/each} {/each}
</ModalContent> </ModalContent>
</span>
<style> <style>
div { div {
min-width: 0; min-width: 0;
} }
.modal-wrap :global(.secondary-action) {
margin-right: unset;
}
</style> </style>

View File

@ -479,6 +479,7 @@
definition.name !== "Screenslot" && definition.name !== "Screenslot" &&
children.length === 0 && children.length === 0 &&
!instance._blockElementHasChildren && !instance._blockElementHasChildren &&
!definition.block &&
definition.skeleton !== false definition.skeleton !== false
</script> </script>

View File

@ -36,7 +36,6 @@
let dataProviderId let dataProviderId
let repeaterId let repeaterId
let schema let schema
let schemaLoaded = false
$: fetchSchema(dataSource) $: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema) $: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema)
@ -75,12 +74,10 @@
enrichRelationships: true, enrichRelationships: true,
}) })
} }
schemaLoaded = true
} }
</script> </script>
{#if schemaLoaded} <Block>
<Block>
<BlockComponent <BlockComponent
type="form" type="form"
bind:id={formId} bind:id={formId}
@ -208,5 +205,4 @@
</BlockComponent> </BlockComponent>
</BlockComponent> </BlockComponent>
</BlockComponent> </BlockComponent>
</Block> </Block>
{/if}

View File

@ -36,7 +36,6 @@
let newRowSidePanelId let newRowSidePanelId
let schema let schema
let primaryDisplay let primaryDisplay
let schemaLoaded = false
$: fetchSchema(dataSource) $: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema) $: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema)
@ -89,7 +88,6 @@
enrichRelationships: true, enrichRelationships: true,
}) })
} }
schemaLoaded = true
} }
const getNormalFields = schema => { const getNormalFields = schema => {
@ -113,8 +111,7 @@
} }
</script> </script>
{#if schemaLoaded} <Block>
<Block>
<BlockComponent <BlockComponent
type="form" type="form"
bind:id={formId} bind:id={formId}
@ -270,5 +267,4 @@
</BlockComponent> </BlockComponent>
{/if} {/if}
</BlockComponent> </BlockComponent>
</Block> </Block>
{/if}

View File

@ -20,7 +20,6 @@
const context = getContext("context") const context = getContext("context")
const { API, fetchDatasourceSchema } = getContext("sdk") const { API, fetchDatasourceSchema } = getContext("sdk")
let loaded = false
let schema let schema
let table let table
@ -49,9 +48,6 @@
// Fetches the form schema from this form's dataSource // Fetches the form schema from this form's dataSource
const fetchSchema = async dataSource => { const fetchSchema = async dataSource => {
schema = (await fetchDatasourceSchema(dataSource)) || {} schema = (await fetchDatasourceSchema(dataSource)) || {}
if (!loaded) {
loaded = true
}
} }
const fetchTable = async dataSource => { const fetchTable = async dataSource => {
@ -70,8 +66,7 @@
) )
</script> </script>
{#if loaded} {#key resetKey}
{#key resetKey}
<InnerForm <InnerForm
{dataSource} {dataSource}
{theme} {theme}
@ -86,5 +81,4 @@
> >
<slot /> <slot />
</InnerForm> </InnerForm>
{/key} {/key}
{/if}

View File

@ -1,4 +1,5 @@
import { derived } from "svelte/store" import { derived } from "svelte/store"
import { Constants } from "@budibase/frontend-core"
import { devToolsStore } from "../devTools.js" import { devToolsStore } from "../devTools.js"
import { authStore } from "../auth.js" import { authStore } from "../auth.js"
@ -6,6 +7,10 @@ import { authStore } from "../auth.js"
export const currentRole = derived( export const currentRole = derived(
[devToolsStore, authStore], [devToolsStore, authStore],
([$devToolsStore, $authStore]) => { ([$devToolsStore, $authStore]) => {
return ($devToolsStore.enabled && $devToolsStore.role) || $authStore?.roleId return (
($devToolsStore.enabled && $devToolsStore.role) ||
$authStore?.roleId ||
Constants.Roles.PUBLIC
)
} }
) )