Use label instead of key

This commit is contained in:
Adria Navarro 2025-02-03 18:36:21 +01:00
parent 8187d212eb
commit bae8afd750
3 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,7 @@
function getErrorTitle(error: UIComponentError) { function getErrorTitle(error: UIComponentError) {
const titleParts = [$screenComponents[error.componentId]._instanceName] const titleParts = [$screenComponents[error.componentId]._instanceName]
if (error.errorType === "setting") { if (error.errorType === "setting") {
titleParts.push(error.key) titleParts.push(error.label)
} }
return titleParts.join(" - ") return titleParts.join(" - ")
} }

View File

@ -118,6 +118,7 @@ function getInvalidDatasources(
{ {
componentId: component._id!, componentId: component._id!,
key: setting.key, key: setting.key,
label: setting.label || setting.key,
message: `The ${friendlyTypeName} named "${label}" could not be found`, message: `The ${friendlyTypeName} named "${label}" could not be found`,
errorType: "setting", errorType: "setting",
}, },
@ -195,6 +196,7 @@ function getMissingRequiredSettings(
result[component._id!] = missingRequiredSettings.map(s => ({ result[component._id!] = missingRequiredSettings.map(s => ({
componentId: component._id!, componentId: component._id!,
key: s.key, key: s.key,
label: s.label || s.key,
message: `Add the <mark>${s.label}</mark> setting to start using your component`, message: `Add the <mark>${s.label}</mark> setting to start using your component`,
errorType: "setting", errorType: "setting",
})) }))
@ -263,6 +265,7 @@ export function findComponentsBySettingsType(
setting: { setting: {
type: string type: string
key: string key: string
label: string | undefined
} }
}[] = [] }[] = []
@ -277,7 +280,7 @@ export function findComponentsBySettingsType(
if (setting) { if (setting) {
result.push({ result.push({
component, component,
setting: { type: setting.type, key: setting.key }, setting: { type: setting.type, key: setting.key, label: setting.label },
}) })
} }
component._children?.forEach(child => { component._children?.forEach(child => {

View File

@ -6,6 +6,7 @@ interface BaseUIComponentError {
interface UISettingComponentError extends BaseUIComponentError { interface UISettingComponentError extends BaseUIComponentError {
errorType: "setting" errorType: "setting"
key: string key: string
label: string
} }
interface UIAncestorComponentError extends BaseUIComponentError { interface UIAncestorComponentError extends BaseUIComponentError {