Rename ViewUIFieldMetadata -> ViewFieldMetadata to match master.
This commit is contained in:
parent
e760dc4dc6
commit
7c6c03c80b
|
@ -7,17 +7,17 @@ import {
|
|||
ViewResponse,
|
||||
ViewResponseEnriched,
|
||||
ViewV2,
|
||||
BasicViewUIFieldMetadata,
|
||||
BasicViewFieldMetadata,
|
||||
ViewCalculationFieldMetadata,
|
||||
RelationSchemaField,
|
||||
ViewUIFieldMetadata,
|
||||
ViewFieldMetadata,
|
||||
} from "@budibase/types"
|
||||
import { builderSocket, gridSocket } from "../../../websockets"
|
||||
import { helpers } from "@budibase/shared-core"
|
||||
|
||||
function stripUnknownFields(
|
||||
field: BasicViewUIFieldMetadata
|
||||
): RequiredKeys<BasicViewUIFieldMetadata> {
|
||||
field: BasicViewFieldMetadata
|
||||
): RequiredKeys<BasicViewFieldMetadata> {
|
||||
if (helpers.views.isCalculationField(field)) {
|
||||
const strippedField: RequiredKeys<ViewCalculationFieldMetadata> = {
|
||||
order: field.order,
|
||||
|
@ -31,7 +31,7 @@ function stripUnknownFields(
|
|||
}
|
||||
return strippedField
|
||||
} else {
|
||||
const strippedField: RequiredKeys<BasicViewUIFieldMetadata> = {
|
||||
const strippedField: RequiredKeys<BasicViewFieldMetadata> = {
|
||||
order: field.order,
|
||||
width: field.width,
|
||||
visible: field.visible,
|
||||
|
@ -83,7 +83,7 @@ async function parseSchema(view: CreateViewRequest) {
|
|||
|
||||
p[fieldName] = fieldSchema
|
||||
return p
|
||||
}, {} as Record<string, RequiredKeys<ViewUIFieldMetadata>>)
|
||||
}, {} as Record<string, RequiredKeys<ViewFieldMetadata>>)
|
||||
return finalViewSchema
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
RelationshipType,
|
||||
TableSchema,
|
||||
RenameColumn,
|
||||
ViewUIFieldMetadata,
|
||||
ViewFieldMetadata,
|
||||
FeatureFlag,
|
||||
BBReferenceFieldSubType,
|
||||
} from "@budibase/types"
|
||||
|
@ -1154,7 +1154,7 @@ describe.each([
|
|||
|
||||
const createView = async (
|
||||
tableId: string,
|
||||
schema: Record<string, ViewUIFieldMetadata>
|
||||
schema: Record<string, ViewFieldMetadata>
|
||||
) =>
|
||||
await config.api.viewV2.create({
|
||||
name: generator.guid(),
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
Row,
|
||||
Table,
|
||||
TableSchema,
|
||||
ViewUIFieldMetadata,
|
||||
ViewFieldMetadata,
|
||||
ViewV2,
|
||||
} from "@budibase/types"
|
||||
import sdk from "../../sdk"
|
||||
|
@ -263,7 +263,7 @@ export async function squashLinks<T = Row[] | Row>(
|
|||
FeatureFlag.ENRICHED_RELATIONSHIPS
|
||||
)
|
||||
|
||||
let viewSchema: Record<string, ViewUIFieldMetadata> = {}
|
||||
let viewSchema: Record<string, ViewFieldMetadata> = {}
|
||||
if (sdk.views.isView(source)) {
|
||||
if (helpers.views.isCalculationView(source)) {
|
||||
return enriched
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import {
|
||||
BasicViewUIFieldMetadata,
|
||||
BasicViewFieldMetadata,
|
||||
ViewCalculationFieldMetadata,
|
||||
ViewUIFieldMetadata,
|
||||
ViewFieldMetadata,
|
||||
ViewV2,
|
||||
} from "@budibase/types"
|
||||
import { pickBy } from "lodash"
|
||||
|
||||
export function isCalculationField(
|
||||
field: ViewUIFieldMetadata
|
||||
field: ViewFieldMetadata
|
||||
): field is ViewCalculationFieldMetadata {
|
||||
return "calculationType" in field
|
||||
}
|
||||
|
||||
export function isBasicViewField(
|
||||
field: ViewUIFieldMetadata
|
||||
): field is BasicViewUIFieldMetadata {
|
||||
field: ViewFieldMetadata
|
||||
): field is BasicViewFieldMetadata {
|
||||
return !isCalculationField(field)
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export interface View {
|
|||
groupBy?: string
|
||||
}
|
||||
|
||||
export interface BasicViewUIFieldMetadata extends UIFieldMetadata {
|
||||
export interface BasicViewFieldMetadata extends UIFieldMetadata {
|
||||
readonly?: boolean
|
||||
columns?: Record<string, RelationSchemaField>
|
||||
}
|
||||
|
@ -42,13 +42,13 @@ export interface RelationSchemaField extends UIFieldMetadata {
|
|||
readonly?: boolean
|
||||
}
|
||||
|
||||
export interface ViewCalculationFieldMetadata extends BasicViewUIFieldMetadata {
|
||||
export interface ViewCalculationFieldMetadata extends BasicViewFieldMetadata {
|
||||
calculationType: CalculationType
|
||||
field: string
|
||||
}
|
||||
|
||||
export type ViewUIFieldMetadata =
|
||||
| BasicViewUIFieldMetadata
|
||||
export type ViewFieldMetadata =
|
||||
| BasicViewFieldMetadata
|
||||
| ViewCalculationFieldMetadata
|
||||
|
||||
export enum CalculationType {
|
||||
|
@ -71,7 +71,7 @@ export interface ViewV2 {
|
|||
order?: SortOrder
|
||||
type?: SortType
|
||||
}
|
||||
schema?: Record<string, ViewUIFieldMetadata>
|
||||
schema?: Record<string, ViewFieldMetadata>
|
||||
}
|
||||
|
||||
export type ViewSchema = ViewCountOrSumSchema | ViewStatisticsSchema
|
||||
|
|
Loading…
Reference in New Issue