@datatechsolutions/ui 2.11.43 → 2.11.46
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/astrlabe/index.d.mts +2 -2
- package/dist/astrlabe/index.d.ts +2 -2
- package/dist/astrlabe/index.js +108 -108
- package/dist/astrlabe/index.mjs +2 -2
- package/dist/astrlabe/workflow-canvas.d.mts +1 -1
- package/dist/astrlabe/workflow-canvas.d.ts +1 -1
- package/dist/astrlabe/workflow-canvas.js +2 -2
- package/dist/astrlabe/workflow-canvas.mjs +1 -1
- package/dist/{chunk-7XITJWOE.js → chunk-3B5V4VUC.js} +737 -633
- package/dist/chunk-3B5V4VUC.js.map +1 -0
- package/dist/{chunk-RCOGWCF2.mjs → chunk-MAGSMQG7.mjs} +738 -634
- package/dist/chunk-MAGSMQG7.mjs.map +1 -0
- package/dist/{workflow-canvas-Mlbo6q5K.d.mts → workflow-canvas-D4928AfA.d.mts} +11 -0
- package/dist/{workflow-canvas-Dn7U7P92.d.ts → workflow-canvas-NSxfr5dy.d.ts} +11 -0
- package/package.json +1 -1
- package/dist/chunk-7XITJWOE.js.map +0 -1
- package/dist/chunk-RCOGWCF2.mjs.map +0 -1
|
@@ -8,7 +8,7 @@ import { Position, NodeResizer, MarkerType, useReactFlow, getBezierPath, BaseEdg
|
|
|
8
8
|
import '@xyflow/react/dist/style.css';
|
|
9
9
|
import { create } from 'zustand';
|
|
10
10
|
import { PlusIcon, XMarkIcon } from '@heroicons/react/24/solid';
|
|
11
|
-
import { Bars2Icon, CursorArrowRaysIcon, HandRaisedIcon, MagnifyingGlassPlusIcon, MagnifyingGlassMinusIcon, ArrowsPointingInIcon, ArrowUturnLeftIcon, ArrowUturnRightIcon, MapIcon, EllipsisHorizontalIcon, Squares2X2Icon, ArrowsRightLeftIcon, CommandLineIcon, ExclamationTriangleIcon, CpuChipIcon, TrashIcon, WrenchScrewdriverIcon, NewspaperIcon, ChartBarIcon, CloudIcon, ScaleIcon, AdjustmentsHorizontalIcon, CircleStackIcon, PlayIcon, StopIcon, ArrowsPointingOutIcon, CodeBracketIcon, GlobeAltIcon, DocumentTextIcon, ArrowPathIcon, BookOpenIcon, ChatBubbleLeftRightIcon, QuestionMarkCircleIcon, AdjustmentsVerticalIcon, Square3Stack3DIcon, DocumentMagnifyingGlassIcon, ListBulletIcon, PlayCircleIcon, PencilSquareIcon, ServerStackIcon, KeyIcon, RectangleGroupIcon, ChevronDownIcon, ChevronUpIcon, PresentationChartBarIcon, ChartPieIcon, ChartBarSquareIcon, CurrencyDollarIcon, ShieldCheckIcon, ClipboardDocumentCheckIcon, FireIcon, ShoppingBagIcon, UsersIcon, BuildingStorefrontIcon, PencilIcon, DocumentDuplicateIcon, ClipboardDocumentIcon, ClipboardIcon, PlusIcon as PlusIcon$1, XMarkIcon as XMarkIcon$1,
|
|
11
|
+
import { Bars2Icon, CursorArrowRaysIcon, HandRaisedIcon, MagnifyingGlassPlusIcon, MagnifyingGlassMinusIcon, ArrowsPointingInIcon, ArrowUturnLeftIcon, ArrowUturnRightIcon, MapIcon, EllipsisHorizontalIcon, Squares2X2Icon, ArrowsRightLeftIcon, CommandLineIcon, ExclamationTriangleIcon, CpuChipIcon, TrashIcon, WrenchScrewdriverIcon, NewspaperIcon, ChartBarIcon, CloudIcon, ScaleIcon, AdjustmentsHorizontalIcon, CircleStackIcon, PlayIcon, StopIcon, ArrowsPointingOutIcon, CodeBracketIcon, GlobeAltIcon, DocumentTextIcon, ArrowPathIcon, BookOpenIcon, ChatBubbleLeftRightIcon, QuestionMarkCircleIcon, AdjustmentsVerticalIcon, Square3Stack3DIcon, DocumentMagnifyingGlassIcon, ListBulletIcon, PlayCircleIcon, PencilSquareIcon, ServerStackIcon, KeyIcon, RectangleGroupIcon, ChevronDownIcon, ChevronUpIcon, PresentationChartBarIcon, ChartPieIcon, ChartBarSquareIcon, CurrencyDollarIcon, ShieldCheckIcon, ClipboardDocumentCheckIcon, FireIcon, ShoppingBagIcon, UsersIcon, BuildingStorefrontIcon, PencilIcon, DocumentDuplicateIcon, ClipboardDocumentIcon, ClipboardIcon, PlusIcon as PlusIcon$1, XMarkIcon as XMarkIcon$1, TableCellsIcon, FunnelIcon, Cog6ToothIcon, VariableIcon, MagnifyingGlassIcon, CheckIcon } from '@heroicons/react/24/outline';
|
|
12
12
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var DEFAULT_PASTE_OFFSET = 40;
|
|
@@ -1153,6 +1153,493 @@ function getEntityHandleColor(entityKey) {
|
|
|
1153
1153
|
function getEntityMinimapColor(entityKey) {
|
|
1154
1154
|
return presetFromKey(entityKey).minimapColor;
|
|
1155
1155
|
}
|
|
1156
|
+
var DATASOURCE_LOGOS = {
|
|
1157
|
+
bigquery: "/logos/datasources/bigquery.svg",
|
|
1158
|
+
postgres: "/logos/datasources/postgres.svg",
|
|
1159
|
+
snowflake: "/logos/datasources/snowflake.svg",
|
|
1160
|
+
mongodb: "/logos/datasources/mongodb.svg",
|
|
1161
|
+
redis: "/logos/datasources/redis.svg",
|
|
1162
|
+
mysql: "/logos/datasources/mysql.svg",
|
|
1163
|
+
clickhouse: "/logos/datasources/clickhouse.svg",
|
|
1164
|
+
elasticsearch: "/logos/datasources/elasticsearch.svg",
|
|
1165
|
+
duckdb: "/logos/datasources/duckdb.svg",
|
|
1166
|
+
sqlite: "/logos/datasources/sqlite.svg",
|
|
1167
|
+
mariadb: "/logos/datasources/mariadb.svg",
|
|
1168
|
+
oracle: "/logos/datasources/oracle.svg",
|
|
1169
|
+
mssql: "/logos/datasources/mssql.svg",
|
|
1170
|
+
sqlserver: "/logos/datasources/mssql.svg",
|
|
1171
|
+
cassandra: "/logos/datasources/cassandra.svg",
|
|
1172
|
+
dynamodb: "/logos/datasources/dynamodb.svg",
|
|
1173
|
+
cockroach: "/logos/datasources/cockroachdb.svg",
|
|
1174
|
+
supabase: "/logos/datasources/supabase.svg",
|
|
1175
|
+
firebase: "/logos/datasources/firebase.svg",
|
|
1176
|
+
neo4j: "/logos/datasources/neo4j.svg"
|
|
1177
|
+
};
|
|
1178
|
+
function getDatasourceLogo(datasourceId, dialect) {
|
|
1179
|
+
const search = (dialect ?? datasourceId).toLowerCase();
|
|
1180
|
+
for (const [key, url] of Object.entries(DATASOURCE_LOGOS)) {
|
|
1181
|
+
if (search.includes(key)) return url;
|
|
1182
|
+
}
|
|
1183
|
+
return null;
|
|
1184
|
+
}
|
|
1185
|
+
var TYPE_COLORS = {
|
|
1186
|
+
string: "bg-gray-500/10 text-gray-500 dark:text-gray-400",
|
|
1187
|
+
varchar: "bg-gray-500/10 text-gray-500 dark:text-gray-400",
|
|
1188
|
+
text: "bg-gray-500/10 text-gray-500 dark:text-gray-400",
|
|
1189
|
+
integer: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
1190
|
+
int: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
1191
|
+
bigint: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
1192
|
+
number: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
|
|
1193
|
+
decimal: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400",
|
|
1194
|
+
float: "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400",
|
|
1195
|
+
boolean: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
|
|
1196
|
+
date: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
1197
|
+
timestamp: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
1198
|
+
datetime: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
1199
|
+
json: "bg-violet-500/10 text-violet-600 dark:text-violet-400",
|
|
1200
|
+
jsonb: "bg-violet-500/10 text-violet-600 dark:text-violet-400",
|
|
1201
|
+
uuid: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
|
|
1202
|
+
array: "bg-pink-500/10 text-pink-600 dark:text-pink-400"
|
|
1203
|
+
};
|
|
1204
|
+
var SIDEBAR_SECTIONS = [
|
|
1205
|
+
{ id: "connection", label: "Connection", icon: CircleStackIcon },
|
|
1206
|
+
{ id: "table", label: "Table", icon: TableCellsIcon },
|
|
1207
|
+
{ id: "columns", label: "Columns", icon: TableCellsIcon },
|
|
1208
|
+
{ id: "filters", label: "Filters", icon: FunnelIcon },
|
|
1209
|
+
{ id: "output", label: "Output", icon: Cog6ToothIcon }
|
|
1210
|
+
];
|
|
1211
|
+
function DatasourceNodeConfigForm({
|
|
1212
|
+
open,
|
|
1213
|
+
nodeId,
|
|
1214
|
+
config,
|
|
1215
|
+
onSave,
|
|
1216
|
+
onCancel,
|
|
1217
|
+
datasources,
|
|
1218
|
+
onLoadTables,
|
|
1219
|
+
onLoadSchema,
|
|
1220
|
+
readOnly = false
|
|
1221
|
+
}) {
|
|
1222
|
+
const t = useTranslations("agents.workflow.datasourceNodeConfig");
|
|
1223
|
+
const [activeSectionId, setActiveSectionId] = useState("connection");
|
|
1224
|
+
const [selectedDatasourceId, setSelectedDatasourceId] = useState(config.datasourceId ?? "");
|
|
1225
|
+
const [selectedTable, setSelectedTable] = useState(config.table ?? "");
|
|
1226
|
+
const [availableTables, setAvailableTables] = useState([]);
|
|
1227
|
+
const [availableColumns, setAvailableColumns] = useState([]);
|
|
1228
|
+
const [selectedColumns, setSelectedColumns] = useState([...config.selectedColumns ?? []]);
|
|
1229
|
+
const [outputVariable, setOutputVariable] = useState(config.outputVariable);
|
|
1230
|
+
const [limit, setLimit] = useState(config.limit);
|
|
1231
|
+
const [filterVariables, setFilterVariables] = useState({ ...config.filterVariables });
|
|
1232
|
+
const [tableSearch, setTableSearch] = useState("");
|
|
1233
|
+
const [columnSearch, setColumnSearch] = useState("");
|
|
1234
|
+
const allColumnNames = availableColumns.map((column) => column.name);
|
|
1235
|
+
const allSelected = selectedColumns.length > 0 && selectedColumns.length === allColumnNames.length;
|
|
1236
|
+
const selectedDatasource = datasources.find((datasource) => datasource.id === selectedDatasourceId);
|
|
1237
|
+
const filteredTables = useMemo(
|
|
1238
|
+
() => tableSearch ? availableTables.filter((table) => table.toLowerCase().includes(tableSearch.toLowerCase())) : availableTables,
|
|
1239
|
+
[availableTables, tableSearch]
|
|
1240
|
+
);
|
|
1241
|
+
const filteredColumns = useMemo(
|
|
1242
|
+
() => columnSearch ? availableColumns.filter((column) => column.name.toLowerCase().includes(columnSearch.toLowerCase())) : availableColumns,
|
|
1243
|
+
[availableColumns, columnSearch]
|
|
1244
|
+
);
|
|
1245
|
+
const loadTables = useCallback(async (datasourceId) => {
|
|
1246
|
+
if (!datasourceId) {
|
|
1247
|
+
setAvailableTables([]);
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
const tables = await onLoadTables(datasourceId);
|
|
1251
|
+
setAvailableTables(tables);
|
|
1252
|
+
}, [onLoadTables]);
|
|
1253
|
+
const loadSchema = useCallback(async (datasourceId, table) => {
|
|
1254
|
+
if (!datasourceId || !table) {
|
|
1255
|
+
setAvailableColumns([]);
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
const columns = await onLoadSchema(datasourceId, table);
|
|
1259
|
+
setAvailableColumns(columns);
|
|
1260
|
+
}, [onLoadSchema]);
|
|
1261
|
+
useEffect(() => {
|
|
1262
|
+
if (selectedDatasourceId) loadTables(selectedDatasourceId);
|
|
1263
|
+
}, [selectedDatasourceId, loadTables]);
|
|
1264
|
+
useEffect(() => {
|
|
1265
|
+
if (selectedDatasourceId && selectedTable) loadSchema(selectedDatasourceId, selectedTable);
|
|
1266
|
+
}, [selectedDatasourceId, selectedTable, loadSchema]);
|
|
1267
|
+
const handleDatasourceChange = (datasourceId) => {
|
|
1268
|
+
setSelectedDatasourceId(datasourceId);
|
|
1269
|
+
setSelectedTable("");
|
|
1270
|
+
setAvailableTables([]);
|
|
1271
|
+
setAvailableColumns([]);
|
|
1272
|
+
setSelectedColumns([]);
|
|
1273
|
+
setFilterVariables({});
|
|
1274
|
+
setTableSearch("");
|
|
1275
|
+
setColumnSearch("");
|
|
1276
|
+
};
|
|
1277
|
+
const handleTableChange = (table) => {
|
|
1278
|
+
setSelectedTable(table);
|
|
1279
|
+
setAvailableColumns([]);
|
|
1280
|
+
setSelectedColumns([]);
|
|
1281
|
+
setFilterVariables({});
|
|
1282
|
+
setColumnSearch("");
|
|
1283
|
+
};
|
|
1284
|
+
const handleToggleColumn = (columnName) => {
|
|
1285
|
+
setSelectedColumns(
|
|
1286
|
+
(previous) => previous.includes(columnName) ? previous.filter((name) => name !== columnName) : [...previous, columnName]
|
|
1287
|
+
);
|
|
1288
|
+
};
|
|
1289
|
+
const handleAddFilter = () => {
|
|
1290
|
+
setFilterVariables((previous) => ({ ...previous, [`field_${Object.keys(previous).length}`]: "" }));
|
|
1291
|
+
};
|
|
1292
|
+
const handleUpdateFilterVariable = (oldKey, newKey) => {
|
|
1293
|
+
setFilterVariables((previous) => {
|
|
1294
|
+
const updated = { ...previous };
|
|
1295
|
+
const value = updated[oldKey] ?? "";
|
|
1296
|
+
delete updated[oldKey];
|
|
1297
|
+
updated[newKey] = value;
|
|
1298
|
+
return updated;
|
|
1299
|
+
});
|
|
1300
|
+
};
|
|
1301
|
+
const handleUpdateFilterField = (key, newValue) => {
|
|
1302
|
+
setFilterVariables((previous) => ({ ...previous, [key]: newValue }));
|
|
1303
|
+
};
|
|
1304
|
+
const handleRemoveFilter = (key) => {
|
|
1305
|
+
setFilterVariables((previous) => {
|
|
1306
|
+
const updated = { ...previous };
|
|
1307
|
+
delete updated[key];
|
|
1308
|
+
return updated;
|
|
1309
|
+
});
|
|
1310
|
+
};
|
|
1311
|
+
const handleSave = () => {
|
|
1312
|
+
const cleanedFilters = {};
|
|
1313
|
+
for (const [key, value] of Object.entries(filterVariables)) {
|
|
1314
|
+
if (key.trim() && value.trim()) cleanedFilters[key.trim()] = value.trim();
|
|
1315
|
+
}
|
|
1316
|
+
onSave({
|
|
1317
|
+
...config,
|
|
1318
|
+
datasourceId: selectedDatasourceId,
|
|
1319
|
+
dialect: selectedDatasource?.dialect ?? "",
|
|
1320
|
+
table: selectedTable,
|
|
1321
|
+
selectedColumns,
|
|
1322
|
+
outputVariable: outputVariable.trim(),
|
|
1323
|
+
limit,
|
|
1324
|
+
filterVariables: cleanedFilters
|
|
1325
|
+
});
|
|
1326
|
+
};
|
|
1327
|
+
const filterEntries = Object.entries(filterVariables);
|
|
1328
|
+
const canSave = selectedDatasourceId && selectedTable && selectedColumns.length > 0;
|
|
1329
|
+
function renderSection() {
|
|
1330
|
+
switch (activeSectionId) {
|
|
1331
|
+
case "connection":
|
|
1332
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1333
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("datasourceHelp") }),
|
|
1334
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: datasources.map((datasource) => {
|
|
1335
|
+
const isSelected = datasource.id === selectedDatasourceId;
|
|
1336
|
+
const logo2 = getDatasourceLogo(datasource.id, datasource.dialect);
|
|
1337
|
+
return /* @__PURE__ */ jsxs(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
type: "button",
|
|
1341
|
+
onClick: () => {
|
|
1342
|
+
if (!readOnly) {
|
|
1343
|
+
handleDatasourceChange(datasource.id);
|
|
1344
|
+
setActiveSectionId("table");
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1347
|
+
disabled: readOnly && datasource.id !== selectedDatasourceId,
|
|
1348
|
+
className: `flex items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all ${isSelected ? "border-cyan-500/50 bg-cyan-500/5 ring-1 ring-cyan-500/20 dark:border-cyan-400/40 dark:bg-cyan-400/5" : "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm dark:border-white/10 dark:bg-white/[0.03] dark:hover:border-white/20"}`,
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center", children: logo2 ? /* @__PURE__ */ jsx("img", { src: logo2, alt: datasource.dialect, className: "h-7 w-7" }) : /* @__PURE__ */ jsx(ServerStackIcon, { className: "h-6 w-6 text-gray-400" }) }),
|
|
1351
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1352
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-xs font-semibold text-gray-900 dark:text-white", children: datasource.name }),
|
|
1353
|
+
/* @__PURE__ */ jsx("p", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: datasource.dialect })
|
|
1354
|
+
] }),
|
|
1355
|
+
isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4 shrink-0 text-cyan-500 dark:text-cyan-400" })
|
|
1356
|
+
]
|
|
1357
|
+
},
|
|
1358
|
+
datasource.id
|
|
1359
|
+
);
|
|
1360
|
+
}) })
|
|
1361
|
+
] });
|
|
1362
|
+
case "table":
|
|
1363
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1364
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("tableHelp") }),
|
|
1365
|
+
!selectedDatasourceId ? /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-xs text-gray-400", children: t("selectDatasource") }) : /* @__PURE__ */ jsxs("div", { className: "liquid-surface rounded-xl border border-white/30 dark:border-white/10", children: [
|
|
1366
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-gray-200/50 px-3 py-2 dark:border-white/5", children: [
|
|
1367
|
+
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "h-3.5 w-3.5 text-gray-400" }),
|
|
1368
|
+
/* @__PURE__ */ jsx(
|
|
1369
|
+
"input",
|
|
1370
|
+
{
|
|
1371
|
+
type: "text",
|
|
1372
|
+
value: tableSearch,
|
|
1373
|
+
onChange: (event) => setTableSearch(event.target.value),
|
|
1374
|
+
placeholder: t("selectTable"),
|
|
1375
|
+
className: "flex-1 bg-transparent text-xs text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-500"
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
availableTables.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-gray-400", children: availableTables.length })
|
|
1379
|
+
] }),
|
|
1380
|
+
/* @__PURE__ */ jsxs("div", { className: "max-h-64 overflow-y-auto p-1", children: [
|
|
1381
|
+
filteredTables.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-[10px] text-gray-400", children: t("noColumnsAvailable") }),
|
|
1382
|
+
filteredTables.map((table) => {
|
|
1383
|
+
const isSelected = table === selectedTable;
|
|
1384
|
+
return /* @__PURE__ */ jsxs(
|
|
1385
|
+
"button",
|
|
1386
|
+
{
|
|
1387
|
+
type: "button",
|
|
1388
|
+
onClick: () => {
|
|
1389
|
+
if (!readOnly) {
|
|
1390
|
+
handleTableChange(table);
|
|
1391
|
+
setActiveSectionId("columns");
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
className: `flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-xs transition-colors ${isSelected ? "bg-cyan-500/10 font-semibold text-cyan-700 dark:text-cyan-300" : "text-gray-700 hover:bg-gray-100/60 dark:text-gray-300 dark:hover:bg-white/5"}`,
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ jsx(TableCellsIcon, { className: "h-3.5 w-3.5 shrink-0 text-gray-400" }),
|
|
1397
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: table }),
|
|
1398
|
+
isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto h-3.5 w-3.5 shrink-0 text-cyan-500" })
|
|
1399
|
+
]
|
|
1400
|
+
},
|
|
1401
|
+
table
|
|
1402
|
+
);
|
|
1403
|
+
})
|
|
1404
|
+
] })
|
|
1405
|
+
] })
|
|
1406
|
+
] });
|
|
1407
|
+
case "columns":
|
|
1408
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1409
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1410
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
1411
|
+
selectedColumns.length,
|
|
1412
|
+
"/",
|
|
1413
|
+
availableColumns.length,
|
|
1414
|
+
" selected"
|
|
1415
|
+
] }),
|
|
1416
|
+
!readOnly && /* @__PURE__ */ jsx(
|
|
1417
|
+
"button",
|
|
1418
|
+
{
|
|
1419
|
+
type: "button",
|
|
1420
|
+
onClick: () => setSelectedColumns(allSelected ? [] : [...allColumnNames]),
|
|
1421
|
+
disabled: availableColumns.length === 0,
|
|
1422
|
+
className: "text-[10px] font-semibold text-cyan-600 hover:text-cyan-700 disabled:opacity-40 dark:text-cyan-400",
|
|
1423
|
+
children: allSelected ? t("deselectAll") : t("selectAll")
|
|
1424
|
+
}
|
|
1425
|
+
)
|
|
1426
|
+
] }),
|
|
1427
|
+
!selectedTable ? /* @__PURE__ */ jsx("p", { className: "py-8 text-center text-xs text-gray-400", children: t("selectTable") }) : /* @__PURE__ */ jsxs("div", { className: "liquid-surface rounded-xl border border-white/30 dark:border-white/10", children: [
|
|
1428
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-b border-gray-200/50 px-3 py-2 dark:border-white/5", children: [
|
|
1429
|
+
/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "h-3.5 w-3.5 text-gray-400" }),
|
|
1430
|
+
/* @__PURE__ */ jsx(
|
|
1431
|
+
"input",
|
|
1432
|
+
{
|
|
1433
|
+
type: "text",
|
|
1434
|
+
value: columnSearch,
|
|
1435
|
+
onChange: (event) => setColumnSearch(event.target.value),
|
|
1436
|
+
placeholder: "Search columns...",
|
|
1437
|
+
className: "flex-1 bg-transparent text-xs text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-500"
|
|
1438
|
+
}
|
|
1439
|
+
)
|
|
1440
|
+
] }),
|
|
1441
|
+
/* @__PURE__ */ jsxs("div", { className: "max-h-64 overflow-y-auto p-1", children: [
|
|
1442
|
+
filteredColumns.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-[10px] text-gray-400", children: t("noColumnsAvailable") }),
|
|
1443
|
+
filteredColumns.map((column) => {
|
|
1444
|
+
const isSelected = selectedColumns.includes(column.name);
|
|
1445
|
+
const typeColor = TYPE_COLORS[column.type.toLowerCase()] ?? TYPE_COLORS.string;
|
|
1446
|
+
return /* @__PURE__ */ jsxs(
|
|
1447
|
+
"button",
|
|
1448
|
+
{
|
|
1449
|
+
type: "button",
|
|
1450
|
+
onClick: () => {
|
|
1451
|
+
if (!readOnly) handleToggleColumn(column.name);
|
|
1452
|
+
},
|
|
1453
|
+
className: `flex w-full items-center gap-2 rounded-lg px-3 py-1.5 text-left transition-colors ${isSelected ? "bg-cyan-500/8 dark:bg-cyan-400/5" : "hover:bg-gray-100/60 dark:hover:bg-white/5"}`,
|
|
1454
|
+
children: [
|
|
1455
|
+
/* @__PURE__ */ jsx("div", { className: `flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors ${isSelected ? "border-cyan-500 bg-cyan-500 dark:border-cyan-400 dark:bg-cyan-400" : "border-gray-300 dark:border-gray-600"}`, children: isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "h-2.5 w-2.5 text-white" }) }),
|
|
1456
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 truncate text-xs text-gray-900 dark:text-white", children: [
|
|
1457
|
+
column.name,
|
|
1458
|
+
column.nullable && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[9px] text-gray-400", children: "?" })
|
|
1459
|
+
] }),
|
|
1460
|
+
/* @__PURE__ */ jsx("span", { className: `shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-medium ${typeColor}`, children: column.type })
|
|
1461
|
+
]
|
|
1462
|
+
},
|
|
1463
|
+
column.name
|
|
1464
|
+
);
|
|
1465
|
+
})
|
|
1466
|
+
] })
|
|
1467
|
+
] })
|
|
1468
|
+
] });
|
|
1469
|
+
case "filters":
|
|
1470
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1471
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1472
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: t("filtersHelp") }),
|
|
1473
|
+
!readOnly && /* @__PURE__ */ jsxs(
|
|
1474
|
+
"button",
|
|
1475
|
+
{
|
|
1476
|
+
type: "button",
|
|
1477
|
+
onClick: handleAddFilter,
|
|
1478
|
+
className: "flex items-center gap-1 text-[10px] font-semibold text-cyan-600 hover:text-cyan-700 dark:text-cyan-400",
|
|
1479
|
+
children: [
|
|
1480
|
+
/* @__PURE__ */ jsx(PlusIcon$1, { className: "h-3 w-3" }),
|
|
1481
|
+
t("addFilter")
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
)
|
|
1485
|
+
] }),
|
|
1486
|
+
filterEntries.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 py-8", children: [
|
|
1487
|
+
/* @__PURE__ */ jsx(FunnelIcon, { className: "h-8 w-8 text-gray-300 dark:text-gray-600" }),
|
|
1488
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "No filters configured" }),
|
|
1489
|
+
/* @__PURE__ */ jsxs(
|
|
1490
|
+
"button",
|
|
1491
|
+
{
|
|
1492
|
+
type: "button",
|
|
1493
|
+
onClick: handleAddFilter,
|
|
1494
|
+
className: "flex items-center gap-1 rounded-lg bg-cyan-500/10 px-3 py-1.5 text-[10px] font-semibold text-cyan-600 hover:bg-cyan-500/15 dark:text-cyan-400",
|
|
1495
|
+
children: [
|
|
1496
|
+
/* @__PURE__ */ jsx(PlusIcon$1, { className: "h-3 w-3" }),
|
|
1497
|
+
t("addFilter")
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
)
|
|
1501
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: filterEntries.map(([variableName, columnName], index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2 dark:border-white/10 dark:bg-white/[0.03]", children: [
|
|
1502
|
+
/* @__PURE__ */ jsxs(
|
|
1503
|
+
"select",
|
|
1504
|
+
{
|
|
1505
|
+
value: columnName,
|
|
1506
|
+
onChange: (event) => handleUpdateFilterField(variableName, event.target.value),
|
|
1507
|
+
disabled: readOnly,
|
|
1508
|
+
className: "flex-1 rounded bg-transparent text-xs text-gray-900 outline-none disabled:opacity-60 dark:text-white",
|
|
1509
|
+
children: [
|
|
1510
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t("columnName") }),
|
|
1511
|
+
availableColumns.map((column) => /* @__PURE__ */ jsx("option", { value: column.name, children: column.name }, column.name))
|
|
1512
|
+
]
|
|
1513
|
+
}
|
|
1514
|
+
),
|
|
1515
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-gray-400", children: "=" }),
|
|
1516
|
+
/* @__PURE__ */ jsx(
|
|
1517
|
+
"input",
|
|
1518
|
+
{
|
|
1519
|
+
type: "text",
|
|
1520
|
+
value: variableName,
|
|
1521
|
+
onChange: (event) => handleUpdateFilterVariable(variableName, event.target.value),
|
|
1522
|
+
placeholder: t("variableReference"),
|
|
1523
|
+
readOnly,
|
|
1524
|
+
className: "flex-1 bg-transparent text-xs text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-500"
|
|
1525
|
+
}
|
|
1526
|
+
),
|
|
1527
|
+
!readOnly && /* @__PURE__ */ jsx(
|
|
1528
|
+
"button",
|
|
1529
|
+
{
|
|
1530
|
+
type: "button",
|
|
1531
|
+
onClick: () => handleRemoveFilter(variableName),
|
|
1532
|
+
className: "shrink-0 rounded-md p-1 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-900/20",
|
|
1533
|
+
children: /* @__PURE__ */ jsx(XMarkIcon$1, { className: "h-3 w-3" })
|
|
1534
|
+
}
|
|
1535
|
+
)
|
|
1536
|
+
] }, index)) })
|
|
1537
|
+
] });
|
|
1538
|
+
case "output":
|
|
1539
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
1540
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1541
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1.5 block text-xs font-medium text-gray-700 dark:text-gray-300", children: t("outputVariableLabel") }),
|
|
1542
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-[10px] text-gray-500 dark:text-gray-400", children: t("outputVariableHelp") }),
|
|
1543
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-xl border border-gray-200 bg-white px-3 py-2.5 dark:border-white/10 dark:bg-white/[0.03]", children: [
|
|
1544
|
+
/* @__PURE__ */ jsx(VariableIcon, { className: "h-4 w-4 text-gray-400" }),
|
|
1545
|
+
/* @__PURE__ */ jsx(
|
|
1546
|
+
"input",
|
|
1547
|
+
{
|
|
1548
|
+
type: "text",
|
|
1549
|
+
value: outputVariable,
|
|
1550
|
+
onChange: (event) => setOutputVariable(event.target.value),
|
|
1551
|
+
placeholder: "datasourceResult",
|
|
1552
|
+
readOnly,
|
|
1553
|
+
className: "flex-1 bg-transparent text-sm text-gray-900 outline-none placeholder:text-gray-400 dark:text-white dark:placeholder:text-gray-500"
|
|
1554
|
+
}
|
|
1555
|
+
)
|
|
1556
|
+
] })
|
|
1557
|
+
] }),
|
|
1558
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1559
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1.5 block text-xs font-medium text-gray-700 dark:text-gray-300", children: t("limitLabel") }),
|
|
1560
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-[10px] text-gray-500 dark:text-gray-400", children: t("limitHelp") }),
|
|
1561
|
+
/* @__PURE__ */ jsx(
|
|
1562
|
+
"input",
|
|
1563
|
+
{
|
|
1564
|
+
type: "number",
|
|
1565
|
+
value: limit,
|
|
1566
|
+
onChange: (event) => setLimit(Math.max(1, Number.parseInt(event.target.value, 10) || 1)),
|
|
1567
|
+
min: 1,
|
|
1568
|
+
max: 1e4,
|
|
1569
|
+
readOnly,
|
|
1570
|
+
className: "w-32 rounded-xl border border-gray-200 bg-white px-3 py-2.5 text-sm text-gray-900 outline-none focus:border-cyan-400 dark:border-white/10 dark:bg-white/[0.03] dark:text-white"
|
|
1571
|
+
}
|
|
1572
|
+
)
|
|
1573
|
+
] }),
|
|
1574
|
+
selectedDatasource && selectedTable && /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-cyan-500/20 bg-cyan-500/5 p-3 dark:border-cyan-400/15 dark:bg-cyan-400/5", children: [
|
|
1575
|
+
/* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold uppercase tracking-wider text-cyan-600 dark:text-cyan-400 mb-2", children: "Summary" }),
|
|
1576
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 text-xs text-gray-600 dark:text-gray-300", children: [
|
|
1577
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1578
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Source:" }),
|
|
1579
|
+
" ",
|
|
1580
|
+
selectedDatasource.name,
|
|
1581
|
+
" (",
|
|
1582
|
+
selectedDatasource.dialect,
|
|
1583
|
+
")"
|
|
1584
|
+
] }),
|
|
1585
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1586
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Table:" }),
|
|
1587
|
+
" ",
|
|
1588
|
+
selectedTable
|
|
1589
|
+
] }),
|
|
1590
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1591
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Columns:" }),
|
|
1592
|
+
" ",
|
|
1593
|
+
selectedColumns.length,
|
|
1594
|
+
" of ",
|
|
1595
|
+
availableColumns.length
|
|
1596
|
+
] }),
|
|
1597
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1598
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Filters:" }),
|
|
1599
|
+
" ",
|
|
1600
|
+
filterEntries.length
|
|
1601
|
+
] }),
|
|
1602
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1603
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Limit:" }),
|
|
1604
|
+
" ",
|
|
1605
|
+
limit
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1608
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Output:" }),
|
|
1609
|
+
" ",
|
|
1610
|
+
outputVariable || "\u2014"
|
|
1611
|
+
] })
|
|
1612
|
+
] })
|
|
1613
|
+
] })
|
|
1614
|
+
] });
|
|
1615
|
+
default:
|
|
1616
|
+
return null;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
const logo = getDatasourceLogo(selectedDatasourceId, selectedDatasource?.dialect);
|
|
1620
|
+
return /* @__PURE__ */ jsx(
|
|
1621
|
+
GlassModal,
|
|
1622
|
+
{
|
|
1623
|
+
open,
|
|
1624
|
+
onClose: onCancel,
|
|
1625
|
+
title: selectedDatasource?.name ?? t("datasourceLabel"),
|
|
1626
|
+
subtitle: selectedTable ? `${selectedDatasource?.dialect} \xB7 ${selectedTable}` : void 0,
|
|
1627
|
+
icon: logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "h-5 w-5" }) : /* @__PURE__ */ jsx(ServerStackIcon, { className: "h-5 w-5 text-white" }),
|
|
1628
|
+
gradient: "from-cyan-500 to-blue-600",
|
|
1629
|
+
maxWidth: "3xl",
|
|
1630
|
+
sidebar: {
|
|
1631
|
+
sections: SIDEBAR_SECTIONS,
|
|
1632
|
+
activeSectionId,
|
|
1633
|
+
onSectionChange: setActiveSectionId
|
|
1634
|
+
},
|
|
1635
|
+
footer: /* @__PURE__ */ jsx("div", { className: "flex justify-end gap-2 px-6 py-3", children: readOnly ? /* @__PURE__ */ jsx(Button, { outline: true, onClick: onCancel, children: "Close" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1636
|
+
/* @__PURE__ */ jsx(Button, { outline: true, onClick: onCancel, children: t("cancel") }),
|
|
1637
|
+
/* @__PURE__ */ jsx(Button, { color: "cyan", onClick: handleSave, disabled: !canSave, children: t("save") })
|
|
1638
|
+
] }) }),
|
|
1639
|
+
children: renderSection()
|
|
1640
|
+
}
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1156
1643
|
function LangChainIcon({ className }) {
|
|
1157
1644
|
return /* @__PURE__ */ jsx("svg", { role: "img", viewBox: "0 0 24 24", fill: "currentColor", className, "aria-label": "LangChain", children: /* @__PURE__ */ jsx("path", { d: "M6.0988 5.9175C2.7359 5.9175 0 8.6462 0 12s2.736 6.0825 6.0988 6.0825h11.8024C21.2641 18.0825 24 15.3538 24 12s-2.736-6.0825-6.0988-6.0825ZM5.9774 7.851c.493.0124 1.02.2496 1.273.6228.3673.4592.4778 1.0668.8944 1.4932.5604.6118 1.199 1.1505 1.7161 1.802.4892.5954.8386 1.2937 1.1436 1.9975.1244.2335.1257.5202.31.7197.0908.1204.5346.4483.4383.5645.0555.1204.4702.286.3263.4027-.1944.04-.4129.0476-.5616-.1074-.0549.126-.183.0596-.2819.0432a4 4 0 0 0-.025.0736c-.3288.0219-.5754-.3126-.732-.565-.3111-.168-.6642-.2702-.982-.446-.0182.2895.0452.6485-.231.8353-.014.5565.8436.0656.9222.4804-.061.0067-.1286-.0095-.1774.0373-.2239.2172-.4805-.1645-.7385-.007-.3464.174-.3808.3161-.8096.352-.0237-.0359-.0143-.0592.0059-.0811.1207-.1399.1295-.3046.3356-.3643-.2122-.0334-.3899.0833-.5686.1757-.2323.095-.2304-.2141-.5878.0164-.0396-.0322-.0208-.0615.0018-.0864.0908-.1107.2102-.127.345-.1208-.663-.3686-.9751.4507-1.2813.0432-.092.0243-.1265.1068-.1845.1652-.05-.0548-.0123-.1212-.0099-.1857-.0598-.028-.1356-.041-.1179-.1366-.1171-.0395-.1988.0295-.286.0952-.0787-.0608.0532-.1492.0776-.2125.0702-.1216.23-.025.3111-.1126.2306-.1308.552.0814.8155.0455.203.0255.4544-.1825.3526-.39-.2171-.2767-.179-.6386-.1839-.9695-.0268-.1929-.491-.4382-.6252-.6462-.1659-.1873-.295-.4047-.4243-.6182-.4666-.9008-.3198-2.0584-.9077-2.8947-.266.1466-.6125.0774-.8418-.119-.1238.1125-.1292.2598-.139.4161-.297-.2962-.2593-.8559-.022-1.1855.0969-.1302.2127-.2373.342-.3316.0292-.0213.0391-.0419.0385-.0747.1174-.5267.5764-.7391 1.0694-.7267m12.4071.46c.5575 0 1.0806.2159 1.474.6082s.61.9145.61 1.4704c0 .556-.2167 1.078-.61 1.4698v.0006l-.902.8995a2.08 2.08 0 0 1-.8597.5166l-.0164.0047-.0058.0164a2.05 2.05 0 0 1-.474.7308l-.9018.8995c-.3934.3924-.917.6083-1.4745.6083s-1.0806-.216-1.474-.6083c-.813-.8107-.813-2.1294 0-2.9402l.9019-.8995a2.056 2.056 0 0 1 .858-.5143l.017-.0053.0058-.0158a2.07 2.07 0 0 1 .4752-.7337l.9018-.8995c.3934-.3924.9171-.6083 1.4745-.6083zm0 .8965a1.18 1.18 0 0 0-.8388.3462l-.9018.8995a1.181 1.181 0 0 0-.3427.9252l.0053.0572c.0323.2652.149.5044.3374.6917.13.1296.2733.2114.4471.2686a.9.9 0 0 1 .014.1582.884.884 0 0 1-.2609.6304l-.0554.0554c-.3013-.1028-.5525-.253-.7794-.4792a2.06 2.06 0 0 1-.5761-1.0968l-.0099-.0578-.0461.0368a1.1 1.1 0 0 0-.0876.0794l-.9024.8995c-.4623.461-.4623 1.212 0 1.673.2311.2305.535.346.8394.3461.3043 0 .6077-.1156.8388-.3462l.9019-.8995c.4623-.461.4623-1.2113 0-1.673a1.17 1.17 0 0 0-.4367-.2749 1 1 0 0 1-.014-.1611c0-.2591.1023-.505.2901-.6923.3019.1028.57.2694.7962.495.3007.2999.4994.679.5756 1.0968l.0105.0578.0455-.0373a1.1 1.1 0 0 0 .0887-.0794l.902-.8996c.4622-.461.4628-1.2124 0-1.6735a1.18 1.18 0 0 0-.8395-.3462Zm-9.973 5.1567-.0006.0006c-.0793.3078-.1048.8318-.506.847-.033.1776.1228.2445.2655.1874.141-.0645.2081.0508.2557.1657.2177.0317.5394-.0725.5516-.3298-.325-.1867-.4253-.5418-.5662-.8709" }) });
|
|
1158
1645
|
}
|
|
@@ -2838,7 +3325,7 @@ var NoteFlowNode = memo(function NoteFlowNode2({ data, selected }) {
|
|
|
2838
3325
|
}
|
|
2839
3326
|
);
|
|
2840
3327
|
});
|
|
2841
|
-
var
|
|
3328
|
+
var DATASOURCE_LOGOS2 = {
|
|
2842
3329
|
bigquery: "/logos/datasources/bigquery.svg",
|
|
2843
3330
|
postgres: "/logos/datasources/postgres.svg",
|
|
2844
3331
|
snowflake: "/logos/datasources/snowflake.svg",
|
|
@@ -2860,9 +3347,9 @@ var DATASOURCE_LOGOS = {
|
|
|
2860
3347
|
firebase: "/logos/datasources/firebase.svg",
|
|
2861
3348
|
neo4j: "/logos/datasources/neo4j.svg"
|
|
2862
3349
|
};
|
|
2863
|
-
function
|
|
3350
|
+
function getDatasourceLogo2(datasourceId, dialect) {
|
|
2864
3351
|
const search = (dialect ?? datasourceId).toLowerCase();
|
|
2865
|
-
for (const [key, url] of Object.entries(
|
|
3352
|
+
for (const [key, url] of Object.entries(DATASOURCE_LOGOS2)) {
|
|
2866
3353
|
if (search.includes(key)) return url;
|
|
2867
3354
|
}
|
|
2868
3355
|
return null;
|
|
@@ -2889,7 +3376,7 @@ var DatasourceFlowNode = memo(function DatasourceFlowNode2({ id, data, selected
|
|
|
2889
3376
|
}
|
|
2890
3377
|
const columnCount = config.selectedColumns?.length ?? 0;
|
|
2891
3378
|
const filterCount = config.filterVariables ? Object.keys(config.filterVariables).length : 0;
|
|
2892
|
-
const logo =
|
|
3379
|
+
const logo = getDatasourceLogo2(config.datasourceId, config.dialect);
|
|
2893
3380
|
const content = /* @__PURE__ */ jsxs(NodeCard, { compact: isCompact, selected, nodeType: "datasource", children: [
|
|
2894
3381
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
2895
3382
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
@@ -2956,7 +3443,7 @@ var DatasourceFlowNode = memo(function DatasourceFlowNode2({ id, data, selected
|
|
|
2956
3443
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2957
3444
|
/* @__PURE__ */ jsx(NodeRunningIndicator, { nodeId: id }),
|
|
2958
3445
|
/* @__PURE__ */ jsx(WorkflowHandle, { type: "target", position: Position.Left, id: "left-in", colorClass: "!bg-cyan-400" }),
|
|
2959
|
-
|
|
3446
|
+
!onEdit ? /* @__PURE__ */ jsx("div", { className: "w-full", children: content }) : /* @__PURE__ */ jsx(
|
|
2960
3447
|
"button",
|
|
2961
3448
|
{
|
|
2962
3449
|
type: "button",
|
|
@@ -4509,332 +4996,55 @@ function ListOperatorNodeConfigForm({ config, onSave, onCancel }) {
|
|
|
4509
4996
|
/* @__PURE__ */ jsx(
|
|
4510
4997
|
"input",
|
|
4511
4998
|
{
|
|
4512
|
-
type: "text",
|
|
4513
|
-
value: condition,
|
|
4514
|
-
onChange: (event) => setCondition(event.target.value),
|
|
4515
|
-
placeholder: t("conditionPlaceholder"),
|
|
4516
|
-
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4517
|
-
}
|
|
4518
|
-
)
|
|
4519
|
-
] }),
|
|
4520
|
-
showSortFields && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4521
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4522
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("sortKeyLabel") }),
|
|
4523
|
-
/* @__PURE__ */ jsx(
|
|
4524
|
-
"input",
|
|
4525
|
-
{
|
|
4526
|
-
type: "text",
|
|
4527
|
-
value: sortKey,
|
|
4528
|
-
onChange: (event) => setSortKey(event.target.value),
|
|
4529
|
-
placeholder: t("sortKeyPlaceholder"),
|
|
4530
|
-
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4531
|
-
}
|
|
4532
|
-
)
|
|
4533
|
-
] }),
|
|
4534
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4535
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("sortOrderLabel") }),
|
|
4536
|
-
/* @__PURE__ */ jsx(
|
|
4537
|
-
"select",
|
|
4538
|
-
{
|
|
4539
|
-
value: sortOrder,
|
|
4540
|
-
onChange: (event) => setSortOrder(event.target.value),
|
|
4541
|
-
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500",
|
|
4542
|
-
children: SORT_ORDER_OPTIONS.map((order) => /* @__PURE__ */ jsx("option", { value: order, children: t(`sortOrder_${order}`) }, order))
|
|
4543
|
-
}
|
|
4544
|
-
)
|
|
4545
|
-
] })
|
|
4546
|
-
] }),
|
|
4547
|
-
showLimitField && /* @__PURE__ */ jsxs("div", { children: [
|
|
4548
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("limitCountLabel") }),
|
|
4549
|
-
/* @__PURE__ */ jsx(
|
|
4550
|
-
"input",
|
|
4551
|
-
{
|
|
4552
|
-
type: "number",
|
|
4553
|
-
value: limitCount,
|
|
4554
|
-
onChange: (event) => setLimitCount(Number(event.target.value)),
|
|
4555
|
-
min: 1,
|
|
4556
|
-
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4557
|
-
}
|
|
4558
|
-
)
|
|
4559
|
-
] }),
|
|
4560
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700", children: [
|
|
4561
|
-
/* @__PURE__ */ jsx(
|
|
4562
|
-
"button",
|
|
4563
|
-
{
|
|
4564
|
-
type: "button",
|
|
4565
|
-
onClick: onCancel,
|
|
4566
|
-
className: "rounded-lg border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
|
|
4567
|
-
children: t("cancel")
|
|
4568
|
-
}
|
|
4569
|
-
),
|
|
4570
|
-
/* @__PURE__ */ jsx(
|
|
4571
|
-
"button",
|
|
4572
|
-
{
|
|
4573
|
-
type: "button",
|
|
4574
|
-
onClick: handleSave,
|
|
4575
|
-
className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 dark:bg-indigo-500 dark:hover:bg-indigo-600",
|
|
4576
|
-
children: t("save")
|
|
4577
|
-
}
|
|
4578
|
-
)
|
|
4579
|
-
] })
|
|
4580
|
-
] });
|
|
4581
|
-
}
|
|
4582
|
-
function IterationStartNodeConfigForm({ config, onSave, onCancel }) {
|
|
4583
|
-
const t = useTranslations("agents.workflow.iterationStartNodeConfig");
|
|
4584
|
-
const [iteratorVariable, setIteratorVariable] = useState(config.iteratorVariable);
|
|
4585
|
-
const [itemVariable, setItemVariable] = useState(config.itemVariable);
|
|
4586
|
-
const [indexVariable, setIndexVariable] = useState(config.indexVariable);
|
|
4587
|
-
const handleSave = () => {
|
|
4588
|
-
onSave({ ...config, iteratorVariable, itemVariable, indexVariable });
|
|
4589
|
-
};
|
|
4590
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
4591
|
-
/* @__PURE__ */ jsx(
|
|
4592
|
-
FormInput,
|
|
4593
|
-
{
|
|
4594
|
-
type: "text",
|
|
4595
|
-
label: t("iteratorVariableLabel"),
|
|
4596
|
-
value: iteratorVariable,
|
|
4597
|
-
onValueChange: setIteratorVariable,
|
|
4598
|
-
placeholder: t("iteratorVariablePlaceholder")
|
|
4599
|
-
}
|
|
4600
|
-
),
|
|
4601
|
-
/* @__PURE__ */ jsx(
|
|
4602
|
-
FormInput,
|
|
4603
|
-
{
|
|
4604
|
-
type: "text",
|
|
4605
|
-
label: t("itemVariableLabel"),
|
|
4606
|
-
value: itemVariable,
|
|
4607
|
-
onValueChange: setItemVariable,
|
|
4608
|
-
placeholder: t("itemVariablePlaceholder")
|
|
4609
|
-
}
|
|
4610
|
-
),
|
|
4611
|
-
/* @__PURE__ */ jsx(
|
|
4612
|
-
FormInput,
|
|
4613
|
-
{
|
|
4614
|
-
type: "text",
|
|
4615
|
-
label: t("indexVariableLabel"),
|
|
4616
|
-
value: indexVariable,
|
|
4617
|
-
onValueChange: setIndexVariable,
|
|
4618
|
-
placeholder: t("indexVariablePlaceholder")
|
|
4619
|
-
}
|
|
4620
|
-
),
|
|
4621
|
-
/* @__PURE__ */ jsx(
|
|
4622
|
-
ConfigFormActions,
|
|
4623
|
-
{
|
|
4624
|
-
cancelLabel: t("cancel"),
|
|
4625
|
-
saveLabel: t("save"),
|
|
4626
|
-
onCancel,
|
|
4627
|
-
onSave: handleSave
|
|
4628
|
-
}
|
|
4629
|
-
)
|
|
4630
|
-
] });
|
|
4631
|
-
}
|
|
4632
|
-
var FIELD_TYPE_BADGE_COLORS = {
|
|
4633
|
-
string: "bg-gray-100 text-gray-600 dark:bg-gray-500/20 dark:text-gray-300",
|
|
4634
|
-
number: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
|
|
4635
|
-
boolean: "bg-green-100 text-green-600 dark:bg-green-500/20 dark:text-green-300",
|
|
4636
|
-
date: "bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-300",
|
|
4637
|
-
object: "bg-purple-100 text-purple-600 dark:bg-purple-500/20 dark:text-purple-300",
|
|
4638
|
-
array: "bg-teal-100 text-teal-600 dark:bg-teal-500/20 dark:text-teal-300"
|
|
4639
|
-
};
|
|
4640
|
-
function EntityNodeConfigForm({ config, entities = [], onSave, onCancel }) {
|
|
4641
|
-
const t = useTranslations("agents.workflow.entityNodeConfig");
|
|
4642
|
-
const [selectedFields, setSelectedFields] = useState([...config.selectedFields]);
|
|
4643
|
-
const [outputVariable, setOutputVariable] = useState(config.outputVariable);
|
|
4644
|
-
const [limit, setLimit] = useState(config.limit);
|
|
4645
|
-
const [filterVariables, setFilterVariables] = useState({ ...config.filterVariables });
|
|
4646
|
-
const entityDefinition = useMemo(
|
|
4647
|
-
() => entities.find((entity) => entity.id === config.entityMasterId),
|
|
4648
|
-
[entities, config.entityMasterId]
|
|
4649
|
-
);
|
|
4650
|
-
const availableFields = useMemo(() => entityDefinition?.fields ?? [], [entityDefinition]);
|
|
4651
|
-
const allFieldNames = useMemo(() => availableFields.map((field) => field.name), [availableFields]);
|
|
4652
|
-
const allSelected = selectedFields.length === allFieldNames.length;
|
|
4653
|
-
const gradient = getEntityGradient(config.entityMasterId);
|
|
4654
|
-
const badgeColor = getEntityBadgeColor(config.entityMasterId);
|
|
4655
|
-
const handleToggleSelectAll = () => {
|
|
4656
|
-
if (allSelected) {
|
|
4657
|
-
setSelectedFields([]);
|
|
4658
|
-
} else {
|
|
4659
|
-
setSelectedFields([...allFieldNames]);
|
|
4660
|
-
}
|
|
4661
|
-
};
|
|
4662
|
-
const handleToggleField = (fieldName) => {
|
|
4663
|
-
setSelectedFields(
|
|
4664
|
-
(previous) => previous.includes(fieldName) ? previous.filter((name) => name !== fieldName) : [...previous, fieldName]
|
|
4665
|
-
);
|
|
4666
|
-
};
|
|
4667
|
-
const handleAddFilter = () => {
|
|
4668
|
-
setFilterVariables((previous) => ({ ...previous, "": "" }));
|
|
4669
|
-
};
|
|
4670
|
-
const handleUpdateFilterVariable = (oldKey, newKey) => {
|
|
4671
|
-
setFilterVariables((previous) => {
|
|
4672
|
-
const updated = { ...previous };
|
|
4673
|
-
const value = updated[oldKey] ?? "";
|
|
4674
|
-
delete updated[oldKey];
|
|
4675
|
-
updated[newKey] = value;
|
|
4676
|
-
return updated;
|
|
4677
|
-
});
|
|
4678
|
-
};
|
|
4679
|
-
const handleUpdateFilterField = (key, newValue) => {
|
|
4680
|
-
setFilterVariables((previous) => ({ ...previous, [key]: newValue }));
|
|
4681
|
-
};
|
|
4682
|
-
const handleRemoveFilter = (key) => {
|
|
4683
|
-
setFilterVariables((previous) => {
|
|
4684
|
-
const updated = { ...previous };
|
|
4685
|
-
delete updated[key];
|
|
4686
|
-
return updated;
|
|
4687
|
-
});
|
|
4688
|
-
};
|
|
4689
|
-
const handleSave = () => {
|
|
4690
|
-
const cleanedFilters = {};
|
|
4691
|
-
for (const [key, value] of Object.entries(filterVariables)) {
|
|
4692
|
-
if (key.trim() && value.trim()) {
|
|
4693
|
-
cleanedFilters[key.trim()] = value.trim();
|
|
4694
|
-
}
|
|
4695
|
-
}
|
|
4696
|
-
onSave({
|
|
4697
|
-
...config,
|
|
4698
|
-
selectedFields,
|
|
4699
|
-
outputVariable: outputVariable.trim(),
|
|
4700
|
-
limit,
|
|
4701
|
-
filterVariables: cleanedFilters
|
|
4702
|
-
});
|
|
4703
|
-
};
|
|
4704
|
-
const filterEntries = Object.entries(filterVariables);
|
|
4705
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
4706
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4707
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("entityTypeLabel") }),
|
|
4708
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4709
|
-
/* @__PURE__ */ jsx("div", { className: `flex h-6 w-6 items-center justify-center rounded-md bg-gradient-to-br ${gradient}`, children: /* @__PURE__ */ jsx("span", { className: "text-[10px] text-white font-bold", children: (entityDefinition?.label ?? config.entityMasterId ?? "?").charAt(0).toUpperCase() }) }),
|
|
4710
|
-
/* @__PURE__ */ jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${badgeColor}`, children: entityDefinition?.label ?? config.entityMasterId ?? t("entityTypeLabel") })
|
|
4711
|
-
] }),
|
|
4712
|
-
!entityDefinition && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-amber-600 dark:text-amber-400", children: t("entityNotConfigured") })
|
|
4713
|
-
] }),
|
|
4714
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4715
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("outputVariableLabel") }),
|
|
4716
|
-
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("outputVariableHelp") }),
|
|
4717
|
-
/* @__PURE__ */ jsx(
|
|
4718
|
-
"input",
|
|
4719
|
-
{
|
|
4720
|
-
type: "text",
|
|
4721
|
-
value: outputVariable,
|
|
4722
|
-
onChange: (event) => setOutputVariable(event.target.value),
|
|
4723
|
-
placeholder: `${(entityDefinition?.label ?? "entity").replace(/\s+/g, "")}Data`,
|
|
4724
|
-
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4725
|
-
}
|
|
4726
|
-
)
|
|
4727
|
-
] }),
|
|
4728
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4729
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("limitLabel") }),
|
|
4730
|
-
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("limitHelp") }),
|
|
4731
|
-
/* @__PURE__ */ jsx(
|
|
4732
|
-
"input",
|
|
4733
|
-
{
|
|
4734
|
-
type: "number",
|
|
4735
|
-
value: limit,
|
|
4736
|
-
onChange: (event) => setLimit(Math.max(1, Number.parseInt(event.target.value, 10) || 1)),
|
|
4737
|
-
min: 1,
|
|
4738
|
-
max: 1e3,
|
|
4739
|
-
className: "w-32 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white"
|
|
4999
|
+
type: "text",
|
|
5000
|
+
value: condition,
|
|
5001
|
+
onChange: (event) => setCondition(event.target.value),
|
|
5002
|
+
placeholder: t("conditionPlaceholder"),
|
|
5003
|
+
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4740
5004
|
}
|
|
4741
5005
|
)
|
|
4742
5006
|
] }),
|
|
4743
|
-
/* @__PURE__ */ jsxs(
|
|
4744
|
-
/* @__PURE__ */ jsxs("div", {
|
|
4745
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("
|
|
5007
|
+
showSortFields && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5008
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5009
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("sortKeyLabel") }),
|
|
4746
5010
|
/* @__PURE__ */ jsx(
|
|
4747
|
-
"
|
|
4748
|
-
{
|
|
4749
|
-
type: "button",
|
|
4750
|
-
onClick: handleToggleSelectAll,
|
|
4751
|
-
className: "text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",
|
|
4752
|
-
children: allSelected ? t("deselectAll") : t("selectAll")
|
|
4753
|
-
}
|
|
4754
|
-
)
|
|
4755
|
-
] }),
|
|
4756
|
-
selectedFields.length === 0 && /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-amber-600 dark:text-amber-400", children: t("noFieldsSelected") }),
|
|
4757
|
-
/* @__PURE__ */ jsxs("div", { className: "max-h-48 space-y-1 overflow-y-auto rounded-lg border border-gray-200 p-2 dark:border-gray-700", children: [
|
|
4758
|
-
availableFields.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-2 py-2 text-xs text-gray-500 dark:text-gray-400", children: t("noFieldsSelected") }),
|
|
4759
|
-
availableFields.map((field) => {
|
|
4760
|
-
const isSelected = selectedFields.includes(field.name);
|
|
4761
|
-
const typeBadgeColor = FIELD_TYPE_BADGE_COLORS[field.type] ?? FIELD_TYPE_BADGE_COLORS.string;
|
|
4762
|
-
return /* @__PURE__ */ jsxs(
|
|
4763
|
-
"label",
|
|
4764
|
-
{
|
|
4765
|
-
className: `flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors ${isSelected ? "bg-indigo-50 dark:bg-indigo-500/10" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
|
|
4766
|
-
children: [
|
|
4767
|
-
/* @__PURE__ */ jsx(
|
|
4768
|
-
"input",
|
|
4769
|
-
{
|
|
4770
|
-
type: "checkbox",
|
|
4771
|
-
checked: isSelected,
|
|
4772
|
-
onChange: () => handleToggleField(field.name),
|
|
4773
|
-
className: "h-3.5 w-3.5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600"
|
|
4774
|
-
}
|
|
4775
|
-
),
|
|
4776
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 text-xs font-medium text-gray-900 dark:text-white", children: field.name }),
|
|
4777
|
-
/* @__PURE__ */ jsx("span", { className: `rounded-full px-1.5 py-0.5 text-[9px] font-medium ${typeBadgeColor}`, children: field.type })
|
|
4778
|
-
]
|
|
4779
|
-
},
|
|
4780
|
-
field.name
|
|
4781
|
-
);
|
|
4782
|
-
})
|
|
4783
|
-
] })
|
|
4784
|
-
] }),
|
|
4785
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4786
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
4787
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("filtersLabel") }),
|
|
4788
|
-
/* @__PURE__ */ jsxs(
|
|
4789
|
-
"button",
|
|
5011
|
+
"input",
|
|
4790
5012
|
{
|
|
4791
|
-
type: "
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
t("addFilter")
|
|
4797
|
-
]
|
|
5013
|
+
type: "text",
|
|
5014
|
+
value: sortKey,
|
|
5015
|
+
onChange: (event) => setSortKey(event.target.value),
|
|
5016
|
+
placeholder: t("sortKeyPlaceholder"),
|
|
5017
|
+
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4798
5018
|
}
|
|
4799
5019
|
)
|
|
4800
5020
|
] }),
|
|
4801
|
-
/* @__PURE__ */
|
|
4802
|
-
|
|
5021
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5022
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("sortOrderLabel") }),
|
|
4803
5023
|
/* @__PURE__ */ jsx(
|
|
4804
|
-
"input",
|
|
4805
|
-
{
|
|
4806
|
-
type: "text",
|
|
4807
|
-
value: variableName,
|
|
4808
|
-
onChange: (event) => handleUpdateFilterVariable(variableName, event.target.value),
|
|
4809
|
-
placeholder: t("variableName"),
|
|
4810
|
-
className: "flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
4811
|
-
}
|
|
4812
|
-
),
|
|
4813
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400", children: "\u2192" }),
|
|
4814
|
-
/* @__PURE__ */ jsxs(
|
|
4815
5024
|
"select",
|
|
4816
5025
|
{
|
|
4817
|
-
value:
|
|
4818
|
-
onChange: (event) =>
|
|
4819
|
-
className: "
|
|
4820
|
-
children:
|
|
4821
|
-
/* @__PURE__ */ jsx("option", { value: "", children: t("fieldName") }),
|
|
4822
|
-
availableFields.map((field) => /* @__PURE__ */ jsx("option", { value: field.name, children: field.name }, field.name))
|
|
4823
|
-
]
|
|
4824
|
-
}
|
|
4825
|
-
),
|
|
4826
|
-
/* @__PURE__ */ jsx(
|
|
4827
|
-
"button",
|
|
4828
|
-
{
|
|
4829
|
-
type: "button",
|
|
4830
|
-
onClick: () => handleRemoveFilter(variableName),
|
|
4831
|
-
className: "rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
|
|
4832
|
-
children: /* @__PURE__ */ jsx(XMarkIcon$1, { className: "h-3.5 w-3.5" })
|
|
5026
|
+
value: sortOrder,
|
|
5027
|
+
onChange: (event) => setSortOrder(event.target.value),
|
|
5028
|
+
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500",
|
|
5029
|
+
children: SORT_ORDER_OPTIONS.map((order) => /* @__PURE__ */ jsx("option", { value: order, children: t(`sortOrder_${order}`) }, order))
|
|
4833
5030
|
}
|
|
4834
5031
|
)
|
|
4835
|
-
] }
|
|
5032
|
+
] })
|
|
4836
5033
|
] }),
|
|
4837
|
-
/* @__PURE__ */ jsxs("div", {
|
|
5034
|
+
showLimitField && /* @__PURE__ */ jsxs("div", { children: [
|
|
5035
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("limitCountLabel") }),
|
|
5036
|
+
/* @__PURE__ */ jsx(
|
|
5037
|
+
"input",
|
|
5038
|
+
{
|
|
5039
|
+
type: "number",
|
|
5040
|
+
value: limitCount,
|
|
5041
|
+
onChange: (event) => setLimitCount(Number(event.target.value)),
|
|
5042
|
+
min: 1,
|
|
5043
|
+
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
5044
|
+
}
|
|
5045
|
+
)
|
|
5046
|
+
] }),
|
|
5047
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700", children: [
|
|
4838
5048
|
/* @__PURE__ */ jsx(
|
|
4839
5049
|
"button",
|
|
4840
5050
|
{
|
|
@@ -4849,149 +5059,100 @@ function EntityNodeConfigForm({ config, entities = [], onSave, onCancel }) {
|
|
|
4849
5059
|
{
|
|
4850
5060
|
type: "button",
|
|
4851
5061
|
onClick: handleSave,
|
|
4852
|
-
|
|
4853
|
-
className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-indigo-500 dark:hover:bg-indigo-600",
|
|
5062
|
+
className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 dark:bg-indigo-500 dark:hover:bg-indigo-600",
|
|
4854
5063
|
children: t("save")
|
|
4855
5064
|
}
|
|
4856
5065
|
)
|
|
4857
5066
|
] })
|
|
4858
5067
|
] });
|
|
4859
5068
|
}
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
function SectionHeader({ icon: Icon, title, badge }) {
|
|
4909
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
4910
|
-
/* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 text-gray-400 dark:text-gray-500" }),
|
|
4911
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: title }),
|
|
4912
|
-
badge !== void 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto rounded-full bg-indigo-500/10 px-2 py-0.5 text-[10px] font-semibold text-indigo-600 dark:text-indigo-400", children: badge })
|
|
5069
|
+
function IterationStartNodeConfigForm({ config, onSave, onCancel }) {
|
|
5070
|
+
const t = useTranslations("agents.workflow.iterationStartNodeConfig");
|
|
5071
|
+
const [iteratorVariable, setIteratorVariable] = useState(config.iteratorVariable);
|
|
5072
|
+
const [itemVariable, setItemVariable] = useState(config.itemVariable);
|
|
5073
|
+
const [indexVariable, setIndexVariable] = useState(config.indexVariable);
|
|
5074
|
+
const handleSave = () => {
|
|
5075
|
+
onSave({ ...config, iteratorVariable, itemVariable, indexVariable });
|
|
5076
|
+
};
|
|
5077
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
5078
|
+
/* @__PURE__ */ jsx(
|
|
5079
|
+
FormInput,
|
|
5080
|
+
{
|
|
5081
|
+
type: "text",
|
|
5082
|
+
label: t("iteratorVariableLabel"),
|
|
5083
|
+
value: iteratorVariable,
|
|
5084
|
+
onValueChange: setIteratorVariable,
|
|
5085
|
+
placeholder: t("iteratorVariablePlaceholder")
|
|
5086
|
+
}
|
|
5087
|
+
),
|
|
5088
|
+
/* @__PURE__ */ jsx(
|
|
5089
|
+
FormInput,
|
|
5090
|
+
{
|
|
5091
|
+
type: "text",
|
|
5092
|
+
label: t("itemVariableLabel"),
|
|
5093
|
+
value: itemVariable,
|
|
5094
|
+
onValueChange: setItemVariable,
|
|
5095
|
+
placeholder: t("itemVariablePlaceholder")
|
|
5096
|
+
}
|
|
5097
|
+
),
|
|
5098
|
+
/* @__PURE__ */ jsx(
|
|
5099
|
+
FormInput,
|
|
5100
|
+
{
|
|
5101
|
+
type: "text",
|
|
5102
|
+
label: t("indexVariableLabel"),
|
|
5103
|
+
value: indexVariable,
|
|
5104
|
+
onValueChange: setIndexVariable,
|
|
5105
|
+
placeholder: t("indexVariablePlaceholder")
|
|
5106
|
+
}
|
|
5107
|
+
),
|
|
5108
|
+
/* @__PURE__ */ jsx(
|
|
5109
|
+
ConfigFormActions,
|
|
5110
|
+
{
|
|
5111
|
+
cancelLabel: t("cancel"),
|
|
5112
|
+
saveLabel: t("save"),
|
|
5113
|
+
onCancel,
|
|
5114
|
+
onSave: handleSave
|
|
5115
|
+
}
|
|
5116
|
+
)
|
|
4913
5117
|
] });
|
|
4914
5118
|
}
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
}) {
|
|
4924
|
-
const t = useTranslations("agents.workflow.
|
|
4925
|
-
const [
|
|
4926
|
-
const [
|
|
4927
|
-
const [
|
|
4928
|
-
const [
|
|
4929
|
-
const
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
const [filterVariables, setFilterVariables] = useState({ ...config.filterVariables });
|
|
4933
|
-
const [tableSearch, setTableSearch] = useState("");
|
|
4934
|
-
const [columnSearch, setColumnSearch] = useState("");
|
|
4935
|
-
const allColumnNames = availableColumns.map((column) => column.name);
|
|
4936
|
-
const allSelected = selectedColumns.length > 0 && selectedColumns.length === allColumnNames.length;
|
|
4937
|
-
const selectedDatasource = datasources.find((datasource) => datasource.id === selectedDatasourceId);
|
|
4938
|
-
const filteredTables = useMemo(
|
|
4939
|
-
() => tableSearch ? availableTables.filter((table) => table.toLowerCase().includes(tableSearch.toLowerCase())) : availableTables,
|
|
4940
|
-
[availableTables, tableSearch]
|
|
4941
|
-
);
|
|
4942
|
-
const filteredColumns = useMemo(
|
|
4943
|
-
() => columnSearch ? availableColumns.filter((column) => column.name.toLowerCase().includes(columnSearch.toLowerCase())) : availableColumns,
|
|
4944
|
-
[availableColumns, columnSearch]
|
|
5119
|
+
var FIELD_TYPE_BADGE_COLORS = {
|
|
5120
|
+
string: "bg-gray-100 text-gray-600 dark:bg-gray-500/20 dark:text-gray-300",
|
|
5121
|
+
number: "bg-blue-100 text-blue-600 dark:bg-blue-500/20 dark:text-blue-300",
|
|
5122
|
+
boolean: "bg-green-100 text-green-600 dark:bg-green-500/20 dark:text-green-300",
|
|
5123
|
+
date: "bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-300",
|
|
5124
|
+
object: "bg-purple-100 text-purple-600 dark:bg-purple-500/20 dark:text-purple-300",
|
|
5125
|
+
array: "bg-teal-100 text-teal-600 dark:bg-teal-500/20 dark:text-teal-300"
|
|
5126
|
+
};
|
|
5127
|
+
function EntityNodeConfigForm({ config, entities = [], onSave, onCancel }) {
|
|
5128
|
+
const t = useTranslations("agents.workflow.entityNodeConfig");
|
|
5129
|
+
const [selectedFields, setSelectedFields] = useState([...config.selectedFields]);
|
|
5130
|
+
const [outputVariable, setOutputVariable] = useState(config.outputVariable);
|
|
5131
|
+
const [limit, setLimit] = useState(config.limit);
|
|
5132
|
+
const [filterVariables, setFilterVariables] = useState({ ...config.filterVariables });
|
|
5133
|
+
const entityDefinition = useMemo(
|
|
5134
|
+
() => entities.find((entity) => entity.id === config.entityMasterId),
|
|
5135
|
+
[entities, config.entityMasterId]
|
|
4945
5136
|
);
|
|
4946
|
-
const
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
const tables = await onLoadTables(datasourceId);
|
|
4952
|
-
setAvailableTables(tables);
|
|
4953
|
-
}, [onLoadTables]);
|
|
4954
|
-
const loadSchema = useCallback(async (datasourceId, table) => {
|
|
4955
|
-
if (!datasourceId || !table) {
|
|
4956
|
-
setAvailableColumns([]);
|
|
4957
|
-
return;
|
|
4958
|
-
}
|
|
4959
|
-
const columns = await onLoadSchema(datasourceId, table);
|
|
4960
|
-
setAvailableColumns(columns);
|
|
4961
|
-
}, [onLoadSchema]);
|
|
4962
|
-
useEffect(() => {
|
|
4963
|
-
if (selectedDatasourceId) loadTables(selectedDatasourceId);
|
|
4964
|
-
}, [selectedDatasourceId, loadTables]);
|
|
4965
|
-
useEffect(() => {
|
|
4966
|
-
if (selectedDatasourceId && selectedTable) loadSchema(selectedDatasourceId, selectedTable);
|
|
4967
|
-
}, [selectedDatasourceId, selectedTable, loadSchema]);
|
|
4968
|
-
const handleDatasourceChange = (datasourceId) => {
|
|
4969
|
-
setSelectedDatasourceId(datasourceId);
|
|
4970
|
-
setSelectedTable("");
|
|
4971
|
-
setAvailableTables([]);
|
|
4972
|
-
setAvailableColumns([]);
|
|
4973
|
-
setSelectedColumns([]);
|
|
4974
|
-
setFilterVariables({});
|
|
4975
|
-
setTableSearch("");
|
|
4976
|
-
setColumnSearch("");
|
|
4977
|
-
};
|
|
4978
|
-
const handleTableChange = (table) => {
|
|
4979
|
-
setSelectedTable(table);
|
|
4980
|
-
setAvailableColumns([]);
|
|
4981
|
-
setSelectedColumns([]);
|
|
4982
|
-
setFilterVariables({});
|
|
4983
|
-
setColumnSearch("");
|
|
4984
|
-
};
|
|
5137
|
+
const availableFields = useMemo(() => entityDefinition?.fields ?? [], [entityDefinition]);
|
|
5138
|
+
const allFieldNames = useMemo(() => availableFields.map((field) => field.name), [availableFields]);
|
|
5139
|
+
const allSelected = selectedFields.length === allFieldNames.length;
|
|
5140
|
+
const gradient = getEntityGradient(config.entityMasterId);
|
|
5141
|
+
const badgeColor = getEntityBadgeColor(config.entityMasterId);
|
|
4985
5142
|
const handleToggleSelectAll = () => {
|
|
4986
|
-
|
|
5143
|
+
if (allSelected) {
|
|
5144
|
+
setSelectedFields([]);
|
|
5145
|
+
} else {
|
|
5146
|
+
setSelectedFields([...allFieldNames]);
|
|
5147
|
+
}
|
|
4987
5148
|
};
|
|
4988
|
-
const
|
|
4989
|
-
|
|
4990
|
-
(previous) => previous.includes(
|
|
5149
|
+
const handleToggleField = (fieldName) => {
|
|
5150
|
+
setSelectedFields(
|
|
5151
|
+
(previous) => previous.includes(fieldName) ? previous.filter((name) => name !== fieldName) : [...previous, fieldName]
|
|
4991
5152
|
);
|
|
4992
5153
|
};
|
|
4993
5154
|
const handleAddFilter = () => {
|
|
4994
|
-
setFilterVariables((previous) => ({ ...previous,
|
|
5155
|
+
setFilterVariables((previous) => ({ ...previous, "": "" }));
|
|
4995
5156
|
};
|
|
4996
5157
|
const handleUpdateFilterVariable = (oldKey, newKey) => {
|
|
4997
5158
|
setFilterVariables((previous) => {
|
|
@@ -5015,185 +5176,108 @@ function DatasourceNodeConfigForm({
|
|
|
5015
5176
|
const handleSave = () => {
|
|
5016
5177
|
const cleanedFilters = {};
|
|
5017
5178
|
for (const [key, value] of Object.entries(filterVariables)) {
|
|
5018
|
-
if (key.trim() && value.trim())
|
|
5179
|
+
if (key.trim() && value.trim()) {
|
|
5180
|
+
cleanedFilters[key.trim()] = value.trim();
|
|
5181
|
+
}
|
|
5019
5182
|
}
|
|
5020
5183
|
onSave({
|
|
5021
5184
|
...config,
|
|
5022
|
-
|
|
5023
|
-
dialect: selectedDatasource?.dialect ?? "",
|
|
5024
|
-
table: selectedTable,
|
|
5025
|
-
selectedColumns,
|
|
5185
|
+
selectedFields,
|
|
5026
5186
|
outputVariable: outputVariable.trim(),
|
|
5027
5187
|
limit,
|
|
5028
5188
|
filterVariables: cleanedFilters
|
|
5029
5189
|
});
|
|
5030
5190
|
};
|
|
5031
5191
|
const filterEntries = Object.entries(filterVariables);
|
|
5032
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-
|
|
5192
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
5033
5193
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
5034
|
-
/* @__PURE__ */ jsx(
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
{
|
|
5041
|
-
type: "button",
|
|
5042
|
-
onClick: () => handleDatasourceChange(datasource.id),
|
|
5043
|
-
className: `flex items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all ${isSelected ? "border-cyan-500/50 bg-cyan-500/5 ring-1 ring-cyan-500/20 dark:border-cyan-400/40 dark:bg-cyan-400/5" : "border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm dark:border-white/10 dark:bg-white/[0.03] dark:hover:border-white/20"}`,
|
|
5044
|
-
children: [
|
|
5045
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-9 w-9 shrink-0 items-center justify-center", children: logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: datasource.dialect, className: "h-7 w-7" }) : /* @__PURE__ */ jsx(ServerStackIcon, { className: "h-6 w-6 text-gray-400" }) }),
|
|
5046
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
5047
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs font-semibold text-gray-900 dark:text-white", children: datasource.name }),
|
|
5048
|
-
/* @__PURE__ */ jsx("p", { className: "text-[10px] text-gray-400 dark:text-gray-500", children: datasource.dialect })
|
|
5049
|
-
] }),
|
|
5050
|
-
isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4 shrink-0 text-cyan-500 dark:text-cyan-400" })
|
|
5051
|
-
]
|
|
5052
|
-
},
|
|
5053
|
-
datasource.id
|
|
5054
|
-
);
|
|
5055
|
-
}) })
|
|
5194
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("entityTypeLabel") }),
|
|
5195
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
5196
|
+
/* @__PURE__ */ jsx("div", { className: `flex h-6 w-6 items-center justify-center rounded-md bg-gradient-to-br ${gradient}`, children: /* @__PURE__ */ jsx("span", { className: "text-[10px] text-white font-bold", children: (entityDefinition?.label ?? config.entityMasterId ?? "?").charAt(0).toUpperCase() }) }),
|
|
5197
|
+
/* @__PURE__ */ jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${badgeColor}`, children: entityDefinition?.label ?? config.entityMasterId ?? t("entityTypeLabel") })
|
|
5198
|
+
] }),
|
|
5199
|
+
!entityDefinition && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-amber-600 dark:text-amber-400", children: t("entityNotConfigured") })
|
|
5056
5200
|
] }),
|
|
5057
|
-
|
|
5058
|
-
/* @__PURE__ */ jsx(
|
|
5059
|
-
/* @__PURE__ */
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
}
|
|
5071
|
-
)
|
|
5072
|
-
] }),
|
|
5073
|
-
/* @__PURE__ */ jsxs("div", { className: "max-h-36 overflow-y-auto p-1", children: [
|
|
5074
|
-
filteredTables.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-3 text-center text-[10px] text-gray-400", children: availableTables.length === 0 ? t("noColumnsAvailable") : "No matches" }),
|
|
5075
|
-
filteredTables.map((table) => {
|
|
5076
|
-
const isSelected = table === selectedTable;
|
|
5077
|
-
return /* @__PURE__ */ jsxs(
|
|
5078
|
-
"button",
|
|
5079
|
-
{
|
|
5080
|
-
type: "button",
|
|
5081
|
-
onClick: () => handleTableChange(table),
|
|
5082
|
-
className: `flex w-full items-center gap-2 rounded-lg px-3 py-1.5 text-left text-xs transition-colors ${isSelected ? "bg-cyan-500/10 font-semibold text-cyan-700 dark:text-cyan-300" : "text-gray-700 hover:bg-gray-100/60 dark:text-gray-300 dark:hover:bg-white/5"}`,
|
|
5083
|
-
children: [
|
|
5084
|
-
/* @__PURE__ */ jsx(TableCellsIcon, { className: "h-3 w-3 shrink-0 text-gray-400" }),
|
|
5085
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: table }),
|
|
5086
|
-
isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto h-3 w-3 shrink-0 text-cyan-500" })
|
|
5087
|
-
]
|
|
5088
|
-
},
|
|
5089
|
-
table
|
|
5090
|
-
);
|
|
5091
|
-
})
|
|
5092
|
-
] })
|
|
5093
|
-
] })
|
|
5201
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5202
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("outputVariableLabel") }),
|
|
5203
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("outputVariableHelp") }),
|
|
5204
|
+
/* @__PURE__ */ jsx(
|
|
5205
|
+
"input",
|
|
5206
|
+
{
|
|
5207
|
+
type: "text",
|
|
5208
|
+
value: outputVariable,
|
|
5209
|
+
onChange: (event) => setOutputVariable(event.target.value),
|
|
5210
|
+
placeholder: `${(entityDefinition?.label ?? "entity").replace(/\s+/g, "")}Data`,
|
|
5211
|
+
className: "w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
5212
|
+
}
|
|
5213
|
+
)
|
|
5094
5214
|
] }),
|
|
5095
|
-
|
|
5096
|
-
/* @__PURE__ */
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
)
|
|
5110
|
-
] })
|
|
5111
|
-
] }),
|
|
5112
|
-
/* @__PURE__ */ jsxs("div", { className: "w-24", children: [
|
|
5113
|
-
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-[10px] font-medium text-gray-500 dark:text-gray-400", children: t("limitLabel") }),
|
|
5114
|
-
/* @__PURE__ */ jsx(
|
|
5115
|
-
"input",
|
|
5116
|
-
{
|
|
5117
|
-
type: "number",
|
|
5118
|
-
value: limit,
|
|
5119
|
-
onChange: (event) => setLimit(Math.max(1, Number.parseInt(event.target.value, 10) || 1)),
|
|
5120
|
-
min: 1,
|
|
5121
|
-
max: 1e4,
|
|
5122
|
-
className: "w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs text-gray-900 outline-none focus:border-cyan-400 dark:border-white/10 dark:bg-white/[0.03] dark:text-white"
|
|
5123
|
-
}
|
|
5124
|
-
)
|
|
5125
|
-
] })
|
|
5215
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5216
|
+
/* @__PURE__ */ jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("limitLabel") }),
|
|
5217
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("limitHelp") }),
|
|
5218
|
+
/* @__PURE__ */ jsx(
|
|
5219
|
+
"input",
|
|
5220
|
+
{
|
|
5221
|
+
type: "number",
|
|
5222
|
+
value: limit,
|
|
5223
|
+
onChange: (event) => setLimit(Math.max(1, Number.parseInt(event.target.value, 10) || 1)),
|
|
5224
|
+
min: 1,
|
|
5225
|
+
max: 1e3,
|
|
5226
|
+
className: "w-32 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white"
|
|
5227
|
+
}
|
|
5228
|
+
)
|
|
5126
5229
|
] }),
|
|
5127
|
-
|
|
5128
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between
|
|
5129
|
-
/* @__PURE__ */ jsx(
|
|
5130
|
-
SectionHeader,
|
|
5131
|
-
{
|
|
5132
|
-
icon: TableCellsIcon,
|
|
5133
|
-
title: t("columnsLabel"),
|
|
5134
|
-
badge: `${selectedColumns.length}/${availableColumns.length}`
|
|
5135
|
-
}
|
|
5136
|
-
),
|
|
5230
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5231
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
5232
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("fieldsLabel") }),
|
|
5137
5233
|
/* @__PURE__ */ jsx(
|
|
5138
5234
|
"button",
|
|
5139
5235
|
{
|
|
5140
5236
|
type: "button",
|
|
5141
5237
|
onClick: handleToggleSelectAll,
|
|
5142
|
-
|
|
5143
|
-
className: "text-[10px] font-semibold text-cyan-600 hover:text-cyan-700 disabled:opacity-40 dark:text-cyan-400 dark:hover:text-cyan-300",
|
|
5238
|
+
className: "text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",
|
|
5144
5239
|
children: allSelected ? t("deselectAll") : t("selectAll")
|
|
5145
5240
|
}
|
|
5146
5241
|
)
|
|
5147
5242
|
] }),
|
|
5148
|
-
/* @__PURE__ */
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5243
|
+
selectedFields.length === 0 && /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-amber-600 dark:text-amber-400", children: t("noFieldsSelected") }),
|
|
5244
|
+
/* @__PURE__ */ jsxs("div", { className: "max-h-48 space-y-1 overflow-y-auto rounded-lg border border-gray-200 p-2 dark:border-gray-700", children: [
|
|
5245
|
+
availableFields.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-2 py-2 text-xs text-gray-500 dark:text-gray-400", children: t("noFieldsSelected") }),
|
|
5246
|
+
availableFields.map((field) => {
|
|
5247
|
+
const isSelected = selectedFields.includes(field.name);
|
|
5248
|
+
const typeBadgeColor = FIELD_TYPE_BADGE_COLORS[field.type] ?? FIELD_TYPE_BADGE_COLORS.string;
|
|
5249
|
+
return /* @__PURE__ */ jsxs(
|
|
5250
|
+
"label",
|
|
5153
5251
|
{
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
className: `flex w-full items-center gap-2 rounded-lg px-3 py-1.5 text-left transition-colors ${isSelected ? "bg-cyan-500/8 dark:bg-cyan-400/5" : "hover:bg-gray-100/60 dark:hover:bg-white/5"}`,
|
|
5173
|
-
children: [
|
|
5174
|
-
/* @__PURE__ */ jsx("div", { className: `flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors ${isSelected ? "border-cyan-500 bg-cyan-500 dark:border-cyan-400 dark:bg-cyan-400" : "border-gray-300 dark:border-gray-600"}`, children: isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "h-2.5 w-2.5 text-white" }) }),
|
|
5175
|
-
/* @__PURE__ */ jsxs("span", { className: "flex-1 truncate text-xs text-gray-900 dark:text-white", children: [
|
|
5176
|
-
column.name,
|
|
5177
|
-
column.nullable && /* @__PURE__ */ jsx("span", { className: "ml-1 text-[9px] text-gray-400", children: "?" })
|
|
5178
|
-
] }),
|
|
5179
|
-
/* @__PURE__ */ jsx("span", { className: `shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-medium ${typeColor}`, children: column.type })
|
|
5180
|
-
]
|
|
5181
|
-
},
|
|
5182
|
-
column.name
|
|
5183
|
-
);
|
|
5184
|
-
})
|
|
5185
|
-
] })
|
|
5252
|
+
className: `flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors ${isSelected ? "bg-indigo-50 dark:bg-indigo-500/10" : "hover:bg-gray-50 dark:hover:bg-gray-800"}`,
|
|
5253
|
+
children: [
|
|
5254
|
+
/* @__PURE__ */ jsx(
|
|
5255
|
+
"input",
|
|
5256
|
+
{
|
|
5257
|
+
type: "checkbox",
|
|
5258
|
+
checked: isSelected,
|
|
5259
|
+
onChange: () => handleToggleField(field.name),
|
|
5260
|
+
className: "h-3.5 w-3.5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600"
|
|
5261
|
+
}
|
|
5262
|
+
),
|
|
5263
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 text-xs font-medium text-gray-900 dark:text-white", children: field.name }),
|
|
5264
|
+
/* @__PURE__ */ jsx("span", { className: `rounded-full px-1.5 py-0.5 text-[9px] font-medium ${typeBadgeColor}`, children: field.type })
|
|
5265
|
+
]
|
|
5266
|
+
},
|
|
5267
|
+
field.name
|
|
5268
|
+
);
|
|
5269
|
+
})
|
|
5186
5270
|
] })
|
|
5187
5271
|
] }),
|
|
5188
|
-
|
|
5189
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between
|
|
5190
|
-
/* @__PURE__ */ jsx(
|
|
5272
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
5273
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
5274
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-gray-700 dark:text-gray-300", children: t("filtersLabel") }),
|
|
5191
5275
|
/* @__PURE__ */ jsxs(
|
|
5192
5276
|
"button",
|
|
5193
5277
|
{
|
|
5194
5278
|
type: "button",
|
|
5195
5279
|
onClick: handleAddFilter,
|
|
5196
|
-
className: "flex items-center gap-1 text-
|
|
5280
|
+
className: "flex items-center gap-1 text-xs font-medium text-indigo-600 hover:text-indigo-700 dark:text-indigo-400 dark:hover:text-indigo-300",
|
|
5197
5281
|
children: [
|
|
5198
5282
|
/* @__PURE__ */ jsx(PlusIcon$1, { className: "h-3 w-3" }),
|
|
5199
5283
|
t("addFilter")
|
|
@@ -5201,28 +5285,29 @@ function DatasourceNodeConfigForm({
|
|
|
5201
5285
|
}
|
|
5202
5286
|
)
|
|
5203
5287
|
] }),
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
"select",
|
|
5207
|
-
{
|
|
5208
|
-
value: columnName,
|
|
5209
|
-
onChange: (event) => handleUpdateFilterField(variableName, event.target.value),
|
|
5210
|
-
className: "flex-1 rounded bg-transparent text-xs text-gray-900 outline-none dark:text-white",
|
|
5211
|
-
children: [
|
|
5212
|
-
/* @__PURE__ */ jsx("option", { value: "", children: t("columnName") }),
|
|
5213
|
-
availableColumns.map((column) => /* @__PURE__ */ jsx("option", { value: column.name, children: column.name }, column.name))
|
|
5214
|
-
]
|
|
5215
|
-
}
|
|
5216
|
-
),
|
|
5217
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-gray-400", children: "=" }),
|
|
5288
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("filtersHelp") }),
|
|
5289
|
+
filterEntries.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: filterEntries.map(([variableName, fieldName], index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
5218
5290
|
/* @__PURE__ */ jsx(
|
|
5219
5291
|
"input",
|
|
5220
5292
|
{
|
|
5221
5293
|
type: "text",
|
|
5222
5294
|
value: variableName,
|
|
5223
5295
|
onChange: (event) => handleUpdateFilterVariable(variableName, event.target.value),
|
|
5224
|
-
placeholder: t("
|
|
5225
|
-
className: "flex-1 bg-
|
|
5296
|
+
placeholder: t("variableName"),
|
|
5297
|
+
className: "flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
|
|
5298
|
+
}
|
|
5299
|
+
),
|
|
5300
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400", children: "\u2192" }),
|
|
5301
|
+
/* @__PURE__ */ jsxs(
|
|
5302
|
+
"select",
|
|
5303
|
+
{
|
|
5304
|
+
value: fieldName,
|
|
5305
|
+
onChange: (event) => handleUpdateFilterField(variableName, event.target.value),
|
|
5306
|
+
className: "flex-1 rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-xs text-gray-900 outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white",
|
|
5307
|
+
children: [
|
|
5308
|
+
/* @__PURE__ */ jsx("option", { value: "", children: t("fieldName") }),
|
|
5309
|
+
availableFields.map((field) => /* @__PURE__ */ jsx("option", { value: field.name, children: field.name }, field.name))
|
|
5310
|
+
]
|
|
5226
5311
|
}
|
|
5227
5312
|
),
|
|
5228
5313
|
/* @__PURE__ */ jsx(
|
|
@@ -5230,20 +5315,29 @@ function DatasourceNodeConfigForm({
|
|
|
5230
5315
|
{
|
|
5231
5316
|
type: "button",
|
|
5232
5317
|
onClick: () => handleRemoveFilter(variableName),
|
|
5233
|
-
className: "
|
|
5234
|
-
children: /* @__PURE__ */ jsx(XMarkIcon$1, { className: "h-3 w-3" })
|
|
5318
|
+
className: "rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20",
|
|
5319
|
+
children: /* @__PURE__ */ jsx(XMarkIcon$1, { className: "h-3.5 w-3.5" })
|
|
5235
5320
|
}
|
|
5236
5321
|
)
|
|
5237
5322
|
] }, index)) })
|
|
5238
5323
|
] }),
|
|
5239
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200
|
|
5240
|
-
/* @__PURE__ */ jsx(
|
|
5324
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200 pt-4 dark:border-gray-700", children: [
|
|
5325
|
+
/* @__PURE__ */ jsx(
|
|
5326
|
+
"button",
|
|
5327
|
+
{
|
|
5328
|
+
type: "button",
|
|
5329
|
+
onClick: onCancel,
|
|
5330
|
+
className: "rounded-lg border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
|
|
5331
|
+
children: t("cancel")
|
|
5332
|
+
}
|
|
5333
|
+
),
|
|
5241
5334
|
/* @__PURE__ */ jsx(
|
|
5242
|
-
|
|
5335
|
+
"button",
|
|
5243
5336
|
{
|
|
5244
|
-
|
|
5337
|
+
type: "button",
|
|
5245
5338
|
onClick: handleSave,
|
|
5246
|
-
disabled:
|
|
5339
|
+
disabled: selectedFields.length === 0,
|
|
5340
|
+
className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-indigo-500 dark:hover:bg-indigo-600",
|
|
5247
5341
|
children: t("save")
|
|
5248
5342
|
}
|
|
5249
5343
|
)
|
|
@@ -5611,18 +5705,8 @@ function LogicNodeModal({ onSave, entities = [], datasources = [], onLoadTables,
|
|
|
5611
5705
|
case "iteration_start":
|
|
5612
5706
|
return /* @__PURE__ */ jsx(IterationStartNodeConfigForm, { config, onSave: handleSave, onCancel: closeModal });
|
|
5613
5707
|
case "datasource":
|
|
5614
|
-
return
|
|
5615
|
-
|
|
5616
|
-
{
|
|
5617
|
-
nodeId,
|
|
5618
|
-
config,
|
|
5619
|
-
onSave: handleSave,
|
|
5620
|
-
onCancel: closeModal,
|
|
5621
|
-
datasources,
|
|
5622
|
-
onLoadTables: onLoadTables ?? (async () => []),
|
|
5623
|
-
onLoadSchema: onLoadSchema ?? (async () => [])
|
|
5624
|
-
}
|
|
5625
|
-
);
|
|
5708
|
+
return null;
|
|
5709
|
+
// Datasource uses its own GlassModal with sidebar — rendered separately
|
|
5626
5710
|
case "entity":
|
|
5627
5711
|
return /* @__PURE__ */ jsx(EntityNodeConfigForm, { config, entities, onSave: handleSave, onCancel: closeModal });
|
|
5628
5712
|
case "group":
|
|
@@ -6054,6 +6138,9 @@ function WorkflowCanvasInner({
|
|
|
6054
6138
|
agentTools = [],
|
|
6055
6139
|
rules,
|
|
6056
6140
|
entities = [],
|
|
6141
|
+
datasources = [],
|
|
6142
|
+
onLoadTables,
|
|
6143
|
+
onLoadSchema,
|
|
6057
6144
|
initialGraph,
|
|
6058
6145
|
onGraphChange,
|
|
6059
6146
|
onEditTool,
|
|
@@ -7410,7 +7497,7 @@ function WorkflowCanvasInner({
|
|
|
7410
7497
|
const handleEdgeClick = useCallback(() => {
|
|
7411
7498
|
closeContextMenu();
|
|
7412
7499
|
}, [closeContextMenu]);
|
|
7413
|
-
useMemo(() => {
|
|
7500
|
+
const editingLogicNode = useMemo(() => {
|
|
7414
7501
|
if (!editingLogicNodeId) return null;
|
|
7415
7502
|
const node = nodes.find((matchingNode) => matchingNode.id === editingLogicNodeId);
|
|
7416
7503
|
if (!node) return null;
|
|
@@ -7586,6 +7673,23 @@ function WorkflowCanvasInner({
|
|
|
7586
7673
|
},
|
|
7587
7674
|
entities: allEntities
|
|
7588
7675
|
}
|
|
7676
|
+
),
|
|
7677
|
+
editingLogicNode?.config?.type === "datasource" && /* @__PURE__ */ jsx(
|
|
7678
|
+
DatasourceNodeConfigForm,
|
|
7679
|
+
{
|
|
7680
|
+
open: true,
|
|
7681
|
+
nodeId: editingLogicNode.nodeId,
|
|
7682
|
+
config: editingLogicNode.config,
|
|
7683
|
+
readOnly: Boolean(nodes.find((n) => n.id === editingLogicNode.nodeId)?.data?.readOnly),
|
|
7684
|
+
onSave: (updatedConfig) => {
|
|
7685
|
+
handleSaveLogicNodeConfig(editingLogicNode.nodeId, updatedConfig);
|
|
7686
|
+
setEditingLogicNodeId(null);
|
|
7687
|
+
},
|
|
7688
|
+
onCancel: () => setEditingLogicNodeId(null),
|
|
7689
|
+
datasources,
|
|
7690
|
+
onLoadTables: onLoadTables ?? (async () => []),
|
|
7691
|
+
onLoadSchema: onLoadSchema ?? (async () => [])
|
|
7692
|
+
}
|
|
7589
7693
|
)
|
|
7590
7694
|
] });
|
|
7591
7695
|
}
|
|
@@ -7724,5 +7828,5 @@ function Workspace({
|
|
|
7724
7828
|
}
|
|
7725
7829
|
|
|
7726
7830
|
export { AgentFlowNode, AgentToolFlowNode, AnswerFlowNode, AnthropicIcon, CATEGORY_COLORS, CATEGORY_PILL_COLORS, CodeFlowNode, CrewAIIcon, DocumentExtractorFlowNode, EndFlowNode, EntityFlowNode, FRAMEWORK_META, GoogleADKIcon, GroupFlowNode, HttpRequestFlowNode, ICON_MAP, IfElseFlowNode, IterationFlowNode, IterationStartFlowNode, KnowledgeBaseFlowNode, LOGIC_ICON_MAP, LOGIC_NODE_BADGE_COLORS, LOGIC_NODE_GRADIENTS, LOGIC_NODE_HANDLE_COLORS, LangChainIcon, ListOperatorFlowNode, LogicNodeModal, MINIMAP_NODE_COLORS, ModelProviderFlowNode, NODE_EXECUTION_ACCENT_COLORS, NodeCard, NodeContextMenu, NoteFlowNode, OpenAIIcon, PanelContextMenu, ParameterExtractorFlowNode, QuestionClassifierFlowNode, RuleFlowNode, SelectionContextMenu, StartFlowNode, StrandsIcon, TemplateTransformFlowNode, ToolFlowNode, VariableAggregatorFlowNode, VariableAssignerFlowNode, WorkflowBuilderProvider, WorkflowCanvas, Workspace, getCompatibleModels, getDefaultFrameworkForModel, getEntityBadgeColor, getEntityGradient, getEntityHandleColor, getEntityIcon, getEntityMinimapColor, getFrameworkMeta, getNodeExecutionAccent, getNodeExecutionAccentRgb, isFrameworkCompatibleWithProviders, isModelCompatibleWithFramework, useModalStore, useWorkflowBuilderClient, useWorkflowBuilderClientOptional, useWorkflowStore };
|
|
7727
|
-
//# sourceMappingURL=chunk-
|
|
7728
|
-
//# sourceMappingURL=chunk-
|
|
7831
|
+
//# sourceMappingURL=chunk-MAGSMQG7.mjs.map
|
|
7832
|
+
//# sourceMappingURL=chunk-MAGSMQG7.mjs.map
|