adminforth 1.0.37 → 1.0.39

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.
@@ -138,7 +138,6 @@ class SQLiteConnector {
138
138
 
139
139
 
140
140
  getData({ resource, limit, offset, sort, filters }) {
141
- console.log('getDataREQ', { resource, limit, offset, sort, filters });
142
141
  const columns = resource.dataSourceColumns.map((col) => col.name).join(', ');
143
142
  const tableName = resource.table;
144
143
 
@@ -148,7 +148,6 @@ class SQLiteConnector {
148
148
  return value;
149
149
  }
150
150
  getData({ resource, limit, offset, sort, filters }) {
151
- console.log('getDataREQ', { resource, limit, offset, sort, filters });
152
151
  const columns = resource.dataSourceColumns.map((col) => col.name).join(', ');
153
152
  const tableName = resource.table;
154
153
  for (const filter of filters) {
package/dist/index.js CHANGED
@@ -519,11 +519,14 @@ class AdminForth {
519
519
  }
520
520
  const resource = this.config.resources.find((res) => res.resourceId == resourceId);
521
521
  if (!resource) {
522
- return { error: `Resource ${resourceId} not found` };
522
+ return { error: `Resource '${resourceId}' not found` };
523
523
  }
524
524
  const columnConfig = resource.columns.find((col) => col.name == column);
525
+ if (!columnConfig) {
526
+ return { error: `Column "${column}' not found in resource with resourceId '${resourceId}'` };
527
+ }
525
528
  if (!columnConfig.foreignResource) {
526
- return { error: `Column ${column} in resource ${resourceId} is not a foreign key` };
529
+ return { error: `Column '${column}' in resource '${resourceId}' is not a foreign key` };
527
530
  }
528
531
  const targetResourceId = columnConfig.foreignResource.resourceId;
529
532
  const targetResource = this.config.resources.find((res) => res.resourceId == targetResourceId);
@@ -179,15 +179,15 @@ class CodeInjector {
179
179
  const homepageMenuItem = this.adminforth.config.menu.find((mi) => mi.homepage);
180
180
  let childrenHomePageMenuItem = this.adminforth.config.menu.find((mi) => { var _a; return mi.children && ((_a = mi.children) === null || _a === void 0 ? void 0 : _a.find((mi) => mi.homepage)); });
181
181
  let childrenHomepage = (_e = childrenHomePageMenuItem === null || childrenHomePageMenuItem === void 0 ? void 0 : childrenHomePageMenuItem.children) === null || _e === void 0 ? void 0 : _e.find((mi) => mi.homepage);
182
- let homePagePath = (homepageMenuItem === null || homepageMenuItem === void 0 ? void 0 : homepageMenuItem.path) || `resource/${childrenHomepage === null || childrenHomepage === void 0 ? void 0 : childrenHomepage.resourceId}`;
182
+ let homePagePath = (homepageMenuItem === null || homepageMenuItem === void 0 ? void 0 : homepageMenuItem.path) || `/resource/${childrenHomepage === null || childrenHomepage === void 0 ? void 0 : childrenHomepage.resourceId}`;
183
183
  if (!homePagePath) {
184
- homePagePath = ((_f = this.adminforth.config.menu.filter((mi) => mi.path)[0]) === null || _f === void 0 ? void 0 : _f.path) || `resource/${(_g = this.adminforth.config.menu.filter((mi) => mi.children)[0]) === null || _g === void 0 ? void 0 : _g.resourceId}`;
184
+ homePagePath = ((_f = this.adminforth.config.menu.filter((mi) => mi.path)[0]) === null || _f === void 0 ? void 0 : _f.path) || `/resource/${(_g = this.adminforth.config.menu.filter((mi) => mi.children)[0]) === null || _g === void 0 ? void 0 : _g.resourceId}`;
185
185
  }
186
186
  routes += `{
187
187
  path: '/',
188
188
  name: 'home',
189
189
  //redirect to login
190
- redirect: '/${homePagePath}'
190
+ redirect: '${homePagePath}'
191
191
  },\n`;
192
192
  const routerVuePath = path.join(CodeInjector.SPA_TMP_PATH, 'src', 'router', 'index.ts');
193
193
  let routerVueContent = yield fs.promises.readFile(routerVuePath, 'utf-8');
package/index.ts CHANGED
@@ -588,11 +588,14 @@ class AdminForth {
588
588
  }
589
589
  const resource = this.config.resources.find((res) => res.resourceId == resourceId);
590
590
  if (!resource) {
591
- return { error: `Resource ${resourceId} not found` };
591
+ return { error: `Resource '${resourceId}' not found` };
592
592
  }
593
593
  const columnConfig = resource.columns.find((col) => col.name == column);
594
+ if (!columnConfig) {
595
+ return { error: `Column "${column}' not found in resource with resourceId '${resourceId}'` };
596
+ }
594
597
  if (!columnConfig.foreignResource) {
595
- return { error: `Column ${column} in resource ${resourceId} is not a foreign key` };
598
+ return { error: `Column '${column}' in resource '${resourceId}' is not a foreign key` };
596
599
  }
597
600
  const targetResourceId = columnConfig.foreignResource.resourceId;
598
601
  const targetResource = this.config.resources.find((res) => res.resourceId == targetResourceId);
@@ -203,9 +203,9 @@ class CodeInjector {
203
203
  const homepageMenuItem = this.adminforth.config.menu.find((mi)=>mi.homepage);
204
204
  let childrenHomePageMenuItem = this.adminforth.config.menu.find((mi)=>mi.children && mi.children?.find((mi)=>mi.homepage));
205
205
  let childrenHomepage = childrenHomePageMenuItem?.children?.find((mi)=>mi.homepage)
206
- let homePagePath = homepageMenuItem?.path || `resource/${childrenHomepage?.resourceId}`;
206
+ let homePagePath = homepageMenuItem?.path || `/resource/${childrenHomepage?.resourceId}`;
207
207
  if (!homePagePath) {
208
- homePagePath=this.adminforth.config.menu.filter((mi)=>mi.path)[0]?.path || `resource/${this.adminforth.config.menu.filter((mi)=>mi.children)[0]?.resourceId}` ;
208
+ homePagePath=this.adminforth.config.menu.filter((mi)=>mi.path)[0]?.path || `/resource/${this.adminforth.config.menu.filter((mi)=>mi.children)[0]?.resourceId}` ;
209
209
  }
210
210
 
211
211
 
@@ -216,7 +216,7 @@ class CodeInjector {
216
216
  path: '/',
217
217
  name: 'home',
218
218
  //redirect to login
219
- redirect: '/${homePagePath}'
219
+ redirect: '${homePagePath}'
220
220
  },\n`;
221
221
  const routerVuePath = path.join(CodeInjector.SPA_TMP_PATH, 'src', 'router', 'index.ts');
222
222
  let routerVueContent = await fs.promises.readFile(routerVuePath, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",