Move type to ui

This commit is contained in:
Adria Navarro 2025-01-24 10:23:02 +01:00
parent 0ae0141b26
commit 1f28bf978b
4 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import { tables } from "./tables"
import { selectedScreen } from "./screens" import { selectedScreen } from "./screens"
import { viewsV2 } from "./viewsV2" import { viewsV2 } from "./viewsV2"
import { findComponentsBySettingsType } from "@/helpers/screen" import { findComponentsBySettingsType } from "@/helpers/screen"
import { DatasourceType, Screen } from "@budibase/types" import { UIDatasourceType, Screen } from "@budibase/types"
import { queries } from "./queries" import { queries } from "./queries"
import { views } from "./views" import { views } from "./views"
import { featureFlag } from "@/helpers" import { featureFlag } from "@/helpers"
@ -21,11 +21,11 @@ function reduceBy<TItem extends {}, TKey extends keyof TItem>(
) )
} }
const friendlyNameByType: Partial<Record<DatasourceType, string>> = { const friendlyNameByType: Partial<Record<UIDatasourceType, string>> = {
viewV2: "view", viewV2: "view",
} }
const validationKeyByType: Record<DatasourceType, string | null> = { const validationKeyByType: Record<UIDatasourceType, string | null> = {
table: "tableId", table: "tableId",
view: "name", view: "name",
viewV2: "id", viewV2: "id",
@ -53,7 +53,7 @@ export const screenComponentErrors = derived(
)) { )) {
const componentSettings = component[setting.key] const componentSettings = component[setting.key]
const { label } = componentSettings const { label } = componentSettings
const type = componentSettings.type as DatasourceType const type = componentSettings.type as UIDatasourceType
const validationKey = validationKeyByType[type] const validationKey = validationKeyByType[type]
if (!validationKey) { if (!validationKey) {

View File

@ -57,5 +57,3 @@ export interface RestConfig {
} }
dynamicVariables?: DynamicVariable[] dynamicVariables?: DynamicVariable[]
} }
export type DatasourceType = "table" | "view" | "viewV2" | "query" | "custom"

View File

@ -0,0 +1 @@
export type UIDatasourceType = "table" | "view" | "viewV2" | "query" | "custom"

View File

@ -2,3 +2,4 @@ export * from "./stores"
export * from "./bindings" export * from "./bindings"
export * from "./components" export * from "./components"
export * from "./dataFetch" export * from "./dataFetch"
export * from "./datasource"