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