myoperator-ui 0.0.223 → 0.0.225
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 +28 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18435,7 +18435,7 @@ function VarPopup({
|
|
|
18435
18435
|
{group.label}
|
|
18436
18436
|
</p>
|
|
18437
18437
|
{group.items.map((item) => {
|
|
18438
|
-
const insertValue = item.value ?? \`{{
|
|
18438
|
+
const insertValue = item.value ?? \`{{\${item.name}}}\`;
|
|
18439
18439
|
return (
|
|
18440
18440
|
<div key={item.name} className="flex items-center rounded-sm transition-colors hover:bg-semantic-bg-ui">
|
|
18441
18441
|
<button
|
|
@@ -18445,7 +18445,7 @@ function VarPopup({
|
|
|
18445
18445
|
onMouseDown={(e) => { e.preventDefault(); onSelect(insertValue); }}
|
|
18446
18446
|
className="relative flex flex-1 min-w-0 cursor-pointer select-none items-center px-2 py-1.5 text-sm outline-none"
|
|
18447
18447
|
>
|
|
18448
|
-
{\`{{
|
|
18448
|
+
{\`{{\${item.name}}}\`}
|
|
18449
18449
|
</button>
|
|
18450
18450
|
{item.editable && onEditVariable && (
|
|
18451
18451
|
<button
|
|
@@ -19170,6 +19170,7 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19170
19170
|
|
|
19171
19171
|
// Test variable values \u2014 filled by user before clicking Test API
|
|
19172
19172
|
const [testVarValues, setTestVarValues] = React.useState<Record<string, string>>({});
|
|
19173
|
+
const [testVarSubmitAttempted, setTestVarSubmitAttempted] = React.useState(false);
|
|
19173
19174
|
|
|
19174
19175
|
// Unique {{variable}} refs found across url, body, headers, queryParams
|
|
19175
19176
|
const testableVars = React.useMemo(
|
|
@@ -19197,6 +19198,7 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19197
19198
|
setBody(initialData?.body ?? "");
|
|
19198
19199
|
setApiResponse("");
|
|
19199
19200
|
setStep2SubmitAttempted(false);
|
|
19201
|
+
setTestVarSubmitAttempted(false);
|
|
19200
19202
|
setNameError("");
|
|
19201
19203
|
setUrlError("");
|
|
19202
19204
|
setBodyError("");
|
|
@@ -19223,6 +19225,7 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19223
19225
|
setBody(initialData?.body ?? "");
|
|
19224
19226
|
setApiResponse("");
|
|
19225
19227
|
setStep2SubmitAttempted(false);
|
|
19228
|
+
setTestVarSubmitAttempted(false);
|
|
19226
19229
|
setNameError("");
|
|
19227
19230
|
setUrlError("");
|
|
19228
19231
|
setBodyError("");
|
|
@@ -19296,6 +19299,14 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19296
19299
|
|
|
19297
19300
|
const handleTestApi = async () => {
|
|
19298
19301
|
if (!onTestApi) return;
|
|
19302
|
+
|
|
19303
|
+
// Validate all test variable values are filled
|
|
19304
|
+
if (testableVars.length > 0) {
|
|
19305
|
+
setTestVarSubmitAttempted(true);
|
|
19306
|
+
const hasEmpty = testableVars.some((v) => !testVarValues[v]?.trim());
|
|
19307
|
+
if (hasEmpty) return;
|
|
19308
|
+
}
|
|
19309
|
+
|
|
19299
19310
|
setIsTesting(true);
|
|
19300
19311
|
try {
|
|
19301
19312
|
const step2: CreateFunctionStep2Data = {
|
|
@@ -19686,8 +19697,11 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19686
19697
|
<span className="text-sm text-semantic-text-muted">
|
|
19687
19698
|
Variable values for testing
|
|
19688
19699
|
</span>
|
|
19689
|
-
{testableVars.map((variable) =>
|
|
19690
|
-
|
|
19700
|
+
{testableVars.map((variable) => {
|
|
19701
|
+
const isEmpty = testVarSubmitAttempted && !testVarValues[variable]?.trim();
|
|
19702
|
+
return (
|
|
19703
|
+
<div key={variable} className="flex flex-col gap-1">
|
|
19704
|
+
<div className="flex items-center gap-3">
|
|
19691
19705
|
<span className="text-sm text-semantic-text-muted font-mono shrink-0 min-w-[120px]">
|
|
19692
19706
|
{variable}
|
|
19693
19707
|
</span>
|
|
@@ -19701,10 +19715,18 @@ export const CreateFunctionModal = React.forwardRef(
|
|
|
19701
19715
|
}))
|
|
19702
19716
|
}
|
|
19703
19717
|
placeholder="Enter test value"
|
|
19704
|
-
className={cn(inputCls, "flex-1 h-9 text-sm")}
|
|
19718
|
+
className={cn(inputCls, "flex-1 h-9 text-sm", isEmpty && "border-semantic-error-primary")}
|
|
19719
|
+
aria-invalid={isEmpty}
|
|
19705
19720
|
/>
|
|
19721
|
+
</div>
|
|
19722
|
+
{isEmpty && (
|
|
19723
|
+
<p className="m-0 text-sm text-semantic-error-primary pl-[132px]">
|
|
19724
|
+
Test value is required
|
|
19725
|
+
</p>
|
|
19726
|
+
)}
|
|
19706
19727
|
</div>
|
|
19707
|
-
|
|
19728
|
+
);
|
|
19729
|
+
})}
|
|
19708
19730
|
</div>
|
|
19709
19731
|
)}
|
|
19710
19732
|
|