adminforth 1.3.41 → 1.3.42
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.
|
@@ -176,6 +176,15 @@ export default class ConfigValidator {
|
|
|
176
176
|
}
|
|
177
177
|
col.showIn = col.showIn || Object.values(AdminForthResourcePages);
|
|
178
178
|
if (col.foreignResource) {
|
|
179
|
+
if (!col.foreignResource.resourceId) {
|
|
180
|
+
errors.push(`Resource "${res.resourceId}" column "${col.name}" has foreignResource without resourceId`);
|
|
181
|
+
}
|
|
182
|
+
const resource = this.config.resources.find((r) => r.resourceId === col.foreignResource.resourceId);
|
|
183
|
+
if (!resource) {
|
|
184
|
+
const similar = suggestIfTypo(this.config.resources.map((r) => r.resourceId), col.foreignResource.resourceId);
|
|
185
|
+
errors.push(`Resource "${res.resourceId}" column "${col.name}" has foreignResource resourceId which is not in resources: "${col.foreignResource.resourceId}".
|
|
186
|
+
${similar ? `Did you mean "${similar}" instead of "${col.foreignResource.resourceId}"?` : ''}`);
|
|
187
|
+
}
|
|
179
188
|
const befHook = (_b = (_a = col.foreignResource.hooks) === null || _a === void 0 ? void 0 : _a.dropdownList) === null || _b === void 0 ? void 0 : _b.beforeDatasourceRequest;
|
|
180
189
|
if (befHook) {
|
|
181
190
|
if (!Array.isArray(befHook)) {
|
|
@@ -356,7 +365,9 @@ export default class ConfigValidator {
|
|
|
356
365
|
errors.push(`Menu item with type 'resource' must have resourceId : ${JSON.stringify(item)}`);
|
|
357
366
|
}
|
|
358
367
|
if (item.resourceId && !this.config.resources.find((res) => res.resourceId === item.resourceId)) {
|
|
359
|
-
|
|
368
|
+
const similar = suggestIfTypo(this.config.resources.map((res) => res.resourceId), item.resourceId);
|
|
369
|
+
errors.push(`Menu item with type 'resourceId' has resourceId which is not in resources: "${JSON.stringify(item)}".
|
|
370
|
+
${similar ? `Did you mean "${similar}" instead of "${item.resourceId}"?` : ''}`);
|
|
360
371
|
}
|
|
361
372
|
if (item.type === 'component' && !item.component) {
|
|
362
373
|
errors.push(`Menu item with type 'component' must have component : ${JSON.stringify(item)}`);
|
|
@@ -195,6 +195,16 @@ export default class ConfigValidator implements IConfigValidator {
|
|
|
195
195
|
col.showIn = col.showIn || Object.values(AdminForthResourcePages);
|
|
196
196
|
|
|
197
197
|
if (col.foreignResource) {
|
|
198
|
+
|
|
199
|
+
if (!col.foreignResource.resourceId) {
|
|
200
|
+
errors.push(`Resource "${res.resourceId}" column "${col.name}" has foreignResource without resourceId`);
|
|
201
|
+
}
|
|
202
|
+
const resource = this.config.resources.find((r) => r.resourceId === col.foreignResource.resourceId);
|
|
203
|
+
if (!resource) {
|
|
204
|
+
const similar = suggestIfTypo(this.config.resources.map((r) => r.resourceId), col.foreignResource.resourceId);
|
|
205
|
+
errors.push(`Resource "${res.resourceId}" column "${col.name}" has foreignResource resourceId which is not in resources: "${col.foreignResource.resourceId}".
|
|
206
|
+
${similar ? `Did you mean "${similar}" instead of "${col.foreignResource.resourceId}"?` : ''}`);
|
|
207
|
+
}
|
|
198
208
|
const befHook = col.foreignResource.hooks?.dropdownList?.beforeDatasourceRequest;
|
|
199
209
|
if (befHook) {
|
|
200
210
|
if (!Array.isArray(befHook)) {
|
|
@@ -413,7 +423,9 @@ export default class ConfigValidator implements IConfigValidator {
|
|
|
413
423
|
}
|
|
414
424
|
|
|
415
425
|
if (item.resourceId && !this.config.resources.find((res) => res.resourceId === item.resourceId)) {
|
|
416
|
-
|
|
426
|
+
const similar = suggestIfTypo(this.config.resources.map((res) => res.resourceId), item.resourceId);
|
|
427
|
+
errors.push(`Menu item with type 'resourceId' has resourceId which is not in resources: "${JSON.stringify(item)}".
|
|
428
|
+
${similar ? `Did you mean "${similar}" instead of "${item.resourceId}"?` : ''}`);
|
|
417
429
|
}
|
|
418
430
|
|
|
419
431
|
if (item.type === 'component' && !item.component) {
|