Handle lack of IDs from calculation views
This commit is contained in:
parent
7a0b0ccb34
commit
6e0b5341b1
File diff suppressed because one or more lines are too long
|
@ -43,6 +43,14 @@ export const deriveStores = context => {
|
|||
// Disable some features if we're editing a view
|
||||
if (type === "viewV2") {
|
||||
config.canEditColumns = false
|
||||
|
||||
// Disable features for calculation views
|
||||
if ($definition?.type === ViewV2Type.CALCULATION) {
|
||||
config.canAddRows = false
|
||||
config.canEditRows = false
|
||||
config.canDeleteRows = false
|
||||
config.canExpandRows = false
|
||||
}
|
||||
}
|
||||
|
||||
// Disable adding rows if we don't have any valid columns
|
||||
|
@ -60,19 +68,7 @@ export const deriveStores = context => {
|
|||
config.canEditColumns = false
|
||||
}
|
||||
|
||||
// Disable features for calculation views
|
||||
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
|
||||
config.canAddRows = false
|
||||
config.canEditRows = false
|
||||
config.canDeleteRows = false
|
||||
config.canExpandRows = false
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
config,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { derived, get } from "svelte/store"
|
|||
import { getDatasourceDefinition, getDatasourceSchema } from "../../../fetch"
|
||||
import { enrichSchemaWithRelColumns, memo } from "../../../utils"
|
||||
import { cloneDeep } from "lodash"
|
||||
import { ViewV2Type } from "@budibase/types"
|
||||
|
||||
export const createStores = () => {
|
||||
const definition = memo(null)
|
||||
|
@ -81,13 +82,20 @@ export const deriveStores = context => {
|
|||
}
|
||||
)
|
||||
|
||||
const hasBudibaseIdentifiers = derived(datasource, $datasource => {
|
||||
let type = $datasource?.type
|
||||
if (type === "provider") {
|
||||
type = $datasource.value?.datasource?.type
|
||||
const hasBudibaseIdentifiers = derived(
|
||||
[datasource, definition],
|
||||
([$datasource, $definition]) => {
|
||||
let type = $datasource?.type
|
||||
if (type === "provider") {
|
||||
type = $datasource.value?.datasource?.type
|
||||
}
|
||||
// Handle calculation views
|
||||
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
|
||||
return false
|
||||
}
|
||||
return ["table", "viewV2", "link"].includes(type)
|
||||
}
|
||||
return ["table", "viewV2", "link"].includes(type)
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
schema,
|
||||
|
|
|
@ -39,18 +39,6 @@ export default class ViewV2Fetch extends DataFetch {
|
|||
this.options
|
||||
const { cursor, query, definition } = get(this.store)
|
||||
|
||||
// If this is a calculation view and there are no schema fields then do nothing
|
||||
console.log(definition)
|
||||
if (
|
||||
definition.calculation &&
|
||||
!Object.keys(definition.schema || {}).length
|
||||
) {
|
||||
return {
|
||||
rows: [],
|
||||
hasNextPage: false,
|
||||
}
|
||||
}
|
||||
|
||||
// If sort/filter params are not defined, update options to store the
|
||||
// params built in to this view. This ensures that we can accurately
|
||||
// compare old and new params and skip a redundant API call.
|
||||
|
|
Loading…
Reference in New Issue