@oomol-lab/open-flow 0.1.0-beta.66 → 0.1.0-beta.67
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/browser/{createResourceDialog-C-Si_cYs.js → createResourceDialog-BQVD8Rqb.js} +2 -2
- package/dist/browser/{icons-BD3m0RQq.js → dialog-CS2Vt2if.js} +1225 -1224
- package/dist/browser/event-sources.d.ts +4 -1
- package/dist/browser/flow-authoring-node.d.ts +2 -0
- package/dist/browser/flow-authoring.js +6 -5
- package/dist/browser/flow-change.js +6 -5
- package/dist/browser/{flowChanges-T4_R5p1f.js → flowChanges-VB9Y4iy7.js} +2186 -1939
- package/dist/browser/{flowWorkspace-C0J5C0oM.js → flowWorkspace-C1hlTnZq.js} +801 -666
- package/dist/browser/preview.css +121 -55
- package/dist/browser/preview.js +34156 -33896
- package/dist/browser/theme.css +1 -0
- package/dist/browser/ui.css +34 -4
- package/dist/browser/workbench-contract.d.ts +1 -1
- package/dist/browser/workbench.css +130 -98
- package/dist/browser/workbench.d.ts +0 -1
- package/dist/browser/workbench.js +361 -120
- package/dist/browser/{workbenchSelect-B-PFpF_Q.js → workbenchSelect-CpXhjUou.js} +1 -1
- package/dist/command/index.js +25 -25
- package/dist/common/authoringExamples.d.ts +2 -2
- package/dist/common/control-api-conformance.js +31 -9
- package/dist/common/control-api.d.ts +4 -1
- package/dist/common/control-api.js +15 -5
- package/dist/common/control-requests.js +7 -6
- package/dist/common/decision.js +5 -4
- package/dist/common/flow-encoding.js +7 -4
- package/dist/common/flow-semantics.js +11 -8
- package/dist/common/integration-trigger.js +5 -4
- package/dist/common/mcp.js +16 -6
- package/dist/common/openapi.js +5 -4
- package/dist/common/poll-trigger.js +5 -4
- package/dist/common/scheduler.js +5 -4
- package/dist/common/webhook-trigger.js +5 -4
- package/dist/common/workflow.js +5 -4
- package/package.json +1 -1
- package/skills/open-flow/SKILL.md +9 -0
- package/skills/open-flow/references/flow-authoring.md +2 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
|
|
2
|
-
import { $ as useIconifyCollectionLoader, $
|
|
2
|
+
import { $ as useIconifyCollectionLoader, $n as sourceOutputLabel, $t as EmptyDescription, A as datePickerChange, Ar as controlErrorCode, Bn as ja_default$1, Bt as PopoverHeader, C as schemaForEditor, Cn as MenuItem, Cr as workflowSelectionTask, D as typeOfSchema, Dn as MenuRootContext, E as isUnconstrainedSchema, En as useContextMenuRootContext, F as indexAddNodeOptions, Fn as waitBranchDescription, Ft as IdTooltip, Gn as EventSourceSetup, Gt as ScrollArea, H as observeResource, Hn as en_default$1, Ht as PopoverTitle, I as feishuResourceKind, In as zh_TW_default$1, It as followWorkbenchLink, J as triggerNodeIcon, Jt as InputGroup, K as designerGraph, Kn as errorNotice, Kt as VirtualScrollArea, L as supportsFeishuChatFilter, Ln as zh_CN_default$1, Lt as Popover, M as isDateFormat, Mn as SourceSelect, Mr as useAriaLabelledBy, Nn as createI18n$1, Nr as IconThemeContext, O as calendarChange, On as useMenuRootContext, Pn as uiLocales, Pt as WorkflowExportMenuItem, Q as IconifyProvider, Qn as resolutionOutputPorts, Qt as EmptyContent, Rn as ru_default$1, Rt as PopoverContent, S as editorGroups, Sn as MenuPopup, Sr as workflowCandidateGroup, T as getDefaultValue, Tn as ContextMenuRootContext, U as resourceData, Un as I18n, Ut as PopoverTrigger, Vn as fr_default$1, Vt as PopoverPanelContent, W as resourceValue, Wn as FeishuEventPicker, Wt as NativeScrollArea, X as providerIcon, Xn as decodeResultList, Xt as InputGroupInput, Y as actionSummary, Yt as InputGroupAddon, Z as ContentIcon, Zt as Empty, _n as findRootOwnerId, _r as securityOptions, an as DropdownMenuContent, at as revisionView, b as defaultValueEditorSchema, bn as MenuPositioner, br as servers, cn as DropdownMenuLabel, dn as DropdownMenuSeparator, dr as triggerConfigValues, dt as diagnosticNodeId, en as EmptyHeader, et as useIconifyData, fn as DropdownMenuSub, ft as schemaMismatchMessage, gn as isElementDisabled, gr as openApiTask, hn as DropdownMenuTrigger, hr as openApiFieldIssues, in as DropdownMenuCheckboxItem, it as hasRunFilter, j as datePickerValue, jn as SourceForm, jr as Checkbox, k as calendarDate, kn as Badge, ln as DropdownMenuRadioGroup, mn as DropdownMenuSubTrigger, mr as object, mt as connectionCatalog, n as agentTool, nn as EmptyTitle, nr as triggerOutputDefinitions, on as DropdownMenuGroup, pn as DropdownMenuSubContent, pr as listOperations, q as semanticNodeIcon, qt as Z$2, rn as DropdownMenu, rr as isJsonObject, rt as canCancelRun, sn as DropdownMenuItem, tn as EmptyMedia, tt as wrapLayout, un as DropdownMenuRadioItem, ur as triggerConfigValue, ut as diagnosticMessage, vn as useCompositeItem, vr as selectOperation, w as valueForEditor, wn as MenuGroup, wr as inputValue, x as editorComponent, xn as MenuPortal, yn as MenuRoot, yr as serverAddress, z as mapSource, zn as ko_default$1, zt as PopoverDescription } from "./flowChanges-VB9Y4iy7.js";
|
|
3
3
|
import { a as derive, c as strictEqual, i as compute, l as val, n as attachSetter, r as combine, s as readonlyVal } from "./dist-bO8nvHFH.js";
|
|
4
4
|
import { c as useLang, i as isString, l as useTranslate, n as isBoolean, o as I18nProvider, r as isPlainObject, s as useI18n, t as isArray$1, u as useVal } from "./dist-BFmpkX4P.js";
|
|
5
|
-
import { $ as decodeRevisionContent, $r as escapeKey, $t as useAnchoredPopupScrollLock, A as variableInputCompatible, Ai as EMPTY_ARRAY$1, Ar as activeElement, At as SelectItem, Bi as useIsoLayoutEffect, Bn as useDismiss, Br as createLucideIcon, Bt as ARROW_LEFT, C as FieldDescription, Ci as useControlled, Cr as getGridNavigatedIndex, Di as cva, Dn as useInteractions, Dr as isListIndexDisabled, Dt as SelectChevron, E as FieldLabel, Ei as cn$1, En as useListNavigation, Er as isIndexOutOfListBounds, Et as Select$1, Fi as useButton, Ft as IndexGuessBehavior, Gi as isElement, Gr as transitionStatusMapping, Gt as HORIZONTAL_KEYS, Hi as useStableCallback, Hn as FloatingFocusManager, Hr as useOpenChangeComplete, Ht as ARROW_UP, I as nodeNameIssue, Ii as CompositeRootContext, Ir as ownerDocument, It as useCompositeListItem, J as operatorsForType, Jr as createChangeEventDetails, Jt as VERTICAL_KEYS, Kt as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, Lr as useLabelableId, Lt as ALL_KEYS, Mi as NOOP, Mn as useFloatingRootContext, Mr as getTarget, Mt as SelectTrigger, Nr as isAndroid, Nt as SelectValue, O as matchesSchema, Oi as clsx, Or as stopEvent$1, Ot as SelectContent, Pi as useMergedRefs, Pr as isFirefox, Qr as closePress, Ri as formatErrorMessage, Rr as ChevronDown, Rt as ARROW_DOWN, S as Field, Si as visuallyHiddenInput, Sn as selectedValueIncludes, Sr as getGridCellIndices, St as string, T as FieldGroup, Ti as buttonVariants, Tr as getMinListIndex, Tt as dequal, U as comparisonIssue, Ui as useRefWithInit, Vn as useClick, Vr as useTransitionStatus, Vt as ARROW_RIGHT, Wr as TransitionStatusDataAttributes, X as unaryOperator, Xr as cancelOpen, Xt as isNativeInput, Yn as FloatingPortal, Yr as createGenericEventDetails, Yt as VERTICAL_KEYS_WITH_EXTRA_KEYS, Z as valueType, Zn as DROPDOWN_COLLISION_AVOIDANCE, Zr as clearPress, Zt as scrollIntoViewIfNeeded, _ as TooltipPositioner, _i as useBaseUiId, _n as stringifyAsValue, _t as literal,
|
|
5
|
+
import { $ as decodeRevisionContent, $r as escapeKey, $t as useAnchoredPopupScrollLock, A as variableInputCompatible, Ai as EMPTY_ARRAY$1, Ar as activeElement, At as SelectItem, Bi as useIsoLayoutEffect, Bn as useDismiss, Br as createLucideIcon, Bt as ARROW_LEFT, C as FieldDescription, Ci as useControlled, Cr as getGridNavigatedIndex, Di as cva, Dn as useInteractions, Dr as isListIndexDisabled, Dt as SelectChevron, E as FieldLabel, Ei as cn$1, En as useListNavigation, Er as isIndexOutOfListBounds, Et as Select$1, Fi as useButton, Ft as IndexGuessBehavior, Gi as isElement, Gr as transitionStatusMapping, Gt as HORIZONTAL_KEYS, Hi as useStableCallback, Hn as FloatingFocusManager, Hr as useOpenChangeComplete, Ht as ARROW_UP, I as nodeNameIssue, Ii as CompositeRootContext, Ir as ownerDocument, It as useCompositeListItem, J as operatorsForType, Jr as createChangeEventDetails, Jt as VERTICAL_KEYS, Kt as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, Lr as useLabelableId, Lt as ALL_KEYS, Mi as NOOP, Mn as useFloatingRootContext, Mr as getTarget, Mt as SelectTrigger, Nr as isAndroid, Nt as SelectValue, O as matchesSchema, Oi as clsx, Or as stopEvent$1, Ot as SelectContent, Pi as useMergedRefs, Pr as isFirefox, Qr as closePress, Ri as formatErrorMessage, Rr as ChevronDown, Rt as ARROW_DOWN, S as Field, Si as visuallyHiddenInput, Sn as selectedValueIncludes, Sr as getGridCellIndices, St as string, T as FieldGroup, Ti as buttonVariants, Tr as getMinListIndex, Tt as dequal, U as comparisonIssue, Ui as useRefWithInit, Vn as useClick, Vr as useTransitionStatus, Vt as ARROW_RIGHT, Wr as TransitionStatusDataAttributes, X as unaryOperator, Xr as cancelOpen, Xt as isNativeInput, Yn as FloatingPortal, Yr as createGenericEventDetails, Yt as VERTICAL_KEYS_WITH_EXTRA_KEYS, Z as valueType, Zn as DROPDOWN_COLLISION_AVOIDANCE, Zr as clearPress, Zt as scrollIntoViewIfNeeded, _ as TooltipPositioner, _i as useBaseUiId, _n as stringifyAsValue, _t as literal, ai as itemPress, an as useDirection, at as decisionQuestionIssues, b as TooltipRoot, bi as fieldValidityMapping, bn as findItemIndex, br as findNonDisabledListIndex, c as DialogTrigger, cn as getPseudoElementBounds, cr as createSelector, ct as limitDecisionQuestions, d as TooltipContent, dn as triggerOpenStateMapping, dr as Label, en as usePositioner, er as addEventListener, et as webhookMethods, f as TooltipProvider, fi as triggerPress, fn as resolveAriaLabelledBy, fr as Input$1, g as TooltipPopup, gi as useFieldRootContext, gn as stringifyAsLabel, h as TooltipArrow, hi as useRegisterFieldControl, hn as isGroupedItems, i as DialogDescription, ii as inputPress, ji as EMPTY_OBJECT, jr as contains, jt as SelectSeparator, k as schemaObject, ki as useRenderElement, kr as isInteractiveElement, kt as SelectGroup, l as Icon, ln as popupStateMapping, lr as useValueAsRef, m as createTooltipHandle, mi as useFormContext, mn as hasNullItemLabel, mr as useTimeout, ni as inputChange, nn as InternalBackdrop, nr as Store, oi as listNavigation, on as CompositeList, or as require_with_selector, ot as decisionTask, p as TooltipTrigger, pi as useLabelableContext, pn as useOpenInteractionType, pt as discriminatedUnion, q as operandHandle, qr as useValueChanged, qt as MODIFIER_KEYS, r as DialogContent, ri as inputClear, rn as useAnchorPositioning, rr as useStore$1, rt as decisionLimits, s as DialogTitle, si as none$1, sn as inertValue, sr as require_builtin_esm_external_require_react, st as defaultDecisionQuestion, t as Dialog, tn as getDisabledMountTransitionStyles, tt as webhookSupportsBody, u as Tooltip, un as pressableTriggerOpenStateMapping, ur as useOnFirstRender, v as TooltipPortal, vi as useId$1, vn as compareItemEquality, vt as number, w as FieldError, wi as Button$1, wn as useTypeahead, wr as getMaxListIndex, x as Spinner, xi as visuallyHidden, xn as removeItem, xr as getGridCellIndexOfCorner, xt as strictObject, y as TooltipTrigger$1, yi as DEFAULT_FIELD_STATE_ATTRIBUTES, yn as defaultItemEquality, yr as createGridCellMap, zi as mergeProps, zt as ARROW_KEYS } from "./dialog-CS2Vt2if.js";
|
|
6
6
|
import { a as renameObjectField, i as objectValue, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue, u as resolveUiLanguage } from "./value-BADHeZ9I.js";
|
|
7
7
|
import { n as compile, r as validate } from "./flowRunInputEditorStore-DJqmR6Qh.js";
|
|
8
|
-
import { t as WorkbenchSelect } from "./workbenchSelect-
|
|
8
|
+
import { t as WorkbenchSelect } from "./workbenchSelect-CpXhjUou.js";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import reactExports, { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1474,6 +1474,473 @@ function AccountName({ name, builtIn, truncate = false }) {
|
|
|
1474
1474
|
});
|
|
1475
1475
|
}
|
|
1476
1476
|
//#endregion
|
|
1477
|
+
//#region src/form/browser/fieldTypeDisplay.tsx
|
|
1478
|
+
/** Presents a fixed type, optionally using its read-only surface as a disclosure control. */
|
|
1479
|
+
function FieldTypeDisplay({ id, label, accessibleLabel, icon, compact = true, addon = false, surface = false, disclosure }) {
|
|
1480
|
+
const [container, setContainer] = useState(null);
|
|
1481
|
+
const className = `flex ${addon ? "size-6 px-1" : "h-[30px] w-full px-2"} min-w-0 items-center gap-1.5 text-xs font-normal text-muted-foreground ${compact ? "justify-center" : ""} ${surface ? "rounded-[var(--ui-control-radius,var(--ui-radius))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] dark:bg-[var(--ui-control-background,var(--ui-muted))]" : ""}`;
|
|
1482
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1483
|
+
ref: setContainer,
|
|
1484
|
+
className: "min-w-0",
|
|
1485
|
+
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
|
|
1486
|
+
render: disclosure == null ? /* @__PURE__ */ jsx("span", {
|
|
1487
|
+
id,
|
|
1488
|
+
role: "img",
|
|
1489
|
+
"aria-label": accessibleLabel,
|
|
1490
|
+
"data-field-control": surface || void 0,
|
|
1491
|
+
"data-readonly": surface || void 0
|
|
1492
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
1493
|
+
id,
|
|
1494
|
+
type: "button",
|
|
1495
|
+
"aria-label": accessibleLabel,
|
|
1496
|
+
"aria-expanded": disclosure.expanded,
|
|
1497
|
+
"aria-controls": disclosure.controls,
|
|
1498
|
+
"data-field-control": true,
|
|
1499
|
+
"data-readonly": true,
|
|
1500
|
+
onClick: disclosure.onToggle
|
|
1501
|
+
}),
|
|
1502
|
+
className: `${className} ${disclosure == null ? "cursor-default" : "cursor-pointer text-left outline-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-ring"}`,
|
|
1503
|
+
children: [icon, !compact && /* @__PURE__ */ jsx("span", {
|
|
1504
|
+
className: "min-w-0 truncate",
|
|
1505
|
+
children: label
|
|
1506
|
+
})]
|
|
1507
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
1508
|
+
container,
|
|
1509
|
+
children: label
|
|
1510
|
+
})] })
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
//#endregion
|
|
1514
|
+
//#region src/form/browser/selectionMenuStyles.ts
|
|
1515
|
+
var selectionMenuContentClass = "rounded-[calc(var(--ui-control-radius,var(--ui-radius))_+_2px)] p-1";
|
|
1516
|
+
var selectionMenuItemClass = "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal";
|
|
1517
|
+
//#endregion
|
|
1518
|
+
//#region src/form/browser/fieldSelect.tsx
|
|
1519
|
+
var fieldSelectTriggerClass = "w-full min-w-0 px-2 text-xs font-normal text-foreground";
|
|
1520
|
+
/** The field editor uses the product selection surface instead of the browser menu. */
|
|
1521
|
+
function FieldSelect({ id, value, onChange, children, disabled, readOnly, danger, icons, displayValue, showTooltip, variant, "aria-label": label, "aria-invalid": invalid, "aria-describedby": describedBy }) {
|
|
1522
|
+
const [open, setOpen] = useState(false);
|
|
1523
|
+
const [container, setContainer] = useState(null);
|
|
1524
|
+
const options = Children.toArray(children).filter(isValidElement).map((child) => {
|
|
1525
|
+
const props = child.props;
|
|
1526
|
+
return {
|
|
1527
|
+
value: String(props.value ?? props.children),
|
|
1528
|
+
label: props.children,
|
|
1529
|
+
disabled: props.disabled
|
|
1530
|
+
};
|
|
1531
|
+
});
|
|
1532
|
+
const selected = options.find((option) => option.value === String(value));
|
|
1533
|
+
if (readOnly && icons?.[value]) return /* @__PURE__ */ jsx(FieldTypeDisplay, {
|
|
1534
|
+
addon: variant === "addon",
|
|
1535
|
+
id,
|
|
1536
|
+
label: selected?.label,
|
|
1537
|
+
accessibleLabel: `${label}: ${selected?.label ?? value}`,
|
|
1538
|
+
icon: /* @__PURE__ */ jsx("i", {
|
|
1539
|
+
"aria-hidden": "true",
|
|
1540
|
+
className: `${icons[value]} inline-block shrink-0 text-base`
|
|
1541
|
+
})
|
|
1542
|
+
});
|
|
1543
|
+
const trigger = /* @__PURE__ */ jsx(SelectTrigger, {
|
|
1544
|
+
id,
|
|
1545
|
+
size: "field",
|
|
1546
|
+
variant,
|
|
1547
|
+
"aria-label": label,
|
|
1548
|
+
"aria-invalid": invalid || danger,
|
|
1549
|
+
"aria-describedby": describedBy,
|
|
1550
|
+
"data-field-prompt": danger || void 0,
|
|
1551
|
+
className: variant === "addon" ? void 0 : fieldSelectTriggerClass,
|
|
1552
|
+
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
1553
|
+
className: variant === "addon" ? "flex-none justify-center" : void 0,
|
|
1554
|
+
children: displayValue ?? (icons?.[value] ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("i", {
|
|
1555
|
+
"aria-hidden": "true",
|
|
1556
|
+
className: `${icons[value]} inline-block shrink-0 text-base`
|
|
1557
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1558
|
+
className: "sr-only",
|
|
1559
|
+
children: selected?.label
|
|
1560
|
+
})] }) : void 0)
|
|
1561
|
+
})
|
|
1562
|
+
});
|
|
1563
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1564
|
+
ref: setContainer,
|
|
1565
|
+
className: "min-w-0",
|
|
1566
|
+
children: /* @__PURE__ */ jsxs(Select$1, {
|
|
1567
|
+
open,
|
|
1568
|
+
onOpenChange: setOpen,
|
|
1569
|
+
value: String(value),
|
|
1570
|
+
onValueChange: (next) => {
|
|
1571
|
+
if (next != null) onChange(next);
|
|
1572
|
+
},
|
|
1573
|
+
disabled: disabled || readOnly,
|
|
1574
|
+
items: options,
|
|
1575
|
+
children: [icons || showTooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: trigger }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
1576
|
+
container,
|
|
1577
|
+
children: selected?.label
|
|
1578
|
+
})] }) : trigger, /* @__PURE__ */ jsx(SelectContent, {
|
|
1579
|
+
container,
|
|
1580
|
+
align: "start",
|
|
1581
|
+
alignItemWithTrigger: false,
|
|
1582
|
+
className: `${selectionMenuContentClass} w-max min-w-[max(9rem,var(--anchor-width))] max-w-(--available-width)`,
|
|
1583
|
+
children: options.filter((option) => !option.disabled).map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
1584
|
+
value: option.value,
|
|
1585
|
+
disabled: option.disabled,
|
|
1586
|
+
className: selectionMenuItemClass,
|
|
1587
|
+
children: [icons?.[option.value] && /* @__PURE__ */ jsx("i", {
|
|
1588
|
+
"aria-hidden": "true",
|
|
1589
|
+
className: `${icons[option.value]} inline-block shrink-0 text-base`
|
|
1590
|
+
}), option.label]
|
|
1591
|
+
}, option.value))
|
|
1592
|
+
})]
|
|
1593
|
+
})
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/workbench/browser/runtime/editor/inspectorStatusSection.tsx
|
|
1598
|
+
function InspectorStatusSection({ title, actions, children, tone = "neutral", section, alert = false }) {
|
|
1599
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1600
|
+
className: "inspector-status",
|
|
1601
|
+
"data-tone": tone,
|
|
1602
|
+
"data-inspector-section": section,
|
|
1603
|
+
role: alert ? "alert" : void 0,
|
|
1604
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
1605
|
+
className: "inspector-section-title",
|
|
1606
|
+
children: [title, actions]
|
|
1607
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1608
|
+
className: "inspector-status-content",
|
|
1609
|
+
children
|
|
1610
|
+
})]
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/workbench/browser/runtime/editor/connectionSettings.tsx
|
|
1615
|
+
var manageAccountOption = "__manage-account__";
|
|
1616
|
+
var noAccountsOption = "__no-accounts__";
|
|
1617
|
+
function ConnectionAlert({ detail, disabled, message, onRetry }) {
|
|
1618
|
+
const t = useTranslate();
|
|
1619
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1620
|
+
className: "connection-alert",
|
|
1621
|
+
role: "alert",
|
|
1622
|
+
children: [
|
|
1623
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
1624
|
+
name: "alert",
|
|
1625
|
+
size: 14
|
|
1626
|
+
}),
|
|
1627
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1628
|
+
className: "connection-alert-message",
|
|
1629
|
+
children: [/* @__PURE__ */ jsx("p", { children: message }), detail != null && /* @__PURE__ */ jsx("p", { children: detail })]
|
|
1630
|
+
}),
|
|
1631
|
+
onRetry != null && /* @__PURE__ */ jsx(Button$1, {
|
|
1632
|
+
disabled,
|
|
1633
|
+
onClick: onRetry,
|
|
1634
|
+
size: "sm",
|
|
1635
|
+
type: "button",
|
|
1636
|
+
variant: "secondary",
|
|
1637
|
+
children: t("inspector.account.retry")
|
|
1638
|
+
})
|
|
1639
|
+
]
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
function AccountControlButton({ disabled, status, label, hint, onClick }) {
|
|
1643
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsxs(Button$1, {
|
|
1644
|
+
type: "button",
|
|
1645
|
+
variant: "outline",
|
|
1646
|
+
size: "sm",
|
|
1647
|
+
className: "account-control justify-between font-normal",
|
|
1648
|
+
"data-status": status,
|
|
1649
|
+
disabled,
|
|
1650
|
+
onClick,
|
|
1651
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1652
|
+
className: "truncate",
|
|
1653
|
+
children: label
|
|
1654
|
+
}), /* @__PURE__ */ jsx("i", {
|
|
1655
|
+
"aria-hidden": "true",
|
|
1656
|
+
className: status === "warning" ? "i-lucide-light:plus size-3.5" : "i-lucide-light:rotate-cw size-3.5"
|
|
1657
|
+
})]
|
|
1658
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: hint ?? label })] });
|
|
1659
|
+
}
|
|
1660
|
+
function AccountSelect({ connections, disabled, loading = false, id, invalid, warning, addWhenEmpty, allowDeferred = false, label, selectedConnection, selectedId, onChange, onManage }) {
|
|
1661
|
+
const t = useTranslate();
|
|
1662
|
+
const [container, setContainer] = useState(null);
|
|
1663
|
+
const selected = selectedConnection ?? connections.find((candidate) => candidate.connectionId == selectedId);
|
|
1664
|
+
const showLoading = loading && selected == null && selectedId !== "";
|
|
1665
|
+
const builtInName = t("inspector.account.oomolBuiltIn");
|
|
1666
|
+
const displayName = (connection) => accountDisplayName(connection, connection.displayName, builtInName);
|
|
1667
|
+
const selectedLabel = selectedId === "" ? t("inspector.account.deferred") : selected == null ? selectedId == null ? void 0 : `${selectedId} (${t("inspector.account.unavailable")})` : `${displayName(selected)}${selected.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""}`;
|
|
1668
|
+
const missingSelected = selectedId != null && selectedId !== "" && !connections.some((candidate) => candidate.connectionId == selectedId);
|
|
1669
|
+
const empty = !loading && connections.length == 0;
|
|
1670
|
+
const items = [
|
|
1671
|
+
...allowDeferred || selectedId === "" ? [{
|
|
1672
|
+
value: "",
|
|
1673
|
+
label: t("inspector.account.deferred"),
|
|
1674
|
+
disabled: !allowDeferred
|
|
1675
|
+
}] : [],
|
|
1676
|
+
...missingSelected ? [{
|
|
1677
|
+
value: selectedId,
|
|
1678
|
+
label: selectedLabel,
|
|
1679
|
+
disabled: true
|
|
1680
|
+
}] : [],
|
|
1681
|
+
...empty ? [{
|
|
1682
|
+
value: noAccountsOption,
|
|
1683
|
+
label: t("inspector.account.noAccounts"),
|
|
1684
|
+
disabled: true
|
|
1685
|
+
}] : [],
|
|
1686
|
+
...connections.map((candidate) => ({
|
|
1687
|
+
value: candidate.connectionId,
|
|
1688
|
+
label: `${displayName(candidate)}${candidate.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""}`
|
|
1689
|
+
})),
|
|
1690
|
+
...onManage == null ? [] : [{
|
|
1691
|
+
value: manageAccountOption,
|
|
1692
|
+
label: t("inspector.account.addAccount")
|
|
1693
|
+
}]
|
|
1694
|
+
];
|
|
1695
|
+
if (!allowDeferred && !loading && addWhenEmpty && connections.length === 0 && selectedId == null) return /* @__PURE__ */ jsx(AccountControlButton, {
|
|
1696
|
+
disabled,
|
|
1697
|
+
status: "warning",
|
|
1698
|
+
onClick: onManage,
|
|
1699
|
+
label: t("inspector.account.addAccount")
|
|
1700
|
+
});
|
|
1701
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1702
|
+
ref: setContainer,
|
|
1703
|
+
className: "account-select relative min-w-0",
|
|
1704
|
+
children: [/* @__PURE__ */ jsxs(Select$1, {
|
|
1705
|
+
disabled: disabled || loading,
|
|
1706
|
+
items,
|
|
1707
|
+
value: selectedId ?? null,
|
|
1708
|
+
onValueChange: (value) => {
|
|
1709
|
+
if (value == null) return;
|
|
1710
|
+
if (value == manageAccountOption) onManage?.();
|
|
1711
|
+
else onChange(value);
|
|
1712
|
+
},
|
|
1713
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1714
|
+
id,
|
|
1715
|
+
size: "field",
|
|
1716
|
+
"aria-label": label ?? t("inspector.account.connection"),
|
|
1717
|
+
"aria-busy": loading || void 0,
|
|
1718
|
+
"aria-invalid": invalid || void 0,
|
|
1719
|
+
"data-status": invalid ? "danger" : warning ? "warning" : void 0,
|
|
1720
|
+
className: `${fieldSelectTriggerClass} account-control`,
|
|
1721
|
+
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
1722
|
+
className: !loading && selectedId != null ? "mr-5" : void 0,
|
|
1723
|
+
placeholder: t("inspector.account.chooseAccount"),
|
|
1724
|
+
children: showLoading ? /* @__PURE__ */ jsxs("span", {
|
|
1725
|
+
role: "status",
|
|
1726
|
+
className: "flex min-w-0 items-center gap-2 text-muted-foreground",
|
|
1727
|
+
children: [/* @__PURE__ */ jsx(Spinner, {}), /* @__PURE__ */ jsx("span", {
|
|
1728
|
+
className: "truncate",
|
|
1729
|
+
children: t("inspector.account.loading")
|
|
1730
|
+
})]
|
|
1731
|
+
}) : selected == null ? selectedLabel : /* @__PURE__ */ jsx(AccountName, {
|
|
1732
|
+
name: displayName(selected),
|
|
1733
|
+
builtIn: selected.builtInAccount,
|
|
1734
|
+
truncate: true
|
|
1735
|
+
})
|
|
1736
|
+
})
|
|
1737
|
+
}), /* @__PURE__ */ jsxs(SelectContent, {
|
|
1738
|
+
container,
|
|
1739
|
+
align: "start",
|
|
1740
|
+
alignItemWithTrigger: false,
|
|
1741
|
+
className: `${selectionMenuContentClass} w-max min-w-[max(9rem,var(--anchor-width))] max-w-(--available-width)`,
|
|
1742
|
+
children: [
|
|
1743
|
+
(allowDeferred || selectedId === "") && /* @__PURE__ */ jsx(SelectItem, {
|
|
1744
|
+
value: "",
|
|
1745
|
+
disabled: !allowDeferred,
|
|
1746
|
+
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
1747
|
+
children: t("inspector.account.deferred")
|
|
1748
|
+
}),
|
|
1749
|
+
missingSelected && /* @__PURE__ */ jsx(SelectItem, {
|
|
1750
|
+
value: selectedId,
|
|
1751
|
+
disabled: true,
|
|
1752
|
+
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
1753
|
+
children: selectedLabel
|
|
1754
|
+
}),
|
|
1755
|
+
empty && /* @__PURE__ */ jsx(SelectItem, {
|
|
1756
|
+
value: noAccountsOption,
|
|
1757
|
+
disabled: true,
|
|
1758
|
+
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
1759
|
+
children: t("inspector.account.noAccounts")
|
|
1760
|
+
}),
|
|
1761
|
+
connections.map((candidate) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
1762
|
+
value: candidate.connectionId,
|
|
1763
|
+
className: selectionMenuItemClass,
|
|
1764
|
+
children: [/* @__PURE__ */ jsx(AccountName, {
|
|
1765
|
+
name: displayName(candidate),
|
|
1766
|
+
builtIn: candidate.builtInAccount,
|
|
1767
|
+
truncate: true
|
|
1768
|
+
}), candidate.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""]
|
|
1769
|
+
}, candidate.connectionId)),
|
|
1770
|
+
onManage != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2 bg-border/50" }), /* @__PURE__ */ jsx(SelectItem, {
|
|
1771
|
+
value: manageAccountOption,
|
|
1772
|
+
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
1773
|
+
children: t("inspector.account.addAccount")
|
|
1774
|
+
})] })
|
|
1775
|
+
]
|
|
1776
|
+
})]
|
|
1777
|
+
}), !loading && selectedId != null && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx(Button$1, {
|
|
1778
|
+
className: "account-select-clear absolute top-1/2 right-7 -translate-y-1/2 text-muted-foreground",
|
|
1779
|
+
type: "button",
|
|
1780
|
+
variant: "ghost",
|
|
1781
|
+
size: "icon-xs",
|
|
1782
|
+
"aria-label": t(selectedId === "" ? "inspector.account.clearDeferred" : "connectionUsage.stopUsing"),
|
|
1783
|
+
disabled,
|
|
1784
|
+
onPointerDown: (event) => {
|
|
1785
|
+
if (event.button == 0) onChange(void 0);
|
|
1786
|
+
},
|
|
1787
|
+
onClick: (event) => {
|
|
1788
|
+
if (event.detail == 0) onChange(void 0);
|
|
1789
|
+
},
|
|
1790
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
1791
|
+
"aria-hidden": "true",
|
|
1792
|
+
className: "i-lucide-light:x"
|
|
1793
|
+
})
|
|
1794
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
1795
|
+
container,
|
|
1796
|
+
children: t(selectedId === "" ? "inspector.account.clearDeferred" : "connectionUsage.stopUsing")
|
|
1797
|
+
})] })]
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
function ConnectorAccount({ accessError, onConfigureAccess, action, actionError, actionId, activeConnections, authorizationPending, connection, connectionError, connectionId, connectors, disabled, fieldIdPrefix, loading, nodeId }) {
|
|
1801
|
+
const t = useTranslate();
|
|
1802
|
+
const available = activeConnections ?? [];
|
|
1803
|
+
const accessIssue = accessError ?? (actionError?.code == "connector.access-required" || actionError?.code == "connector.access-invalid" ? actionError.message : void 0);
|
|
1804
|
+
const pending = loading || accessIssue == null && actionError == null && (action == null || activeConnections == null && connectionError == null);
|
|
1805
|
+
const required = !pending && (accessIssue != null || connectionId !== "" && action?.authenticated == true && (connectionId == null || activeConnections != null && connection?.status != "active"));
|
|
1806
|
+
let onManage;
|
|
1807
|
+
let content;
|
|
1808
|
+
if (pending) content = /* @__PURE__ */ jsx("p", { children: t("inspector.account.loading") });
|
|
1809
|
+
else if (accessIssue != null) content = /* @__PURE__ */ jsx("p", { children: accessIssue });
|
|
1810
|
+
else if (actionError != null || action == null) {
|
|
1811
|
+
const canRetry = actionError?.code != "authorization.denied" && actionError?.code != "connector.action-not-found";
|
|
1812
|
+
content = /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
1813
|
+
disabled,
|
|
1814
|
+
message: actionError?.code == "authorization.denied" ? t("inspector.account.contactAdmin") : actionError?.message ?? t("inspector.account.statusUnavailable", { action: actionId }),
|
|
1815
|
+
onRetry: canRetry ? () => void connectors.refresh(true) : void 0
|
|
1816
|
+
});
|
|
1817
|
+
} else if (connectionError != null) content = /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
1818
|
+
detail: connectionError,
|
|
1819
|
+
disabled,
|
|
1820
|
+
message: t("inspector.account.refreshFailed"),
|
|
1821
|
+
onRetry: () => void connectors.refresh(true)
|
|
1822
|
+
});
|
|
1823
|
+
else {
|
|
1824
|
+
onManage = onConfigureAccess;
|
|
1825
|
+
let status;
|
|
1826
|
+
if (connectionId != null && connectionId !== "") {
|
|
1827
|
+
if (connection == null) status = t("inspector.account.missing");
|
|
1828
|
+
else if (connection.status != "active") status = t(`inspector.account.status.${connection.status}`);
|
|
1829
|
+
}
|
|
1830
|
+
content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1831
|
+
authorizationPending && /* @__PURE__ */ jsx("p", { children: t("inspector.account.authorizationPending") }),
|
|
1832
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
1833
|
+
className: "connection-field",
|
|
1834
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
1835
|
+
className: "sr-only",
|
|
1836
|
+
htmlFor: `${fieldIdPrefix}-connection`,
|
|
1837
|
+
children: t("inspector.account.connection")
|
|
1838
|
+
}), /* @__PURE__ */ jsx(AccountSelect, {
|
|
1839
|
+
allowDeferred: true,
|
|
1840
|
+
connections: available,
|
|
1841
|
+
disabled,
|
|
1842
|
+
id: `${fieldIdPrefix}-connection`,
|
|
1843
|
+
selectedConnection: connection,
|
|
1844
|
+
selectedId: connectionId,
|
|
1845
|
+
onChange: (next) => void connectors.setConnection(nodeId, next),
|
|
1846
|
+
onManage: onConfigureAccess
|
|
1847
|
+
})]
|
|
1848
|
+
}),
|
|
1849
|
+
status != null && /* @__PURE__ */ jsx("p", { children: status })
|
|
1850
|
+
] });
|
|
1851
|
+
}
|
|
1852
|
+
return /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
1853
|
+
tone: required ? "warning" : "neutral",
|
|
1854
|
+
section: "account",
|
|
1855
|
+
title: t(!pending && accessIssue != null ? "inspector.account.accessTitle" : required ? "inspector.account.required" : "inspector.account.title"),
|
|
1856
|
+
actions: onManage != null && /* @__PURE__ */ jsx(Button$1, {
|
|
1857
|
+
className: "ml-auto",
|
|
1858
|
+
disabled,
|
|
1859
|
+
onClick: onManage,
|
|
1860
|
+
size: "xs",
|
|
1861
|
+
type: "button",
|
|
1862
|
+
variant: "ghost",
|
|
1863
|
+
children: t("inspector.account.manageAccount")
|
|
1864
|
+
}),
|
|
1865
|
+
children: [content, !pending && onConfigureAccess != null && accessIssue != null && /* @__PURE__ */ jsx(Button$1, {
|
|
1866
|
+
className: "self-start",
|
|
1867
|
+
disabled,
|
|
1868
|
+
onClick: onConfigureAccess,
|
|
1869
|
+
size: "sm",
|
|
1870
|
+
type: "button",
|
|
1871
|
+
variant: "default",
|
|
1872
|
+
children: t("inspector.account.manageAccount")
|
|
1873
|
+
})]
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
function TriggerConnection({ activeConnections, authorizationPending, connection, connectionError, connectionLoading, disabled, selection, onConfigureAccess, triggers }) {
|
|
1877
|
+
const t = useTranslate();
|
|
1878
|
+
const trigger = selection.trigger;
|
|
1879
|
+
const providerTrigger = trigger.kind == "poll" || trigger.kind == "integration" ? trigger : void 0;
|
|
1880
|
+
const fieldIdPrefix = `trigger-${selection.id}`;
|
|
1881
|
+
const canManage = onConfigureAccess != null && !connectionLoading && connectionError == null && (activeConnections?.length ?? 0) > 0;
|
|
1882
|
+
return providerTrigger == null ? null : /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
1883
|
+
tone: connection?.status == "active" ? "neutral" : "warning",
|
|
1884
|
+
section: "account",
|
|
1885
|
+
title: t(connection?.status == "active" ? "inspector.account.title" : "inspector.account.required"),
|
|
1886
|
+
actions: canManage && /* @__PURE__ */ jsx(Button$1, {
|
|
1887
|
+
className: "ml-auto",
|
|
1888
|
+
disabled,
|
|
1889
|
+
onClick: () => onConfigureAccess?.(providerTrigger.definition.provider),
|
|
1890
|
+
size: "xs",
|
|
1891
|
+
type: "button",
|
|
1892
|
+
variant: "ghost",
|
|
1893
|
+
children: t("inspector.account.manageAccount")
|
|
1894
|
+
}),
|
|
1895
|
+
children: [authorizationPending && /* @__PURE__ */ jsx("p", { children: t("inspector.account.authorizationPending") }), connectionLoading ? /* @__PURE__ */ jsx("p", { children: t("inspector.account.loading") }) : connectionError != null ? /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
1896
|
+
detail: connectionError,
|
|
1897
|
+
disabled,
|
|
1898
|
+
message: t("inspector.account.refreshFailed"),
|
|
1899
|
+
onRetry: () => void triggers.refresh(true)
|
|
1900
|
+
}) : (activeConnections?.length ?? 0) == 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1901
|
+
className: "inspector-status-prompt",
|
|
1902
|
+
children: [/* @__PURE__ */ jsx("p", { children: t("inspector.account.connectBeforeRun", { service: providerTrigger.definition.provider }) }), /* @__PURE__ */ jsx(Button$1, {
|
|
1903
|
+
disabled: disabled || onConfigureAccess == null,
|
|
1904
|
+
onClick: () => onConfigureAccess?.(providerTrigger.definition.provider),
|
|
1905
|
+
size: "sm",
|
|
1906
|
+
type: "button",
|
|
1907
|
+
children: t("inspector.account.manageAccount")
|
|
1908
|
+
})]
|
|
1909
|
+
}) : /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(Field, {
|
|
1910
|
+
className: "connection-field",
|
|
1911
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
1912
|
+
className: "sr-only",
|
|
1913
|
+
htmlFor: `${fieldIdPrefix}-connection`,
|
|
1914
|
+
children: t("inspector.account.connection")
|
|
1915
|
+
}), /* @__PURE__ */ jsx(AccountSelect, {
|
|
1916
|
+
connections: activeConnections,
|
|
1917
|
+
disabled,
|
|
1918
|
+
id: `${fieldIdPrefix}-connection`,
|
|
1919
|
+
selectedConnection: connection,
|
|
1920
|
+
selectedId: connection?.connectionId,
|
|
1921
|
+
onChange: (next) => void triggers.setConnection(selection.id, next),
|
|
1922
|
+
onManage: onConfigureAccess == null ? void 0 : () => onConfigureAccess(providerTrigger.definition.provider)
|
|
1923
|
+
})]
|
|
1924
|
+
}) })]
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
/** A persisted reference has no live account health or authorization state. */
|
|
1928
|
+
function SavedConnectionReference({ action, connectionId }) {
|
|
1929
|
+
const t = useTranslate();
|
|
1930
|
+
return /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
1931
|
+
title: t("inspector.account.title"),
|
|
1932
|
+
section: "account",
|
|
1933
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1934
|
+
className: "reference-value",
|
|
1935
|
+
children: action
|
|
1936
|
+
}), connectionId != null && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: t("inspector.account.connection") }), /* @__PURE__ */ jsx(Input$1, {
|
|
1937
|
+
"aria-label": t("inspector.account.connection"),
|
|
1938
|
+
readOnly: true,
|
|
1939
|
+
value: connectionId
|
|
1940
|
+
})] })]
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
//#endregion
|
|
1477
1944
|
//#region src/workbench/browser/runtime/editor/connectorAccessPresentation.ts
|
|
1478
1945
|
function connectorAccessPermissionGroupLabel(binding, t) {
|
|
1479
1946
|
if (binding.source == null) return t("connectorAccess.reauthorize");
|
|
@@ -2778,7 +3245,7 @@ function hasConnectionUsageIssue(uses, access, providers, connections) {
|
|
|
2778
3245
|
if (pendingConnectionUses(uses, providers).length > 0) return true;
|
|
2779
3246
|
if (access?.version == 1 && access.bindings.some((binding) => binding.connectionId == null || binding.status != "active")) return true;
|
|
2780
3247
|
if (connections == null) return false;
|
|
2781
|
-
const connectionIds = new Set(uses.flatMap((use) => use.connectionId == null ? [] : [use.connectionId]));
|
|
3248
|
+
const connectionIds = new Set(uses.flatMap((use) => use.connectionId == null || use.connectionId === "" ? [] : [use.connectionId]));
|
|
2782
3249
|
for (const binding of access == null ? [] : access.version == 2 ? access.sharedBindings : access.bindings) if (binding.connectionId != null) connectionIds.add(binding.connectionId);
|
|
2783
3250
|
return [...connectionIds].some((id) => connections.find((connection) => connection.connectionId == id)?.status != "active");
|
|
2784
3251
|
}
|
|
@@ -2814,7 +3281,7 @@ function ConnectionUsageButton(props) {
|
|
|
2814
3281
|
"aria-hidden": "true",
|
|
2815
3282
|
className: "i-lucide-light:plug",
|
|
2816
3283
|
"data-corner-icon": true,
|
|
2817
|
-
style: hasIssue ? { color: "var(--
|
|
3284
|
+
style: hasIssue ? { color: "var(--ui-destructive)" } : void 0
|
|
2818
3285
|
})
|
|
2819
3286
|
})
|
|
2820
3287
|
}), /* @__PURE__ */ jsx(PopoverPanelContent, {
|
|
@@ -2827,7 +3294,7 @@ function ConnectionUsageButton(props) {
|
|
|
2827
3294
|
children: t("connectionUsage.title")
|
|
2828
3295
|
}),
|
|
2829
3296
|
closeLabel: t("connectionUsage.close"),
|
|
2830
|
-
className: "w-
|
|
3297
|
+
className: "w-md",
|
|
2831
3298
|
children: /* @__PURE__ */ jsx(ConnectorAccessSettings, {
|
|
2832
3299
|
...props,
|
|
2833
3300
|
onSelectReference: props.onSelectReference == null ? void 0 : (reference) => {
|
|
@@ -2880,6 +3347,7 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2880
3347
|
const [root, setRoot] = useState(null);
|
|
2881
3348
|
const [removing, setRemoving] = useState();
|
|
2882
3349
|
const [pending, setPending] = useState(false);
|
|
3350
|
+
const [selectingAccount, setSelectingAccount] = useState(false);
|
|
2883
3351
|
const portal = useCallback((element) => {
|
|
2884
3352
|
panel.current = element;
|
|
2885
3353
|
setRoot(element?.closest(".open-flow-workbench") ?? element?.closest(".open-flow-theme") ?? null);
|
|
@@ -2890,7 +3358,7 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2890
3358
|
const uses = displayed?.connectorReferences.accounts ?? [];
|
|
2891
3359
|
const accounts = /* @__PURE__ */ new Map();
|
|
2892
3360
|
for (const use of uses) {
|
|
2893
|
-
if (use.connectionId == null || accounts.has(use.connectionId)) continue;
|
|
3361
|
+
if (use.connectionId == null || use.connectionId === "" || accounts.has(use.connectionId)) continue;
|
|
2894
3362
|
const connection = connections.find((item) => item.connectionId == use.connectionId);
|
|
2895
3363
|
accounts.set(use.connectionId, {
|
|
2896
3364
|
name: (published ? fixedSnapshot?.access.selectedBindings.find((binding) => binding.connectionId == use.connectionId)?.connectionDisplayName : void 0) ?? connection?.displayName ?? use.connectionId,
|
|
@@ -2910,6 +3378,8 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2910
3378
|
});
|
|
2911
3379
|
}
|
|
2912
3380
|
const pendingUses = pendingConnectionUses(uses, providers.data);
|
|
3381
|
+
const deferredUses = uses.filter((use) => use.connectionId === "" && use.kind != "trigger");
|
|
3382
|
+
const hasAccountUses = accounts.size > 0 || pendingUses.length > 0 || deferredUses.length > 0;
|
|
2913
3383
|
const providerMetadata = Object.fromEntries((providers.data ?? []).map((provider) => [provider.serviceId, provider]));
|
|
2914
3384
|
const referenceIcon = (reference) => {
|
|
2915
3385
|
const node = displayed?.node(reference.nodeId);
|
|
@@ -2940,9 +3410,9 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2940
3410
|
children: t("connectionUsage.published")
|
|
2941
3411
|
})]
|
|
2942
3412
|
}),
|
|
2943
|
-
/* @__PURE__ */ jsx("p", {
|
|
3413
|
+
published && /* @__PURE__ */ jsx("p", {
|
|
2944
3414
|
className: "m-0 text-xs text-muted-foreground",
|
|
2945
|
-
children: t(
|
|
3415
|
+
children: t("connectionUsage.publishedDescription")
|
|
2946
3416
|
}),
|
|
2947
3417
|
published && snapshotError || !published && !state.loading && state.access == null ? /* @__PURE__ */ jsxs("p", {
|
|
2948
3418
|
role: "alert",
|
|
@@ -2959,21 +3429,72 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2959
3429
|
}) : !published && (state.loading || revision == null) || published && fixedSnapshot == null ? /* @__PURE__ */ jsx("p", {
|
|
2960
3430
|
className: "text-xs",
|
|
2961
3431
|
children: t("connectionUsage.loading")
|
|
2962
|
-
}) :
|
|
3432
|
+
}) : !hasAccountUses ? /* @__PURE__ */ jsx("p", {
|
|
2963
3433
|
className: "text-xs text-muted-foreground",
|
|
2964
3434
|
children: t(published ? "connectionUsage.publishedEmpty" : "connectionUsage.empty")
|
|
2965
3435
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
2966
3436
|
className: "flex flex-col gap-4",
|
|
2967
|
-
children: [
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
3437
|
+
children: [[{
|
|
3438
|
+
deferred: false,
|
|
3439
|
+
references: pendingUses
|
|
3440
|
+
}, {
|
|
3441
|
+
deferred: true,
|
|
3442
|
+
references: deferredUses
|
|
3443
|
+
}].map(({ deferred, references }) => references.length > 0 && /* @__PURE__ */ jsxs("section", {
|
|
3444
|
+
className: "flex flex-col gap-3",
|
|
3445
|
+
"aria-label": t(deferred ? "inspector.account.deferred" : "connectionUsage.needsConnection"),
|
|
3446
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
3447
|
+
className: cn$1("m-0 text-xs font-medium", deferred ? "text-muted-foreground" : "text-[var(--warning-foreground)]"),
|
|
3448
|
+
children: t(deferred ? "inspector.account.deferred" : "connectionUsage.needsConnection")
|
|
3449
|
+
}), [...new Set(references.map((use) => use.providerId))].map((providerId) => {
|
|
3450
|
+
const provider = providers.data?.find((item) => item.serviceId == providerId) ?? {
|
|
3451
|
+
serviceId: providerId,
|
|
3452
|
+
serviceName: providerId
|
|
3453
|
+
};
|
|
3454
|
+
const providerReferences = references.filter((use) => use.providerId == providerId);
|
|
3455
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
3456
|
+
"aria-label": provider.serviceName,
|
|
3457
|
+
className: cn$1("flex min-w-0 flex-col gap-3 rounded-md p-3", deferred ? "border border-border/50" : "bg-[var(--warning-subtle-surface)] [--ui-control-hover-background:var(--warning-subtle-hover)]"),
|
|
3458
|
+
children: [
|
|
3459
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3460
|
+
className: "flex min-w-0 items-center gap-2 text-[13px] font-medium",
|
|
3461
|
+
children: [/* @__PURE__ */ jsx(ContentIcon, {
|
|
3462
|
+
src: providerIcon(provider),
|
|
3463
|
+
className: "size-4 shrink-0 data-[icon-kind=initials]:text-[20px]"
|
|
3464
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3465
|
+
className: "min-w-0 truncate",
|
|
3466
|
+
title: provider.serviceName,
|
|
3467
|
+
children: provider.serviceName
|
|
3468
|
+
})]
|
|
3469
|
+
}),
|
|
3470
|
+
!published && /* @__PURE__ */ jsx(AccountSelect, {
|
|
3471
|
+
connections: connections.filter((connection) => connection.serviceId == providerId && connection.status == "active"),
|
|
3472
|
+
disabled: selectingAccount || connectionState.error != null,
|
|
3473
|
+
loading: connectionState.data == null && connectionState.error == null,
|
|
3474
|
+
warning: !deferred,
|
|
3475
|
+
selectedId: deferred ? "" : void 0,
|
|
3476
|
+
allowDeferred: !providerReferences.some((use) => use.kind == "trigger"),
|
|
3477
|
+
label: t("actionPicker.accountFor", { action: provider.serviceName }),
|
|
3478
|
+
onChange: (connectionId) => {
|
|
3479
|
+
setSelectingAccount(true);
|
|
3480
|
+
store.workspace.setServiceConnections(providerId, connectionId, deferred ? "" : void 0).then((saved) => {
|
|
3481
|
+
setSelectingAccount(false);
|
|
3482
|
+
if (saved) panel.current?.focus();
|
|
3483
|
+
});
|
|
3484
|
+
},
|
|
3485
|
+
onManage: () => void store.connectors.connect(providerId)
|
|
3486
|
+
}),
|
|
3487
|
+
/* @__PURE__ */ jsx(AccountReferences, {
|
|
3488
|
+
showLabel: false,
|
|
3489
|
+
icon: referenceIcon,
|
|
3490
|
+
references: providerReferences,
|
|
3491
|
+
label: t(deferred ? "inspector.account.deferred" : "connectionUsage.needsConnection"),
|
|
3492
|
+
onSelect: published ? void 0 : onSelectReference
|
|
3493
|
+
})
|
|
3494
|
+
]
|
|
3495
|
+
}, providerId);
|
|
3496
|
+
})]
|
|
3497
|
+
}, String(deferred))), /* @__PURE__ */ jsx("div", {
|
|
2977
3498
|
className: "flex flex-col gap-4",
|
|
2978
3499
|
children: [...new Set([...accounts.values()].map((account) => account.providerId))].map((providerId) => {
|
|
2979
3500
|
const provider = providers.data?.find((item) => item.serviceId == providerId) ?? {
|
|
@@ -2992,7 +3513,8 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
2992
3513
|
src: providerIcon(provider),
|
|
2993
3514
|
className: "size-4 shrink-0 data-[icon-kind=initials]:text-[20px]"
|
|
2994
3515
|
}), /* @__PURE__ */ jsx("span", {
|
|
2995
|
-
className: "min-w-0
|
|
3516
|
+
className: "min-w-0 truncate",
|
|
3517
|
+
title: provider.serviceName,
|
|
2996
3518
|
children: provider.serviceName
|
|
2997
3519
|
})]
|
|
2998
3520
|
}), /* @__PURE__ */ jsx("span", {
|
|
@@ -3015,7 +3537,8 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
3015
3537
|
className: "i-codicon:credit-card size-3.5 shrink-0 text-sm text-muted-foreground"
|
|
3016
3538
|
}), /* @__PURE__ */ jsx(AccountName, {
|
|
3017
3539
|
name: accountDisplayName(connection, account.name, builtInName),
|
|
3018
|
-
builtIn: connection?.builtInAccount
|
|
3540
|
+
builtIn: connection?.builtInAccount,
|
|
3541
|
+
truncate: true
|
|
3019
3542
|
})]
|
|
3020
3543
|
}), !published && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
3021
3544
|
render: /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -3058,7 +3581,7 @@ function ConnectorAccessSettings({ connectionHref, onManage, onSelectReference,
|
|
|
3058
3581
|
})
|
|
3059
3582
|
})]
|
|
3060
3583
|
}),
|
|
3061
|
-
|
|
3584
|
+
hasAccountUses && (connectionState.error != null || connectionState.data == null) && /* @__PURE__ */ jsxs("p", {
|
|
3062
3585
|
className: "text-xs text-muted-foreground",
|
|
3063
3586
|
role: "status",
|
|
3064
3587
|
children: [t(connectionState.error != null ? "connectorAccess.accountsFailed" : "inspector.account.loading"), connectionState.error != null && /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -3468,14 +3991,14 @@ function ConnectorAccessEmptyState({ store, serviceId }) {
|
|
|
3468
3991
|
})]
|
|
3469
3992
|
});
|
|
3470
3993
|
}
|
|
3471
|
-
function AccountReferences({ hierarchy = false, icon, code = false, references, label,
|
|
3994
|
+
function AccountReferences({ hierarchy = false, showLabel = !hierarchy, icon, code = false, references, label, onSelect }) {
|
|
3472
3995
|
const t = useTranslate();
|
|
3473
3996
|
if (references.length == 0 && !code) return null;
|
|
3474
3997
|
return /* @__PURE__ */ jsxs("div", {
|
|
3475
3998
|
className: "flex min-w-0 flex-col gap-1",
|
|
3476
3999
|
children: [
|
|
3477
|
-
(
|
|
3478
|
-
className:
|
|
4000
|
+
(showLabel || references.length == 0) && /* @__PURE__ */ jsx("span", {
|
|
4001
|
+
className: "text-xs text-muted-foreground",
|
|
3479
4002
|
children: references.length > 0 ? label : t("connectionUsage.codeAccess")
|
|
3480
4003
|
}),
|
|
3481
4004
|
references.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
@@ -3488,7 +4011,8 @@ function AccountReferences({ hierarchy = false, icon, code = false, references,
|
|
|
3488
4011
|
className: "size-4 shrink-0 data-[icon-kind=initials]:text-[20px]"
|
|
3489
4012
|
}),
|
|
3490
4013
|
/* @__PURE__ */ jsx("span", {
|
|
3491
|
-
className: "min-w-0 flex-1
|
|
4014
|
+
className: "min-w-0 flex-1 truncate",
|
|
4015
|
+
title: reference.name,
|
|
3492
4016
|
children: reference.name
|
|
3493
4017
|
}),
|
|
3494
4018
|
reference.kind != null && /* @__PURE__ */ jsx("span", {
|
|
@@ -3508,7 +4032,7 @@ function AccountReferences({ hierarchy = false, icon, code = false, references,
|
|
|
3508
4032
|
className: "flex min-h-7 items-center gap-2 px-2 py-1 text-[13px]",
|
|
3509
4033
|
children: content
|
|
3510
4034
|
}) : /* @__PURE__ */ jsxs(Button$1, {
|
|
3511
|
-
className: "h-auto min-h-7 w-full justify-start gap-2 px-2 py-1 text-left text-[13px] font-normal
|
|
4035
|
+
className: "h-auto min-h-7 w-full justify-start gap-2 px-2 py-1 text-left text-[13px] font-normal",
|
|
3512
4036
|
variant: "ghost",
|
|
3513
4037
|
size: "xs",
|
|
3514
4038
|
type: "button",
|
|
@@ -3518,7 +4042,11 @@ function AccountReferences({ hierarchy = false, icon, code = false, references,
|
|
|
3518
4042
|
className: "i-lucide-light:arrow-up-right size-3 shrink-0 text-muted-foreground"
|
|
3519
4043
|
})]
|
|
3520
4044
|
})]
|
|
3521
|
-
}, JSON.stringify([
|
|
4045
|
+
}, JSON.stringify([
|
|
4046
|
+
reference.nodeId,
|
|
4047
|
+
reference.kind,
|
|
4048
|
+
reference.providerId
|
|
4049
|
+
]));
|
|
3522
4050
|
})
|
|
3523
4051
|
}),
|
|
3524
4052
|
code && /* @__PURE__ */ jsx("p", {
|
|
@@ -3532,7 +4060,7 @@ function ConnectionConsoleLink({ href, children }) {
|
|
|
3532
4060
|
const className = cn$1(buttonVariants({
|
|
3533
4061
|
variant: "ghost",
|
|
3534
4062
|
size: "xs"
|
|
3535
|
-
}), "-my-1 -ml-2 min-w-0 h-auto min-h-6 shrink justify-start gap-2 py-1 text-left text-[13px] text-foreground
|
|
4063
|
+
}), "-my-1 -ml-2 min-w-0 h-auto min-h-6 shrink justify-start gap-2 py-1 text-left text-[13px] text-foreground");
|
|
3536
4064
|
return href == null ? /* @__PURE__ */ jsx("span", {
|
|
3537
4065
|
className: cn$1(className, "pointer-events-none"),
|
|
3538
4066
|
children
|
|
@@ -5877,461 +6405,8 @@ function ActionPickerPage({ portalRoot, connectors, disabled, selected, onToggle
|
|
|
5877
6405
|
});
|
|
5878
6406
|
}
|
|
5879
6407
|
//#endregion
|
|
5880
|
-
//#region src/form/browser/fieldTypeDisplay.tsx
|
|
5881
|
-
/** Presents a fixed type, optionally using its read-only surface as a disclosure control. */
|
|
5882
|
-
function FieldTypeDisplay({ id, label, accessibleLabel, icon, compact = true, addon = false, surface = false, disclosure }) {
|
|
5883
|
-
const [container, setContainer] = useState(null);
|
|
5884
|
-
const className = `flex ${addon ? "size-6 px-1" : "h-[30px] w-full px-2"} min-w-0 items-center gap-1.5 text-xs font-normal text-muted-foreground ${compact ? "justify-center" : ""} ${surface ? "rounded-[var(--ui-control-radius,var(--ui-radius))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] dark:bg-[var(--ui-control-background,var(--ui-muted))]" : ""}`;
|
|
5885
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5886
|
-
ref: setContainer,
|
|
5887
|
-
className: "min-w-0",
|
|
5888
|
-
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
|
|
5889
|
-
render: disclosure == null ? /* @__PURE__ */ jsx("span", {
|
|
5890
|
-
id,
|
|
5891
|
-
role: "img",
|
|
5892
|
-
"aria-label": accessibleLabel,
|
|
5893
|
-
"data-field-control": surface || void 0,
|
|
5894
|
-
"data-readonly": surface || void 0
|
|
5895
|
-
}) : /* @__PURE__ */ jsx("button", {
|
|
5896
|
-
id,
|
|
5897
|
-
type: "button",
|
|
5898
|
-
"aria-label": accessibleLabel,
|
|
5899
|
-
"aria-expanded": disclosure.expanded,
|
|
5900
|
-
"aria-controls": disclosure.controls,
|
|
5901
|
-
"data-field-control": true,
|
|
5902
|
-
"data-readonly": true,
|
|
5903
|
-
onClick: disclosure.onToggle
|
|
5904
|
-
}),
|
|
5905
|
-
className: `${className} ${disclosure == null ? "cursor-default" : "cursor-pointer text-left outline-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-ring"}`,
|
|
5906
|
-
children: [icon, !compact && /* @__PURE__ */ jsx("span", {
|
|
5907
|
-
className: "min-w-0 truncate",
|
|
5908
|
-
children: label
|
|
5909
|
-
})]
|
|
5910
|
-
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
5911
|
-
container,
|
|
5912
|
-
children: label
|
|
5913
|
-
})] })
|
|
5914
|
-
});
|
|
5915
|
-
}
|
|
5916
|
-
//#endregion
|
|
5917
|
-
//#region src/form/browser/selectionMenuStyles.ts
|
|
5918
|
-
var selectionMenuContentClass = "rounded-[calc(var(--ui-control-radius,var(--ui-radius))_+_2px)] p-1";
|
|
5919
|
-
var selectionMenuItemClass = "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal";
|
|
5920
|
-
//#endregion
|
|
5921
|
-
//#region src/form/browser/fieldSelect.tsx
|
|
5922
|
-
var fieldSelectTriggerClass = "w-full min-w-0 px-2 text-xs font-normal text-foreground";
|
|
5923
|
-
/** The field editor uses the product selection surface instead of the browser menu. */
|
|
5924
|
-
function FieldSelect({ id, value, onChange, children, disabled, readOnly, danger, icons, displayValue, showTooltip, variant, "aria-label": label, "aria-invalid": invalid, "aria-describedby": describedBy }) {
|
|
5925
|
-
const [open, setOpen] = useState(false);
|
|
5926
|
-
const [container, setContainer] = useState(null);
|
|
5927
|
-
const options = Children.toArray(children).filter(isValidElement).map((child) => {
|
|
5928
|
-
const props = child.props;
|
|
5929
|
-
return {
|
|
5930
|
-
value: String(props.value ?? props.children),
|
|
5931
|
-
label: props.children,
|
|
5932
|
-
disabled: props.disabled
|
|
5933
|
-
};
|
|
5934
|
-
});
|
|
5935
|
-
const selected = options.find((option) => option.value === String(value));
|
|
5936
|
-
if (readOnly && icons?.[value]) return /* @__PURE__ */ jsx(FieldTypeDisplay, {
|
|
5937
|
-
addon: variant === "addon",
|
|
5938
|
-
id,
|
|
5939
|
-
label: selected?.label,
|
|
5940
|
-
accessibleLabel: `${label}: ${selected?.label ?? value}`,
|
|
5941
|
-
icon: /* @__PURE__ */ jsx("i", {
|
|
5942
|
-
"aria-hidden": "true",
|
|
5943
|
-
className: `${icons[value]} inline-block shrink-0 text-base`
|
|
5944
|
-
})
|
|
5945
|
-
});
|
|
5946
|
-
const trigger = /* @__PURE__ */ jsx(SelectTrigger, {
|
|
5947
|
-
id,
|
|
5948
|
-
size: "field",
|
|
5949
|
-
variant,
|
|
5950
|
-
"aria-label": label,
|
|
5951
|
-
"aria-invalid": invalid || danger,
|
|
5952
|
-
"aria-describedby": describedBy,
|
|
5953
|
-
"data-field-prompt": danger || void 0,
|
|
5954
|
-
className: variant === "addon" ? void 0 : fieldSelectTriggerClass,
|
|
5955
|
-
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
5956
|
-
className: variant === "addon" ? "flex-none justify-center" : void 0,
|
|
5957
|
-
children: displayValue ?? (icons?.[value] ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("i", {
|
|
5958
|
-
"aria-hidden": "true",
|
|
5959
|
-
className: `${icons[value]} inline-block shrink-0 text-base`
|
|
5960
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
5961
|
-
className: "sr-only",
|
|
5962
|
-
children: selected?.label
|
|
5963
|
-
})] }) : void 0)
|
|
5964
|
-
})
|
|
5965
|
-
});
|
|
5966
|
-
return /* @__PURE__ */ jsx("div", {
|
|
5967
|
-
ref: setContainer,
|
|
5968
|
-
className: "min-w-0",
|
|
5969
|
-
children: /* @__PURE__ */ jsxs(Select$1, {
|
|
5970
|
-
open,
|
|
5971
|
-
onOpenChange: setOpen,
|
|
5972
|
-
value: String(value),
|
|
5973
|
-
onValueChange: (next) => {
|
|
5974
|
-
if (next != null) onChange(next);
|
|
5975
|
-
},
|
|
5976
|
-
disabled: disabled || readOnly,
|
|
5977
|
-
items: options,
|
|
5978
|
-
children: [icons || showTooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: trigger }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
5979
|
-
container,
|
|
5980
|
-
children: selected?.label
|
|
5981
|
-
})] }) : trigger, /* @__PURE__ */ jsx(SelectContent, {
|
|
5982
|
-
container,
|
|
5983
|
-
align: "start",
|
|
5984
|
-
alignItemWithTrigger: false,
|
|
5985
|
-
className: `${selectionMenuContentClass} w-max min-w-[max(9rem,var(--anchor-width))] max-w-(--available-width)`,
|
|
5986
|
-
children: options.filter((option) => !option.disabled).map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
5987
|
-
value: option.value,
|
|
5988
|
-
disabled: option.disabled,
|
|
5989
|
-
className: selectionMenuItemClass,
|
|
5990
|
-
children: [icons?.[option.value] && /* @__PURE__ */ jsx("i", {
|
|
5991
|
-
"aria-hidden": "true",
|
|
5992
|
-
className: `${icons[option.value]} inline-block shrink-0 text-base`
|
|
5993
|
-
}), option.label]
|
|
5994
|
-
}, option.value))
|
|
5995
|
-
})]
|
|
5996
|
-
})
|
|
5997
|
-
});
|
|
5998
|
-
}
|
|
5999
|
-
//#endregion
|
|
6000
|
-
//#region src/workbench/browser/runtime/editor/inspectorStatusSection.tsx
|
|
6001
|
-
function InspectorStatusSection({ title, actions, children, tone = "neutral", section, alert = false }) {
|
|
6002
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
6003
|
-
className: "inspector-status",
|
|
6004
|
-
"data-tone": tone,
|
|
6005
|
-
"data-inspector-section": section,
|
|
6006
|
-
role: alert ? "alert" : void 0,
|
|
6007
|
-
children: [/* @__PURE__ */ jsxs("h3", {
|
|
6008
|
-
className: "inspector-section-title",
|
|
6009
|
-
children: [title, actions]
|
|
6010
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
6011
|
-
className: "inspector-status-content",
|
|
6012
|
-
children
|
|
6013
|
-
})]
|
|
6014
|
-
});
|
|
6015
|
-
}
|
|
6016
|
-
//#endregion
|
|
6017
|
-
//#region src/workbench/browser/runtime/editor/connectionSettings.tsx
|
|
6018
|
-
var manageAccountOption = "__manage-account__";
|
|
6019
|
-
function ConnectionAlert({ detail, disabled, message, onRetry }) {
|
|
6020
|
-
const t = useTranslate();
|
|
6021
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
6022
|
-
className: "connection-alert",
|
|
6023
|
-
role: "alert",
|
|
6024
|
-
children: [
|
|
6025
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
6026
|
-
name: "alert",
|
|
6027
|
-
size: 14
|
|
6028
|
-
}),
|
|
6029
|
-
/* @__PURE__ */ jsxs("div", {
|
|
6030
|
-
className: "connection-alert-message",
|
|
6031
|
-
children: [/* @__PURE__ */ jsx("p", { children: message }), detail != null && /* @__PURE__ */ jsx("p", { children: detail })]
|
|
6032
|
-
}),
|
|
6033
|
-
onRetry != null && /* @__PURE__ */ jsx(Button$1, {
|
|
6034
|
-
disabled,
|
|
6035
|
-
onClick: onRetry,
|
|
6036
|
-
size: "sm",
|
|
6037
|
-
type: "button",
|
|
6038
|
-
variant: "secondary",
|
|
6039
|
-
children: t("inspector.account.retry")
|
|
6040
|
-
})
|
|
6041
|
-
]
|
|
6042
|
-
});
|
|
6043
|
-
}
|
|
6044
|
-
function AccountControlButton({ disabled, status, label, hint, onClick }) {
|
|
6045
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsxs(Button$1, {
|
|
6046
|
-
type: "button",
|
|
6047
|
-
variant: "outline",
|
|
6048
|
-
size: "sm",
|
|
6049
|
-
className: "account-control justify-between font-normal",
|
|
6050
|
-
"data-status": status,
|
|
6051
|
-
disabled,
|
|
6052
|
-
onClick,
|
|
6053
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
6054
|
-
className: "truncate",
|
|
6055
|
-
children: label
|
|
6056
|
-
}), /* @__PURE__ */ jsx("i", {
|
|
6057
|
-
"aria-hidden": "true",
|
|
6058
|
-
className: status === "warning" ? "i-lucide-light:plus size-3.5" : "i-lucide-light:rotate-cw size-3.5"
|
|
6059
|
-
})]
|
|
6060
|
-
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: hint ?? label })] });
|
|
6061
|
-
}
|
|
6062
|
-
function AccountSelect({ connections, disabled, loading = false, id, invalid, warning, addWhenEmpty, label, selectedConnection, selectedId, onChange, onManage }) {
|
|
6063
|
-
const t = useTranslate();
|
|
6064
|
-
const [container, setContainer] = useState(null);
|
|
6065
|
-
const selected = selectedConnection ?? connections.find((candidate) => candidate.connectionId == selectedId);
|
|
6066
|
-
const showLoading = loading && selected == null;
|
|
6067
|
-
const builtInName = t("inspector.account.oomolBuiltIn");
|
|
6068
|
-
const displayName = (connection) => accountDisplayName(connection, connection.displayName, builtInName);
|
|
6069
|
-
const selectedLabel = selected == null ? selectedId == null ? void 0 : `${selectedId} (${t("inspector.account.unavailable")})` : `${displayName(selected)}${selected.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""}`;
|
|
6070
|
-
const missingSelected = selectedId != null && !connections.some((candidate) => candidate.connectionId == selectedId);
|
|
6071
|
-
const items = [
|
|
6072
|
-
...missingSelected ? [{
|
|
6073
|
-
value: selectedId,
|
|
6074
|
-
label: selectedLabel,
|
|
6075
|
-
disabled: true
|
|
6076
|
-
}] : [],
|
|
6077
|
-
...connections.map((candidate) => ({
|
|
6078
|
-
value: candidate.connectionId,
|
|
6079
|
-
label: `${displayName(candidate)}${candidate.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""}`
|
|
6080
|
-
})),
|
|
6081
|
-
...onManage == null ? [] : [{
|
|
6082
|
-
value: manageAccountOption,
|
|
6083
|
-
label: t("inspector.account.addAccount")
|
|
6084
|
-
}]
|
|
6085
|
-
];
|
|
6086
|
-
if (!loading && addWhenEmpty && connections.length === 0 && selectedId == null) return /* @__PURE__ */ jsx(AccountControlButton, {
|
|
6087
|
-
disabled,
|
|
6088
|
-
status: "warning",
|
|
6089
|
-
onClick: onManage,
|
|
6090
|
-
label: t("inspector.account.addAccount")
|
|
6091
|
-
});
|
|
6092
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
6093
|
-
ref: setContainer,
|
|
6094
|
-
className: "account-select relative min-w-0",
|
|
6095
|
-
children: [/* @__PURE__ */ jsxs(Select$1, {
|
|
6096
|
-
disabled: disabled || loading,
|
|
6097
|
-
items,
|
|
6098
|
-
value: selectedId ?? null,
|
|
6099
|
-
onValueChange: (value) => {
|
|
6100
|
-
if (value == null) return;
|
|
6101
|
-
if (value == manageAccountOption) onManage?.();
|
|
6102
|
-
else onChange(value);
|
|
6103
|
-
},
|
|
6104
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
6105
|
-
id,
|
|
6106
|
-
size: "field",
|
|
6107
|
-
"aria-label": label ?? t("inspector.account.connection"),
|
|
6108
|
-
"aria-busy": loading || void 0,
|
|
6109
|
-
"aria-invalid": invalid || void 0,
|
|
6110
|
-
"data-status": invalid ? "danger" : warning ? "warning" : void 0,
|
|
6111
|
-
className: `${fieldSelectTriggerClass} account-control`,
|
|
6112
|
-
children: /* @__PURE__ */ jsx(SelectValue, {
|
|
6113
|
-
className: !loading && selectedId != null ? "mr-5" : void 0,
|
|
6114
|
-
placeholder: t("inspector.account.chooseAccount"),
|
|
6115
|
-
children: showLoading ? /* @__PURE__ */ jsxs("span", {
|
|
6116
|
-
role: "status",
|
|
6117
|
-
className: "flex min-w-0 items-center gap-2 text-muted-foreground",
|
|
6118
|
-
children: [/* @__PURE__ */ jsx(Spinner, {}), /* @__PURE__ */ jsx("span", {
|
|
6119
|
-
className: "truncate",
|
|
6120
|
-
children: t("inspector.account.loading")
|
|
6121
|
-
})]
|
|
6122
|
-
}) : selected == null ? selectedLabel : /* @__PURE__ */ jsx(AccountName, {
|
|
6123
|
-
name: displayName(selected),
|
|
6124
|
-
builtIn: selected.builtInAccount,
|
|
6125
|
-
truncate: true
|
|
6126
|
-
})
|
|
6127
|
-
})
|
|
6128
|
-
}), /* @__PURE__ */ jsxs(SelectContent, {
|
|
6129
|
-
container,
|
|
6130
|
-
align: "start",
|
|
6131
|
-
alignItemWithTrigger: false,
|
|
6132
|
-
className: `${selectionMenuContentClass} w-max min-w-[max(9rem,var(--anchor-width))] max-w-(--available-width)`,
|
|
6133
|
-
children: [
|
|
6134
|
-
missingSelected && /* @__PURE__ */ jsx(SelectItem, {
|
|
6135
|
-
value: selectedId,
|
|
6136
|
-
disabled: true,
|
|
6137
|
-
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
6138
|
-
children: selectedLabel
|
|
6139
|
-
}),
|
|
6140
|
-
connections.map((candidate) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
6141
|
-
value: candidate.connectionId,
|
|
6142
|
-
className: selectionMenuItemClass,
|
|
6143
|
-
children: [/* @__PURE__ */ jsx(AccountName, {
|
|
6144
|
-
name: displayName(candidate),
|
|
6145
|
-
builtIn: candidate.builtInAccount,
|
|
6146
|
-
truncate: true
|
|
6147
|
-
}), candidate.isDefault ? ` (${t("inspector.account.teamDefault")})` : ""]
|
|
6148
|
-
}, candidate.connectionId)),
|
|
6149
|
-
onManage != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2 bg-border/50" }), /* @__PURE__ */ jsx(SelectItem, {
|
|
6150
|
-
value: manageAccountOption,
|
|
6151
|
-
className: "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal",
|
|
6152
|
-
children: t("inspector.account.addAccount")
|
|
6153
|
-
})] })
|
|
6154
|
-
]
|
|
6155
|
-
})]
|
|
6156
|
-
}), !loading && selectedId != null && /* @__PURE__ */ jsx(Button$1, {
|
|
6157
|
-
className: "account-select-clear absolute top-1/2 right-7 -translate-y-1/2 text-muted-foreground",
|
|
6158
|
-
type: "button",
|
|
6159
|
-
variant: "ghost",
|
|
6160
|
-
size: "icon-xs",
|
|
6161
|
-
"aria-label": t("connectionUsage.stopUsing"),
|
|
6162
|
-
title: t("connectionUsage.stopUsing"),
|
|
6163
|
-
disabled,
|
|
6164
|
-
onPointerDown: (event) => {
|
|
6165
|
-
if (event.button == 0) onChange(void 0);
|
|
6166
|
-
},
|
|
6167
|
-
onClick: (event) => {
|
|
6168
|
-
if (event.detail == 0) onChange(void 0);
|
|
6169
|
-
},
|
|
6170
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
6171
|
-
"aria-hidden": "true",
|
|
6172
|
-
className: "i-lucide-light:x"
|
|
6173
|
-
})
|
|
6174
|
-
})]
|
|
6175
|
-
});
|
|
6176
|
-
}
|
|
6177
|
-
function ConnectorAccount({ accessError, onConfigureAccess, action, actionError, actionId, activeConnections, authorizationPending, connection, connectionError, connectionId, connectors, disabled, fieldIdPrefix, loading, nodeId }) {
|
|
6178
|
-
const t = useTranslate();
|
|
6179
|
-
const available = activeConnections ?? [];
|
|
6180
|
-
const accessIssue = accessError ?? (actionError?.code == "connector.access-required" || actionError?.code == "connector.access-invalid" ? actionError.message : void 0);
|
|
6181
|
-
const pending = loading || accessIssue == null && actionError == null && (action == null || activeConnections == null && connectionError == null);
|
|
6182
|
-
const required = !pending && (accessIssue != null || action?.authenticated == true && (connectionId == null || activeConnections != null && connection?.status != "active"));
|
|
6183
|
-
let onManage;
|
|
6184
|
-
let content;
|
|
6185
|
-
if (pending) content = /* @__PURE__ */ jsx("p", { children: t("inspector.account.loading") });
|
|
6186
|
-
else if (accessIssue != null) content = /* @__PURE__ */ jsx("p", { children: accessIssue });
|
|
6187
|
-
else if (actionError != null || action == null) {
|
|
6188
|
-
const canRetry = actionError?.code != "authorization.denied" && actionError?.code != "connector.action-not-found";
|
|
6189
|
-
content = /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
6190
|
-
disabled,
|
|
6191
|
-
message: actionError?.code == "authorization.denied" ? t("inspector.account.contactAdmin") : actionError?.message ?? t("inspector.account.statusUnavailable", { action: actionId }),
|
|
6192
|
-
onRetry: canRetry ? () => void connectors.refresh(true) : void 0
|
|
6193
|
-
});
|
|
6194
|
-
} else if (connectionError != null) content = /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
6195
|
-
detail: connectionError,
|
|
6196
|
-
disabled,
|
|
6197
|
-
message: t("inspector.account.refreshFailed"),
|
|
6198
|
-
onRetry: () => void connectors.refresh(true)
|
|
6199
|
-
});
|
|
6200
|
-
else if (connectionId == null && available.length == 0) content = /* @__PURE__ */ jsxs(Fragment$1, { children: [authorizationPending && /* @__PURE__ */ jsx("p", { children: t("inspector.account.authorizationPending") }), /* @__PURE__ */ jsxs("div", {
|
|
6201
|
-
className: "inspector-status-prompt",
|
|
6202
|
-
children: [/* @__PURE__ */ jsx("p", { children: t("inspector.account.connectBeforeRun", { service: action.serviceName }) }), /* @__PURE__ */ jsxs(Button$1, {
|
|
6203
|
-
disabled: disabled || onConfigureAccess == null,
|
|
6204
|
-
onClick: onConfigureAccess,
|
|
6205
|
-
size: "sm",
|
|
6206
|
-
type: "button",
|
|
6207
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
6208
|
-
"data-icon": "inline-start",
|
|
6209
|
-
name: "plus"
|
|
6210
|
-
}), t("inspector.account.manageAccount")]
|
|
6211
|
-
})]
|
|
6212
|
-
})] });
|
|
6213
|
-
else {
|
|
6214
|
-
onManage = onConfigureAccess;
|
|
6215
|
-
let status;
|
|
6216
|
-
if (connectionId != null) {
|
|
6217
|
-
if (connection == null) status = t("inspector.account.missing");
|
|
6218
|
-
else if (connection.status != "active") status = t(`inspector.account.status.${connection.status}`);
|
|
6219
|
-
}
|
|
6220
|
-
content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6221
|
-
authorizationPending && /* @__PURE__ */ jsx("p", { children: t("inspector.account.authorizationPending") }),
|
|
6222
|
-
/* @__PURE__ */ jsxs(Field, {
|
|
6223
|
-
className: "connection-field",
|
|
6224
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
6225
|
-
className: "sr-only",
|
|
6226
|
-
htmlFor: `${fieldIdPrefix}-connection`,
|
|
6227
|
-
children: t("inspector.account.connection")
|
|
6228
|
-
}), /* @__PURE__ */ jsx(AccountSelect, {
|
|
6229
|
-
connections: available,
|
|
6230
|
-
disabled,
|
|
6231
|
-
id: `${fieldIdPrefix}-connection`,
|
|
6232
|
-
selectedConnection: connection,
|
|
6233
|
-
selectedId: connectionId,
|
|
6234
|
-
onChange: (next) => void connectors.setConnection(nodeId, next),
|
|
6235
|
-
onManage: onConfigureAccess
|
|
6236
|
-
})]
|
|
6237
|
-
}),
|
|
6238
|
-
status != null && /* @__PURE__ */ jsx("p", { children: status })
|
|
6239
|
-
] });
|
|
6240
|
-
}
|
|
6241
|
-
return /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
6242
|
-
tone: required ? "warning" : "neutral",
|
|
6243
|
-
section: "account",
|
|
6244
|
-
title: t(!pending && accessIssue != null ? "inspector.account.accessTitle" : required ? "inspector.account.required" : "inspector.account.title"),
|
|
6245
|
-
actions: onManage != null && /* @__PURE__ */ jsx(Button$1, {
|
|
6246
|
-
className: "ml-auto",
|
|
6247
|
-
disabled,
|
|
6248
|
-
onClick: onManage,
|
|
6249
|
-
size: "xs",
|
|
6250
|
-
type: "button",
|
|
6251
|
-
variant: "ghost",
|
|
6252
|
-
children: t("inspector.account.manageAccount")
|
|
6253
|
-
}),
|
|
6254
|
-
children: [content, !pending && onConfigureAccess != null && accessIssue != null && /* @__PURE__ */ jsx(Button$1, {
|
|
6255
|
-
className: "self-start",
|
|
6256
|
-
disabled,
|
|
6257
|
-
onClick: onConfigureAccess,
|
|
6258
|
-
size: "sm",
|
|
6259
|
-
type: "button",
|
|
6260
|
-
variant: "default",
|
|
6261
|
-
children: t("inspector.account.manageAccount")
|
|
6262
|
-
})]
|
|
6263
|
-
});
|
|
6264
|
-
}
|
|
6265
|
-
function TriggerConnection({ activeConnections, authorizationPending, connection, connectionError, connectionLoading, disabled, selection, onConfigureAccess, triggers }) {
|
|
6266
|
-
const t = useTranslate();
|
|
6267
|
-
const trigger = selection.trigger;
|
|
6268
|
-
const providerTrigger = trigger.kind == "poll" || trigger.kind == "integration" ? trigger : void 0;
|
|
6269
|
-
const fieldIdPrefix = `trigger-${selection.id}`;
|
|
6270
|
-
const canManage = onConfigureAccess != null && !connectionLoading && connectionError == null && (activeConnections?.length ?? 0) > 0;
|
|
6271
|
-
return providerTrigger == null ? null : /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
6272
|
-
tone: connection?.status == "active" ? "neutral" : "warning",
|
|
6273
|
-
section: "account",
|
|
6274
|
-
title: t(connection?.status == "active" ? "inspector.account.title" : "inspector.account.required"),
|
|
6275
|
-
actions: canManage && /* @__PURE__ */ jsx(Button$1, {
|
|
6276
|
-
className: "ml-auto",
|
|
6277
|
-
disabled,
|
|
6278
|
-
onClick: () => onConfigureAccess?.(providerTrigger.definition.provider),
|
|
6279
|
-
size: "xs",
|
|
6280
|
-
type: "button",
|
|
6281
|
-
variant: "ghost",
|
|
6282
|
-
children: t("inspector.account.manageAccount")
|
|
6283
|
-
}),
|
|
6284
|
-
children: [authorizationPending && /* @__PURE__ */ jsx("p", { children: t("inspector.account.authorizationPending") }), connectionLoading ? /* @__PURE__ */ jsx("p", { children: t("inspector.account.loading") }) : connectionError != null ? /* @__PURE__ */ jsx(ConnectionAlert, {
|
|
6285
|
-
detail: connectionError,
|
|
6286
|
-
disabled,
|
|
6287
|
-
message: t("inspector.account.refreshFailed"),
|
|
6288
|
-
onRetry: () => void triggers.refresh(true)
|
|
6289
|
-
}) : (activeConnections?.length ?? 0) == 0 ? /* @__PURE__ */ jsxs("div", {
|
|
6290
|
-
className: "inspector-status-prompt",
|
|
6291
|
-
children: [/* @__PURE__ */ jsx("p", { children: t("inspector.account.connectBeforeRun", { service: providerTrigger.definition.provider }) }), /* @__PURE__ */ jsx(Button$1, {
|
|
6292
|
-
disabled: disabled || onConfigureAccess == null,
|
|
6293
|
-
onClick: () => onConfigureAccess?.(providerTrigger.definition.provider),
|
|
6294
|
-
size: "sm",
|
|
6295
|
-
type: "button",
|
|
6296
|
-
children: t("inspector.account.manageAccount")
|
|
6297
|
-
})]
|
|
6298
|
-
}) : /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(Field, {
|
|
6299
|
-
className: "connection-field",
|
|
6300
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
6301
|
-
className: "sr-only",
|
|
6302
|
-
htmlFor: `${fieldIdPrefix}-connection`,
|
|
6303
|
-
children: t("inspector.account.connection")
|
|
6304
|
-
}), /* @__PURE__ */ jsx(AccountSelect, {
|
|
6305
|
-
connections: activeConnections,
|
|
6306
|
-
disabled,
|
|
6307
|
-
id: `${fieldIdPrefix}-connection`,
|
|
6308
|
-
selectedConnection: connection,
|
|
6309
|
-
selectedId: connection?.connectionId,
|
|
6310
|
-
onChange: (next) => void triggers.setConnection(selection.id, next),
|
|
6311
|
-
onManage: onConfigureAccess == null ? void 0 : () => onConfigureAccess(providerTrigger.definition.provider)
|
|
6312
|
-
})]
|
|
6313
|
-
}) })]
|
|
6314
|
-
});
|
|
6315
|
-
}
|
|
6316
|
-
/** A persisted reference has no live account health or authorization state. */
|
|
6317
|
-
function SavedConnectionReference({ action, connectionId }) {
|
|
6318
|
-
const t = useTranslate();
|
|
6319
|
-
return /* @__PURE__ */ jsxs(InspectorStatusSection, {
|
|
6320
|
-
title: t("inspector.account.title"),
|
|
6321
|
-
section: "account",
|
|
6322
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
6323
|
-
className: "reference-value",
|
|
6324
|
-
children: action
|
|
6325
|
-
}), connectionId != null && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, { children: t("inspector.account.connection") }), /* @__PURE__ */ jsx(Input$1, {
|
|
6326
|
-
"aria-label": t("inspector.account.connection"),
|
|
6327
|
-
readOnly: true,
|
|
6328
|
-
value: connectionId
|
|
6329
|
-
})] })]
|
|
6330
|
-
});
|
|
6331
|
-
}
|
|
6332
|
-
//#endregion
|
|
6333
6408
|
//#region src/workbench/browser/runtime/editor/actionSelectionDialog.tsx
|
|
6334
|
-
function ActionSelectionDialog({ title, entries, connectors, prepareAction, disabled, createEntry, onSave, settings, trigger, triggerHint }) {
|
|
6409
|
+
function ActionSelectionDialog({ title, entries, connectors, prepareAction, disabled, createEntry, onSave, notify, settings, trigger, triggerHint }) {
|
|
6335
6410
|
const t = useTranslate();
|
|
6336
6411
|
const [open, setOpen] = useState(false);
|
|
6337
6412
|
const [root, setRoot] = useState(null);
|
|
@@ -6373,6 +6448,7 @@ function ActionSelectionDialog({ title, entries, connectors, prepareAction, disa
|
|
|
6373
6448
|
children: t("actionPicker.description")
|
|
6374
6449
|
}),
|
|
6375
6450
|
/* @__PURE__ */ jsx(ActionSelectionEditor, {
|
|
6451
|
+
notify,
|
|
6376
6452
|
entries,
|
|
6377
6453
|
connectors,
|
|
6378
6454
|
prepareAction,
|
|
@@ -6396,7 +6472,7 @@ function ActionSelectionDialog({ title, entries, connectors, prepareAction, disa
|
|
|
6396
6472
|
})
|
|
6397
6473
|
});
|
|
6398
6474
|
}
|
|
6399
|
-
function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, createEntry, onSave, onCancel, settings }) {
|
|
6475
|
+
function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, createEntry, onSave, notify, onCancel, settings }) {
|
|
6400
6476
|
const t = useTranslate();
|
|
6401
6477
|
const [draft, setDraft] = useState(entries);
|
|
6402
6478
|
const actions = useVal(connectors.$.actions);
|
|
@@ -6404,7 +6480,6 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6404
6480
|
const [initialEntries] = useState(entries);
|
|
6405
6481
|
const [displayOrder, setDisplayOrder] = useState(entries.length === 0 ? [] : null);
|
|
6406
6482
|
const [prepared, setPrepared] = useState({});
|
|
6407
|
-
const [error, setError] = useState();
|
|
6408
6483
|
const [attempt, setAttempt] = useState(0);
|
|
6409
6484
|
const [preparationErrors, setPreparationErrors] = useState({});
|
|
6410
6485
|
const discovered = useRef(/* @__PURE__ */ new Map());
|
|
@@ -6497,6 +6572,7 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6497
6572
|
if (preparationErrors[entry.action] != null) return 0;
|
|
6498
6573
|
const resolved = prepared[entry.action];
|
|
6499
6574
|
if (!resolved?.action.authenticated) return 2;
|
|
6575
|
+
if (entry.connectionId === "") return 2;
|
|
6500
6576
|
if (entry.connectionId == null) return 1;
|
|
6501
6577
|
return resolved.connections.some((account) => account.connectionId === entry.connectionId && account.status === "active") ? 2 : 0;
|
|
6502
6578
|
};
|
|
@@ -6523,7 +6599,6 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6523
6599
|
const refresh = async () => {
|
|
6524
6600
|
setDisplayOrder((current) => current ?? draft.map((entry) => entry.action));
|
|
6525
6601
|
setRefreshing(true);
|
|
6526
|
-
setError(void 0);
|
|
6527
6602
|
const controller = new AbortController();
|
|
6528
6603
|
try {
|
|
6529
6604
|
const services = new Set(draft.flatMap((entry) => {
|
|
@@ -6537,7 +6612,7 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6537
6612
|
setPrepared({});
|
|
6538
6613
|
setAttempt((value) => value + 1);
|
|
6539
6614
|
} catch (cause) {
|
|
6540
|
-
if (mounted.current)
|
|
6615
|
+
if (mounted.current) notify(errorNotice(cause, t));
|
|
6541
6616
|
} finally {
|
|
6542
6617
|
if (mounted.current) setRefreshing(false);
|
|
6543
6618
|
controller.abort();
|
|
@@ -6608,7 +6683,7 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6608
6683
|
const action = resolved?.action ?? discovered.current.get(entry.action) ?? actions[entry.action];
|
|
6609
6684
|
const accounts = resolved?.connections ?? [];
|
|
6610
6685
|
const selected = connections.find((account) => account.connectionId == entry.connectionId);
|
|
6611
|
-
const accountInvalid = resolved != null && action?.authenticated && entry.connectionId != null && !accounts.some((account) => account.connectionId == entry.connectionId && account.status == "active");
|
|
6686
|
+
const accountInvalid = resolved != null && action?.authenticated && entry.connectionId != null && entry.connectionId !== "" && !accounts.some((account) => account.connectionId == entry.connectionId && account.status == "active");
|
|
6612
6687
|
return /* @__PURE__ */ jsxs("section", {
|
|
6613
6688
|
className: "grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-1 py-4 first:pt-1 last:pb-1",
|
|
6614
6689
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -6706,7 +6781,7 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6706
6781
|
selectedId: entry.connectionId,
|
|
6707
6782
|
invalid: accountInvalid === true,
|
|
6708
6783
|
warning: entry.connectionId == null,
|
|
6709
|
-
|
|
6784
|
+
allowDeferred: true,
|
|
6710
6785
|
label: t("actionPicker.accountFor", { action: action?.name ?? entry.action }),
|
|
6711
6786
|
disabled,
|
|
6712
6787
|
onChange: (connectionId) => {
|
|
@@ -6716,7 +6791,7 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6716
6791
|
connectionId
|
|
6717
6792
|
});
|
|
6718
6793
|
},
|
|
6719
|
-
onManage: resolved == null ? void 0 : () => void connectors.connect(resolved.action.serviceId)
|
|
6794
|
+
onManage: resolved == null ? void 0 : () => void connectors.connect(resolved.action.serviceId)
|
|
6720
6795
|
})
|
|
6721
6796
|
})]
|
|
6722
6797
|
}, entry.id ?? entry.action);
|
|
@@ -6725,10 +6800,10 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6725
6800
|
})]
|
|
6726
6801
|
})]
|
|
6727
6802
|
}),
|
|
6728
|
-
|
|
6803
|
+
attempted && !valid && /* @__PURE__ */ jsx("div", {
|
|
6729
6804
|
role: "alert",
|
|
6730
6805
|
className: "flex items-center gap-2 px-4 pb-3 text-destructive",
|
|
6731
|
-
children: /* @__PURE__ */ jsx("span", { children:
|
|
6806
|
+
children: /* @__PURE__ */ jsx("span", { children: t("agent.invalidValues") })
|
|
6732
6807
|
}),
|
|
6733
6808
|
/* @__PURE__ */ jsx("div", { className: "mx-4 h-px shrink-0 bg-border/50" }),
|
|
6734
6809
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -6749,11 +6824,10 @@ function ActionSelectionEditor({ entries, connectors, prepareAction, disabled, c
|
|
|
6749
6824
|
onClick: async () => {
|
|
6750
6825
|
setAttempted(true);
|
|
6751
6826
|
if (!valid) return;
|
|
6752
|
-
setError(void 0);
|
|
6753
6827
|
try {
|
|
6754
|
-
|
|
6828
|
+
await onSave(draft);
|
|
6755
6829
|
} catch (cause) {
|
|
6756
|
-
|
|
6830
|
+
notify(errorNotice(cause, t));
|
|
6757
6831
|
}
|
|
6758
6832
|
},
|
|
6759
6833
|
children: t("common.save")
|
|
@@ -20816,11 +20890,12 @@ function PurposeField({ compact = false, ...props }) {
|
|
|
20816
20890
|
}
|
|
20817
20891
|
//#endregion
|
|
20818
20892
|
//#region src/workbench/browser/runtime/editor/agentTools.tsx
|
|
20819
|
-
function EditableAgentTools({ config, disabled, inputs, connectors, prepareAction, onSave }) {
|
|
20893
|
+
function EditableAgentTools({ config, disabled, inputs, connectors, prepareAction, onSave, notify }) {
|
|
20820
20894
|
const t = useTranslate();
|
|
20821
20895
|
const catalog = useVal(connectors.$.actions);
|
|
20822
20896
|
const summary = actionSummary(config.tools, catalog, []);
|
|
20823
20897
|
return /* @__PURE__ */ jsx(ActionSelectionDialog, {
|
|
20898
|
+
notify,
|
|
20824
20899
|
title: t("agent.tools"),
|
|
20825
20900
|
triggerHint: summary.count > 0 ? t("actionPicker.selectionSummary", {
|
|
20826
20901
|
actions: summary.count,
|
|
@@ -20917,9 +20992,11 @@ function AgentToolSettings({ entry: tool, onChange, disabled, onValidChange, inp
|
|
|
20917
20992
|
}
|
|
20918
20993
|
function AgentTools(props) {
|
|
20919
20994
|
const t = useTranslate();
|
|
20920
|
-
if (props.
|
|
20921
|
-
|
|
20922
|
-
|
|
20995
|
+
if (props.editor != null) return /* @__PURE__ */ jsx(EditableAgentTools, {
|
|
20996
|
+
config: props.config,
|
|
20997
|
+
disabled: props.disabled,
|
|
20998
|
+
inputs: props.inputs,
|
|
20999
|
+
...props.editor
|
|
20923
21000
|
});
|
|
20924
21001
|
if (props.config.tools.length === 0) return null;
|
|
20925
21002
|
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
@@ -20935,7 +21012,7 @@ function AgentTools(props) {
|
|
|
20935
21012
|
/* @__PURE__ */ jsx("summary", { children: tool.name || tool.action }),
|
|
20936
21013
|
/* @__PURE__ */ jsxs("p", {
|
|
20937
21014
|
className: "reference-value",
|
|
20938
|
-
children: [tool.action, tool.connectionId == null ? "" : ` · ${tool.connectionId}`]
|
|
21015
|
+
children: [tool.action, tool.connectionId == null ? "" : ` · ${tool.connectionId === "" ? t("inspector.account.deferred") : tool.connectionId}`]
|
|
20939
21016
|
}),
|
|
20940
21017
|
/* @__PURE__ */ jsx(AgentToolSettings, {
|
|
20941
21018
|
entry: tool,
|
|
@@ -21151,13 +21228,20 @@ function AgentAdvancedSettings() {
|
|
|
21151
21228
|
function EditableAgentSettingsProvider({ children, task, nodeId, store, connectors, prepareAction, disabled, theme }) {
|
|
21152
21229
|
const t = useTranslate();
|
|
21153
21230
|
const [config, renderConfig] = useState(task.executor);
|
|
21154
|
-
const [
|
|
21231
|
+
const [validationError, setValidationError] = useState();
|
|
21232
|
+
const [saveFailed, setSaveFailed] = useState(false);
|
|
21155
21233
|
const [flowId] = useState(store.$.flowId.value);
|
|
21156
21234
|
const [changes] = useState(() => new TaskExecutorChanges(task.executor, async (before, value) => {
|
|
21157
21235
|
if (store.$.flowId.value != flowId) return false;
|
|
21158
21236
|
const current = store.$.revision.value?.node(nodeId);
|
|
21159
21237
|
const definition = current?.kind == "task" ? current.definition : void 0;
|
|
21160
|
-
if (definition == null || !("executor" in definition) || !dequal(definition.executor, before))
|
|
21238
|
+
if (definition == null || !("executor" in definition) || !dequal(definition.executor, before)) {
|
|
21239
|
+
store.notify({
|
|
21240
|
+
kind: "error",
|
|
21241
|
+
message: t("notice.error.flowConflict")
|
|
21242
|
+
});
|
|
21243
|
+
return false;
|
|
21244
|
+
}
|
|
21161
21245
|
const decoded = decodeRevisionContent({
|
|
21162
21246
|
modelVersion: 8,
|
|
21163
21247
|
modules: {},
|
|
@@ -21189,20 +21273,22 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
|
|
|
21189
21273
|
renderConfig(changes.value);
|
|
21190
21274
|
}, [changes, task.executor]);
|
|
21191
21275
|
const save = async () => {
|
|
21276
|
+
setSaveFailed(false);
|
|
21192
21277
|
const value = changes.value;
|
|
21193
21278
|
const notificationInputs = (value.kind === "agent" ? value.notification : void 0)?.inputDefinitions ?? [];
|
|
21194
21279
|
if (value.kind == "agent" && (!value.model.trim() || !Number.isSafeInteger(value.maxRounds) || value.maxRounds < 1 || value.maxRounds > 100)) return false;
|
|
21195
21280
|
if (!agentFixedValuesValid(value, notificationInputs)) {
|
|
21196
|
-
|
|
21281
|
+
setValidationError(t("agent.invalidValues"));
|
|
21197
21282
|
return false;
|
|
21198
21283
|
}
|
|
21199
|
-
|
|
21284
|
+
setValidationError(void 0);
|
|
21200
21285
|
try {
|
|
21201
21286
|
const saved = await changes.save();
|
|
21202
|
-
|
|
21287
|
+
setSaveFailed(!saved);
|
|
21203
21288
|
return saved;
|
|
21204
21289
|
} catch (cause) {
|
|
21205
|
-
|
|
21290
|
+
setSaveFailed(true);
|
|
21291
|
+
store.notify(errorNotice(cause, t));
|
|
21206
21292
|
return false;
|
|
21207
21293
|
}
|
|
21208
21294
|
};
|
|
@@ -21218,16 +21304,33 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
|
|
|
21218
21304
|
task,
|
|
21219
21305
|
config,
|
|
21220
21306
|
nodeId,
|
|
21221
|
-
|
|
21222
|
-
|
|
21307
|
+
toolsEditor: {
|
|
21308
|
+
connectors,
|
|
21309
|
+
prepareAction,
|
|
21310
|
+
notify: store.notify,
|
|
21311
|
+
onSave: async (tools) => {
|
|
21312
|
+
const previous = config.tools;
|
|
21313
|
+
setConfig((before) => before.kind == "agent" ? {
|
|
21314
|
+
...before,
|
|
21315
|
+
tools
|
|
21316
|
+
} : before, false);
|
|
21317
|
+
const saved = await save();
|
|
21318
|
+
if (!saved) setConfig((before) => before.kind == "agent" && before.tools === tools ? {
|
|
21319
|
+
...before,
|
|
21320
|
+
tools: previous
|
|
21321
|
+
} : before, false);
|
|
21322
|
+
return saved;
|
|
21323
|
+
}
|
|
21324
|
+
},
|
|
21223
21325
|
disabled,
|
|
21224
21326
|
theme,
|
|
21225
|
-
|
|
21327
|
+
validationError,
|
|
21226
21328
|
setConfig,
|
|
21227
|
-
save
|
|
21329
|
+
save,
|
|
21330
|
+
saveFailed
|
|
21228
21331
|
});
|
|
21229
21332
|
}
|
|
21230
|
-
function AgentSettingsContent({ children, task, config, nodeId,
|
|
21333
|
+
function AgentSettingsContent({ children, task, config, nodeId, toolsEditor, disabled, theme, validationError, setConfig, save, saveFailed = false }) {
|
|
21231
21334
|
const t = useTranslate();
|
|
21232
21335
|
const inputs = task.inputs.filter((port) => "handle" in port);
|
|
21233
21336
|
const promptSection = /* @__PURE__ */ jsxs("section", {
|
|
@@ -21242,30 +21345,16 @@ function AgentSettingsContent({ children, task, config, nodeId, connectors, prep
|
|
|
21242
21345
|
config,
|
|
21243
21346
|
disabled,
|
|
21244
21347
|
inputs,
|
|
21245
|
-
|
|
21246
|
-
prepareAction,
|
|
21247
|
-
onSave: async (tools) => {
|
|
21248
|
-
const previous = config.tools;
|
|
21249
|
-
setConfig?.((before) => before.kind == "agent" ? {
|
|
21250
|
-
...before,
|
|
21251
|
-
tools
|
|
21252
|
-
} : before, false);
|
|
21253
|
-
const saved = await save?.();
|
|
21254
|
-
if (!saved) setConfig?.((before) => before.kind == "agent" && before.tools === tools ? {
|
|
21255
|
-
...before,
|
|
21256
|
-
tools: previous
|
|
21257
|
-
} : before, false);
|
|
21258
|
-
return saved ?? false;
|
|
21259
|
-
}
|
|
21348
|
+
editor: toolsEditor
|
|
21260
21349
|
})]
|
|
21261
21350
|
}), /* @__PURE__ */ jsxs("div", {
|
|
21262
21351
|
className: "inspector-section-content",
|
|
21263
21352
|
"data-inset": true,
|
|
21264
21353
|
children: [/* @__PURE__ */ jsx(ValueEditorFeedback, {
|
|
21265
|
-
error:
|
|
21354
|
+
error: validationError,
|
|
21266
21355
|
children: (errorId) => /* @__PURE__ */ jsx(PromptEditor, {
|
|
21267
21356
|
ariaDescribedBy: errorId,
|
|
21268
|
-
invalid:
|
|
21357
|
+
invalid: validationError != null,
|
|
21269
21358
|
value: config.prompt,
|
|
21270
21359
|
inputs: inputs.map((port) => port.handle),
|
|
21271
21360
|
disabled,
|
|
@@ -21276,7 +21365,7 @@ function AgentSettingsContent({ children, task, config, nodeId, connectors, prep
|
|
|
21276
21365
|
} : before, false),
|
|
21277
21366
|
onSave: () => void save?.()
|
|
21278
21367
|
})
|
|
21279
|
-
}),
|
|
21368
|
+
}), (saveFailed || validationError != null) && /* @__PURE__ */ jsx("div", {
|
|
21280
21369
|
className: "form-actions code-actions",
|
|
21281
21370
|
children: /* @__PURE__ */ jsx(Button$1, {
|
|
21282
21371
|
type: "button",
|
|
@@ -22315,7 +22404,7 @@ function codeTyping(ports, capabilities = [], catalog = {}, providerIds = []) {
|
|
|
22315
22404
|
const output = definition?.outputSchema == null ? "unknown" : typescriptOf(definition.outputSchema, false);
|
|
22316
22405
|
const ids = declaration.connections.map((connection) => JSON.stringify(connection.connectionId)).join(" | ") || "never";
|
|
22317
22406
|
const aliases = declaration.connections.flatMap((connection) => connection.alias == null ? [] : [JSON.stringify(connection.alias)]).join(" | ") || "never";
|
|
22318
|
-
const options = permissions?.mode == "independent" ? declaration.connectionId == null ? "{ connectionId?: never }" : `{ connectionId?: ${JSON.stringify(declaration.connectionId)} }` : permissions?.mode == "shared" ? "{ connectionId?: string }" : declaration.connections.length == 0 ? dynamicOptions : `{ connectionId: ${ids}; connectionAlias?: never } | { connectionAlias: ${aliases}; connectionId?: never }`;
|
|
22407
|
+
const options = permissions?.mode == "independent" ? declaration.connectionId == null || declaration.connectionId === "" ? "{ connectionId?: never }" : `{ connectionId?: ${JSON.stringify(declaration.connectionId)} }` : permissions?.mode == "shared" ? "{ connectionId?: string }" : declaration.connections.length == 0 ? dynamicOptions : `{ connectionId: ${ids}; connectionAlias?: never } | { connectionAlias: ${aliases}; connectionId?: never }`;
|
|
22319
22408
|
const args = declaration.connections.length > 0 && declaration.connectionId == null ? `[input: {} extends ${input} ? ${input} | undefined : ${input}, options: ${options}]` : `{} extends ${input} ? [input?: ${input}, options?: ${options}] : [input: ${input}, options?: ${options}]`;
|
|
22320
22409
|
const signature = `(...args: ${args}) => Promise<${output}>`;
|
|
22321
22410
|
calls.push(`(...args: [actionId: ${JSON.stringify(declaration.action)}, ...args: ${args}]): Promise<${output}>`);
|
|
@@ -22374,34 +22463,31 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
|
|
|
22374
22463
|
const allowSharedAction = (action) => !action.authenticated || connectorAccess?.mode == "implicit" || connectorAccess?.bindings.some((binding) => binding.status == "active" && binding.providerId == action.serviceId && connectorCandidates?.[action.serviceId]?.candidates.some((candidate) => candidate.accessBindingId == binding.accessBindingId && (candidate.permissions == null || candidate.permissions.allActions || candidate.permissions.actionIds.includes(action.actionId))));
|
|
22375
22464
|
const sharedActionCatalog = Object.fromEntries(Object.entries(useVal(completionCatalog.catalog)).filter(([, action]) => allowSharedAction(action)));
|
|
22376
22465
|
const t = useTranslate();
|
|
22377
|
-
const [
|
|
22466
|
+
const [loadError, setLoadError] = useState();
|
|
22378
22467
|
const [completionError, setCompletionError] = useState();
|
|
22379
22468
|
const [pending, setPending] = useState(false);
|
|
22380
22469
|
useEffect(() => setPermission(savedPermission), [savedPermission, selection.id]);
|
|
22381
22470
|
const permissionActions = permission?.mode == "independent" ? permission.actions.map((entry) => entry.action).join(",") : "";
|
|
22382
22471
|
useEffect(() => {
|
|
22472
|
+
setLoadError(void 0);
|
|
22383
22473
|
if (permissionActions == "") return;
|
|
22384
22474
|
const controller = new AbortController();
|
|
22385
22475
|
Promise.all(permissionActions.split(",").map((id) => connectors.loadCodeAction(id, controller.signal))).then(() => {
|
|
22386
22476
|
const services = new Set(permissionActions.split(",").map((id) => id.split(".")[0]));
|
|
22387
22477
|
return Promise.all([...services].map((id) => connectors.loadCodeConnections(id, controller.signal)));
|
|
22388
22478
|
}).catch((cause) => {
|
|
22389
|
-
if (!controller.signal.aborted)
|
|
22479
|
+
if (!controller.signal.aborted) setLoadError(String(cause));
|
|
22390
22480
|
});
|
|
22391
22481
|
return () => controller.abort();
|
|
22392
22482
|
}, [connectors, permissionActions]);
|
|
22393
22483
|
const savePermission = async (value) => {
|
|
22394
22484
|
setPending(true);
|
|
22395
|
-
setSaveError(void 0);
|
|
22396
22485
|
try {
|
|
22397
|
-
if (!await store.setCodeActions(selection.id, [value]))
|
|
22398
|
-
setSaveError(t("inspector.task.permissionSaveFailed"));
|
|
22399
|
-
return false;
|
|
22400
|
-
}
|
|
22486
|
+
if (!await store.setCodeActions(selection.id, [value])) return false;
|
|
22401
22487
|
setPermission(value);
|
|
22402
22488
|
return true;
|
|
22403
22489
|
} catch (cause) {
|
|
22404
|
-
|
|
22490
|
+
store.notify(errorNotice(cause, t));
|
|
22405
22491
|
return false;
|
|
22406
22492
|
} finally {
|
|
22407
22493
|
setPending(false);
|
|
@@ -22434,9 +22520,10 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
|
|
|
22434
22520
|
if (!("moduleId" in task)) return null;
|
|
22435
22521
|
const selectedActions = permission?.mode == "independent" ? permission.actions : [];
|
|
22436
22522
|
const summary = actionSummary(selectedActions, hintedCatalog, providers.data ?? []);
|
|
22437
|
-
const actionIssue =
|
|
22523
|
+
const actionIssue = loadError != null || diagnostics?.some((item) => item.path.includes("/task/capabilities")) || selectedActions.some((entry) => {
|
|
22438
22524
|
const action = hintedCatalog[entry.action];
|
|
22439
22525
|
if (action == null || !action.authenticated) return false;
|
|
22526
|
+
if (entry.connectionId === "") return false;
|
|
22440
22527
|
if (entry.connectionId == null) return true;
|
|
22441
22528
|
const catalog = accountCatalogs[action.serviceId];
|
|
22442
22529
|
return catalog != null && catalog.byId.get(entry.connectionId)?.status !== "active";
|
|
@@ -22468,6 +22555,7 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
|
|
|
22468
22555
|
store.saveModuleEditor();
|
|
22469
22556
|
},
|
|
22470
22557
|
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [false, /* @__PURE__ */ jsx(ActionSelectionDialog, {
|
|
22558
|
+
notify: store.notify,
|
|
22471
22559
|
title: t("actionPicker.configureActions"),
|
|
22472
22560
|
triggerHint: selectedActions.length > 0 ? t("actionPicker.selectionSummary", {
|
|
22473
22561
|
actions: selectedActions.length,
|
|
@@ -22505,13 +22593,13 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
|
|
|
22505
22593
|
})
|
|
22506
22594
|
}, selection.id)] }),
|
|
22507
22595
|
children: [
|
|
22508
|
-
(
|
|
22596
|
+
(loadError ?? completionError) != null && /* @__PURE__ */ jsxs("div", {
|
|
22509
22597
|
className: "flex flex-col gap-2",
|
|
22510
22598
|
"data-inspector-section": "code-permissions",
|
|
22511
|
-
children: [false, (
|
|
22599
|
+
children: [false, (loadError ?? completionError) != null && /* @__PURE__ */ jsx("p", {
|
|
22512
22600
|
role: "alert",
|
|
22513
22601
|
className: "text-sm text-destructive",
|
|
22514
|
-
children:
|
|
22602
|
+
children: loadError ?? completionError
|
|
22515
22603
|
})]
|
|
22516
22604
|
}),
|
|
22517
22605
|
/* @__PURE__ */ jsx(ValueEditorFeedback, {
|
|
@@ -27503,7 +27591,7 @@ function ErrorTriggerSourcesEditor({ store, nodeId, value, disabled }) {
|
|
|
27503
27591
|
}
|
|
27504
27592
|
//#endregion
|
|
27505
27593
|
//#region src/workbench/browser/runtime/createEventSourceDialog.tsx
|
|
27506
|
-
function CreateEventSourceDialog({ client, teamId, existingNames, disabled, defaultOpen = false, className, trigger, onSelect, onCreated }) {
|
|
27594
|
+
function CreateEventSourceDialog({ client, notify, teamId, existingNames, disabled, defaultOpen = false, className, trigger, onSelect, onCreated }) {
|
|
27507
27595
|
const t = useTranslate();
|
|
27508
27596
|
const [open, setOpen] = useState(defaultOpen);
|
|
27509
27597
|
const [root, setRoot] = useState(null);
|
|
@@ -27512,16 +27600,13 @@ function CreateEventSourceDialog({ client, teamId, existingNames, disabled, defa
|
|
|
27512
27600
|
const [created, setCreated] = useState();
|
|
27513
27601
|
const [selected, setSelected] = useState(false);
|
|
27514
27602
|
const [pending, setPending] = useState(false);
|
|
27515
|
-
const [error, setError] = useState();
|
|
27516
27603
|
async function select(source) {
|
|
27517
27604
|
setPending(true);
|
|
27518
|
-
setError(void 0);
|
|
27519
27605
|
try {
|
|
27520
27606
|
const saved = await onSelect(source);
|
|
27521
27607
|
setSelected(saved);
|
|
27522
|
-
if (!saved) setError(t("eventSources.bindFailed"));
|
|
27523
27608
|
} catch (cause) {
|
|
27524
|
-
|
|
27609
|
+
notify(errorNotice(cause, t));
|
|
27525
27610
|
} finally {
|
|
27526
27611
|
setPending(false);
|
|
27527
27612
|
}
|
|
@@ -27537,7 +27622,6 @@ function CreateEventSourceDialog({ client, teamId, existingNames, disabled, defa
|
|
|
27537
27622
|
if (value) {
|
|
27538
27623
|
setCreated(void 0);
|
|
27539
27624
|
setSelected(false);
|
|
27540
|
-
setError(void 0);
|
|
27541
27625
|
}
|
|
27542
27626
|
},
|
|
27543
27627
|
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
@@ -27560,6 +27644,7 @@ function CreateEventSourceDialog({ client, teamId, existingNames, disabled, defa
|
|
|
27560
27644
|
/* @__PURE__ */ jsxs("div", {
|
|
27561
27645
|
className: "min-h-0 overflow-y-auto",
|
|
27562
27646
|
children: [open && created == null && /* @__PURE__ */ jsx(SourceForm, {
|
|
27647
|
+
notify,
|
|
27563
27648
|
client,
|
|
27564
27649
|
teams: [],
|
|
27565
27650
|
fixedTeamId: teamId,
|
|
@@ -27579,15 +27664,11 @@ function CreateEventSourceDialog({ client, teamId, existingNames, disabled, defa
|
|
|
27579
27664
|
children: created.name
|
|
27580
27665
|
}),
|
|
27581
27666
|
/* @__PURE__ */ jsx(EventSourceSetup, {
|
|
27667
|
+
notify,
|
|
27582
27668
|
source: created,
|
|
27583
27669
|
client,
|
|
27584
27670
|
onChange: setCreated
|
|
27585
27671
|
}),
|
|
27586
|
-
error != null && /* @__PURE__ */ jsx("p", {
|
|
27587
|
-
role: "alert",
|
|
27588
|
-
className: "m-0 text-sm text-destructive",
|
|
27589
|
-
children: error
|
|
27590
|
-
}),
|
|
27591
27672
|
/* @__PURE__ */ jsxs("div", {
|
|
27592
27673
|
className: "flex justify-end gap-2",
|
|
27593
27674
|
children: [!selected && /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -28880,6 +28961,7 @@ function FeishuTriggerConfig({ inputs, fieldLabels, config: assignments, nodeId,
|
|
|
28880
28961
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
28881
28962
|
className: "flex h-[30px] w-full items-center overflow-hidden rounded-[var(--ui-control-radius,var(--ui-radius))] border border-input bg-[var(--ui-control-background,var(--ui-muted))]",
|
|
28882
28963
|
children: [/* @__PURE__ */ jsx(CreateEventSourceDialog, {
|
|
28964
|
+
notify: store.notify,
|
|
28883
28965
|
className: "min-w-0 flex-1",
|
|
28884
28966
|
trigger: /* @__PURE__ */ jsx(Button$1, {
|
|
28885
28967
|
type: "button",
|
|
@@ -34143,22 +34225,26 @@ function ListenerHealth({ binding, enabled }) {
|
|
|
34143
34225
|
}
|
|
34144
34226
|
//#endregion
|
|
34145
34227
|
//#region src/workbench/browser/runtime/publications/webhookEndpoint.tsx
|
|
34146
|
-
function WebhookCopyButton({ endpointUrl, iconOnly = false }) {
|
|
34228
|
+
function WebhookCopyButton({ endpointUrl, notify, iconOnly = false }) {
|
|
34147
34229
|
const t = useTranslate();
|
|
34148
|
-
const [
|
|
34230
|
+
const [copied, setCopied] = useState(false);
|
|
34149
34231
|
const [container, setContainer] = useState(null);
|
|
34150
34232
|
useEffect(() => {
|
|
34151
|
-
if (
|
|
34152
|
-
const timer = globalThis.setTimeout(() =>
|
|
34233
|
+
if (!copied) return;
|
|
34234
|
+
const timer = globalThis.setTimeout(() => setCopied(false), 1500);
|
|
34153
34235
|
return () => globalThis.clearTimeout(timer);
|
|
34154
|
-
}, [
|
|
34155
|
-
const label = t(
|
|
34236
|
+
}, [copied]);
|
|
34237
|
+
const label = t(copied ? "publication.webhookCopied" : "publication.webhookCopy");
|
|
34156
34238
|
const copy = async () => {
|
|
34157
34239
|
try {
|
|
34158
34240
|
await navigator.clipboard.writeText(endpointUrl);
|
|
34159
|
-
|
|
34241
|
+
setCopied(true);
|
|
34160
34242
|
} catch {
|
|
34161
|
-
|
|
34243
|
+
setCopied(false);
|
|
34244
|
+
notify({
|
|
34245
|
+
kind: "error",
|
|
34246
|
+
message: t("webhookDeployment.copyFailed")
|
|
34247
|
+
});
|
|
34162
34248
|
}
|
|
34163
34249
|
};
|
|
34164
34250
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -34173,7 +34259,7 @@ function WebhookCopyButton({ endpointUrl, iconOnly = false }) {
|
|
|
34173
34259
|
}),
|
|
34174
34260
|
children: /* @__PURE__ */ jsx("i", {
|
|
34175
34261
|
"aria-hidden": "true",
|
|
34176
|
-
className:
|
|
34262
|
+
className: copied ? "i-lucide-light:check text-base" : "i-lucide-light:copy text-base"
|
|
34177
34263
|
})
|
|
34178
34264
|
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
34179
34265
|
container,
|
|
@@ -34184,26 +34270,29 @@ function WebhookCopyButton({ endpointUrl, iconOnly = false }) {
|
|
|
34184
34270
|
size: "sm",
|
|
34185
34271
|
variant: "outline",
|
|
34186
34272
|
onClick: copy,
|
|
34187
|
-
children:
|
|
34273
|
+
children: label
|
|
34188
34274
|
}), /* @__PURE__ */ jsx("span", {
|
|
34189
|
-
className:
|
|
34275
|
+
className: "sr-only",
|
|
34190
34276
|
role: "status",
|
|
34191
|
-
children:
|
|
34277
|
+
children: copied ? label : ""
|
|
34192
34278
|
})]
|
|
34193
34279
|
});
|
|
34194
34280
|
}
|
|
34195
|
-
function WebhookEndpoint({ endpointUrl }) {
|
|
34281
|
+
function WebhookEndpoint({ endpointUrl, notify }) {
|
|
34196
34282
|
return /* @__PURE__ */ jsxs("div", {
|
|
34197
34283
|
className: "flex min-w-0 items-start gap-2",
|
|
34198
34284
|
children: [/* @__PURE__ */ jsx("code", {
|
|
34199
34285
|
className: "min-w-0 flex-1 select-text break-all text-foreground text-xs leading-5",
|
|
34200
34286
|
children: endpointUrl
|
|
34201
|
-
}), /* @__PURE__ */ jsx(WebhookCopyButton, {
|
|
34287
|
+
}), /* @__PURE__ */ jsx(WebhookCopyButton, {
|
|
34288
|
+
notify,
|
|
34289
|
+
endpointUrl
|
|
34290
|
+
}, endpointUrl)]
|
|
34202
34291
|
});
|
|
34203
34292
|
}
|
|
34204
34293
|
//#endregion
|
|
34205
34294
|
//#region src/workbench/browser/runtime/editor/webhookDeployment.tsx
|
|
34206
|
-
function WebhookDeployment({ binding, status, enabled, hasUnpublishedChanges, onRetry }) {
|
|
34295
|
+
function WebhookDeployment({ binding, status, enabled, hasUnpublishedChanges, onRetry, notify }) {
|
|
34207
34296
|
const t = useTranslate();
|
|
34208
34297
|
const current = binding?.currentPublicationId != null;
|
|
34209
34298
|
const ready = status === "loaded" && current;
|
|
@@ -34217,6 +34306,7 @@ function WebhookDeployment({ binding, status, enabled, hasUnpublishedChanges, on
|
|
|
34217
34306
|
enabled
|
|
34218
34307
|
})]
|
|
34219
34308
|
}), ready && binding.endpointUrl != null && /* @__PURE__ */ jsx(WebhookCopyButton, {
|
|
34309
|
+
notify,
|
|
34220
34310
|
endpointUrl: binding.endpointUrl,
|
|
34221
34311
|
iconOnly: true
|
|
34222
34312
|
}, binding.endpointUrl)]
|
|
@@ -38750,7 +38840,7 @@ var CanvasStore = class {
|
|
|
38750
38840
|
this.#entries = /* @__PURE__ */ new Map();
|
|
38751
38841
|
this.#modelPositions = /* @__PURE__ */ new Map();
|
|
38752
38842
|
this.#selectedNodeIds = /* @__PURE__ */ new Set();
|
|
38753
|
-
this.completeLayout = () => {
|
|
38843
|
+
this.completeLayout = (availableWidth) => {
|
|
38754
38844
|
if (this.layoutComplete) return true;
|
|
38755
38845
|
const nodes = this.allLayoutNodes();
|
|
38756
38846
|
if (nodes.length === 0) return true;
|
|
@@ -38763,7 +38853,7 @@ var CanvasStore = class {
|
|
|
38763
38853
|
return true;
|
|
38764
38854
|
}
|
|
38765
38855
|
}
|
|
38766
|
-
this.doRelayout();
|
|
38856
|
+
this.doRelayout(availableWidth);
|
|
38767
38857
|
this.layoutMeasurementAttempts = 0;
|
|
38768
38858
|
this.layoutComplete = true;
|
|
38769
38859
|
return "relayout";
|
|
@@ -38795,9 +38885,9 @@ var CanvasStore = class {
|
|
|
38795
38885
|
targetHandle: toManifestHandleName(targetHandle)
|
|
38796
38886
|
});
|
|
38797
38887
|
};
|
|
38798
|
-
this.onRelayout = () => {
|
|
38888
|
+
this.onRelayout = (availableWidth) => {
|
|
38799
38889
|
try {
|
|
38800
|
-
this.doRelayout();
|
|
38890
|
+
this.doRelayout(availableWidth);
|
|
38801
38891
|
} catch (e) {
|
|
38802
38892
|
console.error(e);
|
|
38803
38893
|
}
|
|
@@ -38957,7 +39047,7 @@ var CanvasStore = class {
|
|
|
38957
39047
|
toDeselect.forEach((store) => store.$$.selected.set(false));
|
|
38958
39048
|
};
|
|
38959
39049
|
}
|
|
38960
|
-
doRelayout() {
|
|
39050
|
+
doRelayout(availableWidth) {
|
|
38961
39051
|
const nodes = this.allLayoutNodes();
|
|
38962
39052
|
const g = new ie.Graph().setDefaultEdgeLabel(() => ({}));
|
|
38963
39053
|
g.setGraph({
|
|
@@ -38987,9 +39077,10 @@ var CanvasStore = class {
|
|
|
38987
39077
|
column: rank,
|
|
38988
39078
|
x: x - width / 2,
|
|
38989
39079
|
y: y - height / 2,
|
|
39080
|
+
width,
|
|
38990
39081
|
height
|
|
38991
39082
|
};
|
|
38992
|
-
}));
|
|
39083
|
+
}), availableWidth);
|
|
38993
39084
|
for (const node of nodes) node.$$.position.set(positions[node.nodeId]);
|
|
38994
39085
|
this.#callbacks.onMoveNodes(positions);
|
|
38995
39086
|
}
|
|
@@ -50489,34 +50580,51 @@ var CanvasNode_module_default = {
|
|
|
50489
50580
|
valueKey: "CanvasNode_valueKey_f29c7"
|
|
50490
50581
|
};
|
|
50491
50582
|
var CanvasCard_module_default = {
|
|
50492
|
-
card: "
|
|
50493
|
-
value: "
|
|
50494
|
-
preview: "
|
|
50495
|
-
comment: "
|
|
50496
|
-
selected: "
|
|
50497
|
-
problem: "
|
|
50498
|
-
|
|
50499
|
-
|
|
50500
|
-
|
|
50501
|
-
|
|
50502
|
-
|
|
50503
|
-
|
|
50504
|
-
|
|
50505
|
-
|
|
50506
|
-
|
|
50507
|
-
|
|
50508
|
-
|
|
50509
|
-
|
|
50510
|
-
|
|
50511
|
-
|
|
50512
|
-
|
|
50513
|
-
|
|
50514
|
-
|
|
50515
|
-
|
|
50583
|
+
card: "CanvasCard_card_56d5c",
|
|
50584
|
+
value: "CanvasCard_value_56d5c",
|
|
50585
|
+
preview: "CanvasCard_preview_56d5c",
|
|
50586
|
+
comment: "CanvasCard_comment_56d5c",
|
|
50587
|
+
selected: "CanvasCard_selected_56d5c",
|
|
50588
|
+
problem: "CanvasCard_problem_56d5c",
|
|
50589
|
+
runningBeam: "CanvasCard_runningBeam_56d5c",
|
|
50590
|
+
"running-beam": "CanvasCard_running-beam_56d5c",
|
|
50591
|
+
header: "CanvasCard_header_56d5c",
|
|
50592
|
+
icon: "CanvasCard_icon_56d5c",
|
|
50593
|
+
identity: "CanvasCard_identity_56d5c",
|
|
50594
|
+
indicator: "CanvasCard_indicator_56d5c",
|
|
50595
|
+
warning: "CanvasCard_warning_56d5c",
|
|
50596
|
+
danger: "CanvasCard_danger_56d5c",
|
|
50597
|
+
content: "CanvasCard_content_56d5c",
|
|
50598
|
+
footer: "CanvasCard_footer_56d5c",
|
|
50599
|
+
afterPreview: "CanvasCard_afterPreview_56d5c",
|
|
50600
|
+
branches: "CanvasCard_branches_56d5c",
|
|
50601
|
+
collapse: "CanvasCard_collapse_56d5c",
|
|
50602
|
+
collapseInner: "CanvasCard_collapseInner_56d5c",
|
|
50603
|
+
compactIdentity: "CanvasCard_compactIdentity_56d5c",
|
|
50604
|
+
compact: "CanvasCard_compact_56d5c",
|
|
50605
|
+
withBody: "CanvasCard_withBody_56d5c",
|
|
50606
|
+
compactContent: "CanvasCard_compactContent_56d5c",
|
|
50607
|
+
singleContent: "CanvasCard_singleContent_56d5c",
|
|
50608
|
+
subtitle: "CanvasCard_subtitle_56d5c",
|
|
50609
|
+
fill: "CanvasCard_fill_56d5c"
|
|
50516
50610
|
};
|
|
50517
50611
|
//#endregion
|
|
50518
50612
|
//#region src/canvas/browser/graph/Nodes/components/CanvasCard.tsx
|
|
50519
|
-
|
|
50613
|
+
var runningBeamPathLength = 1e3;
|
|
50614
|
+
var runningBeamLength = 160;
|
|
50615
|
+
var runningBeamLayerCount = 48;
|
|
50616
|
+
var runningBeamPeakOpacity = .9;
|
|
50617
|
+
var runningBeamLayers = Array.from({ length: runningBeamLayerCount }, (_, index) => {
|
|
50618
|
+
const length = runningBeamLength * (1 - index / runningBeamLayerCount);
|
|
50619
|
+
const gap = (runningBeamPathLength - length) / 2;
|
|
50620
|
+
const previousOpacity = runningBeamPeakOpacity * Math.sin(index / runningBeamLayerCount * (Math.PI / 2)) ** 2;
|
|
50621
|
+
const opacity = runningBeamPeakOpacity * Math.sin((index + 1) / runningBeamLayerCount * (Math.PI / 2)) ** 2;
|
|
50622
|
+
return {
|
|
50623
|
+
dash: `0 ${gap} ${length} ${gap}`,
|
|
50624
|
+
opacity: (opacity - previousOpacity) / (1 - previousOpacity)
|
|
50625
|
+
};
|
|
50626
|
+
});
|
|
50627
|
+
function CanvasCard({ title, tone, titleContent, icon, subtitle, subtitleAccessory, children, preview, branches, footer, actions, problem, problemIcon, problemTone = "danger", selected, running = false, fill = false, compact = false, compactContent = false, contentHidden = false, footerHidden = false }) {
|
|
50520
50628
|
const hasContent = Children.toArray(children).some((child) => typeof child != "string" || child.trim().length > 0);
|
|
50521
50629
|
const hasBranches = !isEmptyReactNode(branches);
|
|
50522
50630
|
const hasBody = !contentHidden && (hasContent || !isEmptyReactNode(preview)) || hasBranches || !footerHidden && !isEmptyReactNode(footer);
|
|
@@ -50524,7 +50632,7 @@ function CanvasCard({ title, tone, titleContent, icon, subtitle, subtitleAccesso
|
|
|
50524
50632
|
title: problem,
|
|
50525
50633
|
placement: "top",
|
|
50526
50634
|
children: /* @__PURE__ */ jsx("span", {
|
|
50527
|
-
className: clsx(CanvasCard_module_default.icon, CanvasCard_module_default.indicator, CanvasCard_module_default.warning),
|
|
50635
|
+
className: clsx(CanvasCard_module_default.icon, CanvasCard_module_default.indicator, problemTone == "warning" ? CanvasCard_module_default.warning : CanvasCard_module_default.danger),
|
|
50528
50636
|
"aria-label": problem,
|
|
50529
50637
|
role: "img",
|
|
50530
50638
|
tabIndex: 0,
|
|
@@ -50535,67 +50643,81 @@ function CanvasCard({ title, tone, titleContent, icon, subtitle, subtitleAccesso
|
|
|
50535
50643
|
})
|
|
50536
50644
|
});
|
|
50537
50645
|
return /* @__PURE__ */ jsxs("article", {
|
|
50538
|
-
className: clsx(CanvasCard_module_default.card, fill && CanvasCard_module_default.fill, compact && CanvasCard_module_default.compact, compactContent && CanvasCard_module_default.compactContent, tone && CanvasCard_module_default[tone], selected && CanvasCard_module_default.selected, problem && CanvasCard_module_default.problem),
|
|
50539
|
-
children: [
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50646
|
+
className: clsx(CanvasCard_module_default.card, fill && CanvasCard_module_default.fill, compact && CanvasCard_module_default.compact, compactContent && CanvasCard_module_default.compactContent, tone && CanvasCard_module_default[tone], selected && CanvasCard_module_default.selected, problem && problemTone == "danger" && CanvasCard_module_default.problem),
|
|
50647
|
+
children: [
|
|
50648
|
+
/* @__PURE__ */ jsxs("header", {
|
|
50649
|
+
className: clsx(CanvasCard_module_default.header, hasBody && CanvasCard_module_default.withBody),
|
|
50650
|
+
children: [
|
|
50651
|
+
/* @__PURE__ */ jsxs("div", {
|
|
50652
|
+
className: CanvasCard_module_default.compactIdentity,
|
|
50653
|
+
children: [
|
|
50654
|
+
/* @__PURE__ */ jsx("span", {
|
|
50655
|
+
className: CanvasCard_module_default.icon,
|
|
50656
|
+
children: icon
|
|
50657
|
+
}),
|
|
50658
|
+
/* @__PURE__ */ jsx("strong", {
|
|
50659
|
+
title,
|
|
50660
|
+
children: title
|
|
50661
|
+
}),
|
|
50662
|
+
statusIndicator
|
|
50663
|
+
]
|
|
50664
|
+
}),
|
|
50665
|
+
/* @__PURE__ */ jsx("span", {
|
|
50666
|
+
className: CanvasCard_module_default.icon,
|
|
50667
|
+
children: icon
|
|
50668
|
+
}),
|
|
50669
|
+
/* @__PURE__ */ jsxs("div", {
|
|
50670
|
+
className: CanvasCard_module_default.identity,
|
|
50671
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
50550
50672
|
title,
|
|
50551
|
-
children: title
|
|
50552
|
-
}),
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
|
|
50580
|
-
children
|
|
50581
|
-
|
|
50582
|
-
|
|
50583
|
-
|
|
50584
|
-
})]
|
|
50585
|
-
}),
|
|
50586
|
-
!isEmptyReactNode(branches) && /* @__PURE__ */ jsx("div", {
|
|
50587
|
-
className: CanvasCard_module_default.branches,
|
|
50588
|
-
children: branches
|
|
50589
|
-
}),
|
|
50590
|
-
!isEmptyReactNode(footer) && /* @__PURE__ */ jsx(CardCollapse, {
|
|
50591
|
-
hidden: footerHidden,
|
|
50592
|
-
children: /* @__PURE__ */ jsx("footer", {
|
|
50593
|
-
className: clsx(CanvasCard_module_default.footer, !contentHidden && !isEmptyReactNode(preview) && CanvasCard_module_default.afterPreview),
|
|
50594
|
-
children: footer
|
|
50673
|
+
children: titleContent ?? title
|
|
50674
|
+
}), subtitle && /* @__PURE__ */ jsxs("span", {
|
|
50675
|
+
className: CanvasCard_module_default.subtitle,
|
|
50676
|
+
children: [/* @__PURE__ */ jsx("span", { children: subtitle }), subtitleAccessory]
|
|
50677
|
+
})]
|
|
50678
|
+
}),
|
|
50679
|
+
statusIndicator,
|
|
50680
|
+
actions
|
|
50681
|
+
]
|
|
50682
|
+
}),
|
|
50683
|
+
/* @__PURE__ */ jsxs("div", {
|
|
50684
|
+
className: clsx(hasBody && !hasBranches && CanvasCard_module_default.singleContent),
|
|
50685
|
+
children: [
|
|
50686
|
+
(hasContent || !isEmptyReactNode(preview)) && /* @__PURE__ */ jsxs(CardCollapse, {
|
|
50687
|
+
hidden: contentHidden,
|
|
50688
|
+
children: [hasContent && /* @__PURE__ */ jsx("div", {
|
|
50689
|
+
className: CanvasCard_module_default.content,
|
|
50690
|
+
children
|
|
50691
|
+
}), !isEmptyReactNode(preview) && /* @__PURE__ */ jsx("div", {
|
|
50692
|
+
className: CanvasCard_module_default.preview,
|
|
50693
|
+
children: preview
|
|
50694
|
+
})]
|
|
50695
|
+
}),
|
|
50696
|
+
!isEmptyReactNode(branches) && /* @__PURE__ */ jsx("div", {
|
|
50697
|
+
className: CanvasCard_module_default.branches,
|
|
50698
|
+
children: branches
|
|
50699
|
+
}),
|
|
50700
|
+
!isEmptyReactNode(footer) && /* @__PURE__ */ jsx(CardCollapse, {
|
|
50701
|
+
hidden: footerHidden,
|
|
50702
|
+
children: /* @__PURE__ */ jsx("footer", {
|
|
50703
|
+
className: clsx(CanvasCard_module_default.footer, !contentHidden && !isEmptyReactNode(preview) && CanvasCard_module_default.afterPreview),
|
|
50704
|
+
children: footer
|
|
50705
|
+
})
|
|
50595
50706
|
})
|
|
50596
|
-
|
|
50597
|
-
|
|
50598
|
-
|
|
50707
|
+
]
|
|
50708
|
+
}),
|
|
50709
|
+
running && /* @__PURE__ */ jsx("svg", {
|
|
50710
|
+
className: CanvasCard_module_default.runningBeam,
|
|
50711
|
+
"aria-hidden": "true",
|
|
50712
|
+
children: runningBeamLayers.map((layer, index) => /* @__PURE__ */ jsx("rect", {
|
|
50713
|
+
x: "0.5",
|
|
50714
|
+
y: "0.5",
|
|
50715
|
+
pathLength: runningBeamPathLength,
|
|
50716
|
+
strokeDasharray: layer.dash,
|
|
50717
|
+
strokeOpacity: layer.opacity
|
|
50718
|
+
}, index))
|
|
50719
|
+
})
|
|
50720
|
+
]
|
|
50599
50721
|
});
|
|
50600
50722
|
}
|
|
50601
50723
|
/** Retain content only while the closing transition needs it. */
|
|
@@ -51166,6 +51288,8 @@ function CanvasNode({ nodeStore, problem, branches, compact = false, compactCont
|
|
|
51166
51288
|
const triggerSource = node.kind == "trigger" ? node.presentation?.kind == "error" || node.presentation?.kind == "manual" || node.presentation?.kind == "start" || node.presentation?.kind == "cron" || node.presentation?.kind == "webhook" ? t(`canvasCard.triggerSource.${node.presentation.kind}`) : node.presentation?.source : void 0;
|
|
51167
51289
|
const subtitle = inline ? summary : node.kind == "task" ? node.executorName || t("canvasCard.kind.task") : node.kind == "trigger" && triggerSource ? `${t("canvasCard.kind.trigger")} · ${triggerSource}` : t(`canvasCard.kind.${kind}`);
|
|
51168
51290
|
const runContent = node?.run == null || node.run.status == "idle" ? void 0 : /* @__PURE__ */ jsx(RunChips, { run: node.run });
|
|
51291
|
+
const connectionRequired = (node.kind == "task" || node.kind == "trigger") && node.connectionRequired;
|
|
51292
|
+
const connectionDeferred = node.kind == "task" && node.connectionDeferred && !connectionRequired && !problem;
|
|
51169
51293
|
return /* @__PURE__ */ jsx("div", {
|
|
51170
51294
|
className: NODE_HANDLE_CLASSNAME,
|
|
51171
51295
|
children: /* @__PURE__ */ jsx(CanvasCard, {
|
|
@@ -51199,8 +51323,10 @@ function CanvasNode({ nodeStore, problem, branches, compact = false, compactCont
|
|
|
51199
51323
|
})
|
|
51200
51324
|
}) : void 0,
|
|
51201
51325
|
selected,
|
|
51202
|
-
|
|
51203
|
-
|
|
51326
|
+
running: node.run?.status === "running",
|
|
51327
|
+
problem: connectionRequired ? t("nodeStatus.connectionRequired") : problem ?? (connectionDeferred ? t("nodeStatus.connectionDeferred") : void 0),
|
|
51328
|
+
problemTone: connectionDeferred ? "warning" : "danger",
|
|
51329
|
+
problemIcon: connectionRequired || connectionDeferred ? /* @__PURE__ */ jsx("i", {
|
|
51204
51330
|
"aria-hidden": "true",
|
|
51205
51331
|
className: "i-lucide-light:unplug"
|
|
51206
51332
|
}) : void 0,
|
|
@@ -53148,6 +53274,9 @@ var GET_SIZE = (s) => ({
|
|
|
53148
53274
|
width: s.width,
|
|
53149
53275
|
height: s.height
|
|
53150
53276
|
});
|
|
53277
|
+
function getLayoutWidth(state) {
|
|
53278
|
+
return state.width > 0 ? Math.max(1, state.width - 64) / state.transform[2] : void 0;
|
|
53279
|
+
}
|
|
53151
53280
|
var isSizeEqual = (a, b) => a.width === b.width && a.height === b.height;
|
|
53152
53281
|
var isRectEqual = (a, b) => isSizeEqual(a, b) && a.x === b.x && a.y === b.y;
|
|
53153
53282
|
var ReactFlowContainer = (props) => {
|
|
@@ -53188,6 +53317,7 @@ var selector = (s) => ({
|
|
|
53188
53317
|
});
|
|
53189
53318
|
var FlowControls = /*#__PURE__*/ memo((props) => {
|
|
53190
53319
|
const rf = useReactFlow();
|
|
53320
|
+
const flowState = useStoreApi();
|
|
53191
53321
|
const { minZoomReached, maxZoomReached, zoom } = useStore(selector, shallowPlainObjectEqual);
|
|
53192
53322
|
const nodes = useNodes();
|
|
53193
53323
|
const bgId = useId().replaceAll(":", "");
|
|
@@ -53198,7 +53328,7 @@ var FlowControls = /*#__PURE__*/ memo((props) => {
|
|
|
53198
53328
|
maxZoom: 1
|
|
53199
53329
|
};
|
|
53200
53330
|
const relayout = props.onRelayout == null ? void 0 : () => {
|
|
53201
|
-
props.onRelayout?.();
|
|
53331
|
+
props.onRelayout?.(getLayoutWidth(flowState.getState()));
|
|
53202
53332
|
props.onBeforeFitView?.();
|
|
53203
53333
|
setTimeout(() => rf.fitView(fitViewOptions), 100);
|
|
53204
53334
|
};
|
|
@@ -53411,7 +53541,7 @@ var ReactFlowContainerInner = (props) => {
|
|
|
53411
53541
|
let fitTimer;
|
|
53412
53542
|
let attempts = 0;
|
|
53413
53543
|
const completeLayout = () => {
|
|
53414
|
-
const result = props.onLayoutMeasured?.();
|
|
53544
|
+
const result = props.onLayoutMeasured?.(getLayoutWidth(flowState.getState()));
|
|
53415
53545
|
if (result === false && attempts++ < 5) measurementFrame = requestAnimationFrame(completeLayout);
|
|
53416
53546
|
else if (result === "relayout") {
|
|
53417
53547
|
onBeforeFitView();
|
|
@@ -53446,6 +53576,7 @@ var ReactFlowContainerInner = (props) => {
|
|
|
53446
53576
|
if (transitionTimer) clearTimeout(transitionTimer);
|
|
53447
53577
|
};
|
|
53448
53578
|
}, [
|
|
53579
|
+
flowState,
|
|
53449
53580
|
onBeforeFitView,
|
|
53450
53581
|
props.layoutMotion,
|
|
53451
53582
|
props.onLayoutMeasured,
|
|
@@ -54594,7 +54725,10 @@ function LiveTriggers({ store }) {
|
|
|
54594
54725
|
}),
|
|
54595
54726
|
detail.binding.endpointUrl != null && /* @__PURE__ */ jsxs("div", {
|
|
54596
54727
|
className: "trigger-webhook",
|
|
54597
|
-
children: [/* @__PURE__ */ jsx("span", { children: t("publication.webhookUrl") }), /* @__PURE__ */ jsx(WebhookEndpoint, {
|
|
54728
|
+
children: [/* @__PURE__ */ jsx("span", { children: t("publication.webhookUrl") }), /* @__PURE__ */ jsx(WebhookEndpoint, {
|
|
54729
|
+
notify: store.workspace.notify,
|
|
54730
|
+
endpointUrl: detail.binding.endpointUrl
|
|
54731
|
+
}, detail.binding.endpointUrl)]
|
|
54598
54732
|
}),
|
|
54599
54733
|
/* @__PURE__ */ jsxs("div", {
|
|
54600
54734
|
className: "trigger-binding-detail-sections",
|
|
@@ -58490,7 +58624,8 @@ var NodeInspectorContainer = memo(function NodeInspectorContainer({ store, focus
|
|
|
58490
58624
|
status: bindings.flowId === flowId ? bindings.status : "idle",
|
|
58491
58625
|
enabled: live?.status == "runnable",
|
|
58492
58626
|
hasUnpublishedChanges: live?.hasUnpublishedChanges ?? false,
|
|
58493
|
-
onRetry: () => void store.publications.loadBindings(flowId)
|
|
58627
|
+
onRetry: () => void store.publications.loadBindings(flowId),
|
|
58628
|
+
notify: store.workspace.notify
|
|
58494
58629
|
},
|
|
58495
58630
|
variables: {
|
|
58496
58631
|
enabled: store.variablesEnabled,
|