@grafana/plugin-ui 0.14.1-dsconfig.b962e11 → 0.14.1-dsconfig.bccd84e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +114 -308
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/SchemaField.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/TabLayout.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/fieldUtils.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/renderFieldInput.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/useDatasourceConfigForm.js.map +1 -1
- package/dist/esm/datasource/schema/config.js.map +1 -1
- package/dist/esm/datasource/schema/datasource.js.map +1 -1
- package/dist/esm/datasource/schema/llmHints.js.map +1 -1
- package/dist/esm/datasource/schema/provisioningYaml.js +1 -3
- package/dist/esm/datasource/schema/provisioningYaml.js.map +1 -1
- package/dist/esm/index.d.ts +114 -308
- package/package.json +1 -1
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1013,340 +1013,206 @@ type Props$a<C extends Config = Config> = {
|
|
|
1013
1013
|
};
|
|
1014
1014
|
declare const AdvancedHttpSettings: <C extends Config = Config>(props: Props$a<C>) => JSX.Element;
|
|
1015
1015
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1016
|
+
/**
|
|
1017
|
+
* Datasource configuration schema types and pure helper functions.
|
|
1018
|
+
*
|
|
1019
|
+
* These types describe the structure of datasource plugin configuration schemas
|
|
1020
|
+
* (dsconfig format). Schemas define fields, groups, validations, and relationships
|
|
1021
|
+
* that drive the DatasourceConfigWizard UI and provisioning YAML generation.
|
|
1022
|
+
*/
|
|
1023
|
+
type DatasourceConfigSchema = {
|
|
1023
1024
|
schemaVersion: string;
|
|
1024
|
-
/**
|
|
1025
|
-
* Unique datasource plugin identifier
|
|
1026
|
-
* Example: "prometheus"
|
|
1027
|
-
*/
|
|
1028
1025
|
pluginType: string;
|
|
1029
|
-
/**
|
|
1030
|
-
* Human-readable name
|
|
1031
|
-
*/
|
|
1032
1026
|
pluginName: string;
|
|
1033
|
-
/**
|
|
1034
|
-
* Optional documentation URL
|
|
1035
|
-
*/
|
|
1036
1027
|
docURL?: string;
|
|
1037
|
-
/**
|
|
1038
|
-
* Source of truth for configuration
|
|
1039
|
-
*/
|
|
1040
1028
|
fields: ConfigField[];
|
|
1041
|
-
/**
|
|
1042
|
-
* Optional UI grouping
|
|
1043
|
-
*/
|
|
1044
1029
|
groups?: ConfigGroup[];
|
|
1045
|
-
/**
|
|
1046
|
-
* Relationships between fields
|
|
1047
|
-
*/
|
|
1048
1030
|
relationships?: FieldRelationship[];
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/**
|
|
1052
|
-
* Globally unique identifier
|
|
1053
|
-
* Recommended format: dot-separated path
|
|
1054
|
-
* Example: "auth.method", "httpHeaders.item.key"
|
|
1055
|
-
*/
|
|
1031
|
+
};
|
|
1032
|
+
type ConfigField = {
|
|
1056
1033
|
id: string;
|
|
1057
|
-
/**
|
|
1058
|
-
* Local key used in storage or object
|
|
1059
|
-
*/
|
|
1060
1034
|
key: string;
|
|
1061
|
-
/**
|
|
1062
|
-
* UI metadata
|
|
1063
|
-
*/
|
|
1064
1035
|
label?: string;
|
|
1065
1036
|
description?: string;
|
|
1066
1037
|
docURL?: string;
|
|
1067
|
-
/**
|
|
1068
|
-
* Core type of the field
|
|
1069
|
-
*/
|
|
1070
1038
|
valueType: ValueType;
|
|
1071
|
-
/**
|
|
1072
|
-
* Semantic meaning (optional)
|
|
1073
|
-
*/
|
|
1074
1039
|
semanticType?: SemanticType;
|
|
1075
|
-
/**
|
|
1076
|
-
* Storage location (required for storage fields)
|
|
1077
|
-
*/
|
|
1078
1040
|
target?: TargetLocation;
|
|
1079
|
-
/**
|
|
1080
|
-
* Dotted path prefix within the target for nested objects.
|
|
1081
|
-
* Example: for jsonData.tracesToLogs.datasourceUid,
|
|
1082
|
-
* target="jsonData", section="tracesToLogs", key="datasourceUid".
|
|
1083
|
-
*/
|
|
1084
1041
|
section?: string;
|
|
1085
|
-
/**
|
|
1086
|
-
* Field kind.
|
|
1087
|
-
* @default "storage"
|
|
1088
|
-
*/
|
|
1089
1042
|
kind?: FieldKind;
|
|
1090
|
-
/**
|
|
1091
|
-
* True if field belongs to array item schema
|
|
1092
|
-
*/
|
|
1093
1043
|
isItemField?: boolean;
|
|
1094
|
-
/**
|
|
1095
|
-
* Lifecycle state
|
|
1096
|
-
*/
|
|
1097
1044
|
lifecycle?: Lifecycle;
|
|
1098
|
-
/**
|
|
1099
|
-
* UI rendering hints
|
|
1100
|
-
*/
|
|
1101
1045
|
ui?: FieldUI;
|
|
1102
|
-
/**
|
|
1103
|
-
* Validations rules
|
|
1104
|
-
*/
|
|
1105
1046
|
validations?: FieldValidationRule[];
|
|
1106
|
-
|
|
1107
|
-
* Visibility condition (CEL expression)
|
|
1108
|
-
*/
|
|
1109
|
-
dependsOn?: Expression;
|
|
1110
|
-
/**
|
|
1111
|
-
* Always required
|
|
1112
|
-
*/
|
|
1047
|
+
dependsOn?: string;
|
|
1113
1048
|
required?: boolean;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
*/
|
|
1117
|
-
requiredWhen?: Expression;
|
|
1118
|
-
/**
|
|
1119
|
-
* Disabled condition
|
|
1120
|
-
*/
|
|
1121
|
-
disabledWhen?: Expression;
|
|
1122
|
-
/**
|
|
1123
|
-
* Dynamic overrides
|
|
1124
|
-
*/
|
|
1049
|
+
requiredWhen?: string;
|
|
1050
|
+
disabledWhen?: string;
|
|
1125
1051
|
overrides?: FieldOverride[];
|
|
1126
|
-
/**
|
|
1127
|
-
* Declarative multi-field write side-effects.
|
|
1128
|
-
* When this field's value matches a condition, the listed target
|
|
1129
|
-
* fields are set to specified values. Typically used on virtual
|
|
1130
|
-
* selector fields (e.g. auth method dropdown).
|
|
1131
|
-
*/
|
|
1132
1052
|
effects?: FieldEffect[];
|
|
1133
|
-
/**
|
|
1134
|
-
* Item schema for array elements or map values.
|
|
1135
|
-
* Required if valueType === "array" or "map".
|
|
1136
|
-
*/
|
|
1137
1053
|
item?: FieldItemSchema;
|
|
1138
|
-
/**
|
|
1139
|
-
* Legacy indexed fields (deprecated)
|
|
1140
|
-
*/
|
|
1141
|
-
repeatable?: boolean;
|
|
1142
|
-
pattern?: string;
|
|
1143
|
-
/**
|
|
1144
|
-
* Storage mapping
|
|
1145
|
-
*/
|
|
1146
1054
|
storage?: StorageMapping;
|
|
1147
|
-
/**
|
|
1148
|
-
* Metadata
|
|
1149
|
-
*/
|
|
1150
1055
|
tags?: string[];
|
|
1151
1056
|
examples?: unknown[];
|
|
1152
1057
|
defaultValue?: unknown;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
/**
|
|
1156
|
-
* Type of array items or map values.
|
|
1157
|
-
* For arrays, describes each element.
|
|
1158
|
-
* For maps, describes each value (keys are always strings).
|
|
1159
|
-
*/
|
|
1058
|
+
};
|
|
1059
|
+
type FieldItemSchema = {
|
|
1160
1060
|
valueType: ValueType;
|
|
1161
|
-
/**
|
|
1162
|
-
* Sub-fields for object items. Optional even when valueType = "object"
|
|
1163
|
-
* (omitting allows an unconstrained object).
|
|
1164
|
-
*/
|
|
1165
1061
|
fields?: ConfigField[];
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* CEL expression string
|
|
1169
|
-
*/
|
|
1170
|
-
type Expression = string;
|
|
1062
|
+
};
|
|
1171
1063
|
type ValueType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'map' | 'any';
|
|
1172
1064
|
type SemanticType = 'url' | 'password' | 'token' | 'hostname' | 'duration' | 'datasourceUid' | 'query';
|
|
1173
1065
|
type FieldKind = 'storage' | 'virtual';
|
|
1174
1066
|
type Lifecycle = 'stable' | 'deprecated' | 'experimental';
|
|
1175
1067
|
type TargetLocation = 'root' | 'jsonData' | 'secureJsonData';
|
|
1176
1068
|
type UIComponent = 'input' | 'textarea' | 'select' | 'multiselect' | 'radio' | 'checkbox' | 'switch' | 'code' | 'keyvalue' | 'list';
|
|
1177
|
-
type
|
|
1178
|
-
/**
|
|
1179
|
-
* UI configuration
|
|
1180
|
-
*/
|
|
1181
|
-
interface FieldUI {
|
|
1069
|
+
type FieldUI = {
|
|
1182
1070
|
component: UIComponent;
|
|
1183
1071
|
multiline?: boolean;
|
|
1184
1072
|
rows?: number;
|
|
1185
1073
|
options?: FieldOption[];
|
|
1186
1074
|
allowCustom?: boolean;
|
|
1187
|
-
width?:
|
|
1075
|
+
width?: 'full' | 'half';
|
|
1188
1076
|
placeholder?: string;
|
|
1189
|
-
/**
|
|
1190
|
-
* Language hint for code editor components.
|
|
1191
|
-
* Example: "promql", "logql", "traceql", "sql", "json"
|
|
1192
|
-
*/
|
|
1193
1077
|
language?: string;
|
|
1194
|
-
}
|
|
1195
|
-
type
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1078
|
+
};
|
|
1079
|
+
type FieldOption = {
|
|
1080
|
+
label: string;
|
|
1081
|
+
value: unknown;
|
|
1082
|
+
description?: string;
|
|
1083
|
+
};
|
|
1084
|
+
type FieldValidationRule = PatternValidation | RangeValidation | LengthValidation | ItemCountValidation | AllowedValuesValidation | CustomValidation;
|
|
1085
|
+
type BaseValidation = {
|
|
1201
1086
|
id?: string;
|
|
1202
|
-
/**
|
|
1203
|
-
* Human-readable validation error message.
|
|
1204
|
-
*/
|
|
1205
1087
|
message?: string;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1088
|
+
};
|
|
1089
|
+
type PatternValidation = BaseValidation & {
|
|
1208
1090
|
type: 'pattern';
|
|
1209
1091
|
pattern: string;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1092
|
+
};
|
|
1093
|
+
type RangeValidation = BaseValidation & {
|
|
1212
1094
|
type: 'range';
|
|
1213
1095
|
min?: number;
|
|
1214
1096
|
max?: number;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1097
|
+
};
|
|
1098
|
+
type LengthValidation = BaseValidation & {
|
|
1217
1099
|
type: 'length';
|
|
1218
1100
|
min?: number;
|
|
1219
1101
|
max?: number;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1102
|
+
};
|
|
1103
|
+
type ItemCountValidation = BaseValidation & {
|
|
1222
1104
|
type: 'itemCount';
|
|
1223
1105
|
min?: number;
|
|
1224
1106
|
max?: number;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1107
|
+
};
|
|
1108
|
+
type AllowedValuesValidation = BaseValidation & {
|
|
1227
1109
|
type: 'allowedValues';
|
|
1228
1110
|
values: unknown[];
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1111
|
+
};
|
|
1112
|
+
type CustomValidation = BaseValidation & {
|
|
1231
1113
|
type: 'custom';
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
*/
|
|
1237
|
-
expression: Expression;
|
|
1238
|
-
}
|
|
1239
|
-
interface FieldOverride {
|
|
1240
|
-
/**
|
|
1241
|
-
* CEL condition
|
|
1242
|
-
*/
|
|
1243
|
-
when: Expression;
|
|
1114
|
+
expression: string;
|
|
1115
|
+
};
|
|
1116
|
+
type FieldOverride = {
|
|
1117
|
+
when: string;
|
|
1244
1118
|
defaultValue?: unknown;
|
|
1245
|
-
/**
|
|
1246
|
-
* When true, the field is disabled/read-only while this override is active.
|
|
1247
|
-
*/
|
|
1248
1119
|
readOnly?: boolean;
|
|
1249
1120
|
description?: string;
|
|
1250
1121
|
placeholder?: string;
|
|
1251
1122
|
tooltip?: string;
|
|
1252
1123
|
validations?: FieldValidationRule[];
|
|
1253
1124
|
options?: FieldOption[];
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
* Use "value" in the `when` expression to refer to the field's value.
|
|
1260
|
-
*/
|
|
1261
|
-
interface FieldEffect {
|
|
1262
|
-
/**
|
|
1263
|
-
* CEL expression. Example: "value == 'basic-auth'"
|
|
1264
|
-
*/
|
|
1265
|
-
when: Expression;
|
|
1266
|
-
/**
|
|
1267
|
-
* Maps field IDs to the values they should be set to.
|
|
1268
|
-
* Must contain at least one entry.
|
|
1269
|
-
*/
|
|
1270
|
-
set: Record<string, unknown> & {
|
|
1271
|
-
[k: string]: unknown;
|
|
1272
|
-
};
|
|
1273
|
-
}
|
|
1125
|
+
};
|
|
1126
|
+
type FieldEffect = {
|
|
1127
|
+
when: string;
|
|
1128
|
+
set: Record<string, unknown>;
|
|
1129
|
+
};
|
|
1274
1130
|
type StorageMapping = DirectMapping | IndexedPairMapping | ComputedMapping;
|
|
1275
|
-
|
|
1276
|
-
* Direct mapping
|
|
1277
|
-
*/
|
|
1278
|
-
interface DirectMapping {
|
|
1131
|
+
type DirectMapping = {
|
|
1279
1132
|
type: 'direct';
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
* Indexed pair mapping (headers)
|
|
1283
|
-
*/
|
|
1284
|
-
interface IndexedPairMapping {
|
|
1133
|
+
};
|
|
1134
|
+
type IndexedPairMapping = {
|
|
1285
1135
|
type: 'indexedPair';
|
|
1286
1136
|
key: MappingField;
|
|
1287
1137
|
value: MappingField;
|
|
1288
1138
|
startIndex?: number;
|
|
1289
|
-
}
|
|
1290
|
-
/**
|
|
1291
|
-
* Computed mapping (virtual fields).
|
|
1292
|
-
* At least one of `read` or `write` must be provided.
|
|
1293
|
-
*/
|
|
1139
|
+
};
|
|
1294
1140
|
type ComputedMapping = {
|
|
1295
1141
|
type: 'computed';
|
|
1296
|
-
read
|
|
1297
|
-
write?:
|
|
1298
|
-
} | {
|
|
1299
|
-
type: 'computed';
|
|
1300
|
-
read?: Expression;
|
|
1301
|
-
write: Expression;
|
|
1142
|
+
read?: string;
|
|
1143
|
+
write?: string;
|
|
1302
1144
|
};
|
|
1303
|
-
|
|
1304
|
-
* Mapping field
|
|
1305
|
-
*/
|
|
1306
|
-
interface MappingField {
|
|
1145
|
+
type MappingField = {
|
|
1307
1146
|
target: TargetLocation;
|
|
1308
1147
|
pattern: string;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
label: string;
|
|
1312
|
-
/**
|
|
1313
|
-
* Must match parent field valueType.
|
|
1314
|
-
* Must not be null.
|
|
1315
|
-
*/
|
|
1316
|
-
value: NonNullable<unknown>;
|
|
1317
|
-
/**
|
|
1318
|
-
* Optional human-readable description of the option.
|
|
1319
|
-
*/
|
|
1320
|
-
description?: string;
|
|
1321
|
-
}
|
|
1322
|
-
interface ConfigGroup {
|
|
1148
|
+
};
|
|
1149
|
+
type ConfigGroup = {
|
|
1323
1150
|
id: string;
|
|
1324
1151
|
title: string;
|
|
1325
1152
|
description?: string;
|
|
1326
1153
|
order?: number;
|
|
1327
|
-
/**
|
|
1328
|
-
* When true, the group is optional and can be collapsed/hidden by default.
|
|
1329
|
-
*/
|
|
1330
1154
|
optional?: boolean;
|
|
1331
|
-
/**
|
|
1332
|
-
* References field IDs (not keys)
|
|
1333
|
-
*/
|
|
1334
1155
|
fieldRefs: string[];
|
|
1335
|
-
}
|
|
1336
|
-
type
|
|
1337
|
-
|
|
1338
|
-
type: RelationshipType;
|
|
1339
|
-
/**
|
|
1340
|
-
* References field IDs
|
|
1341
|
-
*/
|
|
1156
|
+
};
|
|
1157
|
+
type FieldRelationship = {
|
|
1158
|
+
type: 'pair' | 'group' | 'datasourceReference';
|
|
1342
1159
|
fields: string[];
|
|
1343
1160
|
description?: string;
|
|
1344
|
-
/**
|
|
1345
|
-
* Constrains the datasource UID to a specific plugin type.
|
|
1346
|
-
* Only applicable when type is "datasourceReference".
|
|
1347
|
-
*/
|
|
1348
1161
|
targetPluginType?: string;
|
|
1349
|
-
}
|
|
1162
|
+
};
|
|
1163
|
+
/**
|
|
1164
|
+
* Resolve a schema's groups into arrays of ConfigField objects.
|
|
1165
|
+
* If the schema has no groups, returns a single group containing all non-virtual fields.
|
|
1166
|
+
*/
|
|
1167
|
+
declare function resolveGroups(schema: DatasourceConfigSchema): Array<{
|
|
1168
|
+
group: ConfigGroup;
|
|
1169
|
+
fields: ConfigField[];
|
|
1170
|
+
}>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Build a virtual "Required" group containing all required fields, any parent
|
|
1173
|
+
* fields they depend on (via `dependsOn`), and any child fields that depend on
|
|
1174
|
+
* required fields. When the schema contains an "auth" group, its fields are
|
|
1175
|
+
* also pulled in (auth is effectively required for Prometheus/Loki/Tempo style
|
|
1176
|
+
* datasources). Fields are returned in schema order and de-duplicated.
|
|
1177
|
+
* Returns `null` when the virtual group would be empty.
|
|
1178
|
+
*/
|
|
1179
|
+
declare function resolveRequiredFieldsGroup(schema: DatasourceConfigSchema): {
|
|
1180
|
+
group: ConfigGroup;
|
|
1181
|
+
fields: ConfigField[];
|
|
1182
|
+
} | null;
|
|
1183
|
+
/**
|
|
1184
|
+
* Unique form key for a field. Section-scoped fields (e.g. section:"logs", key:"defaultTable")
|
|
1185
|
+
* get a prefixed key ("logs.defaultTable") so they don't collide with top-level fields that
|
|
1186
|
+
* share the same key name.
|
|
1187
|
+
*/
|
|
1188
|
+
declare function formKey(field: ConfigField): string;
|
|
1189
|
+
/**
|
|
1190
|
+
* Parse a simple CEL-like dependsOn expression: "fieldId == 'value'" or "fieldId == true".
|
|
1191
|
+
* Returns { field, value } or null if unparseable.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function parseDependsOn(expr: string): {
|
|
1194
|
+
field: string;
|
|
1195
|
+
value: string;
|
|
1196
|
+
} | null;
|
|
1197
|
+
/**
|
|
1198
|
+
* Resolve the first matching override for a field given current form values.
|
|
1199
|
+
* Override `when` uses the same "fieldId == 'value'" syntax as dependsOn.
|
|
1200
|
+
* Returns the matching override or undefined if none match.
|
|
1201
|
+
*/
|
|
1202
|
+
declare function resolveActiveOverride(field: ConfigField, watchedValues: Record<string, unknown>, fieldById: Map<string, ConfigField>): FieldOverride | undefined;
|
|
1203
|
+
/**
|
|
1204
|
+
* Evaluate a simple computed.read expression against form values.
|
|
1205
|
+
* Supports patterns used in dsconfig schemas:
|
|
1206
|
+
* - "fieldRef == true ? 'a' : (fieldRef == true ? 'b' : 'c')"
|
|
1207
|
+
* - Simple ternary chains with equality checks
|
|
1208
|
+
* Falls back to the field's defaultValue if the expression can't be evaluated.
|
|
1209
|
+
*/
|
|
1210
|
+
declare function evaluateComputedRead(expr: string, values: Record<string, unknown>, fields: ConfigField[]): unknown;
|
|
1211
|
+
/**
|
|
1212
|
+
* Compute initial values for all virtual fields that have storage.computed.read expressions.
|
|
1213
|
+
* Call after loading existing storage field values.
|
|
1214
|
+
*/
|
|
1215
|
+
declare function computeVirtualFieldValues(schema: DatasourceConfigSchema, existingValues: Record<string, unknown>): Record<string, unknown>;
|
|
1350
1216
|
|
|
1351
1217
|
type DatasourceConfigWizardProps = {
|
|
1352
1218
|
schema: DatasourceConfigSchema;
|
|
@@ -1592,66 +1458,6 @@ interface Props {
|
|
|
1592
1458
|
}
|
|
1593
1459
|
declare function RawQuery({ query, language, className }: Props): React.JSX.Element;
|
|
1594
1460
|
|
|
1595
|
-
/**
|
|
1596
|
-
* Pure helper functions for working with DatasourceConfigSchema.
|
|
1597
|
-
*
|
|
1598
|
-
* Types are defined in schema.ts — import them from there directly.
|
|
1599
|
-
*/
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* Resolve a schema's groups into arrays of ConfigField objects.
|
|
1603
|
-
* If the schema has no groups, returns a single group containing all non-virtual fields.
|
|
1604
|
-
*/
|
|
1605
|
-
declare function resolveGroups(schema: DatasourceConfigSchema): Array<{
|
|
1606
|
-
group: ConfigGroup;
|
|
1607
|
-
fields: ConfigField[];
|
|
1608
|
-
}>;
|
|
1609
|
-
/**
|
|
1610
|
-
* Build a virtual "Required" group containing all required fields, any parent
|
|
1611
|
-
* fields they depend on (via `dependsOn`), and any child fields that depend on
|
|
1612
|
-
* required fields. When the schema contains an "auth" group, its fields are
|
|
1613
|
-
* also pulled in (auth is effectively required for Prometheus/Loki/Tempo style
|
|
1614
|
-
* datasources). Fields are returned in schema order and de-duplicated.
|
|
1615
|
-
* Returns `null` when the virtual group would be empty.
|
|
1616
|
-
*/
|
|
1617
|
-
declare function resolveRequiredFieldsGroup(schema: DatasourceConfigSchema): {
|
|
1618
|
-
group: ConfigGroup;
|
|
1619
|
-
fields: ConfigField[];
|
|
1620
|
-
} | null;
|
|
1621
|
-
/**
|
|
1622
|
-
* Unique form key for a field. Section-scoped fields (e.g. section:"logs", key:"defaultTable")
|
|
1623
|
-
* get a prefixed key ("logs.defaultTable") so they don't collide with top-level fields that
|
|
1624
|
-
* share the same key name.
|
|
1625
|
-
*/
|
|
1626
|
-
declare function formKey(field: ConfigField): string;
|
|
1627
|
-
/**
|
|
1628
|
-
* Parse a simple CEL-like dependsOn expression: "fieldId == 'value'" or "fieldId == true".
|
|
1629
|
-
* Returns { field, value } or null if unparseable.
|
|
1630
|
-
*/
|
|
1631
|
-
declare function parseDependsOn(expr: string): {
|
|
1632
|
-
field: string;
|
|
1633
|
-
value: string;
|
|
1634
|
-
} | null;
|
|
1635
|
-
/**
|
|
1636
|
-
* Resolve the first matching override for a field given current form values.
|
|
1637
|
-
* Override `when` uses the same "fieldId == 'value'" syntax as dependsOn.
|
|
1638
|
-
* Returns the matching override or undefined if none match.
|
|
1639
|
-
*/
|
|
1640
|
-
declare function resolveActiveOverride(field: ConfigField, watchedValues: Record<string, unknown>, fieldById: Map<string, ConfigField>): FieldOverride | undefined;
|
|
1641
|
-
/**
|
|
1642
|
-
* Evaluate a simple computed.read expression against form values.
|
|
1643
|
-
* Supports patterns used in dsconfig schemas:
|
|
1644
|
-
* - "fieldRef == true ? 'a' : (fieldRef == true ? 'b' : 'c')"
|
|
1645
|
-
* - Simple ternary chains with equality checks
|
|
1646
|
-
* Falls back to the field's defaultValue if the expression can't be evaluated.
|
|
1647
|
-
*/
|
|
1648
|
-
declare function evaluateComputedRead(expr: string, values: Record<string, unknown>, fields: ConfigField[]): unknown;
|
|
1649
|
-
/**
|
|
1650
|
-
* Compute initial values for all virtual fields that have storage.computed.read expressions.
|
|
1651
|
-
* Call after loading existing storage field values.
|
|
1652
|
-
*/
|
|
1653
|
-
declare function computeVirtualFieldValues(schema: DatasourceConfigSchema, existingValues: Record<string, unknown>): Record<string, unknown>;
|
|
1654
|
-
|
|
1655
1461
|
type DatasourceResponse = Record<string, unknown> & {
|
|
1656
1462
|
name: string;
|
|
1657
1463
|
id: number;
|
|
@@ -1746,4 +1552,4 @@ declare function toProvisioningYaml(schema: DatasourceConfigSchema, values?: Rec
|
|
|
1746
1552
|
*/
|
|
1747
1553
|
declare function datasourceToProvisioningYaml(ds: Record<string, unknown>, schema: DatasourceConfigSchema | null): string;
|
|
1748
1554
|
|
|
1749
|
-
export { AccessoryButton, AdvancedHttpSettings, type Aggregate, Auth, AuthMethod, type Props$c as AuthProps, BINARY_OPERATIONS_KEY, CatalogSelector, type ColumnDefinition, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, type DB, DataLink, type DataLinkConfig, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, type DatasourceConfigPayload, DatasourceConfigWizard, type DatasourceConfigWizardProps, type DatasourceResponse, DatePicker, type DatePickerProps, DatePickerWithInput, type DatePickerWithInputProps, DebounceInput, type DebounceInputProps, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, type FetchExistingResult, FlexItem, type FormValues, GroupByRow, type IndexedPairItem, InlineSelect, InputGroup, LabelFilters, type LanguageCompletionProvider, type LanguageDefinition, LinkedToken, MacroType, type MetaDefinition, type NameValue, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, type PositionContext, type Props$s as Props, type ProvisioningYamlOptions, QUERY_FORMAT_OPTIONS, QueryBuilderHints, type QueryBuilderLabelFilter, type QueryBuilderOperation, type QueryBuilderOperationDefinition, type QueryBuilderOperationParamDef, type QueryBuilderOperationParamEditorProps, type QueryBuilderOperationParamValue, QueryEditorMode, QueryEditorModeToggle, type QueryEditorProps, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, type QueryRowFilter, type QueryStats, type QueryWithDefaults, type RAQBFieldTypes, RawQuery, type ResourceSelectorProps, type ResponseParser, RunQueryButton, SECURE_FIELD_CONFIGURED, type SQLConnectionLimits, SQLEditor, SQLEditorMode, SQLEditorTestUtils, type SQLExpression, type SQLFilters, type SQLMonarchLanguage, type SQLOptions, type SQLQuery, type SQLSelectableValue, type SchemaDefinition, SecureSocksProxyToggle, Segment, type SegmentProps, Space, SqlDatasource, SqlQueryEditor, type SqlQueryForInterpolation, type SqlQueryModel, type State$1 as State, type StatementPlacementProvider, StatementPosition, SuggestionKind, type SuggestionKindProvider, TLSSettings, type Props$f as TLSSettingsProps, type TableDefinition, type TableFieldSchema, type TableIdentifier, type TableSchema, TableSelector, type TestQueryModel, TokenType, type ValidationResults, type VisualQuery, type VisualQueryBinary, type VisualQueryModeller, buildDatasourceConfigPayload, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateComputedRead, expandIndexedPair, fetchExistingValues, flattenIndexedPair, formKey, formatDate, generateLLMHint, generateTroubleshootingFields, getStandardSQLCompletionProvider, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, parseDependsOn, resolveActiveOverride, resolveGroups, resolveRequiredFieldsGroup, submitDatasourceConfig, toOption, toProvisioningYaml };
|
|
1555
|
+
export { AccessoryButton, AdvancedHttpSettings, type Aggregate, type AllowedValuesValidation, Auth, AuthMethod, type Props$c as AuthProps, BINARY_OPERATIONS_KEY, CatalogSelector, type ColumnDefinition, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, type ConfigField, type ConfigGroup, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, type CustomValidation, type DB, DataLink, type DataLinkConfig, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, type DatasourceConfigPayload, type DatasourceConfigSchema, DatasourceConfigWizard, type DatasourceConfigWizardProps, type DatasourceResponse, DatePicker, type DatePickerProps, DatePickerWithInput, type DatePickerWithInputProps, DebounceInput, type DebounceInputProps, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, type FetchExistingResult, type FieldEffect, type FieldItemSchema, type FieldKind, type FieldOption, type FieldOverride, type FieldRelationship, type FieldUI, type FieldValidationRule, FlexItem, type FormValues, GroupByRow, type IndexedPairItem, InlineSelect, InputGroup, type ItemCountValidation, LabelFilters, type LanguageCompletionProvider, type LanguageDefinition, type LengthValidation, type Lifecycle, LinkedToken, MacroType, type MetaDefinition, type NameValue, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, type PatternValidation, type PositionContext, type Props$s as Props, type ProvisioningYamlOptions, QUERY_FORMAT_OPTIONS, QueryBuilderHints, type QueryBuilderLabelFilter, type QueryBuilderOperation, type QueryBuilderOperationDefinition, type QueryBuilderOperationParamDef, type QueryBuilderOperationParamEditorProps, type QueryBuilderOperationParamValue, QueryEditorMode, QueryEditorModeToggle, type QueryEditorProps, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, type QueryRowFilter, type QueryStats, type QueryWithDefaults, type RAQBFieldTypes, type RangeValidation, RawQuery, type ResourceSelectorProps, type ResponseParser, RunQueryButton, SECURE_FIELD_CONFIGURED, type SQLConnectionLimits, SQLEditor, SQLEditorMode, SQLEditorTestUtils, type SQLExpression, type SQLFilters, type SQLMonarchLanguage, type SQLOptions, type SQLQuery, type SQLSelectableValue, type SchemaDefinition, SecureSocksProxyToggle, Segment, type SegmentProps, type SemanticType, Space, SqlDatasource, SqlQueryEditor, type SqlQueryForInterpolation, type SqlQueryModel, type State$1 as State, type StatementPlacementProvider, StatementPosition, type StorageMapping, SuggestionKind, type SuggestionKindProvider, TLSSettings, type Props$f as TLSSettingsProps, type TableDefinition, type TableFieldSchema, type TableIdentifier, type TableSchema, TableSelector, type TargetLocation, type TestQueryModel, TokenType, type UIComponent, type ValidationResults, type ValueType, type VisualQuery, type VisualQueryBinary, type VisualQueryModeller, buildDatasourceConfigPayload, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateComputedRead, expandIndexedPair, fetchExistingValues, flattenIndexedPair, formKey, formatDate, generateLLMHint, generateTroubleshootingFields, getStandardSQLCompletionProvider, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, parseDependsOn, resolveActiveOverride, resolveGroups, resolveRequiredFieldsGroup, submitDatasourceConfig, toOption, toProvisioningYaml };
|
package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatasourceConfigWizard.js","sources":["../../../../../src/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.tsx"],"sourcesContent":["import React, { type ReactNode, useCallback, useMemo, useState } from 'react';\nimport { useStyles2, Button, LinkButton, Select, Icon, Alert, Tooltip, Spinner } from '@grafana/ui';\nimport type { DatasourceConfigSchema } from '../../../datasource/schema/schema';\nimport { formKey } from '../../../datasource/schema/config';\nimport { SECURE_FIELD_CONFIGURED } from '../../../datasource/schema/datasource';\nimport { isFieldRequired } from './fieldUtils';\nimport { SchemaField } from './SchemaField';\nimport { AuthorizationHeaderField } from './AuthorizationHeaderField';\nimport { TabLayout } from './TabLayout';\nimport { getWizardStyles } from './wizardStyles';\nimport { useDatasourceConfigForm } from './useDatasourceConfigForm';\n\nexport type DatasourceConfigWizardProps = {\n schema: DatasourceConfigSchema;\n dsUid: string;\n dsName: string;\n onSuccess: (status: string, message?: string) => void;\n onSaving?: (saving: boolean) => void;\n onRetest?: () => void;\n onFollowup?: (intent: string) => void;\n healthError?: string;\n mode?: 'tab' | 'wizard';\n /** Optional render prop for custom action buttons (e.g. analyze/troubleshoot). */\n renderActions?: (props: { dsUid: string; dsName: string; dsType: string; healthError?: string }) => ReactNode;\n};\n\nexport function DatasourceConfigWizard(props: DatasourceConfigWizardProps) {\n const { schema, dsUid, dsName, onSuccess, onSaving, onRetest, healthError, renderActions, mode = 'tab' } = props;\n\n const form = useDatasourceConfigForm({ schema, dsUid, onSuccess, onSaving });\n\n if (mode === 'tab') {\n return (\n <TabLayout\n form={form}\n schema={schema}\n dsUid={dsUid}\n dsName={dsName}\n onRetest={onRetest}\n healthError={healthError}\n renderActions={renderActions}\n />\n );\n }\n\n return (\n <WizardLayout\n form={form}\n schema={schema}\n dsUid={dsUid}\n dsName={dsName}\n onRetest={onRetest}\n healthError={healthError}\n renderActions={renderActions}\n />\n );\n}\n\ntype LayoutProps = {\n form: ReturnType<typeof useDatasourceConfigForm>;\n schema: DatasourceConfigSchema;\n dsUid: string;\n dsName: string;\n onRetest?: () => void;\n healthError?: string;\n renderActions?: (props: { dsUid: string; dsName: string; dsType: string; healthError?: string }) => ReactNode;\n};\n\nfunction WizardLayout({ form, schema, dsUid, dsName, onRetest, healthError, renderActions }: LayoutProps) {\n const styles = useStyles2(getWizardStyles);\n const [currentStep, setCurrentStep] = useState(0);\n\n const {\n resolvedGroups,\n fieldById,\n httpHeadersField,\n control,\n handleSubmit,\n trigger,\n errors,\n watchedValues,\n initializing,\n fetchError,\n submitting,\n submitError,\n readOnly,\n isFieldVisible,\n onSubmit,\n } = form;\n\n const arrowSteps = useMemo(() => {\n const requiredGroup = resolvedGroups.find((g) => g.group.id === '_required');\n if (!requiredGroup) {\n return new Set(resolvedGroups.map((_, i) => i));\n }\n const requiredFieldIds = new Set(requiredGroup.fields.map((f) => f.id));\n const steps = new Set<number>();\n for (let i = 0; i < resolvedGroups.length; i++) {\n const g = resolvedGroups[i];\n if (g.group.id === '_required' || g.fields.some((f) => !requiredFieldIds.has(f.id))) {\n steps.add(i);\n }\n }\n return steps;\n }, [resolvedGroups]);\n\n const currentResolved = resolvedGroups[currentStep];\n\n const isFirstStep = useMemo(() => {\n for (let i = 0; i < currentStep; i++) {\n if (arrowSteps.has(i)) {\n return false;\n }\n }\n return true;\n }, [currentStep, arrowSteps]);\n\n const isLastStep = useMemo(() => {\n for (let i = currentStep + 1; i < resolvedGroups.length; i++) {\n if (arrowSteps.has(i)) {\n return false;\n }\n }\n return true;\n }, [currentStep, arrowSteps, resolvedGroups.length]);\n\n const visibleFieldsForStep = useMemo(\n () => (currentResolved ? currentResolved.fields.filter(isFieldVisible) : []),\n [currentResolved, isFieldVisible]\n );\n\n const currentGroupValid = useMemo(() => {\n if (!currentResolved) {\n return true;\n }\n for (const field of visibleFieldsForStep) {\n if (errors[formKey(field)]) {\n return false;\n }\n if (isFieldRequired(field, watchedValues, fieldById)) {\n const val = watchedValues[formKey(field)];\n if (val === SECURE_FIELD_CONFIGURED) {\n continue;\n }\n if (val === undefined || val === null || val === '') {\n return false;\n }\n }\n }\n return true;\n }, [currentResolved, errors, visibleFieldsForStep, watchedValues, fieldById]);\n\n const goNext = useCallback(async () => {\n if (!currentResolved) {\n return;\n }\n if (!readOnly) {\n const visibleKeys = visibleFieldsForStep.map((f) => formKey(f));\n const valid = await trigger(visibleKeys);\n if (!valid) {\n return;\n }\n }\n setCurrentStep((s) => {\n for (let i = s + 1; i < resolvedGroups.length; i++) {\n if (arrowSteps.has(i)) {\n return i;\n }\n }\n return s;\n });\n }, [currentResolved, visibleFieldsForStep, trigger, resolvedGroups.length, arrowSteps, readOnly]);\n\n const goPrev = useCallback(() => {\n setCurrentStep((s) => {\n for (let i = s - 1; i >= 0; i--) {\n if (arrowSteps.has(i)) {\n return i;\n }\n }\n return s;\n });\n }, [arrowSteps]);\n\n if (initializing) {\n return (\n <div className={styles.container}>\n <Spinner size=\"sm\" inline /> Loading configuration...\n </div>\n );\n }\n\n if (fetchError) {\n return (\n <div className={styles.container}>\n <Alert severity=\"error\" title=\"Failed to load configuration\">\n {fetchError}\n </Alert>\n <div className={styles.buttons}>\n <LinkButton\n variant=\"secondary\"\n size=\"sm\"\n icon=\"external-link-alt\"\n href={`/connections/datasources/edit/${dsUid}`}\n >\n Open datasource settings\n </LinkButton>\n </div>\n </div>\n );\n }\n\n const allDisabled = submitting || readOnly;\n\n if (resolvedGroups.length === 0) {\n return null;\n }\n\n const currentGroup = currentResolved?.group;\n\n return (\n <div className={styles.container}>\n {submitting && (\n <div className={styles.overlay}>\n <Spinner size=\"sm\" />\n <span>Saving & testing…</span>\n </div>\n )}\n {readOnly && (\n <div className={styles.readOnlyBanner}>\n <Icon name=\"lock\" size=\"xs\" />\n <span>Read-only — managed externally</span>\n </div>\n )}\n <div className={styles.navBar}>\n {currentGroup && (\n <Tooltip content={currentGroup.description ?? currentGroup.title}>\n <span className={styles.navTitle}>\n {currentGroup.title}\n <span className={styles.stepCount}>\n {currentStep + 1}/{resolvedGroups.length}\n </span>\n </span>\n </Tooltip>\n )}\n <div className={styles.navActions}>\n <Tooltip content={isFirstStep ? 'First step' : `Previous: ${resolvedGroups[currentStep - 1]?.group.title}`}>\n <Button\n variant=\"secondary\"\n fill=\"text\"\n size=\"sm\"\n icon=\"angle-left\"\n aria-label=\"Previous\"\n onClick={goPrev}\n disabled={isFirstStep || submitting}\n type=\"button\"\n />\n </Tooltip>\n <Select\n options={resolvedGroups.map((g, i) => ({ label: g.group.title, value: i }))}\n value={currentStep}\n onChange={(v) => {\n if (v) {\n setCurrentStep(v.value!);\n }\n }}\n disabled={submitting}\n width={18}\n />\n <Tooltip content={isLastStep ? 'Last step' : `Next: ${resolvedGroups[currentStep + 1]?.group.title}`}>\n <Button\n variant={isLastStep || (!readOnly && !currentGroupValid) ? 'secondary' : 'primary'}\n size=\"sm\"\n icon=\"angle-right\"\n aria-label=\"Next\"\n onClick={goNext}\n disabled={isLastStep || submitting}\n type=\"button\"\n />\n </Tooltip>\n </div>\n </div>\n\n {currentResolved && (\n <form onSubmit={handleSubmit(onSubmit)} className={styles.form}>\n {visibleFieldsForStep.map((field) => (\n <SchemaField\n key={formKey(field)}\n field={field}\n control={control}\n errors={errors}\n disabled={allDisabled}\n dsUid={dsUid}\n watchedValues={watchedValues}\n fieldById={fieldById}\n />\n ))}\n\n {(currentResolved.group.id === '_required' || currentResolved.group.id === 'auth') && httpHeadersField && (\n <AuthorizationHeaderField\n headersFieldKey={formKey(httpHeadersField)}\n control={control}\n disabled={allDisabled}\n watchedValues={watchedValues}\n />\n )}\n\n {submitError && (\n <Alert severity=\"error\" title=\"Error\">\n {submitError}\n </Alert>\n )}\n\n <div className={styles.buttons}>\n {readOnly ? (\n <Button variant=\"primary\" size=\"sm\" icon=\"sync\" onClick={onRetest} type=\"button\">\n Test\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"sm\" disabled={submitting || !currentGroupValid} type=\"submit\">\n {submitting ? 'Saving...' : 'Save & Test'}\n </Button>\n )}\n {healthError && renderActions?.({ dsUid, dsName, dsType: schema.pluginType, healthError })}\n </div>\n </form>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA0BO,SAAS,uBAAuB,KAAA,EAAoC;AACzE,EAAA,MAAM,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ,SAAA,EAAW,QAAA,EAAU,QAAA,EAAU,WAAA,EAAa,aAAA,EAAe,IAAA,GAAO,KAAA,EAAM,GAAI,KAAA;AAE3G,EAAA,MAAM,OAAO,uBAAA,CAAwB,EAAE,QAAQ,KAAA,EAAO,SAAA,EAAW,UAAU,CAAA;AAE3E,EAAA,IAAI,SAAS,KAAA,EAAO;AAClB,IAAA,uBACE,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,KAAW,gBAAA,oBACpF,KAAA,CAAA,aAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,eAAA,EAAiB,QAAQ,gBAAgB,CAAA;AAAA,MACzC,OAAA;AAAA,MACA,QAAA,EAAU,WAAA;AAAA,MACV;AAAA;AAAA,GACF,EAGD,WAAA,oBACC,KAAA,CAAA,aAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAQ,KAAA,EAAM,OAAA,EAAA,EAC3B,WACH,CAAA,kBAGF,KAAA,CAAA,aAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,OAAA,EAAA,EACpB,QAAA,mBACC,KAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,SAAA,EAAU,IAAA,EAAK,IAAA,EAAK,IAAA,EAAK,MAAA,EAAO,OAAA,EAAS,QAAA,EAAU,IAAA,EAAK,QAAA,EAAA,EAAS,MAEjF,CAAA,mBAEA,KAAA,CAAA,aAAA,CAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,SAAA,EAAU,IAAA,EAAK,IAAA,EAAK,QAAA,EAAU,UAAA,IAAc,CAAC,iBAAA,EAAmB,IAAA,EAAK,QAAA,EAAA,EAClF,UAAA,GAAa,WAAA,GAAc,aAC9B,CAAA,EAED,WAAA,KAAe,aAAA,IAAA,IAAA,GAAA,MAAA,GAAA,aAAA,CAAgB,EAAE,KAAA,EAAO,MAAA,EAAQ,MAAA,EAAQ,MAAA,CAAO,UAAA,EAAY,WAAA,EAAY,CAAA,CAC1F,CACF,CAEJ,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DatasourceConfigWizard.js","sources":["../../../../../src/components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.tsx"],"sourcesContent":["import React, { type ReactNode, useCallback, useMemo, useState } from 'react';\nimport { useStyles2, Button, LinkButton, Select, Icon, Alert, Tooltip, Spinner } from '@grafana/ui';\nimport { formKey, type DatasourceConfigSchema } from '../../../datasource/schema/config';\nimport { SECURE_FIELD_CONFIGURED } from '../../../datasource/schema/datasource';\nimport { isFieldRequired } from './fieldUtils';\nimport { SchemaField } from './SchemaField';\nimport { AuthorizationHeaderField } from './AuthorizationHeaderField';\nimport { TabLayout } from './TabLayout';\nimport { getWizardStyles } from './wizardStyles';\nimport { useDatasourceConfigForm } from './useDatasourceConfigForm';\n\nexport type DatasourceConfigWizardProps = {\n schema: DatasourceConfigSchema;\n dsUid: string;\n dsName: string;\n onSuccess: (status: string, message?: string) => void;\n onSaving?: (saving: boolean) => void;\n onRetest?: () => void;\n onFollowup?: (intent: string) => void;\n healthError?: string;\n mode?: 'tab' | 'wizard';\n /** Optional render prop for custom action buttons (e.g. analyze/troubleshoot). */\n renderActions?: (props: { dsUid: string; dsName: string; dsType: string; healthError?: string }) => ReactNode;\n};\n\nexport function DatasourceConfigWizard(props: DatasourceConfigWizardProps) {\n const { schema, dsUid, dsName, onSuccess, onSaving, onRetest, healthError, renderActions, mode = 'tab' } = props;\n\n const form = useDatasourceConfigForm({ schema, dsUid, onSuccess, onSaving });\n\n if (mode === 'tab') {\n return (\n <TabLayout\n form={form}\n schema={schema}\n dsUid={dsUid}\n dsName={dsName}\n onRetest={onRetest}\n healthError={healthError}\n renderActions={renderActions}\n />\n );\n }\n\n return (\n <WizardLayout\n form={form}\n schema={schema}\n dsUid={dsUid}\n dsName={dsName}\n onRetest={onRetest}\n healthError={healthError}\n renderActions={renderActions}\n />\n );\n}\n\ntype LayoutProps = {\n form: ReturnType<typeof useDatasourceConfigForm>;\n schema: DatasourceConfigSchema;\n dsUid: string;\n dsName: string;\n onRetest?: () => void;\n healthError?: string;\n renderActions?: (props: { dsUid: string; dsName: string; dsType: string; healthError?: string }) => ReactNode;\n};\n\nfunction WizardLayout({ form, schema, dsUid, dsName, onRetest, healthError, renderActions }: LayoutProps) {\n const styles = useStyles2(getWizardStyles);\n const [currentStep, setCurrentStep] = useState(0);\n\n const {\n resolvedGroups,\n fieldById,\n httpHeadersField,\n control,\n handleSubmit,\n trigger,\n errors,\n watchedValues,\n initializing,\n fetchError,\n submitting,\n submitError,\n readOnly,\n isFieldVisible,\n onSubmit,\n } = form;\n\n const arrowSteps = useMemo(() => {\n const requiredGroup = resolvedGroups.find((g) => g.group.id === '_required');\n if (!requiredGroup) {\n return new Set(resolvedGroups.map((_, i) => i));\n }\n const requiredFieldIds = new Set(requiredGroup.fields.map((f) => f.id));\n const steps = new Set<number>();\n for (let i = 0; i < resolvedGroups.length; i++) {\n const g = resolvedGroups[i];\n if (g.group.id === '_required' || g.fields.some((f) => !requiredFieldIds.has(f.id))) {\n steps.add(i);\n }\n }\n return steps;\n }, [resolvedGroups]);\n\n const currentResolved = resolvedGroups[currentStep];\n\n const isFirstStep = useMemo(() => {\n for (let i = 0; i < currentStep; i++) {\n if (arrowSteps.has(i)) {\n return false;\n }\n }\n return true;\n }, [currentStep, arrowSteps]);\n\n const isLastStep = useMemo(() => {\n for (let i = currentStep + 1; i < resolvedGroups.length; i++) {\n if (arrowSteps.has(i)) {\n return false;\n }\n }\n return true;\n }, [currentStep, arrowSteps, resolvedGroups.length]);\n\n const visibleFieldsForStep = useMemo(\n () => (currentResolved ? currentResolved.fields.filter(isFieldVisible) : []),\n [currentResolved, isFieldVisible]\n );\n\n const currentGroupValid = useMemo(() => {\n if (!currentResolved) {\n return true;\n }\n for (const field of visibleFieldsForStep) {\n if (errors[formKey(field)]) {\n return false;\n }\n if (isFieldRequired(field, watchedValues, fieldById)) {\n const val = watchedValues[formKey(field)];\n if (val === SECURE_FIELD_CONFIGURED) {\n continue;\n }\n if (val === undefined || val === null || val === '') {\n return false;\n }\n }\n }\n return true;\n }, [currentResolved, errors, visibleFieldsForStep, watchedValues, fieldById]);\n\n const goNext = useCallback(async () => {\n if (!currentResolved) {\n return;\n }\n if (!readOnly) {\n const visibleKeys = visibleFieldsForStep.map((f) => formKey(f));\n const valid = await trigger(visibleKeys);\n if (!valid) {\n return;\n }\n }\n setCurrentStep((s) => {\n for (let i = s + 1; i < resolvedGroups.length; i++) {\n if (arrowSteps.has(i)) {\n return i;\n }\n }\n return s;\n });\n }, [currentResolved, visibleFieldsForStep, trigger, resolvedGroups.length, arrowSteps, readOnly]);\n\n const goPrev = useCallback(() => {\n setCurrentStep((s) => {\n for (let i = s - 1; i >= 0; i--) {\n if (arrowSteps.has(i)) {\n return i;\n }\n }\n return s;\n });\n }, [arrowSteps]);\n\n if (initializing) {\n return (\n <div className={styles.container}>\n <Spinner size=\"sm\" inline /> Loading configuration...\n </div>\n );\n }\n\n if (fetchError) {\n return (\n <div className={styles.container}>\n <Alert severity=\"error\" title=\"Failed to load configuration\">\n {fetchError}\n </Alert>\n <div className={styles.buttons}>\n <LinkButton\n variant=\"secondary\"\n size=\"sm\"\n icon=\"external-link-alt\"\n href={`/connections/datasources/edit/${dsUid}`}\n >\n Open datasource settings\n </LinkButton>\n </div>\n </div>\n );\n }\n\n const allDisabled = submitting || readOnly;\n\n if (resolvedGroups.length === 0) {\n return null;\n }\n\n const currentGroup = currentResolved?.group;\n\n return (\n <div className={styles.container}>\n {submitting && (\n <div className={styles.overlay}>\n <Spinner size=\"sm\" />\n <span>Saving & testing…</span>\n </div>\n )}\n {readOnly && (\n <div className={styles.readOnlyBanner}>\n <Icon name=\"lock\" size=\"xs\" />\n <span>Read-only — managed externally</span>\n </div>\n )}\n <div className={styles.navBar}>\n {currentGroup && (\n <Tooltip content={currentGroup.description ?? currentGroup.title}>\n <span className={styles.navTitle}>\n {currentGroup.title}\n <span className={styles.stepCount}>\n {currentStep + 1}/{resolvedGroups.length}\n </span>\n </span>\n </Tooltip>\n )}\n <div className={styles.navActions}>\n <Tooltip content={isFirstStep ? 'First step' : `Previous: ${resolvedGroups[currentStep - 1]?.group.title}`}>\n <Button\n variant=\"secondary\"\n fill=\"text\"\n size=\"sm\"\n icon=\"angle-left\"\n aria-label=\"Previous\"\n onClick={goPrev}\n disabled={isFirstStep || submitting}\n type=\"button\"\n />\n </Tooltip>\n <Select\n options={resolvedGroups.map((g, i) => ({ label: g.group.title, value: i }))}\n value={currentStep}\n onChange={(v) => {\n if (v) {\n setCurrentStep(v.value!);\n }\n }}\n disabled={submitting}\n width={18}\n />\n <Tooltip content={isLastStep ? 'Last step' : `Next: ${resolvedGroups[currentStep + 1]?.group.title}`}>\n <Button\n variant={isLastStep || (!readOnly && !currentGroupValid) ? 'secondary' : 'primary'}\n size=\"sm\"\n icon=\"angle-right\"\n aria-label=\"Next\"\n onClick={goNext}\n disabled={isLastStep || submitting}\n type=\"button\"\n />\n </Tooltip>\n </div>\n </div>\n\n {currentResolved && (\n <form onSubmit={handleSubmit(onSubmit)} className={styles.form}>\n {visibleFieldsForStep.map((field) => (\n <SchemaField\n key={formKey(field)}\n field={field}\n control={control}\n errors={errors}\n disabled={allDisabled}\n dsUid={dsUid}\n watchedValues={watchedValues}\n fieldById={fieldById}\n />\n ))}\n\n {(currentResolved.group.id === '_required' || currentResolved.group.id === 'auth') && httpHeadersField && (\n <AuthorizationHeaderField\n headersFieldKey={formKey(httpHeadersField)}\n control={control}\n disabled={allDisabled}\n watchedValues={watchedValues}\n />\n )}\n\n {submitError && (\n <Alert severity=\"error\" title=\"Error\">\n {submitError}\n </Alert>\n )}\n\n <div className={styles.buttons}>\n {readOnly ? (\n <Button variant=\"primary\" size=\"sm\" icon=\"sync\" onClick={onRetest} type=\"button\">\n Test\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"sm\" disabled={submitting || !currentGroupValid} type=\"submit\">\n {submitting ? 'Saving...' : 'Save & Test'}\n </Button>\n )}\n {healthError && renderActions?.({ dsUid, dsName, dsType: schema.pluginType, healthError })}\n </div>\n </form>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAyBO,SAAS,uBAAuB,KAAA,EAAoC;AACzE,EAAA,MAAM,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ,SAAA,EAAW,QAAA,EAAU,QAAA,EAAU,WAAA,EAAa,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version":3,"file":"SchemaField.js","sources":["../../../../../src/components/ConfigEditor/DatasourceConfigWizard/SchemaField.tsx"],"sourcesContent":["import React from 'react';\nimport { type useForm, Controller } from 'react-hook-form';\nimport { useStyles2, Icon, Tooltip } from '@grafana/ui';\nimport type
|
|
1
|
+
{"version":3,"file":"SchemaField.js","sources":["../../../../../src/components/ConfigEditor/DatasourceConfigWizard/SchemaField.tsx"],"sourcesContent":["import React from 'react';\nimport { type useForm, Controller } from 'react-hook-form';\nimport { useStyles2, Icon, Tooltip } from '@grafana/ui';\nimport { type ConfigField, resolveActiveOverride, formKey } from '../../../datasource/schema/config';\nimport type { FormValues } from '../../../datasource/schema/types';\nimport { isFieldRequired, buildValidationRules } from './fieldUtils';\nimport { PdcFieldNote } from './PdcFieldNote';\nimport { renderFieldInput } from './renderFieldInput';\nimport { getWizardStyles } from './wizardStyles';\n\nexport type SchemaFieldProps = {\n field: ConfigField;\n control: ReturnType<typeof useForm<FormValues>>['control'];\n errors: ReturnType<typeof useForm<FormValues>>['formState']['errors'];\n disabled?: boolean;\n dsUid: string;\n watchedValues: Record<string, unknown>;\n fieldById: Map<string, ConfigField>;\n};\n\nexport function SchemaField({ field, control, errors, disabled, dsUid, watchedValues, fieldById }: SchemaFieldProps) {\n const styles = useStyles2(getWizardStyles);\n\n const activeOverride = resolveActiveOverride(field, watchedValues, fieldById);\n const fk = formKey(field);\n\n if (field.key === 'pdcInjected' && field.target === 'jsonData') {\n return (\n <Controller\n name={fk}\n control={control}\n render={({ field: formField }) => (\n <PdcFieldNote\n enabled={!!formField.value}\n description={field.description}\n configUrl={`/connections/datasources/edit/${dsUid}`}\n />\n )}\n />\n );\n }\n\n const required = isFieldRequired(field, watchedValues, fieldById);\n const validationRules = buildValidationRules(field, required);\n\n return (\n <Controller\n name={fk}\n control={control}\n rules={validationRules}\n render={({ field: formField }) => {\n const errorMessage = errors[fk]?.message as string | undefined;\n const label = field.label ?? field.key;\n const description = activeOverride?.description ?? field.description;\n const effectiveField = activeOverride\n ? {\n ...field,\n description,\n ui: {\n ...field.ui,\n placeholder: activeOverride.placeholder ?? field.ui?.placeholder,\n } as ConfigField['ui'],\n }\n : field;\n const isReadOnly = !!activeOverride?.readOnly;\n const isBool = field.valueType === 'boolean';\n\n return (\n <div className={isBool ? styles.fieldRowCenter : styles.fieldRow}>\n <div className={isBool ? styles.fieldLabelRowCompact : styles.fieldLabelRow}>\n <span className={styles.fieldLabel}>\n {label}\n {required && <span className={styles.fieldRequired}>*</span>}\n </span>\n {description && (\n <Tooltip content={description}>\n <Icon name=\"info-circle\" size=\"xs\" className={styles.fieldInfoIcon} />\n </Tooltip>\n )}\n </div>\n <div className={styles.fieldInputCol}>\n {renderFieldInput(effectiveField, formField, disabled || isReadOnly)}\n {errorMessage && <span className={styles.fieldError}>{errorMessage}</span>}\n </div>\n </div>\n );\n }}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAoBO,SAAS,WAAA,CAAY,EAAE,KAAA,EAAO,OAAA,EAAS,QAAQ,QAAA,EAAU,KAAA,EAAO,aAAA,EAAe,SAAA,EAAU,EAAqB;AACnH,EAAA,MAAM,MAAA,GAAS,WAAW,eAAe,CAAA;AAEzC,EAAA,MAAM,cAAA,GAAiB,qBAAA,CAAsB,KAAA,EAAO,aAAA,EAAe,SAAS,CAAA;AAC5E,EAAA,MAAM,EAAA,GAAK,QAAQ,KAAK,CAAA;AAExB,EAAA,IAAI,KAAA,CAAM,GAAA,KAAQ,aAAA,IAAiB,KAAA,CAAM,WAAW,UAAA,EAAY;AAC9D,IAAA,uBACE,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,EAAA;AAAA,QACN,OAAA;AAAA,QACA,MAAA,EAAQ,CAAC,EAAE,KAAA,EAAO,WAAU,qBAC1B,KAAA,CAAA,aAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAS,CAAC,CAAC,SAAA,CAAU,KAAA;AAAA,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