@grafana/plugin-ui 0.17.1 → 0.17.2
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 +53 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +9 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/WizardLayout.js +2 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/WizardLayout.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceConfigForm.js +3 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceConfigForm.js.map +1 -1
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceSchema.js +39 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceSchema.js.map +1 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/tracking.js +18 -0
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/tracking.js.map +1 -0
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -24208,6 +24208,20 @@ function groupHasData(group, watchedValues) {
|
|
|
24208
24208
|
return false;
|
|
24209
24209
|
}
|
|
24210
24210
|
|
|
24211
|
+
const trackConfigWizardSectionChange = (config_section = "default", plugin_id = "unknown") => {
|
|
24212
|
+
runtime.reportInteraction("grafana_dsconfig_section_visited", {
|
|
24213
|
+
config_section,
|
|
24214
|
+
plugin_id,
|
|
24215
|
+
grafana_version: runtime.config.buildInfo.version
|
|
24216
|
+
});
|
|
24217
|
+
};
|
|
24218
|
+
const trackConfigWizardSubmitEvent = (props) => {
|
|
24219
|
+
runtime.reportInteraction("grafana_dsconfig_submitted", {
|
|
24220
|
+
...props,
|
|
24221
|
+
grafana_version: runtime.config.buildInfo.version
|
|
24222
|
+
});
|
|
24223
|
+
};
|
|
24224
|
+
|
|
24211
24225
|
function useDatasourceConfigForm(props) {
|
|
24212
24226
|
const { schema, dsUid, onSuccess, onSaving } = props;
|
|
24213
24227
|
const [submitting, setSubmitting] = React.useState(false);
|
|
@@ -24396,8 +24410,10 @@ function useDatasourceConfigForm(props) {
|
|
|
24396
24410
|
const merged = { ...defaults, ...refreshed.values };
|
|
24397
24411
|
const virtualValues = computeVirtualFieldValues(schema, merged);
|
|
24398
24412
|
reset({ ...merged, ...virtualValues });
|
|
24413
|
+
trackConfigWizardSubmitEvent({ success: true });
|
|
24399
24414
|
onSuccess("UPDATED", "Configuration saved.");
|
|
24400
24415
|
} catch (err) {
|
|
24416
|
+
trackConfigWizardSubmitEvent({ success: false });
|
|
24401
24417
|
await minDelay;
|
|
24402
24418
|
setSubmitError(err instanceof Error ? err.message : "Failed to update datasource");
|
|
24403
24419
|
} finally {
|
|
@@ -24491,6 +24507,7 @@ function WizardLayout({ form, schema, dsUid, dsName, onRetest, healthError, rend
|
|
|
24491
24507
|
value: currentStep,
|
|
24492
24508
|
onChange: (v) => {
|
|
24493
24509
|
if ((v == null ? void 0 : v.value) != null) {
|
|
24510
|
+
trackConfigWizardSectionChange(v.label || v.title);
|
|
24494
24511
|
setCurrentStep(v.value);
|
|
24495
24512
|
}
|
|
24496
24513
|
},
|
|
@@ -24698,6 +24715,40 @@ function resolvePluginName(pluginType) {
|
|
|
24698
24715
|
return (_a = cache.get(pluginType)) != null ? _a : pluginType;
|
|
24699
24716
|
}
|
|
24700
24717
|
|
|
24718
|
+
function useDatasourceSchema(pluginType) {
|
|
24719
|
+
const [schema, setSchema] = React.useState(null);
|
|
24720
|
+
const [loading, setLoading] = React.useState(false);
|
|
24721
|
+
const [error, setError] = React.useState(null);
|
|
24722
|
+
React.useEffect(() => {
|
|
24723
|
+
let cancelled = false;
|
|
24724
|
+
setLoading(true);
|
|
24725
|
+
setError(null);
|
|
24726
|
+
fetchConfigSchema(pluginType).then((result) => {
|
|
24727
|
+
if (!cancelled) {
|
|
24728
|
+
setSchema(result);
|
|
24729
|
+
}
|
|
24730
|
+
}).catch((err) => {
|
|
24731
|
+
if (!cancelled) {
|
|
24732
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
24733
|
+
}
|
|
24734
|
+
}).finally(() => {
|
|
24735
|
+
if (!cancelled) {
|
|
24736
|
+
setLoading(false);
|
|
24737
|
+
}
|
|
24738
|
+
});
|
|
24739
|
+
return () => {
|
|
24740
|
+
cancelled = true;
|
|
24741
|
+
};
|
|
24742
|
+
}, [pluginType]);
|
|
24743
|
+
return { schema, loading, error };
|
|
24744
|
+
}
|
|
24745
|
+
function fetchConfigSchema(pluginType) {
|
|
24746
|
+
if (!pluginType) {
|
|
24747
|
+
return Promise.resolve(null);
|
|
24748
|
+
}
|
|
24749
|
+
return getConfigSchema(pluginType);
|
|
24750
|
+
}
|
|
24751
|
+
|
|
24701
24752
|
var __defProp$2 = Object.defineProperty;
|
|
24702
24753
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24703
24754
|
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -29321,6 +29372,7 @@ exports.evaluateCelExpression = evaluateCelExpression;
|
|
|
29321
29372
|
exports.evaluateComputedRead = evaluateComputedRead;
|
|
29322
29373
|
exports.evaluateDependsOn = evaluateDependsOn;
|
|
29323
29374
|
exports.extractFieldRefs = extractFieldRefs;
|
|
29375
|
+
exports.fetchConfigSchema = fetchConfigSchema;
|
|
29324
29376
|
exports.formKey = formKey;
|
|
29325
29377
|
exports.formatDate = formatDate;
|
|
29326
29378
|
exports.formatYamlDiff = formatYamlDiff;
|
|
@@ -29341,5 +29393,6 @@ exports.resolveGroups = resolveGroups;
|
|
|
29341
29393
|
exports.resolvePluginName = resolvePluginName;
|
|
29342
29394
|
exports.resolveRequiredFieldsGroup = resolveRequiredFieldsGroup;
|
|
29343
29395
|
exports.toOption = toOption;
|
|
29396
|
+
exports.useDatasourceSchema = useDatasourceSchema;
|
|
29344
29397
|
exports.useHealthChecks = useHealthChecks;
|
|
29345
29398
|
//# sourceMappingURL=index.cjs.map
|