@adminforth/import-export 1.3.0 → 1.3.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/build.log +2 -2
- package/custom/ImportCsv.vue +12 -0
- package/dist/custom/ImportCsv.vue +12 -0
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -10,5 +10,5 @@ custom/package-lock.json
|
|
|
10
10
|
custom/package.json
|
|
11
11
|
custom/tsconfig.json
|
|
12
12
|
|
|
13
|
-
sent 14,
|
|
14
|
-
total size is
|
|
13
|
+
sent 14,627 bytes received 115 bytes 29,484.00 bytes/sec
|
|
14
|
+
total size is 14,207 speedup is 0.96
|
package/custom/ImportCsv.vue
CHANGED
|
@@ -150,12 +150,20 @@ async function importCsv() {
|
|
|
150
150
|
|
|
151
151
|
complete: async (results) => {
|
|
152
152
|
if (results.errors.length > 0) {
|
|
153
|
+
adminforth.alert({
|
|
154
|
+
message: `CSV parsing errors at row ${results.errors[0]?.row + 1 || '?'}: ${results.errors[0]?.message || 'Unknown error'}`,
|
|
155
|
+
variant: 'danger'
|
|
156
|
+
});
|
|
153
157
|
throw new Error(`CSV parsing errors: ${results.errors.map(e => e.message).join(', ')}`);
|
|
154
158
|
}
|
|
155
159
|
const data: Record<string, string[]> = {};
|
|
156
160
|
const rows = results.data as Record<string, string>[];
|
|
157
161
|
|
|
158
162
|
if (rows.length === 0) {
|
|
163
|
+
adminforth.alert({
|
|
164
|
+
message: `No data rows found in CSV`,
|
|
165
|
+
variant: 'danger'
|
|
166
|
+
});
|
|
159
167
|
throw new Error('No data rows found in CSV');
|
|
160
168
|
}
|
|
161
169
|
Object.keys(rows[0]).forEach(column => {
|
|
@@ -172,6 +180,10 @@ async function importCsv() {
|
|
|
172
180
|
inProgress.value = false;
|
|
173
181
|
},
|
|
174
182
|
error: (error) => {
|
|
183
|
+
adminforth.alert({
|
|
184
|
+
message: `CSV parsing errors: ${error.message}}`,
|
|
185
|
+
variant: 'danger'
|
|
186
|
+
});
|
|
175
187
|
throw new Error(`Failed to parse CSV: ${error.message}`);
|
|
176
188
|
}
|
|
177
189
|
});
|
|
@@ -150,12 +150,20 @@ async function importCsv() {
|
|
|
150
150
|
|
|
151
151
|
complete: async (results) => {
|
|
152
152
|
if (results.errors.length > 0) {
|
|
153
|
+
adminforth.alert({
|
|
154
|
+
message: `CSV parsing errors at row ${results.errors[0]?.row + 1 || '?'}: ${results.errors[0]?.message || 'Unknown error'}`,
|
|
155
|
+
variant: 'danger'
|
|
156
|
+
});
|
|
153
157
|
throw new Error(`CSV parsing errors: ${results.errors.map(e => e.message).join(', ')}`);
|
|
154
158
|
}
|
|
155
159
|
const data: Record<string, string[]> = {};
|
|
156
160
|
const rows = results.data as Record<string, string>[];
|
|
157
161
|
|
|
158
162
|
if (rows.length === 0) {
|
|
163
|
+
adminforth.alert({
|
|
164
|
+
message: `No data rows found in CSV`,
|
|
165
|
+
variant: 'danger'
|
|
166
|
+
});
|
|
159
167
|
throw new Error('No data rows found in CSV');
|
|
160
168
|
}
|
|
161
169
|
Object.keys(rows[0]).forEach(column => {
|
|
@@ -172,6 +180,10 @@ async function importCsv() {
|
|
|
172
180
|
inProgress.value = false;
|
|
173
181
|
},
|
|
174
182
|
error: (error) => {
|
|
183
|
+
adminforth.alert({
|
|
184
|
+
message: `CSV parsing errors: ${error.message}}`,
|
|
185
|
+
variant: 'danger'
|
|
186
|
+
});
|
|
175
187
|
throw new Error(`Failed to parse CSV: ${error.message}`);
|
|
176
188
|
}
|
|
177
189
|
});
|