PR comments
This commit is contained in:
parent
0fe61f36bb
commit
1d2d096ab0
|
@ -49,7 +49,7 @@
|
||||||
{buttons}
|
{buttons}
|
||||||
allowAddRows
|
allowAddRows
|
||||||
allowDeleteRows
|
allowDeleteRows
|
||||||
licensing={$licensing}
|
aiEnabled={$licensing.budibaseAIEnabled || $licensing.customAIConfigsEnabled}
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
on:updatedatasource={handleGridViewUpdate}
|
on:updatedatasource={handleGridViewUpdate}
|
||||||
isCloud={$admin.cloud}
|
isCloud={$admin.cloud}
|
||||||
|
|
|
@ -125,7 +125,8 @@
|
||||||
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
isCloud={$admin.cloud}
|
isCloud={$admin.cloud}
|
||||||
licensing={$licensing}
|
aiEnabled={$licensing.budibaseAIEnabled ||
|
||||||
|
$licensing.customAIConfigsEnabled}
|
||||||
{buttons}
|
{buttons}
|
||||||
buttonsCollapsed
|
buttonsCollapsed
|
||||||
on:updatedatasource={handleGridTableUpdate}
|
on:updatedatasource={handleGridTableUpdate}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// because it functions similarly to one
|
// because it functions similarly to one
|
||||||
import { getContext, onMount } from "svelte"
|
import { getContext, onMount } from "svelte"
|
||||||
import { get, derived, readable } from "svelte/store"
|
import { get, derived, readable } from "svelte/store"
|
||||||
|
import { featuresStore } from "stores"
|
||||||
import { Grid } from "@budibase/frontend-core"
|
import { Grid } from "@budibase/frontend-core"
|
||||||
|
|
||||||
// table is actually any datasource, but called table for legacy compatibility
|
// table is actually any datasource, but called table for legacy compatibility
|
||||||
|
@ -186,6 +187,7 @@
|
||||||
{buttonsCollapsed}
|
{buttonsCollapsed}
|
||||||
{buttonsCollapsedText}
|
{buttonsCollapsedText}
|
||||||
isCloud={$environmentStore.cloud}
|
isCloud={$environmentStore.cloud}
|
||||||
|
aiEnabled={$featuresStore.aiEnabled}
|
||||||
on:rowclick={e => onRowClick?.({ row: e.detail })}
|
on:rowclick={e => onRowClick?.({ row: e.detail })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { derived } from "svelte/store"
|
||||||
import { appStore } from "./app"
|
import { appStore } from "./app"
|
||||||
import { authStore } from "./auth"
|
import { authStore } from "./auth"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
import { Feature } from "@budibase/types"
|
||||||
|
|
||||||
const createFeaturesStore = () => {
|
const createFeaturesStore = () => {
|
||||||
return derived([authStore, appStore], ([$authStore, $appStore]) => {
|
return derived([authStore, appStore], ([$authStore, $appStore]) => {
|
||||||
|
@ -33,8 +34,13 @@ const createFeaturesStore = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const license = getUserLicense()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
logoEnabled: isFreePlan(),
|
logoEnabled: isFreePlan(),
|
||||||
|
aiEnabled:
|
||||||
|
license?.features?.includes(Feature.AI_CUSTOM_CONFIGS) ||
|
||||||
|
license?.features?.includes(Feature.BUDIBASE_AI),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
$: drawerValue = toDrawerValue(fieldValue)
|
$: drawerValue = toDrawerValue(fieldValue)
|
||||||
$: isJS = isJSBinding(fieldValue)
|
$: isJS = isJSBinding(fieldValue)
|
||||||
$: fieldIsValid = isValid(fieldValue)
|
$: fieldIsValid = isValid(fieldValue)
|
||||||
|
$: console.log(filter)
|
||||||
|
|
||||||
const getFieldOptions = field => {
|
const getFieldOptions = field => {
|
||||||
const schema = schemaFields.find(x => x.name === field)
|
const schema = schemaFields.find(x => x.name === field)
|
||||||
|
@ -174,7 +175,7 @@
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div>
|
<div>
|
||||||
{#if [FieldType.STRING, FieldType.LONGFORM, FieldType.NUMBER, FieldType.BIGINT, FieldType.FORMULA].includes(filter.type)}
|
{#if [FieldType.STRING, FieldType.LONGFORM, FieldType.NUMBER, FieldType.BIGINT, FieldType.FORMULA, FieldType.AI].includes(filter.type)}
|
||||||
<Input
|
<Input
|
||||||
disabled={filter.noValue}
|
disabled={filter.noValue}
|
||||||
value={readableValue}
|
value={readableValue}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
export let darkMode = false
|
export let darkMode = false
|
||||||
export let isCloud = null
|
export let isCloud = null
|
||||||
export let rowConditions = null
|
export let rowConditions = null
|
||||||
export let licensing = null
|
export let aiEnabled = false
|
||||||
|
|
||||||
// Unique identifier for DOM nodes inside this instance
|
// Unique identifier for DOM nodes inside this instance
|
||||||
const gridID = `grid-${Math.random().toString().slice(2)}`
|
const gridID = `grid-${Math.random().toString().slice(2)}`
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
buttonsCollapsedText,
|
buttonsCollapsedText,
|
||||||
darkMode,
|
darkMode,
|
||||||
isCloud,
|
isCloud,
|
||||||
licensing,
|
aiEnabled,
|
||||||
rowConditions,
|
rowConditions,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Menu, MenuItem, Helpers } from "@budibase/bbui"
|
import { Menu, MenuItem, Helpers } from "@budibase/bbui"
|
||||||
|
import { FieldType } from "@budibase/types"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import { NewRowID } from "../lib/constants"
|
import { NewRowID } from "../lib/constants"
|
||||||
import GridPopover from "./GridPopover.svelte"
|
import GridPopover from "./GridPopover.svelte"
|
||||||
|
@ -26,9 +27,9 @@
|
||||||
|
|
||||||
$: style = makeStyle($menu)
|
$: style = makeStyle($menu)
|
||||||
$: isNewRow = $focusedRowId === NewRowID
|
$: isNewRow = $focusedRowId === NewRowID
|
||||||
$: budibaseAIEnabled =
|
$: hasAIColumns = $visibleColumns.some(
|
||||||
$config.licensing?.budibaseAIEnabled ||
|
col => col.schema.type === FieldType.AI
|
||||||
$config.licensing?.customAIConfigsEnabled
|
)
|
||||||
|
|
||||||
const makeStyle = menu => {
|
const makeStyle = menu => {
|
||||||
return `left:${menu.left}px; top:${menu.top}px;`
|
return `left:${menu.left}px; top:${menu.top}px;`
|
||||||
|
@ -58,9 +59,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateAIColumns = async () => {
|
const generateAIColumns = async () => {
|
||||||
await rows.actions.saveRow({ rowId: $focusedRowId })
|
|
||||||
await rows.actions.refreshData()
|
|
||||||
menu.actions.close()
|
menu.actions.close()
|
||||||
|
await rows.actions.applyRowChanges({ rowId: $focusedRowId })
|
||||||
$notifications.success("Generated AI columns")
|
$notifications.success("Generated AI columns")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -171,12 +171,10 @@
|
||||||
>
|
>
|
||||||
Delete row
|
Delete row
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{#if budibaseAIEnabled}
|
{#if $config.aiEnabled}
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="MagicWand"
|
icon="MagicWand"
|
||||||
disabled={isNewRow ||
|
disabled={isNewRow || !hasAIColumns}
|
||||||
!$focusedRow?._rev ||
|
|
||||||
!$hasBudibaseIdentifiers}
|
|
||||||
on:click={generateAIColumns}
|
on:click={generateAIColumns}
|
||||||
>
|
>
|
||||||
Generate AI Columns
|
Generate AI Columns
|
||||||
|
|
|
@ -109,6 +109,7 @@ export const createActions = context => {
|
||||||
column.schema.autocolumn ||
|
column.schema.autocolumn ||
|
||||||
column.schema.disabled ||
|
column.schema.disabled ||
|
||||||
column.schema.type === "formula" ||
|
column.schema.type === "formula" ||
|
||||||
|
column.schema.type === "ai" ||
|
||||||
column.schema.readonly
|
column.schema.readonly
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,29 +465,6 @@ export const createActions = context => {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveRow = async ({ rowId }) => {
|
|
||||||
const $rowLookupMap = get(rowLookupMap)
|
|
||||||
const row = $rowLookupMap[rowId]
|
|
||||||
if (row == null) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let savedRow
|
|
||||||
|
|
||||||
// Save row
|
|
||||||
try {
|
|
||||||
const newRow = cleanRow(row)
|
|
||||||
savedRow = await datasource.actions.updateRow(newRow)
|
|
||||||
|
|
||||||
if (savedRow?.id) {
|
|
||||||
// Handle users table edge case
|
|
||||||
await refreshRow(savedRow.id)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
handleValidationError(rowId, error)
|
|
||||||
}
|
|
||||||
return savedRow
|
|
||||||
}
|
|
||||||
|
|
||||||
// Saves any pending changes to a row, as well as any additional changes
|
// Saves any pending changes to a row, as well as any additional changes
|
||||||
// specified
|
// specified
|
||||||
const applyRowChanges = async ({
|
const applyRowChanges = async ({
|
||||||
|
@ -708,7 +685,6 @@ export const createActions = context => {
|
||||||
...rows,
|
...rows,
|
||||||
actions: {
|
actions: {
|
||||||
addRow,
|
addRow,
|
||||||
saveRow,
|
|
||||||
duplicateRow,
|
duplicateRow,
|
||||||
bulkDuplicate,
|
bulkDuplicate,
|
||||||
updateValue,
|
updateValue,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 69ad5e4f92b4749cd1609c0bb7feb2f3326d239c
|
Subproject commit 61391549614b5ac153f267633d0aaea9b07f05c5
|
Loading…
Reference in New Issue