@solidxai/core-ui 0.1.12-beta.3 → 0.1.12-beta.6
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/components/auth/AuthLayout.d.ts.map +1 -1
- package/dist/components/auth/AuthLayout.js +12 -5
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +15 -4
- package/dist/components/auth/AuthSettingsContext.js +1 -1
- package/dist/components/auth/AuthSettingsContext.js.map +1 -1
- package/dist/components/auth/AuthSettingsContext.tsx +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.js +18 -4
- package/dist/components/core/chatter/SolidChatterHeader.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.tsx +17 -3
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.d.ts.map +1 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.js +12 -2
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.js.map +1 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.tsx +12 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts +2 -0
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js +4 -2
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.tsx +11 -3
- package/dist/components/core/form/SolidFormView.js +1 -1
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js +11 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js.map +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.tsx +26 -19
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -5
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +16 -9
- package/dist/components/core/json/SolidJsonEditor.css +7 -0
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -1
- package/dist/components/core/list/SolidDataTable.js +2 -2
- package/dist/components/core/list/SolidDataTable.js.map +1 -1
- package/dist/components/core/list/SolidDataTable.tsx +2 -1
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +58 -58
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +5 -4
- package/dist/components/core/model/FieldMetaDataForm.d.ts +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +119 -102
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.tsx +82 -39
- package/dist/components/core/model/FieldSelector.d.ts +5 -1
- package/dist/components/core/model/FieldSelector.d.ts.map +1 -1
- package/dist/components/core/model/FieldSelector.js +25 -6
- package/dist/components/core/model/FieldSelector.js.map +1 -1
- package/dist/components/core/model/FieldSelector.tsx +50 -5
- package/dist/components/core/module/CreateModule.css +60 -6
- package/dist/components/core/module/CreateModule.d.ts.map +1 -1
- package/dist/components/core/module/CreateModule.js +2 -2
- package/dist/components/core/module/CreateModule.js.map +1 -1
- package/dist/components/core/module/CreateModule.tsx +56 -37
- package/dist/components/layout/AdminTopHeader.js +1 -1
- package/dist/components/layout/AdminTopHeader.js.map +1 -1
- package/dist/components/layout/AdminTopHeader.tsx +2 -2
- package/dist/components/shad-cn-ui/SolidSelect.d.ts +2 -1
- package/dist/components/shad-cn-ui/SolidSelect.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.js +12 -4
- package/dist/components/shad-cn-ui/SolidSelect.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.tsx +13 -1
- package/dist/helpers/modelViewPersistence.d.ts.map +1 -1
- package/dist/helpers/modelViewPersistence.js +3 -2
- package/dist/helpers/modelViewPersistence.js.map +1 -1
- package/dist/helpers/modelViewPersistence.ts +3 -2
- package/dist/redux/api/datasourceIntrospectionApi.d.ts +43 -1
- package/dist/redux/api/datasourceIntrospectionApi.d.ts.map +1 -1
- package/dist/redux/api/datasourceIntrospectionApi.js +34 -1
- package/dist/redux/api/datasourceIntrospectionApi.js.map +1 -1
- package/dist/redux/api/datasourceIntrospectionApi.ts +61 -0
- package/dist/redux/store/defaultStoreConfig.d.ts +11 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/resources/solid-custom.css +3 -86
- package/dist/resources/solid-tailwind-generated.css +1 -1
- package/dist/resources/themes/solid-dark-purple/theme-variables.css +226 -0
- package/dist/resources/themes/solid-dark-purple/theme.css +1 -185
- package/dist/resources/themes/solid-light-purple/theme-variables.css +237 -0
- package/dist/resources/themes/solid-light-purple/theme.css +1 -206
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.css +396 -31
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js +680 -152
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js.map +1 -1
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.tsx +1358 -441
- package/package.json +1 -1
|
@@ -66,16 +66,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
66
66
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
67
|
};
|
|
68
68
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
69
|
-
import { Cog, Database, ExternalLink, RefreshCw, Save, Search, ShieldAlert, Sparkles, } from "lucide-react";
|
|
70
|
-
import { camelCase } from "lodash";
|
|
69
|
+
import { ArrowLeft, Check, Cog, Database, ExternalLink, RefreshCw, Save, Search, ShieldAlert, Sparkles, } from "lucide-react";
|
|
70
|
+
import { camelCase, startCase } from "lodash";
|
|
71
71
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
72
72
|
import { useDispatch } from "react-redux";
|
|
73
|
-
import { useParams } from "react-router-dom";
|
|
73
|
+
import { useNavigate, useParams } from "react-router-dom";
|
|
74
74
|
import { showToast } from "../../../../redux/features/toastSlice";
|
|
75
75
|
import { SolidJsonEditor } from "../../../../components/core/json/SolidJsonEditor";
|
|
76
76
|
import { Column, SolidDataTable } from "../../../../components/core/list/SolidDataTable";
|
|
77
|
+
import FieldMetaDataForm from "../../../../components/core/model/FieldMetaDataForm";
|
|
78
|
+
import { waitForBackendAvailability } from "../../../../helpers/waitForBackendAvailability";
|
|
77
79
|
import { SolidButton, SolidCheckbox, SolidDialog, SolidDialogBody, SolidDialogClose, SolidDialogDescription, SolidDialogFooter, SolidDialogHeader, SolidDialogSeparator, SolidDialogTitle, SolidInput, SolidSelect, SolidSpinner, SolidSwitch, SolidTabGroup, SolidTextarea, } from "../../../../components/shad-cn-ui";
|
|
78
|
-
import { useApplyDatasourceIntrospectionMappingMutation, useGetDatasourceIntrospectionBootstrapQuery, useGetDatasourceIntrospectionTableDetailQuery, useGetDatasourceIntrospectionTablesQuery, usePreviewDatasourceIntrospectionMappingMutation, } from "../../../../redux/api/datasourceIntrospectionApi";
|
|
80
|
+
import { useApplyDatasourceIntrospectionMappingMutation, useCreateDatasourceIntrospectionMigrationArtifactsMutation, useGenerateDatasourceIntrospectionCodeMutation, useGetDatasourceIntrospectionBootstrapQuery, useGetDatasourceIntrospectionTableDetailQuery, useGetDatasourceIntrospectionTablesQuery, usePreviewDatasourceIntrospectionMappingMutation, useRunDatasourceIntrospectionMigrationMutation, } from "../../../../redux/api/datasourceIntrospectionApi";
|
|
79
81
|
import { useGetmodelByIdQuery } from "../../../../redux/api/modelApi";
|
|
80
82
|
import "./DatasourceIntrospectionPage.css";
|
|
81
83
|
function providerLabel(type) {
|
|
@@ -104,6 +106,43 @@ var scalarFieldTypeOptions = [
|
|
|
104
106
|
{ value: "password", label: "Password" },
|
|
105
107
|
];
|
|
106
108
|
var scalarFieldTypeValueSet = new Set(scalarFieldTypeOptions.map(function (option) { return option.value; }));
|
|
109
|
+
var mappingStrategyOptions = [
|
|
110
|
+
{ value: "generated_id", label: "Legacy generated id" },
|
|
111
|
+
{ value: "existing_id", label: "Legacy existing id" },
|
|
112
|
+
];
|
|
113
|
+
function getBaseClassNameForLegacyType(value) {
|
|
114
|
+
return value === "existing_id"
|
|
115
|
+
? "LegacyCommonEntityWithExistingId"
|
|
116
|
+
: "LegacyCommonEntityWithGeneratedId";
|
|
117
|
+
}
|
|
118
|
+
function getSuperclassFieldNameForLegacyType(columnName, legacyTableType) {
|
|
119
|
+
var _a;
|
|
120
|
+
var normalized = columnName.toLowerCase();
|
|
121
|
+
var legacyFieldMap = {
|
|
122
|
+
ss_created_at: "createdAt",
|
|
123
|
+
ss_updated_at: "updatedAt",
|
|
124
|
+
ss_deleted_at: "deletedAt",
|
|
125
|
+
ss_deleted_tracker: "deletedTracker",
|
|
126
|
+
ss_published_at: "publishedAt",
|
|
127
|
+
ss_locale_name: "localeName",
|
|
128
|
+
ss_default_entity_locale_id: "defaultEntityLocaleId",
|
|
129
|
+
ss_created_by_id: "createdBy",
|
|
130
|
+
ss_updated_by_id: "updatedBy",
|
|
131
|
+
};
|
|
132
|
+
if (normalized === "ss_id" && legacyTableType === "generated_id") {
|
|
133
|
+
return "id";
|
|
134
|
+
}
|
|
135
|
+
return (_a = legacyFieldMap[normalized]) !== null && _a !== void 0 ? _a : null;
|
|
136
|
+
}
|
|
137
|
+
function getSuggestedFieldNameForLegacyType(column, legacyTableType) {
|
|
138
|
+
if (legacyTableType === "existing_id" && column.isAutoGenerated) {
|
|
139
|
+
return "id";
|
|
140
|
+
}
|
|
141
|
+
if (legacyTableType === "generated_id" && column.columnName.toLowerCase() === "id") {
|
|
142
|
+
return "legacyId";
|
|
143
|
+
}
|
|
144
|
+
return camelCase(column.columnName.replace(/^ss_/i, ""));
|
|
145
|
+
}
|
|
107
146
|
function getDefaultOrmTypeForSolidFieldType(dataSourceType, solidFieldType) {
|
|
108
147
|
var _a, _b;
|
|
109
148
|
var normalizedDatasourceType = dataSourceType.toLowerCase();
|
|
@@ -159,13 +198,6 @@ function getDefaultOrmTypeForSolidFieldType(dataSourceType, solidFieldType) {
|
|
|
159
198
|
};
|
|
160
199
|
return (_b = (_a = ormTypesByDatasource[normalizedDatasourceType]) === null || _a === void 0 ? void 0 : _a[solidFieldType]) !== null && _b !== void 0 ? _b : "varchar";
|
|
161
200
|
}
|
|
162
|
-
function legacyTypeLabel(value) {
|
|
163
|
-
if (value === "generated_id")
|
|
164
|
-
return "Legacy generated id";
|
|
165
|
-
if (value === "existing_id")
|
|
166
|
-
return "Legacy existing id";
|
|
167
|
-
return "Legacy generated id";
|
|
168
|
-
}
|
|
169
201
|
function statusLabel(record) {
|
|
170
202
|
return record.mapped ? "Mapped" : "Ready to map";
|
|
171
203
|
}
|
|
@@ -176,6 +208,26 @@ function readQueryError(error) {
|
|
|
176
208
|
|| (error === null || error === void 0 ? void 0 : error.message)
|
|
177
209
|
|| "Something went wrong.");
|
|
178
210
|
}
|
|
211
|
+
function isRecoverableGenerateCodeError(error) {
|
|
212
|
+
var _a, _b, _c;
|
|
213
|
+
var status = (_a = error === null || error === void 0 ? void 0 : error.status) !== null && _a !== void 0 ? _a : error === null || error === void 0 ? void 0 : error.originalStatus;
|
|
214
|
+
var message = [
|
|
215
|
+
error === null || error === void 0 ? void 0 : error.error,
|
|
216
|
+
error === null || error === void 0 ? void 0 : error.message,
|
|
217
|
+
(_b = error === null || error === void 0 ? void 0 : error.data) === null || _b === void 0 ? void 0 : _b.message,
|
|
218
|
+
(_c = error === null || error === void 0 ? void 0 : error.data) === null || _c === void 0 ? void 0 : _c.error,
|
|
219
|
+
]
|
|
220
|
+
.filter(Boolean)
|
|
221
|
+
.join(" ")
|
|
222
|
+
.toLowerCase();
|
|
223
|
+
if (status === "FETCH_ERROR" || status === "TIMEOUT_ERROR" || status === "PARSING_ERROR") {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
return (message.includes("failed to fetch")
|
|
227
|
+
|| message.includes("network")
|
|
228
|
+
|| message.includes("load failed")
|
|
229
|
+
|| message.includes("fetch"));
|
|
230
|
+
}
|
|
179
231
|
function normalizeName(value) {
|
|
180
232
|
return value.trim().toLowerCase();
|
|
181
233
|
}
|
|
@@ -207,27 +259,30 @@ function buildDrawerDraft(tableDetail, selectedTable, mappedModelData) {
|
|
|
207
259
|
|| ((_d = modelFields.find(function (field) { return field === null || field === void 0 ? void 0 : field.isUserKey; })) === null || _d === void 0 ? void 0 : _d.name)
|
|
208
260
|
|| "";
|
|
209
261
|
var columns = tableDetail.columns.map(function (column) {
|
|
210
|
-
var _a, _b, _c, _d, _e;
|
|
262
|
+
var _a, _b, _c, _d, _e, _f;
|
|
211
263
|
var matchingField = findMatchingModelField(column, modelFields);
|
|
212
264
|
return {
|
|
213
265
|
columnName: column.columnName,
|
|
214
266
|
fieldName: (_a = matchingField === null || matchingField === void 0 ? void 0 : matchingField.name) !== null && _a !== void 0 ? _a : column.fieldName,
|
|
267
|
+
displayName: (_b = matchingField === null || matchingField === void 0 ? void 0 : matchingField.displayName) !== null && _b !== void 0 ? _b : column.displayName,
|
|
215
268
|
dataType: column.dataType,
|
|
216
|
-
solidFieldType: (
|
|
217
|
-
ormType: (
|
|
269
|
+
solidFieldType: (_c = matchingField === null || matchingField === void 0 ? void 0 : matchingField.type) !== null && _c !== void 0 ? _c : column.solidFieldType,
|
|
270
|
+
ormType: (_d = matchingField === null || matchingField === void 0 ? void 0 : matchingField.ormType) !== null && _d !== void 0 ? _d : column.ormType,
|
|
218
271
|
nullable: column.nullable,
|
|
219
|
-
defaultValue: (
|
|
272
|
+
defaultValue: (_e = matchingField === null || matchingField === void 0 ? void 0 : matchingField.defaultValue) !== null && _e !== void 0 ? _e : column.defaultValue,
|
|
220
273
|
characterMaximumLength: column.characterMaximumLength,
|
|
221
274
|
numericPrecision: column.numericPrecision,
|
|
222
275
|
numericScale: column.numericScale,
|
|
223
276
|
ordinalPosition: column.ordinalPosition,
|
|
224
277
|
isAutoGenerated: column.isAutoGenerated,
|
|
278
|
+
isDetectedPrimaryKey: column.isPrimaryKey,
|
|
225
279
|
handledBySuperclass: column.handledBySuperclass,
|
|
226
280
|
superclassFieldName: column.superclassFieldName,
|
|
227
|
-
fieldId: (
|
|
281
|
+
fieldId: (_f = matchingField === null || matchingField === void 0 ? void 0 : matchingField.id) !== null && _f !== void 0 ? _f : null,
|
|
228
282
|
include: column.handledBySuperclass ? false : Boolean(matchingField) || !selectedTable.mapped,
|
|
229
283
|
matched: Boolean(matchingField),
|
|
230
|
-
isPrimaryKey: Boolean(matchingField === null || matchingField === void 0 ? void 0 : matchingField.isPrimaryKey) || (column.isAutoGenerated && column.fieldName === "id"),
|
|
284
|
+
isPrimaryKey: Boolean(matchingField === null || matchingField === void 0 ? void 0 : matchingField.isPrimaryKey) || column.isPrimaryKey || (column.isAutoGenerated && column.fieldName === "id"),
|
|
285
|
+
fieldConfig: matchingField ? sanitizeExistingFieldPayload(matchingField) : null,
|
|
231
286
|
};
|
|
232
287
|
});
|
|
233
288
|
var draftUserKeyField = modelUserKeyField || tableDetail.suggestedMetadata.userKeyField;
|
|
@@ -277,6 +332,10 @@ function getDrawerValidationErrors(draft) {
|
|
|
277
332
|
errors.push("Field name is required for column \"".concat(column.columnName, "\"."));
|
|
278
333
|
continue;
|
|
279
334
|
}
|
|
335
|
+
if (!column.displayName.trim()) {
|
|
336
|
+
errors.push("Field label is required for column \"".concat(column.columnName, "\"."));
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
280
339
|
if (!scalarFieldTypeValueSet.has(column.solidFieldType)) {
|
|
281
340
|
errors.push("SolidX type \"".concat(column.solidFieldType, "\" is not allowed in step 1 for column \"").concat(column.columnName, "\"."));
|
|
282
341
|
continue;
|
|
@@ -328,6 +387,7 @@ function buildMappingRequest(draft, plannedMigrationTimestamp) {
|
|
|
328
387
|
columns: draft.columns.map(function (column) { return ({
|
|
329
388
|
columnName: column.columnName,
|
|
330
389
|
fieldName: column.fieldName,
|
|
390
|
+
displayName: column.displayName,
|
|
331
391
|
dataType: column.dataType,
|
|
332
392
|
solidFieldType: column.solidFieldType,
|
|
333
393
|
ormType: column.ormType,
|
|
@@ -344,6 +404,7 @@ function buildMappingRequest(draft, plannedMigrationTimestamp) {
|
|
|
344
404
|
include: column.include,
|
|
345
405
|
matched: column.matched,
|
|
346
406
|
isPrimaryKey: column.isPrimaryKey,
|
|
407
|
+
fieldConfig: column.fieldConfig,
|
|
347
408
|
}); }),
|
|
348
409
|
};
|
|
349
410
|
}
|
|
@@ -475,47 +536,65 @@ function parseAndValidateReviewedModelJson(metadataJsonText, draft) {
|
|
|
475
536
|
}
|
|
476
537
|
export function DatasourceIntrospectionPage() {
|
|
477
538
|
var _this = this;
|
|
478
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
539
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
479
540
|
var params = useParams();
|
|
541
|
+
var navigate = useNavigate();
|
|
480
542
|
var dispatch = useDispatch();
|
|
481
543
|
var moduleId = Number((_a = params.moduleId) !== null && _a !== void 0 ? _a : 0);
|
|
482
544
|
var isValidModuleId = Number.isFinite(moduleId) && moduleId > 0;
|
|
483
|
-
var
|
|
545
|
+
var _t = useGetDatasourceIntrospectionBootstrapQuery(moduleId, {
|
|
484
546
|
skip: !isValidModuleId,
|
|
485
|
-
}), bootstrap =
|
|
486
|
-
var
|
|
487
|
-
var
|
|
488
|
-
var
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var
|
|
493
|
-
var
|
|
494
|
-
var
|
|
495
|
-
var
|
|
496
|
-
var
|
|
497
|
-
var
|
|
498
|
-
var
|
|
499
|
-
var
|
|
500
|
-
var
|
|
501
|
-
var
|
|
502
|
-
var
|
|
547
|
+
}), bootstrap = _t.data, isBootstrapLoading = _t.isLoading, isBootstrapFetching = _t.isFetching, bootstrapError = _t.error, refetchBootstrap = _t.refetch;
|
|
548
|
+
var _u = useState(""), selectedDatasource = _u[0], setSelectedDatasource = _u[1];
|
|
549
|
+
var _v = useState([]), selectedRows = _v[0], setSelectedRows = _v[1];
|
|
550
|
+
var _w = useState(""), workspaceTableKey = _w[0], setWorkspaceTableKey = _w[1];
|
|
551
|
+
var _x = useState(""), tableSearch = _x[0], setTableSearch = _x[1];
|
|
552
|
+
var _y = useState(false), settingsOpen = _y[0], setSettingsOpen = _y[1];
|
|
553
|
+
var _z = useState("datasource-info"), settingsTab = _z[0], setSettingsTab = _z[1];
|
|
554
|
+
var _0 = useState(null), drawerDraft = _0[0], setDrawerDraft = _0[1];
|
|
555
|
+
var _1 = useState("general-info"), drawerTab = _1[0], setDrawerTab = _1[1];
|
|
556
|
+
var _2 = useState("configure"), workspaceStep = _2[0], setWorkspaceStep = _2[1];
|
|
557
|
+
var _3 = useState(null), mappingPreview = _3[0], setMappingPreview = _3[1];
|
|
558
|
+
var _4 = useState(null), persistedMappingResult = _4[0], setPersistedMappingResult = _4[1];
|
|
559
|
+
var _5 = useState(null), migrationArtifactsResult = _5[0], setMigrationArtifactsResult = _5[1];
|
|
560
|
+
var _6 = useState(""), generateCodeOutput = _6[0], setGenerateCodeOutput = _6[1];
|
|
561
|
+
var _7 = useState(false), isGeneratingCodeWorkflow = _7[0], setIsGeneratingCodeWorkflow = _7[1];
|
|
562
|
+
var _8 = useState(""), generateCodeStatusMessage = _8[0], setGenerateCodeStatusMessage = _8[1];
|
|
563
|
+
var _9 = useState(null), generateCodeTimeoutMessage = _9[0], setGenerateCodeTimeoutMessage = _9[1];
|
|
564
|
+
var _10 = useState(false), generateCodeReady = _10[0], setGenerateCodeReady = _10[1];
|
|
565
|
+
var _11 = useState(false), hasAttemptedGenerateCode = _11[0], setHasAttemptedGenerateCode = _11[1];
|
|
566
|
+
var _12 = useState(""), runMigrationOutput = _12[0], setRunMigrationOutput = _12[1];
|
|
567
|
+
var _13 = useState(false), runMigrationCompleted = _13[0], setRunMigrationCompleted = _13[1];
|
|
568
|
+
var _14 = useState(null), reviewedMetadataJsonValue = _14[0], setReviewedMetadataJsonValue = _14[1];
|
|
569
|
+
var _15 = useState(""), metadataJsonText = _15[0], setMetadataJsonText = _15[1];
|
|
570
|
+
var _16 = useState(null), metadataJsonValidationError = _16[0], setMetadataJsonValidationError = _16[1];
|
|
571
|
+
var _17 = useState("initial"), metadataJsonResetToken = _17[0], setMetadataJsonResetToken = _17[1];
|
|
572
|
+
var _18 = useState(false), drawerBootstrapping = _18[0], setDrawerBootstrapping = _18[1];
|
|
573
|
+
var _19 = useState(null), fieldConfigColumnName = _19[0], setFieldConfigColumnName = _19[1];
|
|
574
|
+
var _20 = useState({
|
|
503
575
|
relationInferenceEnabled: false,
|
|
504
576
|
prioritizeUnmappedTables: true,
|
|
505
|
-
}), sessionSettings =
|
|
506
|
-
var
|
|
577
|
+
}), sessionSettings = _20[0], setSessionSettings = _20[1];
|
|
578
|
+
var _21 = useState(sessionSettings), draftSessionSettings = _21[0], setDraftSessionSettings = _21[1];
|
|
507
579
|
var drawerBootstrapTimerRef = useRef(null);
|
|
508
|
-
var
|
|
509
|
-
|
|
580
|
+
var _22 = usePreviewDatasourceIntrospectionMappingMutation(), previewMapping = _22[0], isPreviewMappingLoading = _22[1].isLoading;
|
|
581
|
+
var _23 = useApplyDatasourceIntrospectionMappingMutation(), applyMapping = _23[0], isApplyMappingLoading = _23[1].isLoading;
|
|
582
|
+
var _24 = useCreateDatasourceIntrospectionMigrationArtifactsMutation(), createMigrationArtifacts = _24[0], isCreateMigrationArtifactsLoading = _24[1].isLoading;
|
|
583
|
+
var _25 = useGenerateDatasourceIntrospectionCodeMutation(), generateCode = _25[0], isGenerateCodeLoading = _25[1].isLoading;
|
|
584
|
+
var _26 = useRunDatasourceIntrospectionMigrationMutation(), runMigration = _26[0], isRunMigrationLoading = _26[1].isLoading;
|
|
585
|
+
var isSavingMapping = isApplyMappingLoading;
|
|
586
|
+
var isCreatingMigrationArtifacts = isCreateMigrationArtifactsLoading;
|
|
587
|
+
var showFieldDraftToaster = function (message, severity) {
|
|
588
|
+
var errorMessages = Object.values(message !== null && message !== void 0 ? message : {});
|
|
589
|
+
if (!errorMessages.length)
|
|
510
590
|
return;
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
591
|
+
dispatch(showToast({
|
|
592
|
+
severity: severity,
|
|
593
|
+
summary: "Datasource introspection",
|
|
594
|
+
detail: errorMessages.map(String).join(", "),
|
|
595
|
+
life: 3000,
|
|
596
|
+
}));
|
|
515
597
|
};
|
|
516
|
-
var _7 = usePreviewDatasourceIntrospectionMappingMutation(), previewMapping = _7[0], isPreviewMappingLoading = _7[1].isLoading;
|
|
517
|
-
var _8 = useApplyDatasourceIntrospectionMappingMutation(), applyMapping = _8[0], isApplyMappingLoading = _8[1].isLoading;
|
|
518
|
-
var isSavingMapping = isApplyMappingLoading;
|
|
519
598
|
useEffect(function () {
|
|
520
599
|
if (!bootstrap)
|
|
521
600
|
return;
|
|
@@ -526,13 +605,23 @@ export function DatasourceIntrospectionPage() {
|
|
|
526
605
|
}
|
|
527
606
|
}, [bootstrap, selectedDatasource]);
|
|
528
607
|
useEffect(function () {
|
|
529
|
-
|
|
608
|
+
setSelectedRows([]);
|
|
609
|
+
setWorkspaceTableKey("");
|
|
530
610
|
setDrawerDraft(null);
|
|
531
|
-
|
|
611
|
+
setFieldConfigColumnName(null);
|
|
532
612
|
setTableSearch("");
|
|
533
|
-
|
|
534
|
-
setReviewTab("metadata-json");
|
|
613
|
+
setWorkspaceStep("configure");
|
|
535
614
|
setMappingPreview(null);
|
|
615
|
+
setPersistedMappingResult(null);
|
|
616
|
+
setMigrationArtifactsResult(null);
|
|
617
|
+
setGenerateCodeOutput("");
|
|
618
|
+
setIsGeneratingCodeWorkflow(false);
|
|
619
|
+
setGenerateCodeStatusMessage("");
|
|
620
|
+
setGenerateCodeTimeoutMessage(null);
|
|
621
|
+
setGenerateCodeReady(false);
|
|
622
|
+
setHasAttemptedGenerateCode(false);
|
|
623
|
+
setRunMigrationOutput("");
|
|
624
|
+
setRunMigrationCompleted(false);
|
|
536
625
|
setReviewedMetadataJsonValue(null);
|
|
537
626
|
setMetadataJsonText("");
|
|
538
627
|
setMetadataJsonValidationError(null);
|
|
@@ -543,11 +632,6 @@ export function DatasourceIntrospectionPage() {
|
|
|
543
632
|
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
544
633
|
}
|
|
545
634
|
}; }, []);
|
|
546
|
-
useEffect(function () {
|
|
547
|
-
if (!drawerOpen)
|
|
548
|
-
return;
|
|
549
|
-
scrollDrawerBodyToTop();
|
|
550
|
-
}, [drawerOpen, drawerStep, drawerTab, reviewTab, selectedTableKey]);
|
|
551
635
|
var datasourceOptions = useMemo(function () {
|
|
552
636
|
var _a;
|
|
553
637
|
return ((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.datasources) !== null && _a !== void 0 ? _a : []).map(function (datasource) { return ({
|
|
@@ -555,23 +639,55 @@ export function DatasourceIntrospectionPage() {
|
|
|
555
639
|
value: datasource.name,
|
|
556
640
|
}); });
|
|
557
641
|
}, [bootstrap]);
|
|
558
|
-
var
|
|
642
|
+
var _27 = useGetDatasourceIntrospectionTablesQuery({ moduleId: moduleId, datasource: selectedDatasource }, {
|
|
559
643
|
skip: !isValidModuleId || !selectedDatasource,
|
|
560
|
-
}), tablesResponse =
|
|
561
|
-
var
|
|
562
|
-
var
|
|
644
|
+
}), tablesResponse = _27.data, isTablesLoading = _27.isLoading, isTablesFetching = _27.isFetching, tablesError = _27.error, refetchTables = _27.refetch;
|
|
645
|
+
var selectedListRow = (_b = selectedRows[0]) !== null && _b !== void 0 ? _b : null;
|
|
646
|
+
var selectedListRowKey = selectedListRow ? "".concat((_c = selectedListRow.schema) !== null && _c !== void 0 ? _c : "", "::").concat(selectedListRow.tableName) : "";
|
|
647
|
+
var isWorkspaceMode = Boolean(workspaceTableKey);
|
|
648
|
+
var selectedTable = useMemo(function () { var _a, _b; return (_b = (_a = tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.records) === null || _a === void 0 ? void 0 : _a.find(function (record) { var _a; return "".concat((_a = record.schema) !== null && _a !== void 0 ? _a : "", "::").concat(record.tableName) === workspaceTableKey; })) !== null && _b !== void 0 ? _b : null; }, [tablesResponse, workspaceTableKey]);
|
|
649
|
+
var _28 = useGetDatasourceIntrospectionTableDetailQuery({
|
|
563
650
|
moduleId: moduleId,
|
|
564
651
|
datasource: selectedDatasource,
|
|
565
|
-
table: (
|
|
566
|
-
schema: (
|
|
652
|
+
table: (_d = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.tableName) !== null && _d !== void 0 ? _d : "",
|
|
653
|
+
schema: (_e = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.schema) !== null && _e !== void 0 ? _e : undefined,
|
|
567
654
|
}, {
|
|
568
|
-
skip: !
|
|
569
|
-
}), tableDetail =
|
|
570
|
-
var
|
|
571
|
-
skip: !
|
|
572
|
-
}), mappedModelResponse =
|
|
655
|
+
skip: !isWorkspaceMode || !isValidModuleId || !selectedDatasource || !selectedTable || !!(tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.synchronizeBlocked),
|
|
656
|
+
}), tableDetail = _28.data, isTableDetailLoading = _28.isLoading, isTableDetailFetching = _28.isFetching, tableDetailError = _28.error, refetchTableDetail = _28.refetch;
|
|
657
|
+
var _29 = useGetmodelByIdQuery((_f = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelId) !== null && _f !== void 0 ? _f : 0, {
|
|
658
|
+
skip: !isWorkspaceMode || !(selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mapped) || !(selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelId),
|
|
659
|
+
}), mappedModelResponse = _29.data, isMappedModelLoading = _29.isLoading, isMappedModelFetching = _29.isFetching, mappedModelError = _29.error;
|
|
573
660
|
var mappedModelData = mappedModelResponse === null || mappedModelResponse === void 0 ? void 0 : mappedModelResponse.data;
|
|
574
|
-
var selectedDatasourceRecord = (
|
|
661
|
+
var selectedDatasourceRecord = (_h = (_g = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.datasources) === null || _g === void 0 ? void 0 : _g.find(function (datasource) { return datasource.name === selectedDatasource; })) !== null && _h !== void 0 ? _h : null;
|
|
662
|
+
var activeFieldConfigColumn = (_j = drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.columns.find(function (column) { return column.columnName === fieldConfigColumnName; })) !== null && _j !== void 0 ? _j : null;
|
|
663
|
+
var activeFieldConfigMetaData = useMemo(function () {
|
|
664
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
665
|
+
if (!drawerDraft || !activeFieldConfigColumn) {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
var configured = (_a = activeFieldConfigColumn.fieldConfig) !== null && _a !== void 0 ? _a : {};
|
|
669
|
+
var suggestedMax = activeFieldConfigColumn.characterMaximumLength && ["shortText", "longText"].includes(activeFieldConfigColumn.solidFieldType)
|
|
670
|
+
? activeFieldConfigColumn.characterMaximumLength
|
|
671
|
+
: configured.max;
|
|
672
|
+
return __assign(__assign(__assign({}, configured), (activeFieldConfigColumn.fieldId ? { id: activeFieldConfigColumn.fieldId } : {})), { name: activeFieldConfigColumn.fieldName, displayName: activeFieldConfigColumn.displayName, description: (_b = configured.description) !== null && _b !== void 0 ? _b : activeFieldConfigColumn.displayName, type: activeFieldConfigColumn.solidFieldType, ormType: activeFieldConfigColumn.ormType, columnName: activeFieldConfigColumn.columnName, defaultValue: (_d = (_c = configured.defaultValue) !== null && _c !== void 0 ? _c : activeFieldConfigColumn.defaultValue) !== null && _d !== void 0 ? _d : undefined, required: (_e = configured.required) !== null && _e !== void 0 ? _e : (!activeFieldConfigColumn.nullable || activeFieldConfigColumn.isPrimaryKey), unique: (_f = configured.unique) !== null && _f !== void 0 ? _f : false, encrypt: (_g = configured.encrypt) !== null && _g !== void 0 ? _g : false, index: (_h = configured.index) !== null && _h !== void 0 ? _h : false, max: suggestedMax !== null && suggestedMax !== void 0 ? suggestedMax : undefined, min: (_j = configured.min) !== null && _j !== void 0 ? _j : undefined, private: (_k = configured.private) !== null && _k !== void 0 ? _k : false, isSystem: false, isPrimaryKey: activeFieldConfigColumn.isPrimaryKey, isUserKey: drawerDraft.userKeyField === activeFieldConfigColumn.fieldName, enableAuditTracking: (_l = configured.enableAuditTracking) !== null && _l !== void 0 ? _l : drawerDraft.enableAuditTracking, isMultiSelect: (_m = configured.isMultiSelect) !== null && _m !== void 0 ? _m : false, length: (_p = (_o = configured.length) !== null && _o !== void 0 ? _o : activeFieldConfigColumn.characterMaximumLength) !== null && _p !== void 0 ? _p : undefined });
|
|
673
|
+
}, [activeFieldConfigColumn, drawerDraft]);
|
|
674
|
+
var fieldDraftAllFields = useMemo(function () {
|
|
675
|
+
if (!drawerDraft || !activeFieldConfigColumn) {
|
|
676
|
+
return [];
|
|
677
|
+
}
|
|
678
|
+
return drawerDraft.columns
|
|
679
|
+
.filter(function (column) { return column.columnName !== activeFieldConfigColumn.columnName; })
|
|
680
|
+
.map(function (column) {
|
|
681
|
+
var _a;
|
|
682
|
+
return ({
|
|
683
|
+
id: (_a = column.fieldId) !== null && _a !== void 0 ? _a : undefined,
|
|
684
|
+
name: column.fieldName,
|
|
685
|
+
displayName: column.displayName,
|
|
686
|
+
type: column.solidFieldType,
|
|
687
|
+
columnName: column.columnName,
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
}, [activeFieldConfigColumn, drawerDraft]);
|
|
575
691
|
var drawerLoadingError = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mapped) ? (tableDetailError || mappedModelError) : tableDetailError;
|
|
576
692
|
var isDrawerBlockingLoading = Boolean(selectedTable
|
|
577
693
|
&& (drawerBootstrapping
|
|
@@ -580,7 +696,42 @@ export function DatasourceIntrospectionPage() {
|
|
|
580
696
|
|| isTableDetailFetching
|
|
581
697
|
|| (selectedTable.mapped && (isMappedModelLoading || isMappedModelFetching))));
|
|
582
698
|
useEffect(function () {
|
|
583
|
-
if (!
|
|
699
|
+
if (!isWorkspaceMode) {
|
|
700
|
+
setDrawerDraft(null);
|
|
701
|
+
setFieldConfigColumnName(null);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
if (drawerBootstrapTimerRef.current) {
|
|
705
|
+
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
706
|
+
}
|
|
707
|
+
setDrawerDraft(null);
|
|
708
|
+
setFieldConfigColumnName(null);
|
|
709
|
+
setDrawerTab("general-info");
|
|
710
|
+
setWorkspaceStep("configure");
|
|
711
|
+
setMappingPreview(null);
|
|
712
|
+
setPersistedMappingResult(null);
|
|
713
|
+
setMigrationArtifactsResult(null);
|
|
714
|
+
setGenerateCodeOutput("");
|
|
715
|
+
setIsGeneratingCodeWorkflow(false);
|
|
716
|
+
setGenerateCodeStatusMessage("");
|
|
717
|
+
setGenerateCodeTimeoutMessage(null);
|
|
718
|
+
setGenerateCodeReady(false);
|
|
719
|
+
setHasAttemptedGenerateCode(false);
|
|
720
|
+
setRunMigrationOutput("");
|
|
721
|
+
setRunMigrationCompleted(false);
|
|
722
|
+
setReviewedMetadataJsonValue(null);
|
|
723
|
+
setMetadataJsonText("");
|
|
724
|
+
setMetadataJsonValidationError(null);
|
|
725
|
+
setMetadataJsonResetToken("table-".concat(workspaceTableKey, "-").concat(Date.now()));
|
|
726
|
+
setDrawerBootstrapping(true);
|
|
727
|
+
}, [isWorkspaceMode, workspaceTableKey]);
|
|
728
|
+
useEffect(function () {
|
|
729
|
+
if (!isWorkspaceMode || !selectedTable)
|
|
730
|
+
return;
|
|
731
|
+
setSelectedRows([selectedTable]);
|
|
732
|
+
}, [isWorkspaceMode, selectedTable]);
|
|
733
|
+
useEffect(function () {
|
|
734
|
+
if (!isWorkspaceMode || !selectedTable || !tableDetail)
|
|
584
735
|
return;
|
|
585
736
|
if (selectedTable.mapped && (!mappedModelData || mappedModelData.id !== selectedTable.mappedModelId))
|
|
586
737
|
return;
|
|
@@ -591,15 +742,15 @@ export function DatasourceIntrospectionPage() {
|
|
|
591
742
|
drawerBootstrapTimerRef.current = window.setTimeout(function () {
|
|
592
743
|
setDrawerBootstrapping(false);
|
|
593
744
|
}, 150);
|
|
594
|
-
}, [
|
|
745
|
+
}, [isWorkspaceMode, selectedTable, tableDetail, mappedModelData, mappedModelResponse]);
|
|
595
746
|
var filteredRecords = useMemo(function () {
|
|
596
747
|
var _a;
|
|
597
748
|
var records = __spreadArray([], ((_a = tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.records) !== null && _a !== void 0 ? _a : []), true);
|
|
598
749
|
var searchNeedle = tableSearch.trim().toLowerCase();
|
|
599
750
|
var filtered = searchNeedle
|
|
600
751
|
? records.filter(function (record) {
|
|
601
|
-
var _a, _b, _c;
|
|
602
|
-
var haystack = "".concat(record.tableName, " ").concat((_a = record.schema) !== null && _a !== void 0 ? _a : "", " ").concat((_b = record.mappedModelSingularName) !== null && _b !== void 0 ? _b : "", " ").concat((_c = record.mappedModelDisplayName) !== null && _c !== void 0 ? _c : "").toLowerCase();
|
|
752
|
+
var _a, _b, _c, _d, _e;
|
|
753
|
+
var haystack = "".concat(record.tableName, " ").concat((_a = record.schema) !== null && _a !== void 0 ? _a : "", " ").concat((_b = record.mappedModelSingularName) !== null && _b !== void 0 ? _b : "", " ").concat((_c = record.mappedModelDisplayName) !== null && _c !== void 0 ? _c : "", " ").concat((_d = record.mappedModuleName) !== null && _d !== void 0 ? _d : "", " ").concat((_e = record.mappedModuleDisplayName) !== null && _e !== void 0 ? _e : "").toLowerCase();
|
|
603
754
|
return haystack.includes(searchNeedle);
|
|
604
755
|
})
|
|
605
756
|
: records;
|
|
@@ -639,7 +790,7 @@ export function DatasourceIntrospectionPage() {
|
|
|
639
790
|
{
|
|
640
791
|
value: "datasource-info",
|
|
641
792
|
label: "Datasource Info",
|
|
642
|
-
content: (_jsxs("div", { className: "sdix-settings-grid", children: [_jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Target module" }), _jsx("strong", { children: (
|
|
793
|
+
content: (_jsxs("div", { className: "sdix-settings-grid", children: [_jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Target module" }), _jsx("strong", { children: (_k = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _k === void 0 ? void 0 : _k.displayName })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Default datasource" }), _jsx("strong", { children: ((_l = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _l === void 0 ? void 0 : _l.defaultDataSource) || "Not set" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Datasource name" }), _jsx("strong", { children: (selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.displayName) || "Not selected" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Datasource type" }), _jsx("strong", { children: selectedDatasourceRecord ? providerLabel(selectedDatasourceRecord.type) : "-" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Host" }), _jsx("strong", { children: (selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.host) || "-" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Port" }), _jsx("strong", { children: (_m = selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.port) !== null && _m !== void 0 ? _m : "-" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Database" }), _jsx("strong", { children: (selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.database) || "-" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Env Prefix" }), _jsx("strong", { children: (selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.envPrefix) || "-" })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Synchronize" }), _jsx("strong", { children: selectedDatasourceRecord ? (selectedDatasourceRecord.synchronize === true ? "true" : "false") : "-" })] })] })),
|
|
643
794
|
},
|
|
644
795
|
{
|
|
645
796
|
value: "session-settings",
|
|
@@ -659,7 +810,7 @@ export function DatasourceIntrospectionPage() {
|
|
|
659
810
|
_a.sent();
|
|
660
811
|
_a.label = 3;
|
|
661
812
|
case 3:
|
|
662
|
-
if (!selectedTable) return [3 /*break*/, 5];
|
|
813
|
+
if (!(isWorkspaceMode && selectedTable)) return [3 /*break*/, 5];
|
|
663
814
|
return [4 /*yield*/, refetchTableDetail()];
|
|
664
815
|
case 4:
|
|
665
816
|
_a.sent();
|
|
@@ -668,23 +819,39 @@ export function DatasourceIntrospectionPage() {
|
|
|
668
819
|
}
|
|
669
820
|
});
|
|
670
821
|
}); };
|
|
671
|
-
var
|
|
672
|
-
var _a
|
|
822
|
+
var startMappingForRecord = function (record) {
|
|
823
|
+
var _a;
|
|
673
824
|
if (drawerBootstrapTimerRef.current) {
|
|
674
825
|
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
675
826
|
}
|
|
676
|
-
|
|
827
|
+
setSelectedRows([record]);
|
|
828
|
+
setWorkspaceTableKey("".concat((_a = record.schema) !== null && _a !== void 0 ? _a : "", "::").concat(record.tableName));
|
|
829
|
+
};
|
|
830
|
+
var leaveWorkspace = function () {
|
|
831
|
+
if (drawerBootstrapTimerRef.current) {
|
|
832
|
+
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
833
|
+
}
|
|
834
|
+
setWorkspaceTableKey("");
|
|
677
835
|
setDrawerDraft(null);
|
|
836
|
+
setFieldConfigColumnName(null);
|
|
837
|
+
setWorkspaceStep("configure");
|
|
678
838
|
setDrawerTab("general-info");
|
|
679
|
-
setDrawerStep("edit");
|
|
680
|
-
setReviewTab("metadata-json");
|
|
681
839
|
setMappingPreview(null);
|
|
840
|
+
setPersistedMappingResult(null);
|
|
841
|
+
setMigrationArtifactsResult(null);
|
|
842
|
+
setGenerateCodeOutput("");
|
|
843
|
+
setIsGeneratingCodeWorkflow(false);
|
|
844
|
+
setGenerateCodeStatusMessage("");
|
|
845
|
+
setGenerateCodeTimeoutMessage(null);
|
|
846
|
+
setGenerateCodeReady(false);
|
|
847
|
+
setHasAttemptedGenerateCode(false);
|
|
848
|
+
setRunMigrationOutput("");
|
|
849
|
+
setRunMigrationCompleted(false);
|
|
682
850
|
setReviewedMetadataJsonValue(null);
|
|
683
851
|
setMetadataJsonText("");
|
|
684
852
|
setMetadataJsonValidationError(null);
|
|
685
|
-
setMetadataJsonResetToken("
|
|
686
|
-
setDrawerBootstrapping(
|
|
687
|
-
setDrawerOpen(true);
|
|
853
|
+
setMetadataJsonResetToken("workspace-closed-".concat(Date.now()));
|
|
854
|
+
setDrawerBootstrapping(false);
|
|
688
855
|
};
|
|
689
856
|
var applyDraftSettings = function () {
|
|
690
857
|
setSessionSettings(draftSessionSettings);
|
|
@@ -692,6 +859,15 @@ export function DatasourceIntrospectionPage() {
|
|
|
692
859
|
};
|
|
693
860
|
var updateDrawerDraft = function (updater) {
|
|
694
861
|
setMappingPreview(null);
|
|
862
|
+
setPersistedMappingResult(null);
|
|
863
|
+
setMigrationArtifactsResult(null);
|
|
864
|
+
setGenerateCodeOutput("");
|
|
865
|
+
setIsGeneratingCodeWorkflow(false);
|
|
866
|
+
setGenerateCodeStatusMessage("");
|
|
867
|
+
setGenerateCodeTimeoutMessage(null);
|
|
868
|
+
setGenerateCodeReady(false);
|
|
869
|
+
setHasAttemptedGenerateCode(false);
|
|
870
|
+
setRunMigrationOutput("");
|
|
695
871
|
setDrawerDraft(function (current) { return (current ? updater(current) : current); });
|
|
696
872
|
};
|
|
697
873
|
var updateGeneralField = function (field, value) {
|
|
@@ -706,21 +882,98 @@ export function DatasourceIntrospectionPage() {
|
|
|
706
882
|
return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
707
883
|
if (column.columnName !== columnName)
|
|
708
884
|
return column;
|
|
709
|
-
|
|
885
|
+
var previousSuggestedLabel = startCase(column.fieldName);
|
|
886
|
+
var nextNormalizedFieldName = camelCase(nextFieldName);
|
|
887
|
+
var nextFieldConfig = column.fieldConfig
|
|
888
|
+
? __assign(__assign({}, column.fieldConfig), { name: nextNormalizedFieldName, displayName: !column.displayName.trim() || column.displayName === previousSuggestedLabel
|
|
889
|
+
? startCase(nextNormalizedFieldName)
|
|
890
|
+
: column.displayName, isUserKey: current.userKeyField === column.fieldName, isPrimaryKey: column.isPrimaryKey }) : column.fieldConfig;
|
|
891
|
+
return __assign(__assign({}, column), { fieldName: nextNormalizedFieldName, displayName: !column.displayName.trim() || column.displayName === previousSuggestedLabel
|
|
892
|
+
? startCase(nextNormalizedFieldName)
|
|
893
|
+
: column.displayName, fieldConfig: nextFieldConfig });
|
|
710
894
|
}), userKeyField: current.userKeyField === ((_a = current.columns.find(function (column) { return column.columnName === columnName; })) === null || _a === void 0 ? void 0 : _a.fieldName)
|
|
711
895
|
? camelCase(nextFieldName)
|
|
712
896
|
: current.userKeyField }));
|
|
713
897
|
});
|
|
714
898
|
};
|
|
899
|
+
var updateColumnDisplayName = function (columnName, nextDisplayName) {
|
|
900
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) { return (column.columnName === columnName
|
|
901
|
+
? __assign(__assign({}, column), { displayName: nextDisplayName, fieldConfig: column.fieldConfig
|
|
902
|
+
? __assign(__assign({}, column.fieldConfig), { displayName: nextDisplayName }) : column.fieldConfig }) : column); }) })); });
|
|
903
|
+
};
|
|
715
904
|
var updateColumnSolidFieldType = function (columnName, nextSolidFieldType) {
|
|
716
905
|
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
717
906
|
if (column.columnName !== columnName)
|
|
718
907
|
return column;
|
|
719
908
|
if (column.handledBySuperclass)
|
|
720
909
|
return column;
|
|
721
|
-
return __assign(__assign({}, column), { solidFieldType: nextSolidFieldType, ormType: getDefaultOrmTypeForSolidFieldType(current.dataSourceType, nextSolidFieldType)
|
|
910
|
+
return __assign(__assign({}, column), { solidFieldType: nextSolidFieldType, ormType: getDefaultOrmTypeForSolidFieldType(current.dataSourceType, nextSolidFieldType), fieldConfig: column.fieldConfig
|
|
911
|
+
? __assign(__assign({}, column.fieldConfig), { type: nextSolidFieldType, ormType: getDefaultOrmTypeForSolidFieldType(current.dataSourceType, nextSolidFieldType) }) : column.fieldConfig });
|
|
722
912
|
}) })); });
|
|
723
913
|
};
|
|
914
|
+
var openFieldConfigEditor = function (columnName) {
|
|
915
|
+
setFieldConfigColumnName(columnName);
|
|
916
|
+
};
|
|
917
|
+
var applyFieldConfigDraft = function (columnName, nextFieldConfig) {
|
|
918
|
+
var sanitized = sanitizeExistingFieldPayload(nextFieldConfig);
|
|
919
|
+
updateDrawerDraft(function (current) {
|
|
920
|
+
var currentColumn = current.columns.find(function (column) { return column.columnName === columnName; });
|
|
921
|
+
if (!currentColumn) {
|
|
922
|
+
return current;
|
|
923
|
+
}
|
|
924
|
+
var nextFieldName = typeof sanitized.name === "string" && sanitized.name.trim()
|
|
925
|
+
? sanitized.name.trim()
|
|
926
|
+
: currentColumn.fieldName;
|
|
927
|
+
var nextDisplayName = typeof sanitized.displayName === "string" && sanitized.displayName.trim()
|
|
928
|
+
? sanitized.displayName.trim()
|
|
929
|
+
: currentColumn.displayName;
|
|
930
|
+
var nextSolidFieldType = typeof sanitized.type === "string" && sanitized.type.trim()
|
|
931
|
+
? sanitized.type.trim()
|
|
932
|
+
: currentColumn.solidFieldType;
|
|
933
|
+
var nextOrmType = typeof sanitized.ormType === "string" && sanitized.ormType.trim()
|
|
934
|
+
? sanitized.ormType.trim()
|
|
935
|
+
: getDefaultOrmTypeForSolidFieldType(current.dataSourceType, nextSolidFieldType);
|
|
936
|
+
var nextUserKeyField = current.userKeyField === currentColumn.fieldName
|
|
937
|
+
? nextFieldName
|
|
938
|
+
: current.userKeyField;
|
|
939
|
+
return __assign(__assign({}, current), { userKeyField: nextUserKeyField, columns: current.columns.map(function (column) {
|
|
940
|
+
if (column.columnName !== columnName) {
|
|
941
|
+
return column.fieldConfig
|
|
942
|
+
? __assign(__assign({}, column), { fieldConfig: __assign(__assign({}, column.fieldConfig), { isUserKey: column.fieldName === nextUserKeyField }) }) : column;
|
|
943
|
+
}
|
|
944
|
+
return __assign(__assign({}, column), { fieldName: nextFieldName, displayName: nextDisplayName, solidFieldType: nextSolidFieldType, ormType: nextOrmType, fieldConfig: __assign(__assign({}, sanitized), { name: nextFieldName, displayName: nextDisplayName, type: nextSolidFieldType, ormType: nextOrmType, columnName: column.columnName, isPrimaryKey: column.isPrimaryKey, isUserKey: nextUserKeyField === nextFieldName }) });
|
|
945
|
+
}) });
|
|
946
|
+
});
|
|
947
|
+
setFieldConfigColumnName(null);
|
|
948
|
+
};
|
|
949
|
+
var updateLegacyTableType = function (legacyTableType) {
|
|
950
|
+
updateDrawerDraft(function (current) {
|
|
951
|
+
var _a;
|
|
952
|
+
var renamedUserKeyColumns = new Map();
|
|
953
|
+
var columns = current.columns.map(function (column) {
|
|
954
|
+
var nextSuperclassFieldName = getSuperclassFieldNameForLegacyType(column.columnName, legacyTableType);
|
|
955
|
+
var nextHandledBySuperclass = Boolean(nextSuperclassFieldName);
|
|
956
|
+
var nextSuggestedFieldName = getSuggestedFieldNameForLegacyType(column, legacyTableType);
|
|
957
|
+
var shouldRebuildFieldName = column.handledBySuperclass !== nextHandledBySuperclass
|
|
958
|
+
|| (legacyTableType === "existing_id" && column.isAutoGenerated && (column.fieldName === "id" || column.fieldName === "legacyId"))
|
|
959
|
+
|| (legacyTableType === "generated_id" && column.columnName.toLowerCase() === "id");
|
|
960
|
+
var nextFieldName = shouldRebuildFieldName ? nextSuggestedFieldName : column.fieldName;
|
|
961
|
+
var nextDisplayName = !column.displayName.trim() || column.displayName === startCase(column.fieldName)
|
|
962
|
+
? startCase(nextFieldName)
|
|
963
|
+
: column.displayName;
|
|
964
|
+
var nextInclude = nextHandledBySuperclass
|
|
965
|
+
? false
|
|
966
|
+
: (legacyTableType === "existing_id" && column.isAutoGenerated ? true : column.include);
|
|
967
|
+
var nextIsPrimaryKey = (legacyTableType === "existing_id" && column.isAutoGenerated && nextFieldName === "id") || (legacyTableType === "generated_id" && column.isDetectedPrimaryKey);
|
|
968
|
+
if (current.userKeyField === column.fieldName && current.userKeyField !== nextFieldName) {
|
|
969
|
+
renamedUserKeyColumns.set(column.fieldName, nextFieldName);
|
|
970
|
+
}
|
|
971
|
+
return __assign(__assign({}, column), { fieldName: nextFieldName, displayName: nextDisplayName, handledBySuperclass: nextHandledBySuperclass, superclassFieldName: nextSuperclassFieldName, include: nextInclude, isPrimaryKey: nextIsPrimaryKey, fieldConfig: column.fieldConfig
|
|
972
|
+
? __assign(__assign({}, column.fieldConfig), { name: nextFieldName, displayName: nextDisplayName, isPrimaryKey: nextIsPrimaryKey }) : column.fieldConfig });
|
|
973
|
+
});
|
|
974
|
+
return __assign(__assign({}, current), { legacyTableType: legacyTableType, baseClassName: getBaseClassNameForLegacyType(legacyTableType), columns: columns, userKeyField: (_a = renamedUserKeyColumns.get(current.userKeyField)) !== null && _a !== void 0 ? _a : current.userKeyField });
|
|
975
|
+
});
|
|
976
|
+
};
|
|
724
977
|
var setColumnIncluded = function (columnName, include) {
|
|
725
978
|
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
726
979
|
if (column.columnName !== columnName)
|
|
@@ -731,8 +984,11 @@ export function DatasourceIntrospectionPage() {
|
|
|
731
984
|
}) })); });
|
|
732
985
|
};
|
|
733
986
|
var changeUserKeyField = function (fieldName) {
|
|
734
|
-
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { userKeyField: fieldName, columns: current.columns.map(function (column) {
|
|
735
|
-
|
|
987
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { userKeyField: fieldName, columns: current.columns.map(function (column) {
|
|
988
|
+
var isUserKey = column.fieldName === fieldName;
|
|
989
|
+
return __assign(__assign({}, column), { include: isUserKey ? (column.handledBySuperclass ? false : true) : column.include, fieldConfig: column.fieldConfig
|
|
990
|
+
? __assign(__assign({}, column.fieldConfig), { isUserKey: isUserKey }) : column.fieldConfig });
|
|
991
|
+
}) })); });
|
|
736
992
|
};
|
|
737
993
|
var setUnmappedColumnsIncluded = function (include) {
|
|
738
994
|
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
@@ -749,7 +1005,7 @@ export function DatasourceIntrospectionPage() {
|
|
|
749
1005
|
return;
|
|
750
1006
|
window.open("/admin/core/solid-core/model-metadata/form/".concat(targetModelId), "_blank", "noopener,noreferrer");
|
|
751
1007
|
};
|
|
752
|
-
var
|
|
1008
|
+
var reviewMappingJson = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
753
1009
|
var validationErrors, preview, error_1;
|
|
754
1010
|
var _a;
|
|
755
1011
|
return __generator(this, function (_b) {
|
|
@@ -778,8 +1034,11 @@ export function DatasourceIntrospectionPage() {
|
|
|
778
1034
|
setMetadataJsonText(JSON.stringify(preview.metadataJson.model, null, 2));
|
|
779
1035
|
setMetadataJsonValidationError(null);
|
|
780
1036
|
setMetadataJsonResetToken("preview-".concat(preview.metadataJson.filePath, "-").concat(Date.now()));
|
|
781
|
-
|
|
782
|
-
|
|
1037
|
+
setPersistedMappingResult(null);
|
|
1038
|
+
setMigrationArtifactsResult(null);
|
|
1039
|
+
setGenerateCodeOutput("");
|
|
1040
|
+
setRunMigrationOutput("");
|
|
1041
|
+
setWorkspaceStep("review-json");
|
|
783
1042
|
return [3 /*break*/, 4];
|
|
784
1043
|
case 3:
|
|
785
1044
|
error_1 = _b.sent();
|
|
@@ -793,8 +1052,8 @@ export function DatasourceIntrospectionPage() {
|
|
|
793
1052
|
}
|
|
794
1053
|
});
|
|
795
1054
|
}); };
|
|
796
|
-
var
|
|
797
|
-
var validationErrors, reviewedModelValidation,
|
|
1055
|
+
var persistMappingArtifacts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1056
|
+
var validationErrors, reviewedModelValidation, response_1, error_2;
|
|
798
1057
|
var _a, _b, _c, _d;
|
|
799
1058
|
return __generator(this, function (_e) {
|
|
800
1059
|
switch (_e.label) {
|
|
@@ -806,14 +1065,13 @@ export function DatasourceIntrospectionPage() {
|
|
|
806
1065
|
validationErrors.forEach(function (detail) {
|
|
807
1066
|
dispatch(showToast({ severity: "error", summary: "Validation", detail: detail }));
|
|
808
1067
|
});
|
|
809
|
-
|
|
1068
|
+
setWorkspaceStep("configure");
|
|
810
1069
|
return [2 /*return*/];
|
|
811
1070
|
}
|
|
812
1071
|
reviewedModelValidation = parseAndValidateReviewedModelJson(metadataJsonText, drawerDraft);
|
|
813
1072
|
if (reviewedModelValidation.error || !reviewedModelValidation.parsed) {
|
|
814
1073
|
setMetadataJsonValidationError((_b = reviewedModelValidation.error) !== null && _b !== void 0 ? _b : "Metadata JSON is invalid.");
|
|
815
|
-
|
|
816
|
-
setDrawerStep("review");
|
|
1074
|
+
setWorkspaceStep("review-json");
|
|
817
1075
|
dispatch(showToast({
|
|
818
1076
|
severity: "error",
|
|
819
1077
|
summary: "Validation",
|
|
@@ -824,43 +1082,208 @@ export function DatasourceIntrospectionPage() {
|
|
|
824
1082
|
setMetadataJsonValidationError(null);
|
|
825
1083
|
_e.label = 1;
|
|
826
1084
|
case 1:
|
|
827
|
-
_e.trys.push([1,
|
|
1085
|
+
_e.trys.push([1, 3, , 4]);
|
|
828
1086
|
return [4 /*yield*/, applyMapping({
|
|
829
1087
|
moduleId: bootstrap.module.id,
|
|
830
1088
|
payload: __assign(__assign({}, buildMappingRequest(drawerDraft, (_d = mappingPreview === null || mappingPreview === void 0 ? void 0 : mappingPreview.migration.timestamp) !== null && _d !== void 0 ? _d : null)), { reviewedModel: reviewedModelValidation.parsed }),
|
|
831
1089
|
}).unwrap()];
|
|
1090
|
+
case 2:
|
|
1091
|
+
response_1 = _e.sent();
|
|
1092
|
+
dispatch(showToast({
|
|
1093
|
+
severity: "success",
|
|
1094
|
+
summary: "Mapping saved",
|
|
1095
|
+
detail: drawerDraft.mapped
|
|
1096
|
+
? "The model mapping metadata was updated successfully."
|
|
1097
|
+
: "The model mapping metadata was created successfully.",
|
|
1098
|
+
}));
|
|
1099
|
+
setPersistedMappingResult(response_1);
|
|
1100
|
+
setMigrationArtifactsResult(null);
|
|
1101
|
+
setGenerateCodeOutput("");
|
|
1102
|
+
setIsGeneratingCodeWorkflow(false);
|
|
1103
|
+
setGenerateCodeStatusMessage("");
|
|
1104
|
+
setGenerateCodeTimeoutMessage(null);
|
|
1105
|
+
setGenerateCodeReady(false);
|
|
1106
|
+
setHasAttemptedGenerateCode(false);
|
|
1107
|
+
setRunMigrationOutput("");
|
|
1108
|
+
setRunMigrationCompleted(false);
|
|
1109
|
+
setDrawerDraft(function (current) { return (current
|
|
1110
|
+
? __assign(__assign({}, current), { mapped: true, modelId: response_1.modelId }) : current); });
|
|
1111
|
+
setWorkspaceStep("generate-code");
|
|
1112
|
+
return [3 /*break*/, 4];
|
|
1113
|
+
case 3:
|
|
1114
|
+
error_2 = _e.sent();
|
|
1115
|
+
dispatch(showToast({
|
|
1116
|
+
severity: "error",
|
|
1117
|
+
summary: "Save failed",
|
|
1118
|
+
detail: readQueryError(error_2),
|
|
1119
|
+
}));
|
|
1120
|
+
return [3 /*break*/, 4];
|
|
1121
|
+
case 4: return [2 /*return*/];
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
}); };
|
|
1125
|
+
var handleGenerateCode = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1126
|
+
var responseMessage, response, error_3, isBackendAvailable;
|
|
1127
|
+
var _a;
|
|
1128
|
+
return __generator(this, function (_b) {
|
|
1129
|
+
switch (_b.label) {
|
|
1130
|
+
case 0:
|
|
1131
|
+
if (!((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _a === void 0 ? void 0 : _a.id))
|
|
1132
|
+
return [2 /*return*/];
|
|
1133
|
+
setHasAttemptedGenerateCode(true);
|
|
1134
|
+
setRunMigrationCompleted(false);
|
|
1135
|
+
setIsGeneratingCodeWorkflow(true);
|
|
1136
|
+
setGenerateCodeStatusMessage("Submitting module generate-code request...");
|
|
1137
|
+
setGenerateCodeTimeoutMessage(null);
|
|
1138
|
+
setGenerateCodeReady(false);
|
|
1139
|
+
responseMessage = "";
|
|
1140
|
+
_b.label = 1;
|
|
1141
|
+
case 1:
|
|
1142
|
+
_b.trys.push([1, 3, , 4]);
|
|
1143
|
+
return [4 /*yield*/, generateCode({ moduleId: bootstrap.module.id }).unwrap()];
|
|
1144
|
+
case 2:
|
|
1145
|
+
response = _b.sent();
|
|
1146
|
+
responseMessage = response.output || response.message || "";
|
|
1147
|
+
setGenerateCodeOutput(responseMessage);
|
|
1148
|
+
setGenerateCodeStatusMessage("Waiting briefly for the backend restart window...");
|
|
1149
|
+
return [3 /*break*/, 4];
|
|
1150
|
+
case 3:
|
|
1151
|
+
error_3 = _b.sent();
|
|
1152
|
+
if (!isRecoverableGenerateCodeError(error_3)) {
|
|
1153
|
+
setIsGeneratingCodeWorkflow(false);
|
|
1154
|
+
setGenerateCodeStatusMessage("");
|
|
1155
|
+
setGenerateCodeTimeoutMessage(null);
|
|
1156
|
+
setGenerateCodeReady(false);
|
|
1157
|
+
dispatch(showToast({
|
|
1158
|
+
severity: "error",
|
|
1159
|
+
summary: "Generate code failed",
|
|
1160
|
+
detail: readQueryError(error_3),
|
|
1161
|
+
}));
|
|
1162
|
+
return [2 /*return*/];
|
|
1163
|
+
}
|
|
1164
|
+
setGenerateCodeStatusMessage("The API connection dropped during restart. Waiting for the backend to come back online...");
|
|
1165
|
+
return [3 /*break*/, 4];
|
|
1166
|
+
case 4: return [4 /*yield*/, new Promise(function (resolve) { return window.setTimeout(resolve, 5000); })];
|
|
1167
|
+
case 5:
|
|
1168
|
+
_b.sent();
|
|
1169
|
+
setGenerateCodeStatusMessage("Checking if the backend is back online...");
|
|
1170
|
+
return [4 /*yield*/, waitForBackendAvailability({
|
|
1171
|
+
retries: 40,
|
|
1172
|
+
delayMs: 1500,
|
|
1173
|
+
})];
|
|
1174
|
+
case 6:
|
|
1175
|
+
isBackendAvailable = _b.sent();
|
|
1176
|
+
setIsGeneratingCodeWorkflow(false);
|
|
1177
|
+
if (!isBackendAvailable) {
|
|
1178
|
+
setGenerateCodeTimeoutMessage("Code generation took longer than expected. The backend did not come back within 60 seconds, so there may be a compilation failure or another startup issue. Please review the generated code manually and check the API logs before continuing.");
|
|
1179
|
+
dispatch(showToast({
|
|
1180
|
+
severity: "warn",
|
|
1181
|
+
summary: "Backend restart taking too long",
|
|
1182
|
+
detail: "The generate-code request completed, but the backend did not come back within 60 seconds.",
|
|
1183
|
+
}));
|
|
1184
|
+
return [2 /*return*/];
|
|
1185
|
+
}
|
|
1186
|
+
setGenerateCodeStatusMessage("Backend is back online. You can continue.");
|
|
1187
|
+
setGenerateCodeReady(true);
|
|
1188
|
+
setMigrationArtifactsResult(null);
|
|
1189
|
+
setRunMigrationOutput("");
|
|
1190
|
+
dispatch(showToast({
|
|
1191
|
+
severity: "success",
|
|
1192
|
+
summary: "Code generated",
|
|
1193
|
+
detail: responseMessage || "The backend is back online. You can continue to the migration artifacts step.",
|
|
1194
|
+
}));
|
|
1195
|
+
return [2 /*return*/];
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
}); };
|
|
1199
|
+
var handleCreateMigrationArtifacts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1200
|
+
var reviewedModelValidation, response, error_4;
|
|
1201
|
+
var _a, _b, _c, _d;
|
|
1202
|
+
return __generator(this, function (_e) {
|
|
1203
|
+
switch (_e.label) {
|
|
1204
|
+
case 0:
|
|
1205
|
+
if (!drawerDraft || !((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _a === void 0 ? void 0 : _a.id) || !(persistedMappingResult === null || persistedMappingResult === void 0 ? void 0 : persistedMappingResult.modelId))
|
|
1206
|
+
return [2 /*return*/];
|
|
1207
|
+
reviewedModelValidation = parseAndValidateReviewedModelJson(metadataJsonText, drawerDraft);
|
|
1208
|
+
if (reviewedModelValidation.error || !reviewedModelValidation.parsed) {
|
|
1209
|
+
setMetadataJsonValidationError((_b = reviewedModelValidation.error) !== null && _b !== void 0 ? _b : "Metadata JSON is invalid.");
|
|
1210
|
+
setWorkspaceStep("review-json");
|
|
1211
|
+
dispatch(showToast({
|
|
1212
|
+
severity: "error",
|
|
1213
|
+
summary: "Validation",
|
|
1214
|
+
detail: (_c = reviewedModelValidation.error) !== null && _c !== void 0 ? _c : "Metadata JSON is invalid.",
|
|
1215
|
+
}));
|
|
1216
|
+
return [2 /*return*/];
|
|
1217
|
+
}
|
|
1218
|
+
_e.label = 1;
|
|
1219
|
+
case 1:
|
|
1220
|
+
_e.trys.push([1, 3, , 4]);
|
|
1221
|
+
return [4 /*yield*/, createMigrationArtifacts({
|
|
1222
|
+
moduleId: bootstrap.module.id,
|
|
1223
|
+
payload: __assign(__assign({}, buildMappingRequest(__assign(__assign({}, drawerDraft), { mapped: true, modelId: persistedMappingResult.modelId }), (_d = mappingPreview === null || mappingPreview === void 0 ? void 0 : mappingPreview.migration.timestamp) !== null && _d !== void 0 ? _d : null)), { reviewedModel: reviewedModelValidation.parsed }),
|
|
1224
|
+
}).unwrap()];
|
|
832
1225
|
case 2:
|
|
833
1226
|
response = _e.sent();
|
|
1227
|
+
setMigrationArtifactsResult(response);
|
|
1228
|
+
setWorkspaceStep("run-migration");
|
|
834
1229
|
dispatch(showToast({
|
|
835
1230
|
severity: "success",
|
|
836
|
-
summary: "
|
|
1231
|
+
summary: "Migration artifacts created",
|
|
837
1232
|
detail: response.migration.written
|
|
838
|
-
? "The
|
|
839
|
-
:
|
|
840
|
-
|
|
841
|
-
|
|
1233
|
+
? "The migration file and datasource registration were written successfully."
|
|
1234
|
+
: "No migration file was required, but the datasource registration was updated successfully.",
|
|
1235
|
+
}));
|
|
1236
|
+
return [3 /*break*/, 4];
|
|
1237
|
+
case 3:
|
|
1238
|
+
error_4 = _e.sent();
|
|
1239
|
+
dispatch(showToast({
|
|
1240
|
+
severity: "error",
|
|
1241
|
+
summary: "Create migration artifacts failed",
|
|
1242
|
+
detail: readQueryError(error_4),
|
|
1243
|
+
}));
|
|
1244
|
+
return [3 /*break*/, 4];
|
|
1245
|
+
case 4: return [2 /*return*/];
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
}); };
|
|
1249
|
+
var handleRunMigration = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1250
|
+
var response, error_5;
|
|
1251
|
+
var _a;
|
|
1252
|
+
return __generator(this, function (_b) {
|
|
1253
|
+
switch (_b.label) {
|
|
1254
|
+
case 0:
|
|
1255
|
+
if (!((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _a === void 0 ? void 0 : _a.id) || !selectedDatasource)
|
|
1256
|
+
return [2 /*return*/];
|
|
1257
|
+
_b.label = 1;
|
|
1258
|
+
case 1:
|
|
1259
|
+
_b.trys.push([1, 5, , 6]);
|
|
1260
|
+
return [4 /*yield*/, runMigration({
|
|
1261
|
+
moduleId: bootstrap.module.id,
|
|
1262
|
+
datasource: selectedDatasource,
|
|
1263
|
+
}).unwrap()];
|
|
1264
|
+
case 2:
|
|
1265
|
+
response = _b.sent();
|
|
1266
|
+
setRunMigrationOutput(response.output || response.message || "");
|
|
1267
|
+
setRunMigrationCompleted(true);
|
|
1268
|
+
dispatch(showToast({
|
|
1269
|
+
severity: "success",
|
|
1270
|
+
summary: "Migration workflow complete",
|
|
1271
|
+
detail: response.message || "Migration, build, and seed ran successfully for datasource \"".concat(selectedDatasource, "\"."),
|
|
842
1272
|
}));
|
|
843
|
-
setDrawerOpen(false);
|
|
844
|
-
setDrawerDraft(null);
|
|
845
|
-
setMappingPreview(null);
|
|
846
|
-
setReviewedMetadataJsonValue(null);
|
|
847
|
-
setMetadataJsonText("");
|
|
848
|
-
setMetadataJsonValidationError(null);
|
|
849
|
-
setMetadataJsonResetToken("saved-".concat(Date.now()));
|
|
850
|
-
setDrawerStep("edit");
|
|
851
1273
|
return [4 /*yield*/, refetchTables()];
|
|
852
1274
|
case 3:
|
|
853
|
-
|
|
1275
|
+
_b.sent();
|
|
854
1276
|
return [4 /*yield*/, refetchBootstrap()];
|
|
855
1277
|
case 4:
|
|
856
|
-
|
|
1278
|
+
_b.sent();
|
|
857
1279
|
return [3 /*break*/, 6];
|
|
858
1280
|
case 5:
|
|
859
|
-
|
|
1281
|
+
error_5 = _b.sent();
|
|
1282
|
+
setRunMigrationOutput(readQueryError(error_5));
|
|
860
1283
|
dispatch(showToast({
|
|
861
1284
|
severity: "error",
|
|
862
|
-
summary: "
|
|
863
|
-
detail: readQueryError(
|
|
1285
|
+
summary: "Run migration failed",
|
|
1286
|
+
detail: readQueryError(error_5),
|
|
864
1287
|
}));
|
|
865
1288
|
return [3 /*break*/, 6];
|
|
866
1289
|
case 6: return [2 /*return*/];
|
|
@@ -870,21 +1293,84 @@ export function DatasourceIntrospectionPage() {
|
|
|
870
1293
|
if (!isValidModuleId) {
|
|
871
1294
|
return (_jsx("div", { className: "sdix-page", children: _jsxs("div", { className: "sdix-empty-state", children: [_jsx(ShieldAlert, { size: 24 }), _jsx("h2", { children: "Module not found" }), _jsx("p", { children: "Open datasource introspection from a saved module so SolidX knows which module should receive the mapped models." })] }) }));
|
|
872
1295
|
}
|
|
873
|
-
var
|
|
1296
|
+
var stepSequence = [
|
|
1297
|
+
"configure",
|
|
1298
|
+
"review-json",
|
|
1299
|
+
"generate-code",
|
|
1300
|
+
"create-migrations",
|
|
1301
|
+
"run-migration",
|
|
1302
|
+
];
|
|
1303
|
+
var currentStepIndex = stepSequence.indexOf(workspaceStep);
|
|
1304
|
+
var stepperItems = [
|
|
1305
|
+
{
|
|
1306
|
+
key: "configure",
|
|
1307
|
+
label: "Configure Mapping",
|
|
1308
|
+
complete: currentStepIndex > 0,
|
|
1309
|
+
active: workspaceStep === "configure",
|
|
1310
|
+
disabled: false,
|
|
1311
|
+
onClick: function () { return setWorkspaceStep("configure"); },
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
key: "review-json",
|
|
1315
|
+
label: "Review Mapping JSON",
|
|
1316
|
+
complete: currentStepIndex > 1,
|
|
1317
|
+
active: workspaceStep === "review-json",
|
|
1318
|
+
disabled: !mappingPreview,
|
|
1319
|
+
onClick: function () {
|
|
1320
|
+
if (mappingPreview)
|
|
1321
|
+
setWorkspaceStep("review-json");
|
|
1322
|
+
},
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
key: "generate-code",
|
|
1326
|
+
label: "Generate Code",
|
|
1327
|
+
complete: currentStepIndex > 2,
|
|
1328
|
+
active: workspaceStep === "generate-code",
|
|
1329
|
+
disabled: !persistedMappingResult,
|
|
1330
|
+
onClick: function () {
|
|
1331
|
+
if (persistedMappingResult)
|
|
1332
|
+
setWorkspaceStep("generate-code");
|
|
1333
|
+
},
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
key: "create-migrations",
|
|
1337
|
+
label: "Create Migrations",
|
|
1338
|
+
complete: currentStepIndex > 3,
|
|
1339
|
+
active: workspaceStep === "create-migrations",
|
|
1340
|
+
disabled: !hasAttemptedGenerateCode,
|
|
1341
|
+
onClick: function () {
|
|
1342
|
+
if (hasAttemptedGenerateCode)
|
|
1343
|
+
setWorkspaceStep("create-migrations");
|
|
1344
|
+
},
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
key: "run-migration",
|
|
1348
|
+
label: "Run Migration",
|
|
1349
|
+
complete: false,
|
|
1350
|
+
active: workspaceStep === "run-migration",
|
|
1351
|
+
disabled: !migrationArtifactsResult,
|
|
1352
|
+
onClick: function () {
|
|
1353
|
+
if (migrationArtifactsResult)
|
|
1354
|
+
setWorkspaceStep("run-migration");
|
|
1355
|
+
},
|
|
1356
|
+
},
|
|
1357
|
+
];
|
|
1358
|
+
var selectableUnmappedColumns = (_o = drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.columns.filter(function (column) { return !column.handledBySuperclass && !column.matched && !column.isPrimaryKey; })) !== null && _o !== void 0 ? _o : [];
|
|
874
1359
|
var allSelectableUnmappedIncluded = selectableUnmappedColumns.length > 0
|
|
875
1360
|
&& selectableUnmappedColumns.every(function (column) { return column.include; });
|
|
876
|
-
var drawerRawDdl = (
|
|
1361
|
+
var drawerRawDdl = (_p = tableDetail === null || tableDetail === void 0 ? void 0 : tableDetail.rawDdl) !== null && _p !== void 0 ? _p : null;
|
|
877
1362
|
var drawerTabs = drawerDraft ? [
|
|
878
1363
|
{
|
|
879
1364
|
value: "general-info",
|
|
880
1365
|
label: "General Info",
|
|
881
|
-
content: (_jsxs("div", { className: "sdix-drawer-form", children: [_jsxs("section", { className: "sdix-form-section", children: [_jsx("h4", { className: "solid-form-layout-label", children: "Model Info" }), _jsxs("div", { className: "sdix-form-grid", children: [_jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-singular-name", children: "Singular Name" }), _jsx(SolidInput, { id: "sdix-singular-name", value: drawerDraft.singularName, onChange: function (event) { return updateGeneralField("singularName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-plural-name", children: "Plural Name" }), _jsx(SolidInput, { id: "sdix-plural-name", value: drawerDraft.pluralName, onChange: function (event) { return updateGeneralField("pluralName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-display-name", children: "Display Name" }), _jsx(SolidInput, { id: "sdix-display-name", value: drawerDraft.displayName, onChange: function (event) { return updateGeneralField("displayName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-user-key-field", children: "User Key Field" }), _jsx(SolidSelect, { id: "sdix-user-key-field", value: drawerDraft.userKeyField, options: drawerUserKeyOptions, placeholder: "Select user key field", onChange: function (event) { return changeUserKeyField(event.value); } })] }), _jsxs("div", { className: "sdix-form-field sdix-form-field--full", children: [_jsx("label", { htmlFor: "sdix-description", children: "Description" }), _jsx(SolidTextarea, { id: "sdix-description", rows:
|
|
1366
|
+
content: (_jsxs("div", { className: "sdix-drawer-form", children: [_jsxs("section", { className: "sdix-form-section", children: [_jsx("h4", { className: "solid-form-layout-label", children: "Model Info" }), _jsxs("div", { className: "sdix-form-grid", children: [_jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-singular-name", children: "Singular Name" }), _jsx(SolidInput, { id: "sdix-singular-name", value: drawerDraft.singularName, onChange: function (event) { return updateGeneralField("singularName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-plural-name", children: "Plural Name" }), _jsx(SolidInput, { id: "sdix-plural-name", value: drawerDraft.pluralName, onChange: function (event) { return updateGeneralField("pluralName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-display-name", children: "Display Name" }), _jsx(SolidInput, { id: "sdix-display-name", value: drawerDraft.displayName, onChange: function (event) { return updateGeneralField("displayName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-user-key-field", children: "User Key Field" }), _jsx(SolidSelect, { id: "sdix-user-key-field", value: drawerDraft.userKeyField, options: drawerUserKeyOptions, placeholder: "Select user key field", onChange: function (event) { return changeUserKeyField(event.value); } })] }), _jsxs("div", { className: "sdix-form-field sdix-form-field--full", children: [_jsx("label", { htmlFor: "sdix-description", children: "Description" }), _jsx(SolidTextarea, { className: "sdix-description-textarea", id: "sdix-description", rows: 2, value: drawerDraft.description, onChange: function (event) { return updateGeneralField("description", event.target.value); } })] })] })] }), _jsxs("section", { className: "sdix-form-section", children: [_jsx("h4", { className: "solid-form-layout-label", children: "Datasource Binding" }), _jsxs("div", { className: "sdix-form-grid", children: [_jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-table-name", children: "Table Name" }), _jsx(SolidInput, { id: "sdix-table-name", value: drawerDraft.tableName, onChange: function (event) { return updateGeneralField("tableName", event.target.value); } })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-schema-name", children: "Schema" }), _jsx(SolidInput, { id: "sdix-schema-name", value: (_q = drawerDraft.schema) !== null && _q !== void 0 ? _q : "default", disabled: true })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-datasource-name", children: "Datasource" }), _jsx(SolidInput, { id: "sdix-datasource-name", value: drawerDraft.dataSource, disabled: true })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-datasource-type", children: "Provider" }), _jsx(SolidInput, { id: "sdix-datasource-type", value: providerLabel(drawerDraft.dataSourceType), disabled: true })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-legacy-type", children: "Mapping Strategy" }), _jsx(SolidSelect, { id: "sdix-legacy-type", value: drawerDraft.legacyTableType, options: mappingStrategyOptions, onChange: function (event) { return updateLegacyTableType(event.value); } }), _jsxs("small", { className: "sdix-inline-note", children: ["This will use ", _jsx("strong", { children: drawerDraft.baseClassName }), " for the generated entity."] })] })] })] })] })),
|
|
882
1367
|
},
|
|
883
1368
|
{
|
|
884
1369
|
value: "columns-mapping",
|
|
885
1370
|
label: "Columns Mapping",
|
|
886
|
-
content: (_jsxs("div", { className: "sdix-columns", children: [_jsx("div", { className: "sdix-columns__toolbar", children: _jsxs("div", { className: "sdix-columns__legend", "aria-label": "Column legend", children: [_jsx("span", { className: "sdix-status-badge is-superclass", children: "System column" }), _jsx("span", { className: "sdix-status-badge is-muted", children: "Application column" })] }) }), _jsxs("div", { className: "sdix-column-table", children: [_jsxs("div", { className: "sdix-column-row sdix-column-row--head sdix-column-row--mapping", children: [_jsx("span", {
|
|
1371
|
+
content: (_jsxs("div", { className: "sdix-columns", children: [_jsx("div", { className: "sdix-columns__toolbar", children: _jsxs("div", { className: "sdix-columns__legend", "aria-label": "Column legend", children: [_jsx("span", { className: "sdix-status-badge is-superclass", children: "System column" }), _jsx("span", { className: "sdix-status-badge is-muted", children: "Application column" })] }) }), _jsxs("div", { className: "sdix-column-table", children: [_jsxs("div", { className: "sdix-column-row sdix-column-row--head sdix-column-row--mapping", children: [_jsx("span", { className: "sdix-column-select-header", children: selectableUnmappedColumns.length ? (_jsx(SolidCheckbox, { checked: allSelectableUnmappedIncluded, onChange: function (event) { return setUnmappedColumnsIncluded(event.target.checked); }, "aria-label": allSelectableUnmappedIncluded ? "Deselect all unmapped columns" : "Select all unmapped columns" })) : ("Include") }), _jsx("span", { children: "Column" }), _jsx("span", { children: "Field" }), _jsx("span", { children: "Label" }), _jsx("span", { children: "Database" }), _jsx("span", { children: "SolidX" }), _jsx("span", { children: "Status" }), _jsx("span", { children: "Action" })] }), drawerDraft.columns.map(function (column) {
|
|
887
1372
|
var isUserKey = drawerDraft.userKeyField === column.fieldName;
|
|
1373
|
+
var isPrimaryKeyField = column.isPrimaryKey;
|
|
888
1374
|
var statusClassName = column.handledBySuperclass
|
|
889
1375
|
? "is-superclass"
|
|
890
1376
|
: column.include
|
|
@@ -901,7 +1387,7 @@ export function DatasourceIntrospectionPage() {
|
|
|
901
1387
|
: column.matched
|
|
902
1388
|
? "Currently omitted"
|
|
903
1389
|
: "Skipped for now";
|
|
904
|
-
return (_jsxs("div", { className: "sdix-column-row sdix-column-row--mapping", children: [_jsxs("span", { className: "sdix-column-meta", children: [_jsx("strong", { children: column.columnName }), column.isAutoGenerated ? _jsx("small", { children: "Generated id column" }) : null] }), _jsxs("span", { children: [_jsx(SolidInput, { value: column.fieldName, disabled: column.handledBySuperclass, onChange: function (event) { return updateColumnFieldName(column.columnName, event.target.value); } }), isUserKey ? _jsx("small", { className: "sdix-inline-note", children: "User key" }) : null] }), _jsx("span", { className: "sdix-column-meta", children: _jsx("strong", { children: column.dataType }) }), _jsx("span", { children: column.handledBySuperclass ? (_jsx("span", { children: column.solidFieldType })) : (_jsx(SolidSelect, { value: column.solidFieldType, options: scalarFieldTypeOptions, onChange: function (event) { return updateColumnSolidFieldType(column.columnName, event.value); } })) }), _jsx("span", { className: "sdix-
|
|
1390
|
+
return (_jsxs("div", { className: "sdix-column-row sdix-column-row--mapping", children: [_jsx("span", { className: "sdix-column-include", children: column.handledBySuperclass ? (_jsx("span", { className: "sdix-column-placeholder", children: "-" })) : column.matched ? (_jsx("span", { className: "sdix-column-placeholder", children: "-" })) : column.isPrimaryKey ? (_jsx(SolidCheckbox, { checked: true, disabled: true, "aria-label": "Required included column" })) : (_jsx(SolidCheckbox, { checked: column.include, onChange: function (event) { return setColumnIncluded(column.columnName, event.target.checked); } })) }), _jsxs("span", { className: "sdix-column-meta", children: [_jsx("strong", { children: column.columnName }), column.isAutoGenerated ? _jsx("small", { children: "Generated id column" }) : null] }), _jsxs("span", { children: [_jsx(SolidInput, { value: column.fieldName, disabled: column.handledBySuperclass, onChange: function (event) { return updateColumnFieldName(column.columnName, event.target.value); } }), isUserKey || isPrimaryKeyField ? (_jsxs("div", { className: "sdix-inline-note-stack", children: [isUserKey ? _jsx("small", { className: "sdix-inline-note", children: "User key" }) : null, isPrimaryKeyField ? _jsx("small", { className: "sdix-inline-note", children: "Primary key" }) : null] })) : null] }), _jsx("span", { children: _jsx(SolidInput, { value: column.displayName, disabled: column.handledBySuperclass, onChange: function (event) { return updateColumnDisplayName(column.columnName, event.target.value); } }) }), _jsx("span", { className: "sdix-column-meta", children: _jsx("strong", { children: column.dataType }) }), _jsx("span", { children: column.handledBySuperclass ? (_jsx("span", { children: column.solidFieldType })) : (_jsx(SolidSelect, { value: column.solidFieldType, options: scalarFieldTypeOptions, onChange: function (event) { return updateColumnSolidFieldType(column.columnName, event.value); } })) }), _jsx("span", { children: _jsx("span", { className: "sdix-status-badge ".concat(statusClassName), children: statusText }) }), _jsx("span", { className: "sdix-column-action", children: _jsxs("div", { className: "sdix-column-action-stack", children: [!column.handledBySuperclass && (column.include || column.matched) ? (_jsx(SolidButton, { size: "small", variant: "outline", className: "sdix-column-action-icon", onClick: function () { return openFieldConfigEditor(column.columnName); }, "aria-label": "Configure ".concat(column.fieldName || column.columnName, " field"), children: _jsx(Cog, { size: 14 }) })) : null, column.handledBySuperclass ? (_jsx(SolidButton, { size: "small", variant: "outline", disabled: true, className: "sdix-column-action-chip sdix-column-action-chip--managed", children: "Managed" })) : column.isPrimaryKey ? (_jsx(SolidButton, { size: "small", variant: "outline", disabled: true, className: "sdix-column-action-chip sdix-column-action-chip--required", children: "Required" })) : column.matched ? (_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setColumnIncluded(column.columnName, false); }, children: "Remove mapping" })) : (_jsx("span", { className: "sdix-column-placeholder", children: "-" }))] }) })] }, column.columnName));
|
|
905
1391
|
})] })] })),
|
|
906
1392
|
},
|
|
907
1393
|
{
|
|
@@ -910,38 +1396,80 @@ export function DatasourceIntrospectionPage() {
|
|
|
910
1396
|
content: (_jsx("div", { className: "sdix-ddl-tab", children: (drawerRawDdl === null || drawerRawDdl === void 0 ? void 0 : drawerRawDdl.available) && drawerRawDdl.statement ? (_jsx("pre", { className: "sdix-ddl-code", children: _jsx("code", { children: drawerRawDdl.statement }) })) : (_jsxs("div", { className: "sdix-empty-state is-inline sdix-ddl-empty", children: [_jsx(Database, { size: 18 }), _jsx("p", { children: (drawerRawDdl === null || drawerRawDdl === void 0 ? void 0 : drawerRawDdl.note) || "DDL preview is not available for this table." })] })) })),
|
|
911
1397
|
},
|
|
912
1398
|
] : [];
|
|
913
|
-
var
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1399
|
+
var reviewJsonPanel = mappingPreview ? (_jsxs("div", { className: "sdix-review-panel sdix-review-panel--metadata", children: [_jsxs("div", { className: "sdix-review-meta sdix-review-meta--compact", children: [_jsx("span", { children: "Target file" }), _jsx("strong", { children: mappingPreview.metadataJson.filePath })] }), _jsx(SolidJsonEditor, { className: "sdix-json-editor", value: reviewedMetadataJsonValue !== null && reviewedMetadataJsonValue !== void 0 ? reviewedMetadataJsonValue : mappingPreview.metadataJson.model, resetToken: metadataJsonResetToken, onValueChange: function (nextValue) {
|
|
1400
|
+
setReviewedMetadataJsonValue(nextValue);
|
|
1401
|
+
if (metadataJsonValidationError) {
|
|
1402
|
+
setMetadataJsonValidationError(null);
|
|
1403
|
+
}
|
|
1404
|
+
}, onTextChange: function (nextText) {
|
|
1405
|
+
setMetadataJsonText(nextText);
|
|
1406
|
+
}, onErrorChange: setMetadataJsonValidationError }), metadataJsonValidationError ? (_jsx("div", { className: "sdix-json-validation-error", children: _jsx("span", { children: metadataJsonValidationError }) })) : null] })) : null;
|
|
1407
|
+
var createMigrationsPanel = mappingPreview ? (_jsx("div", { className: "sdix-review-panel sdix-review-panel--migration", children: mappingPreview.migration.willGenerate && mappingPreview.migration.filePath ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sdix-review-meta sdix-review-meta--compact", children: [_jsx("span", { children: "Target file" }), _jsx("strong", { children: mappingPreview.migration.filePath })] }), _jsx("p", { className: "sdix-review-note", children: "This migration preview is generated from the current mapping and stays read-only here. Moving ahead writes the migration file to disk and updates the datasource registration now that the entity code already exists." }), mappingPreview.migration.content ? (_jsx("pre", { className: "sdix-ddl-code sdix-ddl-code--fill", children: _jsx("code", { children: mappingPreview.migration.content }) })) : null] })) : (_jsxs("div", { className: "sdix-empty-state is-inline sdix-ddl-empty", children: [_jsx(Database, { size: 18 }), _jsx("p", { children: mappingPreview.migration.note })] })) })) : null;
|
|
1408
|
+
var generateCodePanel = (_jsxs("div", { className: "sdix-stage-panel", children: [_jsxs("div", { className: "sdix-stage-panel__header", children: [_jsx("span", { className: "sdix-stage-panel__eyebrow", children: "Step 3" }), _jsx("h3", { children: "Generate module code" }), _jsx("p", { children: "The reviewed metadata JSON is now persisted. Run the normal SolidX module generation flow next so the entity, DTOs, repository, service, controller, and UI code are refreshed before we register the entity on the datasource and write the migration." })] }), _jsxs("div", { className: "sdix-stage-panel__body", children: [_jsxs("div", { className: "sdix-stage-panel__card", children: [_jsx("div", { className: "sdix-stage-panel__card-title", children: "What happens here" }), _jsxs("ul", { className: "sdix-stage-panel__list", children: [_jsxs("li", { children: ["The module generate-code pipeline runs for ", _jsx("strong", { children: (_r = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _r === void 0 ? void 0 : _r.displayName }), "."] }), _jsx("li", { children: "The newly mapped model entity is generated inside the module source folder." }), _jsx("li", { children: "Any existing generated assets for this module may be refreshed." })] })] }), _jsx("div", { className: "sdix-stage-panel__actions", children: _jsx(SolidButton, { leftIcon: _jsx(Sparkles, { size: 14 }), loading: isGenerateCodeLoading || isGeneratingCodeWorkflow, disabled: isGenerateCodeLoading || isGeneratingCodeWorkflow, onClick: function () { return void handleGenerateCode(); }, children: "Generate Code" }) }), isGeneratingCodeWorkflow ? (_jsxs("div", { className: "sdix-empty-state is-inline sdix-stage-progress", children: [_jsx(SolidSpinner, { size: 30 }), _jsx("h3", { children: "Generating code" }), _jsx("p", { children: generateCodeStatusMessage || "Waiting for the backend to finish restarting..." })] })) : null, !isGeneratingCodeWorkflow && generateCodeTimeoutMessage ? (_jsxs("div", { className: "sdix-error is-inline sdix-stage-progress sdix-stage-progress--warning", children: [_jsx(ShieldAlert, { size: 22 }), _jsx("h3", { children: "Manual review recommended" }), _jsx("p", { children: generateCodeTimeoutMessage })] })) : null, generateCodeOutput ? (_jsx("pre", { className: "sdix-ddl-code sdix-ddl-code--fill", children: _jsx("code", { children: generateCodeOutput }) })) : null] })] }));
|
|
1409
|
+
var runMigrationPanel = (_jsxs("div", { className: "sdix-stage-panel", children: [!runMigrationCompleted ? (_jsxs("div", { className: "sdix-stage-panel__header", children: [_jsx("span", { className: "sdix-stage-panel__eyebrow", children: "Step 5" }), _jsx("h3", { children: "Run migration, build, and seed" }), _jsx("p", { children: "With the datasource file updated and module code generated, SolidX can now run the TypeORM migration for the selected datasource, rebuild the project, and reseed the mapped module metadata." })] })) : null, _jsxs("div", { className: "sdix-stage-panel__body", children: [!runMigrationCompleted ? (_jsxs("div", { className: "sdix-stage-panel__card", children: [_jsx("div", { className: "sdix-stage-panel__card-title", children: "Commands" }), _jsx("pre", { className: "sdix-stage-panel__command", children: _jsx("code", { children: "npx @solidxai/solidctl@latest migration -d ".concat(selectedDatasource, " run\nnpx @solidxai/solidctl@latest build\nnpx @solidxai/solidctl@latest seed --modules-to-seed ").concat(((_s = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _s === void 0 ? void 0 : _s.name) || "") }) })] })) : null, runMigrationCompleted ? (_jsxs("div", { className: "sdix-empty-state is-inline sdix-stage-progress", children: [_jsx(Check, { size: 24 }), _jsx("h3", { children: "Migration workflow finished" }), _jsx("p", { children: "Review the command output below. When you are satisfied, click Finish to return to the model list." })] })) : null, runMigrationOutput ? (_jsx("pre", { className: "sdix-ddl-code sdix-ddl-code--fill", children: _jsx("code", { children: runMigrationOutput }) })) : null] })] }));
|
|
1410
|
+
var workspaceContent = drawerDraft ? (function () {
|
|
1411
|
+
switch (workspaceStep) {
|
|
1412
|
+
case "review-json":
|
|
1413
|
+
return reviewJsonPanel;
|
|
1414
|
+
case "create-migrations":
|
|
1415
|
+
return createMigrationsPanel;
|
|
1416
|
+
case "generate-code":
|
|
1417
|
+
return generateCodePanel;
|
|
1418
|
+
case "run-migration":
|
|
1419
|
+
return runMigrationPanel;
|
|
1420
|
+
case "configure":
|
|
1421
|
+
default:
|
|
1422
|
+
return (_jsx(SolidTabGroup, { tabs: drawerTabs, value: drawerTab, onValueChange: setDrawerTab, className: "sdix-drawer-tabs sdix-wizard-tabs", panelClassName: "sdix-drawer-tab-panel sdix-wizard-tab-panel" }));
|
|
1423
|
+
}
|
|
1424
|
+
})() : null;
|
|
1425
|
+
var workspaceMeta = drawerDraft ? (function () {
|
|
1426
|
+
switch (workspaceStep) {
|
|
1427
|
+
case "review-json":
|
|
1428
|
+
return (_jsx("span", { children: "Review the generated metadata JSON before it is written to the module metadata file." }));
|
|
1429
|
+
case "generate-code":
|
|
1430
|
+
return persistedMappingResult ? (_jsxs("span", { children: ["Metadata JSON has been saved for", " ", _jsx("strong", { children: drawerDraft.displayName || drawerDraft.singularName }), ". Generate the module code next so the entity file exists before datasource registration is updated. Continue stays disabled until you attempt code generation at least once."] })) : (_jsx("span", { children: "Save the metadata JSON before generating code." }));
|
|
1431
|
+
case "create-migrations":
|
|
1432
|
+
return mappingPreview ? (_jsxs("span", { children: ["Create the migration artifacts for", " ", _jsx("strong", { children: mappingPreview.summary.includedColumnNames.length }), " ", "mapped columns", mappingPreview.summary.generatedSystemColumnCount
|
|
1433
|
+
? " and ".concat(mappingPreview.summary.generatedSystemColumnCount, " SolidX system column migration changes")
|
|
1434
|
+
: "", "."] })) : null;
|
|
1435
|
+
case "run-migration":
|
|
1436
|
+
return runMigrationCompleted ? (_jsxs("span", { children: ["The migration, build, and seed workflow has completed for", " ", _jsx("strong", { children: selectedDatasource }), ". Review the output below and click Finish when you are ready to return to the model list."] })) : (_jsxs("span", { children: ["Run the migration, build, and seed workflow for", " ", _jsx("strong", { children: selectedDatasource }), " ", "to apply the SolidX system columns on the legacy table and refresh the module metadata state."] }));
|
|
1437
|
+
case "configure":
|
|
1438
|
+
default:
|
|
1439
|
+
return drawerDraft.mapped ? (_jsxs("span", { children: ["Editing mapped model", " ", _jsx("strong", { children: (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelDisplayName) || (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelSingularName) }), drawerDraft.mappedModuleLabel ? " in ".concat(drawerDraft.mappedModuleLabel) : ""] })) : (_jsx("span", { children: "Configure the field mapping draft before generating the metadata JSON preview." }));
|
|
1440
|
+
}
|
|
1441
|
+
})() : null;
|
|
1442
|
+
return (_jsx("div", { className: "sdix-page", children: isBootstrapLoading ? (_jsxs("div", { className: "sdix-loading", children: [_jsx(SolidSpinner, { size: 28 }), _jsx("p", { children: "Loading introspection workspace..." })] })) : bootstrapError ? (_jsxs("div", { className: "sdix-error", children: [_jsx("span", { children: readQueryError(bootstrapError) }), _jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return void refetchBootstrap(); }, children: "Retry" })] })) : (_jsxs(_Fragment, { children: [!isWorkspaceMode ? (_jsxs("div", { className: "sdix-toolbar", children: [_jsx("div", { className: "sdix-toolbar__left", children: _jsxs("div", { className: "sdix-toolbar-search", children: [_jsx(Search, { size: 15 }), _jsx(SolidInput, { value: tableSearch, onChange: function (event) { return setTableSearch(event.target.value); }, placeholder: "Search tables", disabled: !selectedDatasource })] }) }), _jsxs("div", { className: "sdix-toolbar__actions", children: [isBootstrapFetching || isTablesFetching ? (_jsxs("div", { className: "sdix-inline-status", children: [_jsx(SolidSpinner, { size: 16 }), _jsx("span", { children: "Refreshing" })] })) : null, _jsx(SolidButton, { size: "small", leftIcon: _jsx(Sparkles, { size: 14 }), onClick: function () {
|
|
1443
|
+
if (selectedListRow) {
|
|
1444
|
+
startMappingForRecord(selectedListRow);
|
|
1445
|
+
}
|
|
1446
|
+
}, disabled: !selectedListRow, children: "Start Mapping" }), _jsx(SolidSelect, { value: selectedDatasource, options: datasourceOptions, placeholder: "Datasource", className: "sdix-toolbar-select sdix-toolbar-select--compact", onChange: function (event) { return setSelectedDatasource(event.value); } }), _jsx(SolidButton, { size: "small", className: "sdix-icon-button", leftIcon: _jsx(RefreshCw, { size: 16 }), onClick: function () { return void handleRefresh(); }, tooltip: "Refresh", "aria-label": "Refresh" }), _jsx(SolidButton, { size: "small", className: "sdix-icon-button", leftIcon: _jsx(Cog, { size: 16 }), onClick: function () {
|
|
1447
|
+
setDraftSessionSettings(sessionSettings);
|
|
1448
|
+
setSettingsTab("datasource-info");
|
|
1449
|
+
setSettingsOpen(true);
|
|
1450
|
+
}, tooltip: "Session settings", "aria-label": "Session settings" })] })] })) : null, selectedDatasource && (tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.synchronizeBlocked) ? (_jsxs("div", { className: "sdix-blocker", children: [_jsx(ShieldAlert, { size: 20 }), _jsxs("div", { children: [_jsx("h3", { children: "Synchronize must be disabled before introspection" }), _jsx("p", { children: tablesResponse.synchronizeMessage })] })] })) : null, !isWorkspaceMode ? (_jsx("div", { className: "sdix-workbench", children: _jsx("div", { className: "sdix-table-shell", children: !selectedDatasource ? (_jsxs("div", { className: "sdix-empty-state is-inline", children: [_jsx(Database, { size: 22 }), _jsx("p", { children: "Select a datasource to load its tables." })] })) : isTablesLoading ? (_jsxs("div", { className: "sdix-loading is-inline", children: [_jsx(SolidSpinner, { size: 24 }), _jsx("p", { children: "Inspecting datasource tables..." })] })) : tablesError ? (_jsxs("div", { className: "sdix-error is-inline", children: [_jsx("span", { children: readQueryError(tablesError) }), _jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return void refetchTables(); }, children: "Retry" })] })) : !filteredRecords.length ? (_jsxs("div", { className: "sdix-empty-state is-inline", children: [_jsx(Database, { size: 22 }), _jsx("p", { children: tableSearch ? "No tables match the current quick filter." : "No database tables were discovered for this datasource." })] })) : (_jsx("div", { className: "sdix-table-area", children: _jsxs(SolidDataTable, { value: filteredRecords, dataKey: "tableName", viewportHeight: "calc(100vh - 162px)", size: "small", onRowClick: function (_a) {
|
|
1451
|
+
var data = _a.data;
|
|
1452
|
+
return setSelectedRows([data]);
|
|
1453
|
+
}, rowClassName: function (rowData) { var _a; return "".concat((_a = rowData.schema) !== null && _a !== void 0 ? _a : "", "::").concat(rowData.tableName) === selectedListRowKey ? "sdix-table-row-selected" : ""; }, emptyMessage: "No datasource tables found", children: [_jsx(Column, { header: "", body: function (rowData) {
|
|
1454
|
+
var _a;
|
|
1455
|
+
var rowKey = "".concat((_a = rowData.schema) !== null && _a !== void 0 ? _a : "", "::").concat(rowData.tableName);
|
|
1456
|
+
return (_jsx("div", { className: "sdix-selection-cell", "data-no-row-click": "true", children: _jsx(SolidCheckbox, { checked: rowKey === selectedListRowKey, onChange: function (event) { return setSelectedRows(event.target.checked ? [rowData] : []); } }) }));
|
|
1457
|
+
}, style: { width: 52, minWidth: 52 } }), _jsx(Column, { field: "tableName", header: "Table", body: function (rowData) { return (_jsx("div", { className: "sdix-table-primary-cell", children: _jsx("strong", { children: rowData.tableName }) })); }, style: { minWidth: 240 } }), _jsx(Column, { field: "schema", header: "Schema", body: function (rowData) { return rowData.schema || "dbo/default"; }, style: { minWidth: 120 } }), _jsx(Column, { header: "Status", body: function (rowData) { return (_jsx("span", { className: "sdix-status-badge ".concat(rowData.mapped ? "is-mapped" : "is-unmapped"), children: statusLabel(rowData) })); }, style: { minWidth: 150 } }), _jsx(Column, { header: "Superclass", body: function (rowData) { return rowData.suggestedBaseClassName; }, style: { minWidth: 220 } }), _jsx(Column, { field: "suggestedUserKeyField", header: "User Key", style: { minWidth: 160 } }), _jsx(Column, { header: "Mapped Model", body: function (rowData) { return (rowData.mapped
|
|
1458
|
+
? (_jsxs("div", { className: "sdix-table-primary-cell", children: [_jsx("strong", { children: rowData.mappedModelDisplayName || rowData.mappedModelSingularName || "-" }), rowData.mappedModuleDisplayName || rowData.mappedModuleName ? (_jsx("span", { children: rowData.mappedModuleDisplayName || rowData.mappedModuleName })) : null] }))
|
|
1459
|
+
: _jsx("span", { className: "sdix-muted-cell", children: "Not mapped" })); }, style: { minWidth: 200 } }), _jsx(Column, { header: "System Columns", body: function (rowData) { return Math.max(rowData.columnCount - rowData.physicalColumnCount, 0); }, style: { minWidth: 130 } }), _jsx(Column, { header: "Columns", body: function (rowData) { return rowData.physicalColumnCount; }, style: { minWidth: 110 } })] }) })) }) })) : (_jsxs("div", { className: "sdix-workspace-screen", children: [_jsxs("div", { className: "sdix-workspace-header", children: [_jsx(SolidButton, { size: "small", variant: "outline", leftIcon: _jsx(ArrowLeft, { size: 14 }), onClick: leaveWorkspace, children: "Back" }), _jsxs("div", { className: "sdix-workspace-header__identity sdix-workspace-header__identity--right", children: [_jsx("h2", { children: (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.tableName) || "Mapping workspace" }), _jsx("p", { children: selectedTable
|
|
1460
|
+
? "".concat(selectedTable.schema || "dbo", " \u00B7 ").concat((selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.database) || (selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.displayName) || "Datasource").concat(selectedDatasourceRecord ? " \u00B7 ".concat(providerLabel(selectedDatasourceRecord.type)) : "")
|
|
1461
|
+
: "Complete the legacy table mapping in a dedicated workspace." })] })] }), !selectedTable && !isTablesLoading ? (_jsxs("div", { className: "sdix-error", children: [_jsx("span", { children: "The selected table is no longer available for this datasource." }), _jsx(SolidButton, { size: "small", variant: "outline", onClick: leaveWorkspace, children: "Back to table list" })] })) : drawerLoadingError ? (_jsxs("div", { className: "sdix-error", children: [_jsx("span", { children: readQueryError(drawerLoadingError) }), _jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return void refetchTableDetail(); }, children: "Retry" })] })) : isDrawerBlockingLoading ? (_jsxs("div", { className: "sdix-loading sdix-workspace-loading", children: [_jsx(SolidSpinner, { size: 24 }), _jsx("p", { children: "Preparing column mapping preview..." })] })) : (_jsxs("div", { className: "sdix-wizard-shell", children: [_jsx("div", { className: "sdix-wizard-stepper", children: stepperItems.map(function (step, index) { return (_jsxs("button", { type: "button", className: [
|
|
1462
|
+
"sdix-wizard-stepper-item",
|
|
1463
|
+
step.active ? "is-active" : "",
|
|
1464
|
+
step.complete ? "is-complete" : "",
|
|
1465
|
+
step.disabled ? "is-disabled" : "",
|
|
1466
|
+
].filter(Boolean).join(" "), onClick: step.onClick, disabled: step.disabled, children: [_jsx("span", { className: "sdix-wizard-stepper-badge", children: step.complete ? _jsx(Check, { size: 12 }) : index + 1 }), _jsx("span", { className: "sdix-wizard-stepper-label", children: step.label })] }, step.key)); }) }), _jsx("div", { className: "sdix-wizard-panel", children: _jsx("div", { className: "sdix-wizard-panel__body", children: workspaceContent }) }), drawerDraft ? (_jsxs("div", { className: "sdix-wizard-footer", children: [_jsx("div", { className: "sdix-wizard-footer__meta", children: workspaceMeta }), _jsxs("div", { className: "sdix-wizard-footer__actions", children: [drawerDraft.mapped && drawerDraft.modelId ? (_jsx(SolidButton, { size: "small", variant: "outline", leftIcon: _jsx(ExternalLink, { size: 14 }), onClick: openMappedModelForm, children: "Open model form" })) : null, workspaceStep === "configure" ? (_jsx(SolidButton, { size: "small", leftIcon: _jsx(Save, { size: 14 }), loading: isPreviewMappingLoading, onClick: function () { return void reviewMappingJson(); }, children: "Review Mapping" })) : null, workspaceStep === "review-json" ? (_jsxs(_Fragment, { children: [_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setWorkspaceStep("configure"); }, children: "Back" }), _jsx(SolidButton, { size: "small", leftIcon: _jsx(Save, { size: 14 }), loading: isSavingMapping, onClick: function () { return void persistMappingArtifacts(); }, children: "Continue" })] })) : null, workspaceStep === "generate-code" ? (_jsxs(_Fragment, { children: [_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setWorkspaceStep("review-json"); }, children: "Back" }), _jsx(SolidButton, { size: "small", disabled: !hasAttemptedGenerateCode || isGenerateCodeLoading || isGeneratingCodeWorkflow, onClick: function () { return setWorkspaceStep("create-migrations"); }, children: "Continue" })] })) : null, workspaceStep === "create-migrations" ? (_jsxs(_Fragment, { children: [_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setWorkspaceStep("generate-code"); }, children: "Back" }), _jsx(SolidButton, { size: "small", leftIcon: _jsx(Save, { size: 14 }), loading: isCreatingMigrationArtifacts, onClick: function () { return void handleCreateMigrationArtifacts(); }, children: "Continue" })] })) : null, workspaceStep === "run-migration" ? (runMigrationCompleted ? (_jsx(SolidButton, { size: "small", leftIcon: _jsx(Check, { size: 14 }), onClick: function () { return navigate("/admin/core/solid-core/model-metadata/list"); }, children: "Finish" })) : (_jsxs(_Fragment, { children: [_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setWorkspaceStep("create-migrations"); }, children: "Back" }), _jsx(SolidButton, { size: "small", leftIcon: _jsx(Database, { size: 14 }), loading: isRunMigrationLoading, onClick: function () { return void handleRunMigration(); }, children: "Continue" })] }))) : null] })] })) : null] }))] })), _jsxs(SolidDialog, { open: Boolean(activeFieldConfigColumn), onOpenChange: function (open) {
|
|
1467
|
+
if (!open) {
|
|
1468
|
+
setFieldConfigColumnName(null);
|
|
1469
|
+
}
|
|
1470
|
+
}, style: { width: "min(1080px, calc(100vw - 48px))" }, children: [_jsxs(SolidDialogHeader, { children: [_jsxs("div", { children: [_jsx(SolidDialogTitle, { children: "Field configuration" }), _jsx(SolidDialogDescription, { children: "Reuse the standard field form here to fine-tune the mapped SolidX field before saving the introspection draft." })] }), _jsx(SolidDialogClose, {})] }), _jsx(SolidDialogSeparator, {}), _jsx(SolidDialogBody, { children: activeFieldConfigColumn && activeFieldConfigMetaData && drawerDraft ? (_jsx(FieldMetaDataForm, { modelMetaData: {
|
|
1471
|
+
singularName: drawerDraft.singularName,
|
|
1472
|
+
pluralName: drawerDraft.pluralName,
|
|
1473
|
+
}, fieldMetaData: activeFieldConfigMetaData, setFieldMetaData: function () { return undefined; }, setVisiblePopup: function () { return undefined; }, setIsDirty: function () { return undefined; }, allFields: fieldDraftAllFields, deleteModelFunction: function () { return undefined; }, params: params, setIsRequiredPopUp: function () { return undefined; }, showToaster: showFieldDraftToaster, onDraftSubmit: function (nextFieldConfig) { return applyFieldConfigDraft(activeFieldConfigColumn.columnName, nextFieldConfig); }, onClose: function () { return setFieldConfigColumnName(null); }, availableFieldTypes: scalarFieldTypeOptions.map(function (option) { return option.value; }), forceShowTypeSelector: true, selectorRequireContinue: true, selectorContinueLabel: "Next", selectorInitialFieldType: activeFieldConfigColumn.solidFieldType, disableIdentityEditingForExisting: false, submitLabel: "Save field config" })) : null })] }), _jsxs(SolidDialog, { open: settingsOpen, onOpenChange: setSettingsOpen, style: { width: "min(560px, calc(100vw - 32px))" }, children: [_jsxs(SolidDialogHeader, { children: [_jsxs("div", { children: [_jsx(SolidDialogTitle, { children: "Session settings" }), _jsx(SolidDialogDescription, { children: "Review the selected datasource and adjust the session-specific introspection flags." })] }), _jsx(SolidDialogClose, {})] }), _jsx(SolidDialogSeparator, {}), _jsx(SolidDialogBody, { children: _jsx(SolidTabGroup, { tabs: settingsTabs, value: settingsTab, onValueChange: setSettingsTab, className: "sdix-settings-tabs", panelClassName: "sdix-settings-tab-panel" }) }), _jsxs(SolidDialogFooter, { children: [_jsx(SolidButton, { variant: "outline", onClick: function () { return setSettingsOpen(false); }, children: "Cancel" }), _jsx(SolidButton, { onClick: applyDraftSettings, children: "Apply" })] })] })] })) }));
|
|
946
1474
|
}
|
|
947
1475
|
//# sourceMappingURL=DatasourceIntrospectionPage.js.map
|