@grafana/k6-test-builder 0.6.1-alpha.1 → 0.6.1
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/index.js +9 -0
- package/dist/module.js +9 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8191,8 +8191,10 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8191
8191
|
]);
|
|
8192
8192
|
const disableStatistics = !statisticsOptions.length;
|
|
8193
8193
|
const handleDelete = ()=>dispatch((0, $f51ad74c1a393c6c$export$b7e4565ed8378479)(index));
|
|
8194
|
+
const [valueError, setValueError] = (0, $gkIgo$react.useState)();
|
|
8194
8195
|
const createOnChangeHandler = (key, onSuccess)=>{
|
|
8195
8196
|
return ({ target: { value: value } })=>{
|
|
8197
|
+
if (key === "value" && typeof value === "string") validateThresholdValue(value);
|
|
8196
8198
|
dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, key, value));
|
|
8197
8199
|
onSuccess && onSuccess(value);
|
|
8198
8200
|
};
|
|
@@ -8202,6 +8204,11 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8202
8204
|
if ((0, $536aa1751e69cdba$export$2e33e3c2b2cbdd89)(value).find((s)=>s.value === statistic)) return;
|
|
8203
8205
|
dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, "statistic", ""));
|
|
8204
8206
|
};
|
|
8207
|
+
const validateThresholdValue = (val)=>{
|
|
8208
|
+
if (!val) return;
|
|
8209
|
+
const regexpPositiveNumber = /^[+]?\d+.?\d+$/;
|
|
8210
|
+
setValueError(regexpPositiveNumber.test(val) ? undefined : "enter a positive number");
|
|
8211
|
+
};
|
|
8205
8212
|
(0, $gkIgo$react.useEffect)(()=>{
|
|
8206
8213
|
// Set URL to default '' if the request with the selected URL has been deleted/modified
|
|
8207
8214
|
if (url !== "" && url !== "all" && !requestsURLs.includes(url)) dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, "url", ""));
|
|
@@ -8243,6 +8250,8 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8243
8250
|
value: value,
|
|
8244
8251
|
placeholder: "Threshold value",
|
|
8245
8252
|
onChange: createOnChangeHandler("value"),
|
|
8253
|
+
error: !!valueError,
|
|
8254
|
+
helperText: valueError,
|
|
8246
8255
|
InputProps: {
|
|
8247
8256
|
endAdornment: /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)((0, $gkIgo$materialuicore.InputAdornment), {
|
|
8248
8257
|
position: "end",
|
package/dist/module.js
CHANGED
|
@@ -8168,8 +8168,10 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8168
8168
|
]);
|
|
8169
8169
|
const disableStatistics = !statisticsOptions.length;
|
|
8170
8170
|
const handleDelete = ()=>dispatch((0, $a6a312292842f1bc$export$b7e4565ed8378479)(index));
|
|
8171
|
+
const [valueError, setValueError] = (0, $b7VBt$useState)();
|
|
8171
8172
|
const createOnChangeHandler = (key, onSuccess)=>{
|
|
8172
8173
|
return ({ target: { value: value } })=>{
|
|
8174
|
+
if (key === "value" && typeof value === "string") validateThresholdValue(value);
|
|
8173
8175
|
dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, key, value));
|
|
8174
8176
|
onSuccess && onSuccess(value);
|
|
8175
8177
|
};
|
|
@@ -8179,6 +8181,11 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8179
8181
|
if ((0, $46f0f9c909db815a$export$2e33e3c2b2cbdd89)(value).find((s)=>s.value === statistic)) return;
|
|
8180
8182
|
dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, "statistic", ""));
|
|
8181
8183
|
};
|
|
8184
|
+
const validateThresholdValue = (val)=>{
|
|
8185
|
+
if (!val) return;
|
|
8186
|
+
const regexpPositiveNumber = /^[+]?\d+.?\d+$/;
|
|
8187
|
+
setValueError(regexpPositiveNumber.test(val) ? undefined : "enter a positive number");
|
|
8188
|
+
};
|
|
8182
8189
|
(0, $b7VBt$useEffect)(()=>{
|
|
8183
8190
|
// Set URL to default '' if the request with the selected URL has been deleted/modified
|
|
8184
8191
|
if (url !== "" && url !== "all" && !requestsURLs.includes(url)) dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, "url", ""));
|
|
@@ -8220,6 +8227,8 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
|
|
|
8220
8227
|
value: value,
|
|
8221
8228
|
placeholder: "Threshold value",
|
|
8222
8229
|
onChange: createOnChangeHandler("value"),
|
|
8230
|
+
error: !!valueError,
|
|
8231
|
+
helperText: valueError,
|
|
8223
8232
|
InputProps: {
|
|
8224
8233
|
endAdornment: /*#__PURE__*/ (0, $b7VBt$jsx)((0, $b7VBt$InputAdornment), {
|
|
8225
8234
|
position: "end",
|