@adminforth/bulk-ai-flow 1.1.1 → 1.1.3

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/build.log CHANGED
@@ -10,5 +10,5 @@ custom/tsconfig.json
10
10
  custom/visionAction.vue
11
11
  custom/visionTable.vue
12
12
 
13
- sent 24,032 bytes received 115 bytes 48,294.00 bytes/sec
14
- total size is 23,613 speedup is 0.98
13
+ sent 24,151 bytes received 115 bytes 48,532.00 bytes/sec
14
+ total size is 23,732 speedup is 0.98
@@ -84,9 +84,9 @@ const openDialog = async () => {
84
84
  analyzeFields();
85
85
  }
86
86
 
87
- watch(selected, (val) => {
88
- console.log('Selected changed:', val);
89
- }, { deep: true });
87
+ // watch(selected, (val) => {
88
+ // console.log('Selected changed:', val);
89
+ // }, { deep: true });
90
90
 
91
91
  const closeDialog = () => {
92
92
  confirmDialog.value.close();
@@ -131,9 +131,9 @@ function generateTableColumns() {
131
131
  }
132
132
  reqFields.label = record._label;
133
133
  reqFields.images = images.value[index];
134
- reqFields.id = record.id;
134
+ reqFields[primaryKey] = record[primaryKey];
135
135
  indexes.push({
136
- id: record.id,
136
+ [primaryKey]: record[primaryKey],
137
137
  label: record._label,
138
138
  });
139
139
  tableData.push(reqFields);
@@ -194,12 +194,12 @@ function prepareDataForSave() {
194
194
  const checkedItems = selected.value
195
195
  .filter(item => item.isChecked === true)
196
196
  .map(item => {
197
- const { isChecked, id, ...itemWithoutIsCheckedAndId } = item;
197
+ const { isChecked, primaryKey, ...itemWithoutIsCheckedAndId } = item;
198
198
  return itemWithoutIsCheckedAndId;
199
199
  });
200
200
  const checkedItemsIDs = selected.value
201
201
  .filter(item => item.isChecked === true)
202
- .map(item => item.id);
202
+ .map(item => item[primaryKey]);
203
203
  return [checkedItemsIDs, checkedItems];
204
204
  }
205
205
 
@@ -222,7 +222,7 @@ async function analyzeFields() {
222
222
  ...res.result.map((item, idx) => ({
223
223
  ...item,
224
224
  isChecked: true,
225
- id: selected.value[idx]?.id,
225
+ [primaryKey]: selected.value[idx]?.[primaryKey],
226
226
  }))
227
227
  )
228
228
  }
@@ -49,6 +49,7 @@
49
49
  <Select
50
50
  :options="convertColumnEnumToSelectOptions(props.meta.columnEnums, n)"
51
51
  v-model="selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
52
+ :teleportToTop="true"
52
53
  >
53
54
  </Select>
54
55
  </div>
@@ -84,9 +84,9 @@ const openDialog = async () => {
84
84
  analyzeFields();
85
85
  }
86
86
 
87
- watch(selected, (val) => {
88
- console.log('Selected changed:', val);
89
- }, { deep: true });
87
+ // watch(selected, (val) => {
88
+ // console.log('Selected changed:', val);
89
+ // }, { deep: true });
90
90
 
91
91
  const closeDialog = () => {
92
92
  confirmDialog.value.close();
@@ -131,9 +131,9 @@ function generateTableColumns() {
131
131
  }
132
132
  reqFields.label = record._label;
133
133
  reqFields.images = images.value[index];
134
- reqFields.id = record.id;
134
+ reqFields[primaryKey] = record[primaryKey];
135
135
  indexes.push({
136
- id: record.id,
136
+ [primaryKey]: record[primaryKey],
137
137
  label: record._label,
138
138
  });
139
139
  tableData.push(reqFields);
@@ -194,12 +194,12 @@ function prepareDataForSave() {
194
194
  const checkedItems = selected.value
195
195
  .filter(item => item.isChecked === true)
196
196
  .map(item => {
197
- const { isChecked, id, ...itemWithoutIsCheckedAndId } = item;
197
+ const { isChecked, primaryKey, ...itemWithoutIsCheckedAndId } = item;
198
198
  return itemWithoutIsCheckedAndId;
199
199
  });
200
200
  const checkedItemsIDs = selected.value
201
201
  .filter(item => item.isChecked === true)
202
- .map(item => item.id);
202
+ .map(item => item[primaryKey]);
203
203
  return [checkedItemsIDs, checkedItems];
204
204
  }
205
205
 
@@ -222,7 +222,7 @@ async function analyzeFields() {
222
222
  ...res.result.map((item, idx) => ({
223
223
  ...item,
224
224
  isChecked: true,
225
- id: selected.value[idx]?.id,
225
+ [primaryKey]: selected.value[idx]?.[primaryKey],
226
226
  }))
227
227
  )
228
228
  }
@@ -49,6 +49,7 @@
49
49
  <Select
50
50
  :options="convertColumnEnumToSelectOptions(props.meta.columnEnums, n)"
51
51
  v-model="selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
52
+ :teleportToTop="true"
52
53
  >
53
54
  </Select>
54
55
  </div>
package/dist/index.js CHANGED
@@ -52,31 +52,20 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
52
52
  throw new Error(`⚠️ No column found for key "${key}"`);
53
53
  }
54
54
  }
55
- // if (this.options.generateImages) {
56
- // const resource = adminforth.config.resources.find(r => r.resourceId === this.options.generateImages!.attachmentResource);
57
- // if (!resource) {
58
- // throw new Error(`Resource '${this.options.generateImages!.attachmentResource}' not found`);
59
- // }
60
- // this.attachmentResource = resource;
61
- // const field = resource.columns.find(c => c.name === this.options.generateImages!.attachmentFieldName);
62
- // if (!field) {
63
- // throw new Error(`Field '${this.options.generateImages!.attachmentFieldName}' not found in resource '${this.options.generateImages!.attachmentResource}'`);
64
- // }
65
- // const plugin = adminforth.activatedPlugins.find(p =>
66
- // p.resourceConfig!.resourceId === this.options.attachments!.attachmentResource &&
67
- // p.pluginOptions.pathColumnName === this.options.attachments!.attachmentFieldName
68
- // );
69
- // if (!plugin) {
70
- // throw new Error(`Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' not found in resource '${this.options.attachments!.attachmentResource}', please check if Upload Plugin is installed on the field ${this.options.attachments!.attachmentFieldName}`);
71
- // }
72
- // if (!plugin.pluginOptions.storageAdapter.objectCanBeAccesedPublicly()) {
73
- // throw new Error(`Upload Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' in resource '${this.options.attachments!.attachmentResource}'
74
- // uses adapter which is not configured to store objects in public way, so it will produce only signed private URLs which can not be used in HTML text of blog posts.
75
- // Please configure adapter in such way that it will store objects publicly (e.g. for S3 use 'public-read' ACL).
76
- // `);
77
- // }
78
- // this.uploadPlugin = plugin;
79
- // }
55
+ if (this.options.generateImages) {
56
+ console.log('Generate Images options:', this.options.generateImages);
57
+ for (const [key, value] of Object.entries(this.options.generateImages)) {
58
+ const column = columns.find(c => c.name.toLowerCase() === key.toLowerCase());
59
+ if (!column) {
60
+ throw new Error(`⚠️ No column found for key "${key}"`);
61
+ }
62
+ const plugin = adminforth.activatedPlugins.find(p => p.resourceConfig.resourceId === key &&
63
+ p.pluginOptions.pathColumnName === this.resourceConfig.resourceId);
64
+ // if (!plugin) {
65
+ // throw new Error(`Plugin for attachment field '${key}' not found in resource '${this.options.attachments!.attachmentResource}', please check if Upload Plugin is installed on the field ${this.options.attachments!.attachmentFieldName}`);
66
+ // }
67
+ }
68
+ }
80
69
  const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
81
70
  //console.log('Primary Key Column:', primaryKeyColumn);
82
71
  const pageInjection = {
package/index.ts CHANGED
@@ -50,32 +50,22 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
50
50
  }
51
51
 
52
52
 
53
- // if (this.options.generateImages) {
54
- // const resource = adminforth.config.resources.find(r => r.resourceId === this.options.generateImages!.attachmentResource);
55
- // if (!resource) {
56
- // throw new Error(`Resource '${this.options.generateImages!.attachmentResource}' not found`);
57
- // }
58
- // this.attachmentResource = resource;
59
- // const field = resource.columns.find(c => c.name === this.options.generateImages!.attachmentFieldName);
60
- // if (!field) {
61
- // throw new Error(`Field '${this.options.generateImages!.attachmentFieldName}' not found in resource '${this.options.generateImages!.attachmentResource}'`);
62
- // }
63
- // const plugin = adminforth.activatedPlugins.find(p =>
64
- // p.resourceConfig!.resourceId === this.options.attachments!.attachmentResource &&
65
- // p.pluginOptions.pathColumnName === this.options.attachments!.attachmentFieldName
66
- // );
67
- // if (!plugin) {
68
- // throw new Error(`Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' not found in resource '${this.options.attachments!.attachmentResource}', please check if Upload Plugin is installed on the field ${this.options.attachments!.attachmentFieldName}`);
69
- // }
70
-
71
- // if (!plugin.pluginOptions.storageAdapter.objectCanBeAccesedPublicly()) {
72
- // throw new Error(`Upload Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' in resource '${this.options.attachments!.attachmentResource}'
73
- // uses adapter which is not configured to store objects in public way, so it will produce only signed private URLs which can not be used in HTML text of blog posts.
74
- // Please configure adapter in such way that it will store objects publicly (e.g. for S3 use 'public-read' ACL).
75
- // `);
76
- // }
77
- // this.uploadPlugin = plugin;
78
- // }
53
+ if (this.options.generateImages) {
54
+ console.log('Generate Images options:', this.options.generateImages);
55
+ for (const [key, value] of Object.entries(this.options.generateImages)) {
56
+ const column = columns.find(c => c.name.toLowerCase() === key.toLowerCase());
57
+ if (!column) {
58
+ throw new Error(`⚠️ No column found for key "${key}"`);
59
+ }
60
+ const plugin = adminforth.activatedPlugins.find(p =>
61
+ p.resourceConfig!.resourceId === key &&
62
+ p.pluginOptions.pathColumnName === this.resourceConfig.resourceId
63
+ );
64
+ // if (!plugin) {
65
+ // throw new Error(`Plugin for attachment field '${key}' not found in resource '${this.options.attachments!.attachmentResource}', please check if Upload Plugin is installed on the field ${this.options.attachments!.attachmentFieldName}`);
66
+ // }
67
+ }
68
+ }
79
69
 
80
70
 
81
71
  const primaryKeyColumn = this.resourceConfig.columns.find((col) => col.primaryKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },