@solidxai/core-ui 0.1.11 → 0.1.12-beta.1
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/adapters/auth/signInWithOAuthAccessCode.d.ts +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.d.ts.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.js.map +1 -1
- package/dist/adapters/auth/signInWithOAuthAccessCode.ts +1 -1
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +10 -6
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidLogin.tsx +19 -3
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +12 -8
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidRegister.tsx +19 -3
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +46 -43
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/GeneralSettings.tsx +22 -0
- package/dist/components/common/SocialMediaLogin.d.ts +2 -1
- package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +6 -6
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.tsx +36 -8
- package/dist/components/common/SolidLoadingState.d.ts +10 -0
- package/dist/components/common/SolidLoadingState.d.ts.map +1 -0
- package/dist/components/common/SolidLoadingState.js +8 -0
- package/dist/components/common/SolidLoadingState.js.map +1 -0
- package/dist/components/common/SolidLoadingState.module.css +56 -0
- package/dist/components/common/SolidLoadingState.tsx +28 -0
- package/dist/components/core/json/SolidJsonEditor.css +195 -0
- package/dist/components/core/json/SolidJsonEditor.d.ts +19 -0
- package/dist/components/core/json/SolidJsonEditor.d.ts.map +1 -0
- package/dist/components/core/json/SolidJsonEditor.js +109 -0
- package/dist/components/core/json/SolidJsonEditor.js.map +1 -0
- package/dist/components/core/json/SolidJsonEditor.tsx +150 -0
- package/dist/components/core/module/CreateModule.css +70 -2
- 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 +13 -1
- package/dist/components/shad-cn-ui/SolidTabs.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.js +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidTabs.tsx +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.ts +16 -0
- package/dist/redux/api/datasourceIntrospectionApi.d.ts +203 -0
- package/dist/redux/api/datasourceIntrospectionApi.d.ts.map +1 -0
- package/dist/redux/api/datasourceIntrospectionApi.js +71 -0
- package/dist/redux/api/datasourceIntrospectionApi.js.map +1 -0
- package/dist/redux/api/datasourceIntrospectionApi.ts +261 -0
- package/dist/redux/api/datasourceManagementApi.d.ts +46 -0
- package/dist/redux/api/datasourceManagementApi.d.ts.map +1 -0
- package/dist/redux/api/datasourceManagementApi.js +35 -0
- package/dist/redux/api/datasourceManagementApi.js.map +1 -0
- package/dist/redux/api/datasourceManagementApi.ts +86 -0
- package/dist/redux/store/StoreProvider.d.ts.map +1 -1
- package/dist/redux/store/StoreProvider.js +4 -2
- package/dist/redux/store/StoreProvider.js.map +1 -1
- package/dist/redux/store/StoreProvider.tsx +9 -1
- package/dist/redux/store/defaultStoreConfig.d.ts +23 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/redux/store/defaultStoreConfig.js +4 -0
- package/dist/redux/store/defaultStoreConfig.js.map +1 -1
- package/dist/redux/store/defaultStoreConfig.ts +4 -0
- package/dist/resources/solid-custom.css +72 -18
- package/dist/routes/guards/AdminGuard.d.ts.map +1 -1
- package/dist/routes/guards/AdminGuard.js +2 -1
- package/dist/routes/guards/AdminGuard.js.map +1 -1
- package/dist/routes/guards/AdminGuard.tsx +7 -1
- package/dist/routes/guards/AuthGuard.d.ts.map +1 -1
- package/dist/routes/guards/AuthGuard.js +2 -1
- package/dist/routes/guards/AuthGuard.js.map +1 -1
- package/dist/routes/guards/AuthGuard.tsx +8 -2
- package/dist/routes/guards/GuestGuard.d.ts.map +1 -1
- package/dist/routes/guards/GuestGuard.js +2 -1
- package/dist/routes/guards/GuestGuard.js.map +1 -1
- package/dist/routes/guards/GuestGuard.tsx +8 -2
- package/dist/routes/pages/admin/core/DashboardPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.js +7 -5
- package/dist/routes/pages/admin/core/DashboardPage.js.map +1 -1
- package/dist/routes/pages/admin/core/DashboardPage.module.css +18 -0
- package/dist/routes/pages/admin/core/DashboardPage.tsx +50 -32
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.css +828 -0
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts +3 -0
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js +947 -0
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js.map +1 -0
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.tsx +1719 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.css +337 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.d.ts +3 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.js +221 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.js.map +1 -0
- package/dist/routes/pages/admin/core/DatasourcesPage.tsx +540 -0
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +7 -1
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +6 -0
- package/dist/routes/types.d.ts +1 -1
- package/dist/routes/types.d.ts.map +1 -1
- package/dist/routes/types.js.map +1 -1
- package/dist/routes/types.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
|
+
if (ar || !(i in from)) {
|
|
62
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
63
|
+
ar[i] = from[i];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
|
+
};
|
|
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";
|
|
71
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
72
|
+
import { useDispatch } from "react-redux";
|
|
73
|
+
import { useParams } from "react-router-dom";
|
|
74
|
+
import { showToast } from "../../../../redux/features/toastSlice";
|
|
75
|
+
import { SolidJsonEditor } from "../../../../components/core/json/SolidJsonEditor";
|
|
76
|
+
import { Column, SolidDataTable } from "../../../../components/core/list/SolidDataTable";
|
|
77
|
+
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";
|
|
79
|
+
import { useGetmodelByIdQuery } from "../../../../redux/api/modelApi";
|
|
80
|
+
import "./DatasourceIntrospectionPage.css";
|
|
81
|
+
function providerLabel(type) {
|
|
82
|
+
if (type === "postgres")
|
|
83
|
+
return "PostgreSQL";
|
|
84
|
+
if (type === "mysql")
|
|
85
|
+
return "MySQL";
|
|
86
|
+
if (type === "mssql")
|
|
87
|
+
return "MS SQL Server";
|
|
88
|
+
return type;
|
|
89
|
+
}
|
|
90
|
+
var scalarFieldTypeOptions = [
|
|
91
|
+
{ value: "shortText", label: "Short Text" },
|
|
92
|
+
{ value: "longText", label: "Long Text" },
|
|
93
|
+
{ value: "richText", label: "Rich Text" },
|
|
94
|
+
{ value: "boolean", label: "Boolean" },
|
|
95
|
+
{ value: "int", label: "Integer" },
|
|
96
|
+
{ value: "bigint", label: "Big Integer" },
|
|
97
|
+
{ value: "decimal", label: "Decimal" },
|
|
98
|
+
{ value: "date", label: "Date" },
|
|
99
|
+
{ value: "datetime", label: "Date Time" },
|
|
100
|
+
{ value: "time", label: "Time" },
|
|
101
|
+
{ value: "json", label: "JSON" },
|
|
102
|
+
{ value: "uuid", label: "UUID" },
|
|
103
|
+
{ value: "email", label: "Email" },
|
|
104
|
+
{ value: "password", label: "Password" },
|
|
105
|
+
];
|
|
106
|
+
var scalarFieldTypeValueSet = new Set(scalarFieldTypeOptions.map(function (option) { return option.value; }));
|
|
107
|
+
function getDefaultOrmTypeForSolidFieldType(dataSourceType, solidFieldType) {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
var normalizedDatasourceType = dataSourceType.toLowerCase();
|
|
110
|
+
var ormTypesByDatasource = {
|
|
111
|
+
mssql: {
|
|
112
|
+
shortText: "varchar",
|
|
113
|
+
longText: "nvarchar",
|
|
114
|
+
richText: "nvarchar",
|
|
115
|
+
boolean: "bit",
|
|
116
|
+
int: "int",
|
|
117
|
+
bigint: "bigint",
|
|
118
|
+
decimal: "numeric",
|
|
119
|
+
date: "date",
|
|
120
|
+
datetime: "datetime",
|
|
121
|
+
time: "time",
|
|
122
|
+
json: "simple-json",
|
|
123
|
+
uuid: "uniqueidentifier",
|
|
124
|
+
email: "nvarchar",
|
|
125
|
+
password: "nvarchar",
|
|
126
|
+
},
|
|
127
|
+
mysql: {
|
|
128
|
+
shortText: "varchar",
|
|
129
|
+
longText: "longtext",
|
|
130
|
+
richText: "longtext",
|
|
131
|
+
boolean: "boolean",
|
|
132
|
+
int: "int",
|
|
133
|
+
bigint: "int",
|
|
134
|
+
decimal: "decimal",
|
|
135
|
+
date: "date",
|
|
136
|
+
datetime: "datetime",
|
|
137
|
+
time: "time",
|
|
138
|
+
json: "json",
|
|
139
|
+
uuid: "varchar",
|
|
140
|
+
email: "varchar",
|
|
141
|
+
password: "varchar",
|
|
142
|
+
},
|
|
143
|
+
postgres: {
|
|
144
|
+
shortText: "varchar",
|
|
145
|
+
longText: "text",
|
|
146
|
+
richText: "text",
|
|
147
|
+
boolean: "boolean",
|
|
148
|
+
int: "integer",
|
|
149
|
+
bigint: "bigint",
|
|
150
|
+
decimal: "decimal",
|
|
151
|
+
date: "date",
|
|
152
|
+
datetime: "timestamp",
|
|
153
|
+
time: "time",
|
|
154
|
+
json: "json",
|
|
155
|
+
uuid: "varchar",
|
|
156
|
+
email: "varchar",
|
|
157
|
+
password: "varchar",
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
return (_b = (_a = ormTypesByDatasource[normalizedDatasourceType]) === null || _a === void 0 ? void 0 : _a[solidFieldType]) !== null && _b !== void 0 ? _b : "varchar";
|
|
161
|
+
}
|
|
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
|
+
function statusLabel(record) {
|
|
170
|
+
return record.mapped ? "Mapped" : "Ready to map";
|
|
171
|
+
}
|
|
172
|
+
function readQueryError(error) {
|
|
173
|
+
var _a;
|
|
174
|
+
return (((_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.message)
|
|
175
|
+
|| (error === null || error === void 0 ? void 0 : error.error)
|
|
176
|
+
|| (error === null || error === void 0 ? void 0 : error.message)
|
|
177
|
+
|| "Something went wrong.");
|
|
178
|
+
}
|
|
179
|
+
function normalizeName(value) {
|
|
180
|
+
return value.trim().toLowerCase();
|
|
181
|
+
}
|
|
182
|
+
function findMatchingModelField(column, modelFields) {
|
|
183
|
+
var _a;
|
|
184
|
+
return (_a = modelFields.find(function (field) {
|
|
185
|
+
var _a;
|
|
186
|
+
if (field === null || field === void 0 ? void 0 : field.isSystem)
|
|
187
|
+
return false;
|
|
188
|
+
var sameColumnName = normalizeName((_a = field === null || field === void 0 ? void 0 : field.columnName) !== null && _a !== void 0 ? _a : "") === normalizeName(column.columnName);
|
|
189
|
+
if (sameColumnName)
|
|
190
|
+
return true;
|
|
191
|
+
return Boolean(column.isAutoGenerated && column.fieldName === "id" && (field === null || field === void 0 ? void 0 : field.name) === "id");
|
|
192
|
+
})) !== null && _a !== void 0 ? _a : null;
|
|
193
|
+
}
|
|
194
|
+
function sanitizeExistingFieldPayload(field) {
|
|
195
|
+
var _a = field !== null && field !== void 0 ? field : {}, createdAt = _a.createdAt, updatedAt = _a.updatedAt, deletedAt = _a.deletedAt, model = _a.model, mediaStorageProvider = _a.mediaStorageProvider, identifier = _a.identifier, rest = __rest(_a, ["createdAt", "updatedAt", "deletedAt", "model", "mediaStorageProvider", "identifier"]);
|
|
196
|
+
if ((mediaStorageProvider === null || mediaStorageProvider === void 0 ? void 0 : mediaStorageProvider.id) && !rest.mediaStorageProviderId) {
|
|
197
|
+
rest.mediaStorageProviderId = mediaStorageProvider.id;
|
|
198
|
+
}
|
|
199
|
+
return rest;
|
|
200
|
+
}
|
|
201
|
+
function buildDrawerDraft(tableDetail, selectedTable, mappedModelData) {
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
203
|
+
var modelData = selectedTable.mapped ? ((_a = mappedModelData === null || mappedModelData === void 0 ? void 0 : mappedModelData.data) !== null && _a !== void 0 ? _a : null) : null;
|
|
204
|
+
var modelFields = (_b = modelData === null || modelData === void 0 ? void 0 : modelData.fields) !== null && _b !== void 0 ? _b : [];
|
|
205
|
+
var preservedFields = modelFields.map(function (field) { return sanitizeExistingFieldPayload(field); });
|
|
206
|
+
var modelUserKeyField = ((_c = modelData === null || modelData === void 0 ? void 0 : modelData.userKeyField) === null || _c === void 0 ? void 0 : _c.name)
|
|
207
|
+
|| ((_d = modelFields.find(function (field) { return field === null || field === void 0 ? void 0 : field.isUserKey; })) === null || _d === void 0 ? void 0 : _d.name)
|
|
208
|
+
|| "";
|
|
209
|
+
var columns = tableDetail.columns.map(function (column) {
|
|
210
|
+
var _a, _b, _c, _d, _e;
|
|
211
|
+
var matchingField = findMatchingModelField(column, modelFields);
|
|
212
|
+
return {
|
|
213
|
+
columnName: column.columnName,
|
|
214
|
+
fieldName: (_a = matchingField === null || matchingField === void 0 ? void 0 : matchingField.name) !== null && _a !== void 0 ? _a : column.fieldName,
|
|
215
|
+
dataType: column.dataType,
|
|
216
|
+
solidFieldType: (_b = matchingField === null || matchingField === void 0 ? void 0 : matchingField.type) !== null && _b !== void 0 ? _b : column.solidFieldType,
|
|
217
|
+
ormType: (_c = matchingField === null || matchingField === void 0 ? void 0 : matchingField.ormType) !== null && _c !== void 0 ? _c : column.ormType,
|
|
218
|
+
nullable: column.nullable,
|
|
219
|
+
defaultValue: (_d = matchingField === null || matchingField === void 0 ? void 0 : matchingField.defaultValue) !== null && _d !== void 0 ? _d : column.defaultValue,
|
|
220
|
+
characterMaximumLength: column.characterMaximumLength,
|
|
221
|
+
numericPrecision: column.numericPrecision,
|
|
222
|
+
numericScale: column.numericScale,
|
|
223
|
+
ordinalPosition: column.ordinalPosition,
|
|
224
|
+
isAutoGenerated: column.isAutoGenerated,
|
|
225
|
+
handledBySuperclass: column.handledBySuperclass,
|
|
226
|
+
superclassFieldName: column.superclassFieldName,
|
|
227
|
+
fieldId: (_e = matchingField === null || matchingField === void 0 ? void 0 : matchingField.id) !== null && _e !== void 0 ? _e : null,
|
|
228
|
+
include: column.handledBySuperclass ? false : Boolean(matchingField) || !selectedTable.mapped,
|
|
229
|
+
matched: Boolean(matchingField),
|
|
230
|
+
isPrimaryKey: Boolean(matchingField === null || matchingField === void 0 ? void 0 : matchingField.isPrimaryKey) || (column.isAutoGenerated && column.fieldName === "id"),
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
var draftUserKeyField = modelUserKeyField || tableDetail.suggestedMetadata.userKeyField;
|
|
234
|
+
return {
|
|
235
|
+
mapped: selectedTable.mapped,
|
|
236
|
+
modelId: selectedTable.mappedModelId,
|
|
237
|
+
mappedModuleLabel: selectedTable.mappedModuleDisplayName || selectedTable.mappedModuleName || null,
|
|
238
|
+
singularName: (_e = modelData === null || modelData === void 0 ? void 0 : modelData.singularName) !== null && _e !== void 0 ? _e : tableDetail.suggestedMetadata.singularName,
|
|
239
|
+
pluralName: (_f = modelData === null || modelData === void 0 ? void 0 : modelData.pluralName) !== null && _f !== void 0 ? _f : tableDetail.suggestedMetadata.pluralName,
|
|
240
|
+
displayName: (_g = modelData === null || modelData === void 0 ? void 0 : modelData.displayName) !== null && _g !== void 0 ? _g : tableDetail.suggestedMetadata.displayName,
|
|
241
|
+
description: (_h = modelData === null || modelData === void 0 ? void 0 : modelData.description) !== null && _h !== void 0 ? _h : tableDetail.suggestedMetadata.displayName,
|
|
242
|
+
tableName: (_j = modelData === null || modelData === void 0 ? void 0 : modelData.tableName) !== null && _j !== void 0 ? _j : tableDetail.suggestedMetadata.tableName,
|
|
243
|
+
schema: tableDetail.suggestedMetadata.schema,
|
|
244
|
+
dataSource: (_k = modelData === null || modelData === void 0 ? void 0 : modelData.dataSource) !== null && _k !== void 0 ? _k : tableDetail.suggestedMetadata.dataSource,
|
|
245
|
+
dataSourceType: (_l = modelData === null || modelData === void 0 ? void 0 : modelData.dataSourceType) !== null && _l !== void 0 ? _l : tableDetail.suggestedMetadata.dataSourceType,
|
|
246
|
+
legacyTableType: (_m = modelData === null || modelData === void 0 ? void 0 : modelData.legacyTableType) !== null && _m !== void 0 ? _m : tableDetail.suggestedMetadata.legacyTableType,
|
|
247
|
+
baseClassName: tableDetail.suggestedMetadata.baseClassName,
|
|
248
|
+
userKeyField: draftUserKeyField,
|
|
249
|
+
enableAuditTracking: (_o = modelData === null || modelData === void 0 ? void 0 : modelData.enableAuditTracking) !== null && _o !== void 0 ? _o : true,
|
|
250
|
+
enableSoftDelete: (_p = modelData === null || modelData === void 0 ? void 0 : modelData.enableSoftDelete) !== null && _p !== void 0 ? _p : false,
|
|
251
|
+
draftPublishWorkflow: (_q = modelData === null || modelData === void 0 ? void 0 : modelData.draftPublishWorkflow) !== null && _q !== void 0 ? _q : false,
|
|
252
|
+
internationalisation: (_r = modelData === null || modelData === void 0 ? void 0 : modelData.internationalisation) !== null && _r !== void 0 ? _r : false,
|
|
253
|
+
columns: columns,
|
|
254
|
+
preservedFields: preservedFields,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function getDrawerValidationErrors(draft) {
|
|
258
|
+
var errors = [];
|
|
259
|
+
var includedColumns = draft.columns.filter(function (column) { return !column.handledBySuperclass && column.include; });
|
|
260
|
+
var seenFieldNames = new Set();
|
|
261
|
+
if (!draft.singularName.trim()) {
|
|
262
|
+
errors.push("Singular name is required.");
|
|
263
|
+
}
|
|
264
|
+
if (!draft.pluralName.trim()) {
|
|
265
|
+
errors.push("Plural name is required.");
|
|
266
|
+
}
|
|
267
|
+
if (!draft.displayName.trim()) {
|
|
268
|
+
errors.push("Display name is required.");
|
|
269
|
+
}
|
|
270
|
+
if (!includedColumns.length) {
|
|
271
|
+
errors.push("Select at least one physical column to include in the mapping.");
|
|
272
|
+
}
|
|
273
|
+
for (var _i = 0, includedColumns_1 = includedColumns; _i < includedColumns_1.length; _i++) {
|
|
274
|
+
var column = includedColumns_1[_i];
|
|
275
|
+
var normalizedFieldName = column.fieldName.trim();
|
|
276
|
+
if (!normalizedFieldName) {
|
|
277
|
+
errors.push("Field name is required for column \"".concat(column.columnName, "\"."));
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (!scalarFieldTypeValueSet.has(column.solidFieldType)) {
|
|
281
|
+
errors.push("SolidX type \"".concat(column.solidFieldType, "\" is not allowed in step 1 for column \"").concat(column.columnName, "\"."));
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (seenFieldNames.has(normalizedFieldName.toLowerCase())) {
|
|
285
|
+
errors.push("Field name \"".concat(normalizedFieldName, "\" is duplicated in the mapping draft."));
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
seenFieldNames.add(normalizedFieldName.toLowerCase());
|
|
289
|
+
}
|
|
290
|
+
if (!draft.userKeyField.trim()) {
|
|
291
|
+
errors.push("Choose a user key field before saving the mapping.");
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
var userKeyExists = includedColumns.some(function (column) { return column.fieldName === draft.userKeyField; });
|
|
295
|
+
if (!userKeyExists) {
|
|
296
|
+
errors.push("The chosen user key field must remain part of the mapped columns.");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (draft.legacyTableType === "existing_id") {
|
|
300
|
+
var hasPrimaryKey = includedColumns.some(function (column) { return column.isPrimaryKey; });
|
|
301
|
+
if (!hasPrimaryKey) {
|
|
302
|
+
errors.push("Legacy existing-id mappings must keep the generated id column mapped to field name \"id\".");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return errors;
|
|
306
|
+
}
|
|
307
|
+
function buildMappingRequest(draft, plannedMigrationTimestamp) {
|
|
308
|
+
var _a;
|
|
309
|
+
return {
|
|
310
|
+
mapped: draft.mapped,
|
|
311
|
+
modelId: draft.modelId,
|
|
312
|
+
singularName: draft.singularName.trim(),
|
|
313
|
+
pluralName: draft.pluralName.trim(),
|
|
314
|
+
displayName: draft.displayName.trim(),
|
|
315
|
+
description: draft.description.trim() || draft.displayName.trim(),
|
|
316
|
+
tableName: draft.tableName,
|
|
317
|
+
schema: (_a = draft.schema) !== null && _a !== void 0 ? _a : null,
|
|
318
|
+
dataSource: draft.dataSource,
|
|
319
|
+
dataSourceType: draft.dataSourceType,
|
|
320
|
+
legacyTableType: draft.legacyTableType,
|
|
321
|
+
baseClassName: draft.baseClassName,
|
|
322
|
+
userKeyField: draft.userKeyField,
|
|
323
|
+
enableAuditTracking: draft.enableAuditTracking,
|
|
324
|
+
enableSoftDelete: draft.enableSoftDelete,
|
|
325
|
+
draftPublishWorkflow: draft.draftPublishWorkflow,
|
|
326
|
+
internationalisation: draft.internationalisation,
|
|
327
|
+
plannedMigrationTimestamp: plannedMigrationTimestamp !== null && plannedMigrationTimestamp !== void 0 ? plannedMigrationTimestamp : null,
|
|
328
|
+
columns: draft.columns.map(function (column) { return ({
|
|
329
|
+
columnName: column.columnName,
|
|
330
|
+
fieldName: column.fieldName,
|
|
331
|
+
dataType: column.dataType,
|
|
332
|
+
solidFieldType: column.solidFieldType,
|
|
333
|
+
ormType: column.ormType,
|
|
334
|
+
nullable: column.nullable,
|
|
335
|
+
defaultValue: column.defaultValue,
|
|
336
|
+
characterMaximumLength: column.characterMaximumLength,
|
|
337
|
+
numericPrecision: column.numericPrecision,
|
|
338
|
+
numericScale: column.numericScale,
|
|
339
|
+
ordinalPosition: column.ordinalPosition,
|
|
340
|
+
isAutoGenerated: column.isAutoGenerated,
|
|
341
|
+
handledBySuperclass: column.handledBySuperclass,
|
|
342
|
+
superclassFieldName: column.superclassFieldName,
|
|
343
|
+
fieldId: column.fieldId,
|
|
344
|
+
include: column.include,
|
|
345
|
+
matched: column.matched,
|
|
346
|
+
isPrimaryKey: column.isPrimaryKey,
|
|
347
|
+
}); }),
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function parseAndValidateReviewedModelJson(metadataJsonText, draft) {
|
|
351
|
+
var _a, _b;
|
|
352
|
+
var parsed;
|
|
353
|
+
try {
|
|
354
|
+
parsed = JSON.parse(metadataJsonText);
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
return {
|
|
358
|
+
error: "Metadata JSON is not valid JSON: ".concat((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : "Unknown parse error."),
|
|
359
|
+
parsed: null,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
363
|
+
return {
|
|
364
|
+
error: "Metadata JSON must be an object.",
|
|
365
|
+
parsed: null,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
var requiredStringKeys = [
|
|
369
|
+
"singularName",
|
|
370
|
+
"pluralName",
|
|
371
|
+
"displayName",
|
|
372
|
+
"description",
|
|
373
|
+
"dataSource",
|
|
374
|
+
"dataSourceType",
|
|
375
|
+
"tableName",
|
|
376
|
+
"userKeyFieldUserKey",
|
|
377
|
+
];
|
|
378
|
+
for (var _i = 0, requiredStringKeys_1 = requiredStringKeys; _i < requiredStringKeys_1.length; _i++) {
|
|
379
|
+
var key = requiredStringKeys_1[_i];
|
|
380
|
+
if (typeof parsed[key] !== "string" || !parsed[key].trim()) {
|
|
381
|
+
return {
|
|
382
|
+
error: "Metadata JSON must include a non-empty \"".concat(key, "\" string."),
|
|
383
|
+
parsed: null,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
var immutableChecks = [
|
|
388
|
+
{ key: "dataSource", expected: draft.dataSource },
|
|
389
|
+
{ key: "dataSourceType", expected: draft.dataSourceType },
|
|
390
|
+
{ key: "tableName", expected: draft.tableName },
|
|
391
|
+
{ key: "legacyTableType", expected: draft.legacyTableType },
|
|
392
|
+
];
|
|
393
|
+
for (var _c = 0, immutableChecks_1 = immutableChecks; _c < immutableChecks_1.length; _c++) {
|
|
394
|
+
var check = immutableChecks_1[_c];
|
|
395
|
+
if ("".concat((_b = parsed[check.key]) !== null && _b !== void 0 ? _b : "") !== "".concat(check.expected)) {
|
|
396
|
+
return {
|
|
397
|
+
error: "Metadata JSON cannot change immutable binding key \"".concat(check.key, "\"."),
|
|
398
|
+
parsed: null,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
var requiredBooleanKeys = [
|
|
403
|
+
"enableAuditTracking",
|
|
404
|
+
"enableSoftDelete",
|
|
405
|
+
"draftPublishWorkflow",
|
|
406
|
+
"internationalisation",
|
|
407
|
+
];
|
|
408
|
+
for (var _d = 0, requiredBooleanKeys_1 = requiredBooleanKeys; _d < requiredBooleanKeys_1.length; _d++) {
|
|
409
|
+
var key = requiredBooleanKeys_1[_d];
|
|
410
|
+
if (typeof parsed[key] !== "boolean") {
|
|
411
|
+
return {
|
|
412
|
+
error: "Metadata JSON must include a boolean \"".concat(key, "\" value."),
|
|
413
|
+
parsed: null,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (!Array.isArray(parsed.fields)) {
|
|
418
|
+
return {
|
|
419
|
+
error: "Metadata JSON must include a fields array.",
|
|
420
|
+
parsed: null,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
var seenFieldNames = new Set();
|
|
424
|
+
for (var _e = 0, _f = parsed.fields.entries(); _e < _f.length; _e++) {
|
|
425
|
+
var _g = _f[_e], index = _g[0], field = _g[1];
|
|
426
|
+
if (!field || typeof field !== "object" || Array.isArray(field)) {
|
|
427
|
+
return {
|
|
428
|
+
error: "Field at index ".concat(index, " is not a valid object."),
|
|
429
|
+
parsed: null,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
if (typeof field.name !== "string" || !field.name.trim()) {
|
|
433
|
+
return {
|
|
434
|
+
error: "Field at index ".concat(index, " must include a non-empty \"name\"."),
|
|
435
|
+
parsed: null,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
if (typeof field.type !== "string" || !field.type.trim()) {
|
|
439
|
+
return {
|
|
440
|
+
error: "Field \"".concat(field.name, "\" must include a non-empty \"type\"."),
|
|
441
|
+
parsed: null,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
if (typeof field.ormType !== "string" || !field.ormType.trim()) {
|
|
445
|
+
return {
|
|
446
|
+
error: "Field \"".concat(field.name, "\" must include a non-empty \"ormType\"."),
|
|
447
|
+
parsed: null,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
if (typeof field.columnName !== "string" || !field.columnName.trim()) {
|
|
451
|
+
return {
|
|
452
|
+
error: "Field \"".concat(field.name, "\" must include a non-empty \"columnName\"."),
|
|
453
|
+
parsed: null,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
var normalizedFieldName = field.name.trim().toLowerCase();
|
|
457
|
+
if (seenFieldNames.has(normalizedFieldName)) {
|
|
458
|
+
return {
|
|
459
|
+
error: "Field name \"".concat(field.name, "\" is duplicated in metadata JSON."),
|
|
460
|
+
parsed: null,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
seenFieldNames.add(normalizedFieldName);
|
|
464
|
+
}
|
|
465
|
+
if (!parsed.fields.some(function (field) { return (field === null || field === void 0 ? void 0 : field.name) === parsed.userKeyFieldUserKey && !(field === null || field === void 0 ? void 0 : field.isMarkedForRemoval); })) {
|
|
466
|
+
return {
|
|
467
|
+
error: "Metadata JSON must keep userKeyFieldUserKey present in the fields array.",
|
|
468
|
+
parsed: null,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
error: null,
|
|
473
|
+
parsed: parsed,
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
export function DatasourceIntrospectionPage() {
|
|
477
|
+
var _this = this;
|
|
478
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
479
|
+
var params = useParams();
|
|
480
|
+
var dispatch = useDispatch();
|
|
481
|
+
var moduleId = Number((_a = params.moduleId) !== null && _a !== void 0 ? _a : 0);
|
|
482
|
+
var isValidModuleId = Number.isFinite(moduleId) && moduleId > 0;
|
|
483
|
+
var _o = useGetDatasourceIntrospectionBootstrapQuery(moduleId, {
|
|
484
|
+
skip: !isValidModuleId,
|
|
485
|
+
}), bootstrap = _o.data, isBootstrapLoading = _o.isLoading, isBootstrapFetching = _o.isFetching, bootstrapError = _o.error, refetchBootstrap = _o.refetch;
|
|
486
|
+
var _p = useState(""), selectedDatasource = _p[0], setSelectedDatasource = _p[1];
|
|
487
|
+
var _q = useState(""), selectedTableKey = _q[0], setSelectedTableKey = _q[1];
|
|
488
|
+
var _r = useState(""), tableSearch = _r[0], setTableSearch = _r[1];
|
|
489
|
+
var _s = useState(false), settingsOpen = _s[0], setSettingsOpen = _s[1];
|
|
490
|
+
var _t = useState("datasource-info"), settingsTab = _t[0], setSettingsTab = _t[1];
|
|
491
|
+
var _u = useState(false), drawerOpen = _u[0], setDrawerOpen = _u[1];
|
|
492
|
+
var _v = useState(null), drawerDraft = _v[0], setDrawerDraft = _v[1];
|
|
493
|
+
var _w = useState("general-info"), drawerTab = _w[0], setDrawerTab = _w[1];
|
|
494
|
+
var _x = useState("edit"), drawerStep = _x[0], setDrawerStep = _x[1];
|
|
495
|
+
var _y = useState("metadata-json"), reviewTab = _y[0], setReviewTab = _y[1];
|
|
496
|
+
var _z = useState(null), mappingPreview = _z[0], setMappingPreview = _z[1];
|
|
497
|
+
var _0 = useState(null), reviewedMetadataJsonValue = _0[0], setReviewedMetadataJsonValue = _0[1];
|
|
498
|
+
var _1 = useState(""), metadataJsonText = _1[0], setMetadataJsonText = _1[1];
|
|
499
|
+
var _2 = useState(null), metadataJsonValidationError = _2[0], setMetadataJsonValidationError = _2[1];
|
|
500
|
+
var _3 = useState("initial"), metadataJsonResetToken = _3[0], setMetadataJsonResetToken = _3[1];
|
|
501
|
+
var _4 = useState(false), drawerBootstrapping = _4[0], setDrawerBootstrapping = _4[1];
|
|
502
|
+
var _5 = useState({
|
|
503
|
+
relationInferenceEnabled: false,
|
|
504
|
+
prioritizeUnmappedTables: true,
|
|
505
|
+
}), sessionSettings = _5[0], setSessionSettings = _5[1];
|
|
506
|
+
var _6 = useState(sessionSettings), draftSessionSettings = _6[0], setDraftSessionSettings = _6[1];
|
|
507
|
+
var drawerBootstrapTimerRef = useRef(null);
|
|
508
|
+
var scrollDrawerBodyToTop = function () {
|
|
509
|
+
if (typeof document === "undefined")
|
|
510
|
+
return;
|
|
511
|
+
window.requestAnimationFrame(function () {
|
|
512
|
+
var drawerBody = document.querySelector(".sdix-drawer-body");
|
|
513
|
+
drawerBody === null || drawerBody === void 0 ? void 0 : drawerBody.scrollTo({ top: 0, left: 0 });
|
|
514
|
+
});
|
|
515
|
+
};
|
|
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
|
+
useEffect(function () {
|
|
520
|
+
if (!bootstrap)
|
|
521
|
+
return;
|
|
522
|
+
if (selectedDatasource)
|
|
523
|
+
return;
|
|
524
|
+
if (bootstrap.recommendedDatasourceName) {
|
|
525
|
+
setSelectedDatasource(bootstrap.recommendedDatasourceName);
|
|
526
|
+
}
|
|
527
|
+
}, [bootstrap, selectedDatasource]);
|
|
528
|
+
useEffect(function () {
|
|
529
|
+
setSelectedTableKey("");
|
|
530
|
+
setDrawerDraft(null);
|
|
531
|
+
setDrawerOpen(false);
|
|
532
|
+
setTableSearch("");
|
|
533
|
+
setDrawerStep("edit");
|
|
534
|
+
setReviewTab("metadata-json");
|
|
535
|
+
setMappingPreview(null);
|
|
536
|
+
setReviewedMetadataJsonValue(null);
|
|
537
|
+
setMetadataJsonText("");
|
|
538
|
+
setMetadataJsonValidationError(null);
|
|
539
|
+
setMetadataJsonResetToken("datasource-".concat(Date.now()));
|
|
540
|
+
}, [selectedDatasource]);
|
|
541
|
+
useEffect(function () { return function () {
|
|
542
|
+
if (drawerBootstrapTimerRef.current) {
|
|
543
|
+
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
544
|
+
}
|
|
545
|
+
}; }, []);
|
|
546
|
+
useEffect(function () {
|
|
547
|
+
if (!drawerOpen)
|
|
548
|
+
return;
|
|
549
|
+
scrollDrawerBodyToTop();
|
|
550
|
+
}, [drawerOpen, drawerStep, drawerTab, reviewTab, selectedTableKey]);
|
|
551
|
+
var datasourceOptions = useMemo(function () {
|
|
552
|
+
var _a;
|
|
553
|
+
return ((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.datasources) !== null && _a !== void 0 ? _a : []).map(function (datasource) { return ({
|
|
554
|
+
label: "".concat(datasource.displayName, " (").concat(providerLabel(datasource.type), ")"),
|
|
555
|
+
value: datasource.name,
|
|
556
|
+
}); });
|
|
557
|
+
}, [bootstrap]);
|
|
558
|
+
var _9 = useGetDatasourceIntrospectionTablesQuery({ moduleId: moduleId, datasource: selectedDatasource }, {
|
|
559
|
+
skip: !isValidModuleId || !selectedDatasource,
|
|
560
|
+
}), tablesResponse = _9.data, isTablesLoading = _9.isLoading, isTablesFetching = _9.isFetching, tablesError = _9.error, refetchTables = _9.refetch;
|
|
561
|
+
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) === selectedTableKey; })) !== null && _b !== void 0 ? _b : null; }, [tablesResponse, selectedTableKey]);
|
|
562
|
+
var _10 = useGetDatasourceIntrospectionTableDetailQuery({
|
|
563
|
+
moduleId: moduleId,
|
|
564
|
+
datasource: selectedDatasource,
|
|
565
|
+
table: (_b = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.tableName) !== null && _b !== void 0 ? _b : "",
|
|
566
|
+
schema: (_c = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.schema) !== null && _c !== void 0 ? _c : undefined,
|
|
567
|
+
}, {
|
|
568
|
+
skip: !drawerOpen || !isValidModuleId || !selectedDatasource || !selectedTable || !!(tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.synchronizeBlocked),
|
|
569
|
+
}), tableDetail = _10.data, isTableDetailLoading = _10.isLoading, isTableDetailFetching = _10.isFetching, tableDetailError = _10.error, refetchTableDetail = _10.refetch;
|
|
570
|
+
var _11 = useGetmodelByIdQuery((_d = selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelId) !== null && _d !== void 0 ? _d : 0, {
|
|
571
|
+
skip: !drawerOpen || !(selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mapped) || !(selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelId),
|
|
572
|
+
}), mappedModelResponse = _11.data, isMappedModelLoading = _11.isLoading, isMappedModelFetching = _11.isFetching, mappedModelError = _11.error;
|
|
573
|
+
var mappedModelData = mappedModelResponse === null || mappedModelResponse === void 0 ? void 0 : mappedModelResponse.data;
|
|
574
|
+
var selectedDatasourceRecord = (_f = (_e = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.datasources) === null || _e === void 0 ? void 0 : _e.find(function (datasource) { return datasource.name === selectedDatasource; })) !== null && _f !== void 0 ? _f : null;
|
|
575
|
+
var drawerLoadingError = (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mapped) ? (tableDetailError || mappedModelError) : tableDetailError;
|
|
576
|
+
var isDrawerBlockingLoading = Boolean(selectedTable
|
|
577
|
+
&& (drawerBootstrapping
|
|
578
|
+
|| !drawerDraft
|
|
579
|
+
|| isTableDetailLoading
|
|
580
|
+
|| isTableDetailFetching
|
|
581
|
+
|| (selectedTable.mapped && (isMappedModelLoading || isMappedModelFetching))));
|
|
582
|
+
useEffect(function () {
|
|
583
|
+
if (!drawerOpen || !selectedTable || !tableDetail)
|
|
584
|
+
return;
|
|
585
|
+
if (selectedTable.mapped && (!mappedModelData || mappedModelData.id !== selectedTable.mappedModelId))
|
|
586
|
+
return;
|
|
587
|
+
if (drawerBootstrapTimerRef.current) {
|
|
588
|
+
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
589
|
+
}
|
|
590
|
+
setDrawerDraft(buildDrawerDraft(tableDetail, selectedTable, selectedTable.mapped ? mappedModelResponse : undefined));
|
|
591
|
+
drawerBootstrapTimerRef.current = window.setTimeout(function () {
|
|
592
|
+
setDrawerBootstrapping(false);
|
|
593
|
+
}, 150);
|
|
594
|
+
}, [drawerOpen, selectedTable, tableDetail, mappedModelData, mappedModelResponse]);
|
|
595
|
+
var filteredRecords = useMemo(function () {
|
|
596
|
+
var _a;
|
|
597
|
+
var records = __spreadArray([], ((_a = tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.records) !== null && _a !== void 0 ? _a : []), true);
|
|
598
|
+
var searchNeedle = tableSearch.trim().toLowerCase();
|
|
599
|
+
var filtered = searchNeedle
|
|
600
|
+
? 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();
|
|
603
|
+
return haystack.includes(searchNeedle);
|
|
604
|
+
})
|
|
605
|
+
: records;
|
|
606
|
+
if (sessionSettings.prioritizeUnmappedTables) {
|
|
607
|
+
filtered.sort(function (left, right) {
|
|
608
|
+
var _a, _b;
|
|
609
|
+
if (left.mapped !== right.mapped) {
|
|
610
|
+
return left.mapped ? 1 : -1;
|
|
611
|
+
}
|
|
612
|
+
var leftLabel = "".concat((_a = left.schema) !== null && _a !== void 0 ? _a : "", ".").concat(left.tableName).toLowerCase();
|
|
613
|
+
var rightLabel = "".concat((_b = right.schema) !== null && _b !== void 0 ? _b : "", ".").concat(right.tableName).toLowerCase();
|
|
614
|
+
return leftLabel.localeCompare(rightLabel);
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
return filtered;
|
|
618
|
+
}, [sessionSettings.prioritizeUnmappedTables, tableSearch, tablesResponse === null || tablesResponse === void 0 ? void 0 : tablesResponse.records]);
|
|
619
|
+
var drawerUserKeyOptions = useMemo(function () {
|
|
620
|
+
var _a;
|
|
621
|
+
var options = new Map();
|
|
622
|
+
(_a = tableDetail === null || tableDetail === void 0 ? void 0 : tableDetail.userKeyCandidates) === null || _a === void 0 ? void 0 : _a.forEach(function (candidate) {
|
|
623
|
+
options.set(candidate.name, {
|
|
624
|
+
label: "".concat(candidate.label, " \u00B7 ").concat(candidate.reason),
|
|
625
|
+
value: candidate.name,
|
|
626
|
+
});
|
|
627
|
+
});
|
|
628
|
+
drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.columns.filter(function (column) { return !column.handledBySuperclass && column.include; }).forEach(function (column) {
|
|
629
|
+
if (!options.has(column.fieldName)) {
|
|
630
|
+
options.set(column.fieldName, {
|
|
631
|
+
label: "".concat(column.fieldName, " \u00B7 mapped from ").concat(column.columnName),
|
|
632
|
+
value: column.fieldName,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
return Array.from(options.values());
|
|
637
|
+
}, [drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.columns, tableDetail === null || tableDetail === void 0 ? void 0 : tableDetail.userKeyCandidates]);
|
|
638
|
+
var settingsTabs = [
|
|
639
|
+
{
|
|
640
|
+
value: "datasource-info",
|
|
641
|
+
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: (_g = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _g === void 0 ? void 0 : _g.displayName })] }), _jsxs("div", { className: "sdix-settings-static", children: [_jsx("span", { children: "Default datasource" }), _jsx("strong", { children: ((_h = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _h === void 0 ? void 0 : _h.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: (_j = selectedDatasourceRecord === null || selectedDatasourceRecord === void 0 ? void 0 : selectedDatasourceRecord.port) !== null && _j !== void 0 ? _j : "-" })] }), _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
|
+
},
|
|
644
|
+
{
|
|
645
|
+
value: "session-settings",
|
|
646
|
+
label: "Session Settings",
|
|
647
|
+
content: (_jsxs("div", { className: "sdix-settings-grid", children: [_jsxs("div", { className: "sdix-settings-row", children: [_jsxs("div", { children: [_jsx("label", { children: "Relation inference" }), _jsx("p", { children: "Keep this off until we deliberately introduce relation discovery across engines." })] }), _jsx(SolidSwitch, { checked: draftSessionSettings.relationInferenceEnabled, onChange: function (checked) { return setDraftSessionSettings(function (current) { return (__assign(__assign({}, current), { relationInferenceEnabled: checked })); }); } })] }), _jsxs("div", { className: "sdix-settings-row", children: [_jsxs("div", { children: [_jsx("label", { children: "Prioritize unmapped tables" }), _jsx("p", { children: "Bubble unmapped tables to the top of the inventory so the first pass stays focused." })] }), _jsx(SolidSwitch, { checked: draftSessionSettings.prioritizeUnmappedTables, onChange: function (checked) { return setDraftSessionSettings(function (current) { return (__assign(__assign({}, current), { prioritizeUnmappedTables: checked })); }); } })] })] })),
|
|
648
|
+
},
|
|
649
|
+
];
|
|
650
|
+
var handleRefresh = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
651
|
+
return __generator(this, function (_a) {
|
|
652
|
+
switch (_a.label) {
|
|
653
|
+
case 0: return [4 /*yield*/, refetchBootstrap()];
|
|
654
|
+
case 1:
|
|
655
|
+
_a.sent();
|
|
656
|
+
if (!selectedDatasource) return [3 /*break*/, 3];
|
|
657
|
+
return [4 /*yield*/, refetchTables()];
|
|
658
|
+
case 2:
|
|
659
|
+
_a.sent();
|
|
660
|
+
_a.label = 3;
|
|
661
|
+
case 3:
|
|
662
|
+
if (!selectedTable) return [3 /*break*/, 5];
|
|
663
|
+
return [4 /*yield*/, refetchTableDetail()];
|
|
664
|
+
case 4:
|
|
665
|
+
_a.sent();
|
|
666
|
+
_a.label = 5;
|
|
667
|
+
case 5: return [2 /*return*/];
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}); };
|
|
671
|
+
var openTableDrawer = function (record) {
|
|
672
|
+
var _a, _b;
|
|
673
|
+
if (drawerBootstrapTimerRef.current) {
|
|
674
|
+
window.clearTimeout(drawerBootstrapTimerRef.current);
|
|
675
|
+
}
|
|
676
|
+
setSelectedTableKey("".concat((_a = record.schema) !== null && _a !== void 0 ? _a : "", "::").concat(record.tableName));
|
|
677
|
+
setDrawerDraft(null);
|
|
678
|
+
setDrawerTab("general-info");
|
|
679
|
+
setDrawerStep("edit");
|
|
680
|
+
setReviewTab("metadata-json");
|
|
681
|
+
setMappingPreview(null);
|
|
682
|
+
setReviewedMetadataJsonValue(null);
|
|
683
|
+
setMetadataJsonText("");
|
|
684
|
+
setMetadataJsonValidationError(null);
|
|
685
|
+
setMetadataJsonResetToken("table-".concat((_b = record.schema) !== null && _b !== void 0 ? _b : "default", "-").concat(record.tableName, "-").concat(Date.now()));
|
|
686
|
+
setDrawerBootstrapping(true);
|
|
687
|
+
setDrawerOpen(true);
|
|
688
|
+
};
|
|
689
|
+
var applyDraftSettings = function () {
|
|
690
|
+
setSessionSettings(draftSessionSettings);
|
|
691
|
+
setSettingsOpen(false);
|
|
692
|
+
};
|
|
693
|
+
var updateDrawerDraft = function (updater) {
|
|
694
|
+
setMappingPreview(null);
|
|
695
|
+
setDrawerDraft(function (current) { return (current ? updater(current) : current); });
|
|
696
|
+
};
|
|
697
|
+
var updateGeneralField = function (field, value) {
|
|
698
|
+
updateDrawerDraft(function (current) {
|
|
699
|
+
var _a;
|
|
700
|
+
return (__assign(__assign({}, current), (_a = {}, _a[field] = value, _a)));
|
|
701
|
+
});
|
|
702
|
+
};
|
|
703
|
+
var updateColumnFieldName = function (columnName, nextFieldName) {
|
|
704
|
+
updateDrawerDraft(function (current) {
|
|
705
|
+
var _a;
|
|
706
|
+
return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
707
|
+
if (column.columnName !== columnName)
|
|
708
|
+
return column;
|
|
709
|
+
return __assign(__assign({}, column), { fieldName: camelCase(nextFieldName) });
|
|
710
|
+
}), userKeyField: current.userKeyField === ((_a = current.columns.find(function (column) { return column.columnName === columnName; })) === null || _a === void 0 ? void 0 : _a.fieldName)
|
|
711
|
+
? camelCase(nextFieldName)
|
|
712
|
+
: current.userKeyField }));
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
var updateColumnSolidFieldType = function (columnName, nextSolidFieldType) {
|
|
716
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
717
|
+
if (column.columnName !== columnName)
|
|
718
|
+
return column;
|
|
719
|
+
if (column.handledBySuperclass)
|
|
720
|
+
return column;
|
|
721
|
+
return __assign(__assign({}, column), { solidFieldType: nextSolidFieldType, ormType: getDefaultOrmTypeForSolidFieldType(current.dataSourceType, nextSolidFieldType) });
|
|
722
|
+
}) })); });
|
|
723
|
+
};
|
|
724
|
+
var setColumnIncluded = function (columnName, include) {
|
|
725
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
726
|
+
if (column.columnName !== columnName)
|
|
727
|
+
return column;
|
|
728
|
+
if (column.handledBySuperclass || column.isPrimaryKey)
|
|
729
|
+
return column;
|
|
730
|
+
return __assign(__assign({}, column), { include: include });
|
|
731
|
+
}) })); });
|
|
732
|
+
};
|
|
733
|
+
var changeUserKeyField = function (fieldName) {
|
|
734
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { userKeyField: fieldName, columns: current.columns.map(function (column) { return (column.fieldName === fieldName
|
|
735
|
+
? __assign(__assign({}, column), { include: column.handledBySuperclass ? false : true }) : column); }) })); });
|
|
736
|
+
};
|
|
737
|
+
var setUnmappedColumnsIncluded = function (include) {
|
|
738
|
+
updateDrawerDraft(function (current) { return (__assign(__assign({}, current), { columns: current.columns.map(function (column) {
|
|
739
|
+
if (column.handledBySuperclass || column.matched || column.isPrimaryKey) {
|
|
740
|
+
return column;
|
|
741
|
+
}
|
|
742
|
+
return __assign(__assign({}, column), { include: include });
|
|
743
|
+
}) })); });
|
|
744
|
+
};
|
|
745
|
+
var openMappedModelForm = function () {
|
|
746
|
+
var _a;
|
|
747
|
+
var targetModelId = (_a = drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.modelId) !== null && _a !== void 0 ? _a : selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.mappedModelId;
|
|
748
|
+
if (!targetModelId)
|
|
749
|
+
return;
|
|
750
|
+
window.open("/admin/core/solid-core/model-metadata/form/".concat(targetModelId), "_blank", "noopener,noreferrer");
|
|
751
|
+
};
|
|
752
|
+
var viewChanges = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
753
|
+
var validationErrors, preview, error_1;
|
|
754
|
+
var _a;
|
|
755
|
+
return __generator(this, function (_b) {
|
|
756
|
+
switch (_b.label) {
|
|
757
|
+
case 0:
|
|
758
|
+
if (!drawerDraft || !((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _a === void 0 ? void 0 : _a.id))
|
|
759
|
+
return [2 /*return*/];
|
|
760
|
+
validationErrors = getDrawerValidationErrors(drawerDraft);
|
|
761
|
+
if (validationErrors.length) {
|
|
762
|
+
validationErrors.forEach(function (detail) {
|
|
763
|
+
dispatch(showToast({ severity: "error", summary: "Validation", detail: detail }));
|
|
764
|
+
});
|
|
765
|
+
return [2 /*return*/];
|
|
766
|
+
}
|
|
767
|
+
_b.label = 1;
|
|
768
|
+
case 1:
|
|
769
|
+
_b.trys.push([1, 3, , 4]);
|
|
770
|
+
return [4 /*yield*/, previewMapping({
|
|
771
|
+
moduleId: bootstrap.module.id,
|
|
772
|
+
payload: buildMappingRequest(drawerDraft),
|
|
773
|
+
}).unwrap()];
|
|
774
|
+
case 2:
|
|
775
|
+
preview = _b.sent();
|
|
776
|
+
setMappingPreview(preview);
|
|
777
|
+
setReviewedMetadataJsonValue(preview.metadataJson.model);
|
|
778
|
+
setMetadataJsonText(JSON.stringify(preview.metadataJson.model, null, 2));
|
|
779
|
+
setMetadataJsonValidationError(null);
|
|
780
|
+
setMetadataJsonResetToken("preview-".concat(preview.metadataJson.filePath, "-").concat(Date.now()));
|
|
781
|
+
setReviewTab("metadata-json");
|
|
782
|
+
setDrawerStep("review");
|
|
783
|
+
return [3 /*break*/, 4];
|
|
784
|
+
case 3:
|
|
785
|
+
error_1 = _b.sent();
|
|
786
|
+
dispatch(showToast({
|
|
787
|
+
severity: "error",
|
|
788
|
+
summary: "Preview failed",
|
|
789
|
+
detail: readQueryError(error_1),
|
|
790
|
+
}));
|
|
791
|
+
return [3 /*break*/, 4];
|
|
792
|
+
case 4: return [2 /*return*/];
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
}); };
|
|
796
|
+
var saveMapping = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
797
|
+
var validationErrors, reviewedModelValidation, response, error_2;
|
|
798
|
+
var _a, _b, _c, _d;
|
|
799
|
+
return __generator(this, function (_e) {
|
|
800
|
+
switch (_e.label) {
|
|
801
|
+
case 0:
|
|
802
|
+
if (!drawerDraft || !((_a = bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.module) === null || _a === void 0 ? void 0 : _a.id))
|
|
803
|
+
return [2 /*return*/];
|
|
804
|
+
validationErrors = getDrawerValidationErrors(drawerDraft);
|
|
805
|
+
if (validationErrors.length) {
|
|
806
|
+
validationErrors.forEach(function (detail) {
|
|
807
|
+
dispatch(showToast({ severity: "error", summary: "Validation", detail: detail }));
|
|
808
|
+
});
|
|
809
|
+
setDrawerStep("edit");
|
|
810
|
+
return [2 /*return*/];
|
|
811
|
+
}
|
|
812
|
+
reviewedModelValidation = parseAndValidateReviewedModelJson(metadataJsonText, drawerDraft);
|
|
813
|
+
if (reviewedModelValidation.error || !reviewedModelValidation.parsed) {
|
|
814
|
+
setMetadataJsonValidationError((_b = reviewedModelValidation.error) !== null && _b !== void 0 ? _b : "Metadata JSON is invalid.");
|
|
815
|
+
setReviewTab("metadata-json");
|
|
816
|
+
setDrawerStep("review");
|
|
817
|
+
dispatch(showToast({
|
|
818
|
+
severity: "error",
|
|
819
|
+
summary: "Validation",
|
|
820
|
+
detail: (_c = reviewedModelValidation.error) !== null && _c !== void 0 ? _c : "Metadata JSON is invalid.",
|
|
821
|
+
}));
|
|
822
|
+
return [2 /*return*/];
|
|
823
|
+
}
|
|
824
|
+
setMetadataJsonValidationError(null);
|
|
825
|
+
_e.label = 1;
|
|
826
|
+
case 1:
|
|
827
|
+
_e.trys.push([1, 5, , 6]);
|
|
828
|
+
return [4 /*yield*/, applyMapping({
|
|
829
|
+
moduleId: bootstrap.module.id,
|
|
830
|
+
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
|
+
}).unwrap()];
|
|
832
|
+
case 2:
|
|
833
|
+
response = _e.sent();
|
|
834
|
+
dispatch(showToast({
|
|
835
|
+
severity: "success",
|
|
836
|
+
summary: "Saved",
|
|
837
|
+
detail: response.migration.written
|
|
838
|
+
? "The mapping, metadata JSON, and migration template were written successfully."
|
|
839
|
+
: drawerDraft.mapped
|
|
840
|
+
? "The model mapping was updated and written back to metadata JSON."
|
|
841
|
+
: "The model mapping was created and written to metadata JSON.",
|
|
842
|
+
}));
|
|
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
|
+
return [4 /*yield*/, refetchTables()];
|
|
852
|
+
case 3:
|
|
853
|
+
_e.sent();
|
|
854
|
+
return [4 /*yield*/, refetchBootstrap()];
|
|
855
|
+
case 4:
|
|
856
|
+
_e.sent();
|
|
857
|
+
return [3 /*break*/, 6];
|
|
858
|
+
case 5:
|
|
859
|
+
error_2 = _e.sent();
|
|
860
|
+
dispatch(showToast({
|
|
861
|
+
severity: "error",
|
|
862
|
+
summary: "Save failed",
|
|
863
|
+
detail: readQueryError(error_2),
|
|
864
|
+
}));
|
|
865
|
+
return [3 /*break*/, 6];
|
|
866
|
+
case 6: return [2 /*return*/];
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
}); };
|
|
870
|
+
if (!isValidModuleId) {
|
|
871
|
+
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
|
+
}
|
|
873
|
+
var selectableUnmappedColumns = (_k = drawerDraft === null || drawerDraft === void 0 ? void 0 : drawerDraft.columns.filter(function (column) { return !column.handledBySuperclass && !column.matched && !column.isPrimaryKey; })) !== null && _k !== void 0 ? _k : [];
|
|
874
|
+
var allSelectableUnmappedIncluded = selectableUnmappedColumns.length > 0
|
|
875
|
+
&& selectableUnmappedColumns.every(function (column) { return column.include; });
|
|
876
|
+
var drawerRawDdl = (_l = tableDetail === null || tableDetail === void 0 ? void 0 : tableDetail.rawDdl) !== null && _l !== void 0 ? _l : null;
|
|
877
|
+
var drawerTabs = drawerDraft ? [
|
|
878
|
+
{
|
|
879
|
+
value: "general-info",
|
|
880
|
+
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: 3, 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: (_m = drawerDraft.schema) !== null && _m !== void 0 ? _m : "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: "Legacy Strategy" }), _jsx(SolidInput, { id: "sdix-legacy-type", value: legacyTypeLabel(drawerDraft.legacyTableType), disabled: true })] }), _jsxs("div", { className: "sdix-form-field", children: [_jsx("label", { htmlFor: "sdix-base-class", children: "Superclass" }), _jsx(SolidInput, { id: "sdix-base-class", value: drawerDraft.baseClassName, disabled: true })] })] })] })] })),
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
value: "columns-mapping",
|
|
885
|
+
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", { children: "Column" }), _jsx("span", { children: "Field" }), _jsx("span", { children: "Database" }), _jsx("span", { children: "SolidX" }), _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: "Status" }), _jsx("span", { children: "Action" })] }), drawerDraft.columns.map(function (column) {
|
|
887
|
+
var isUserKey = drawerDraft.userKeyField === column.fieldName;
|
|
888
|
+
var statusClassName = column.handledBySuperclass
|
|
889
|
+
? "is-superclass"
|
|
890
|
+
: column.include
|
|
891
|
+
? column.matched
|
|
892
|
+
? "is-mapped"
|
|
893
|
+
: "is-unmapped"
|
|
894
|
+
: "is-muted";
|
|
895
|
+
var statusText = column.handledBySuperclass
|
|
896
|
+
? "System"
|
|
897
|
+
: column.include
|
|
898
|
+
? column.matched
|
|
899
|
+
? "Mapped"
|
|
900
|
+
: "Queued for save"
|
|
901
|
+
: column.matched
|
|
902
|
+
? "Currently omitted"
|
|
903
|
+
: "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-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, label: "Required" })) : (_jsx(SolidCheckbox, { checked: column.include, onChange: function (event) { return setColumnIncluded(column.columnName, event.target.checked); } })) }), _jsx("span", { children: _jsx("span", { className: "sdix-status-badge ".concat(statusClassName), children: statusText }) }), _jsx("span", { className: "sdix-column-action", children: column.handledBySuperclass ? (_jsx(SolidButton, { size: "small", variant: "outline", disabled: true, children: "Managed" })) : column.isPrimaryKey ? (_jsx(SolidButton, { size: "small", variant: "outline", disabled: true, 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
|
+
})] })] })),
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
value: "raw-ddl",
|
|
909
|
+
label: "Raw DDL",
|
|
910
|
+
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
|
+
},
|
|
912
|
+
] : [];
|
|
913
|
+
var reviewTabs = mappingPreview ? [
|
|
914
|
+
{
|
|
915
|
+
value: "metadata-json",
|
|
916
|
+
label: "Metadata JSON",
|
|
917
|
+
content: (_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) {
|
|
918
|
+
setReviewedMetadataJsonValue(nextValue);
|
|
919
|
+
if (metadataJsonValidationError) {
|
|
920
|
+
setMetadataJsonValidationError(null);
|
|
921
|
+
}
|
|
922
|
+
}, onTextChange: function (nextText) {
|
|
923
|
+
setMetadataJsonText(nextText);
|
|
924
|
+
}, onErrorChange: setMetadataJsonValidationError }), metadataJsonValidationError ? (_jsx("div", { className: "sdix-json-validation-error", children: _jsx("span", { children: metadataJsonValidationError }) })) : null] })),
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
value: "migration",
|
|
928
|
+
label: "Migration",
|
|
929
|
+
content: (_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 is read-only here. Saving the mapping will write a new template migration file to the target location." }), 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 })] })) })),
|
|
930
|
+
},
|
|
931
|
+
] : [];
|
|
932
|
+
return (_jsxs("div", { className: "sdix-page", children: [_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 || isTableDetailFetching || isMappedModelFetching ? (_jsxs("div", { className: "sdix-inline-status", children: [_jsx(SolidSpinner, { size: 16 }), _jsx("span", { children: "Refreshing" })] })) : null, _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 () {
|
|
933
|
+
setDraftSessionSettings(sessionSettings);
|
|
934
|
+
setSettingsTab("datasource-info");
|
|
935
|
+
setSettingsOpen(true);
|
|
936
|
+
}, tooltip: "Session settings", "aria-label": "Session settings" })] })] }), 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: [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, _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) {
|
|
937
|
+
var data = _a.data;
|
|
938
|
+
return openTableDrawer(data);
|
|
939
|
+
}, rowClassName: function (rowData) { var _a; return "".concat((_a = rowData.schema) !== null && _a !== void 0 ? _a : "", "::").concat(rowData.tableName) === selectedTableKey && drawerOpen ? "sdix-table-row-selected" : ""; }, emptyMessage: "No datasource tables found", children: [_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
|
|
940
|
+
? (rowData.mappedModelDisplayName || rowData.mappedModelSingularName || "-")
|
|
941
|
+
: _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(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" })] })] }), _jsxs(SolidDialog, { open: drawerOpen, onOpenChange: setDrawerOpen, className: "sdix-drawer", overlayClassName: "sdix-drawer-overlay", dismissible: true, children: [_jsxs(SolidDialogHeader, { className: "sdix-drawer-header", children: [_jsxs("div", { className: "sdix-drawer-header__identity", children: [_jsx(SolidDialogTitle, { children: (selectedTable === null || selectedTable === void 0 ? void 0 : selectedTable.tableName) || "Table details" }), _jsx(SolidDialogDescription, { className: "sdix-drawer-header__meta", children: selectedTable
|
|
942
|
+
? "".concat(selectedTable.schema || "default", " \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)) : "")
|
|
943
|
+
: "Review mapping details" })] }), _jsx(SolidDialogClose, {})] }), _jsx(SolidDialogSeparator, {}), _jsx(SolidDialogBody, { className: "sdix-drawer-body", children: !selectedTable ? (_jsxs("div", { className: "sdix-empty-state is-inline", children: [_jsx(Sparkles, { size: 22 }), _jsx("p", { children: "Select a table row to review its structure." })] })) : drawerLoadingError ? (_jsxs("div", { className: "sdix-error is-inline", 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 is-inline", children: [_jsx(SolidSpinner, { size: 24 }), _jsx("p", { children: "Preparing column mapping preview..." })] })) : (_jsxs("div", { className: "sdix-drawer-stack", children: [drawerDraft && !drawerDraft.mapped && drawerStep === "edit" ? (_jsxs("div", { className: "sdix-detail-callout sdix-system-fields-callout", children: [_jsx("h3", { children: "SolidX system fields are added later" }), _jsxs("p", { children: ["This preview only lists the legacy table columns that already exist today.", " ", "Framework system fields from the selected superclass, including the namespaced", " ", _jsx("code", { children: "ss_*" }), " ", "columns, are introduced when you save the mapping and then generate/apply the follow-up migrations."] })] })) : null, drawerStep === "edit" ? (_jsx(SolidTabGroup, { tabs: drawerTabs, value: drawerTab, onValueChange: setDrawerTab, className: "sdix-drawer-tabs", panelClassName: "sdix-drawer-tab-panel" })) : (_jsx(SolidTabGroup, { tabs: reviewTabs, value: reviewTab, onValueChange: setReviewTab, className: "sdix-drawer-tabs", panelClassName: "sdix-drawer-tab-panel" }))] })) }), drawerDraft && !isDrawerBlockingLoading ? (_jsxs(_Fragment, { children: [_jsx(SolidDialogSeparator, {}), _jsxs(SolidDialogFooter, { className: "sdix-drawer-footer", children: [_jsx("div", { className: "sdix-drawer-footer__meta", children: drawerStep === "review" && mappingPreview ? (_jsxs("span", { children: ["Review the metadata update first, then save to apply", " ", _jsx("strong", { children: mappingPreview.summary.includedColumnNames.length }), " ", "mapped columns", mappingPreview.summary.generatedSystemColumnCount
|
|
944
|
+
? " and ".concat(mappingPreview.summary.generatedSystemColumnCount, " SolidX system column migration changes")
|
|
945
|
+
: "", "."] })) : 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: "Saving will create the model metadata and write it to the module JSON." })) }), _jsxs("div", { className: "sdix-drawer-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, drawerStep === "review" ? (_jsxs(_Fragment, { children: [_jsx(SolidButton, { size: "small", variant: "outline", onClick: function () { return setDrawerStep("edit"); }, children: "Back to editing" }), _jsx(SolidButton, { size: "small", leftIcon: _jsx(Save, { size: 14 }), loading: isSavingMapping, onClick: function () { return void saveMapping(); }, children: "Save mapping" })] })) : (_jsx(SolidButton, { size: "small", leftIcon: _jsx(Save, { size: 14 }), loading: isPreviewMappingLoading, onClick: function () { return void viewChanges(); }, children: "View Changes" }))] })] })] })) : null] })] }))] }));
|
|
946
|
+
}
|
|
947
|
+
//# sourceMappingURL=DatasourceIntrospectionPage.js.map
|