@octaviaflow/core 3.1.0-beta.69 → 3.1.0-beta.70
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/workflow.js
CHANGED
|
@@ -1066,6 +1066,7 @@ function HttpActionPanel({
|
|
|
1066
1066
|
const [curlError, setCurlError] = useState4();
|
|
1067
1067
|
const [copiedCurl, setCopiedCurl] = useState4(false);
|
|
1068
1068
|
const [copiedResult, setCopiedResult] = useState4(false);
|
|
1069
|
+
const [copiedSection, setCopiedSection] = useState4(null);
|
|
1069
1070
|
const applyCurl = () => {
|
|
1070
1071
|
const patch = parseCurl(curlText);
|
|
1071
1072
|
if (!patch) {
|
|
@@ -1114,6 +1115,28 @@ function HttpActionPanel({
|
|
|
1114
1115
|
} catch {
|
|
1115
1116
|
}
|
|
1116
1117
|
};
|
|
1118
|
+
const copySection = async (text, key) => {
|
|
1119
|
+
try {
|
|
1120
|
+
await navigator.clipboard?.writeText(text);
|
|
1121
|
+
setCopiedSection(key);
|
|
1122
|
+
setTimeout(() => setCopiedSection(null), 1600);
|
|
1123
|
+
} catch {
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
const sectionCopyButton = (text, key, label) => /* @__PURE__ */ jsx2(
|
|
1127
|
+
Button,
|
|
1128
|
+
{
|
|
1129
|
+
variant: "ghost",
|
|
1130
|
+
size: "sm",
|
|
1131
|
+
"aria-label": copiedSection === key ? `${label} copied` : `Copy ${label}`,
|
|
1132
|
+
leftIcon: copiedSection === key ? /* @__PURE__ */ jsx2(CheckmarkIcon, { size: "sm" }) : /* @__PURE__ */ jsx2(CopyIcon, { size: "sm" }),
|
|
1133
|
+
className: cn(copiedSection === key && "ods-http-panel__copy-done"),
|
|
1134
|
+
onClick: (e) => {
|
|
1135
|
+
e.stopPropagation();
|
|
1136
|
+
void copySection(text, key);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
);
|
|
1117
1140
|
const validateUrl = (nextUrl, nextBase, hasConnection) => {
|
|
1118
1141
|
if (!nextUrl && !nextBase && !hasConnection) {
|
|
1119
1142
|
setUrlError("URL is required");
|
|
@@ -2051,6 +2074,7 @@ function HttpActionPanel({
|
|
|
2051
2074
|
}
|
|
2052
2075
|
),
|
|
2053
2076
|
/* @__PURE__ */ jsx2("code", { className: "ods-http-panel__console-url", children: connectionId ? `${selectedConnection?.name ?? connectionId} \xB7 ${url || "\u2014"}` : fullUrl || "\u2014" }),
|
|
2077
|
+
sectionCopyButton(fullUrl || url, "url", "request URL"),
|
|
2054
2078
|
preview.phase === "success" && /* @__PURE__ */ jsx2(
|
|
2055
2079
|
Button,
|
|
2056
2080
|
{
|
|
@@ -2108,7 +2132,14 @@ function HttpActionPanel({
|
|
|
2108
2132
|
{
|
|
2109
2133
|
id: "res-headers",
|
|
2110
2134
|
label: "Response headers",
|
|
2111
|
-
trailing: /* @__PURE__ */
|
|
2135
|
+
trailing: /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2136
|
+
sectionCopyButton(
|
|
2137
|
+
Object.entries(preview.response.headers).map(([k, v]) => `${k}: ${v}`).join("\n"),
|
|
2138
|
+
"res-headers",
|
|
2139
|
+
"response headers"
|
|
2140
|
+
),
|
|
2141
|
+
/* @__PURE__ */ jsx2(Badge, { size: "sm", variant: "neutral", children: Object.keys(preview.response.headers).length })
|
|
2142
|
+
] }),
|
|
2112
2143
|
content: /* @__PURE__ */ jsx2("div", { className: "ods-http-panel__res-headers", children: Object.entries(preview.response.headers).map(([k, v]) => /* @__PURE__ */ jsxs2("div", { className: "ods-http-panel__res-header", children: [
|
|
2113
2144
|
/* @__PURE__ */ jsx2("span", { className: "ods-http-panel__res-header-key", children: k }),
|
|
2114
2145
|
/* @__PURE__ */ jsx2("span", { className: "ods-http-panel__res-header-val", children: v })
|
|
@@ -2117,7 +2148,14 @@ function HttpActionPanel({
|
|
|
2117
2148
|
{
|
|
2118
2149
|
id: "res-body",
|
|
2119
2150
|
label: "Response body",
|
|
2120
|
-
trailing:
|
|
2151
|
+
trailing: /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2152
|
+
sectionCopyButton(
|
|
2153
|
+
typeof preview.response.body === "object" ? JSON.stringify(preview.response.body, null, 2) : String(preview.response.bodyRaw ?? preview.response.body ?? ""),
|
|
2154
|
+
"res-body",
|
|
2155
|
+
"response body"
|
|
2156
|
+
),
|
|
2157
|
+
!preview.response.ok && /* @__PURE__ */ jsx2(Badge, { size: "sm", variant: "error", children: "Error" })
|
|
2158
|
+
] }),
|
|
2121
2159
|
content: (
|
|
2122
2160
|
// Size guard: the tree view renders recursively (no
|
|
2123
2161
|
// virtualization) — very large bodies fall back to text.
|