adminforth 1.3.51-next.3 → 1.3.52-next.0
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/modules/codeInjector.js +1 -1
- package/dist/servers/express.js +9 -2
- package/index.ts +2 -1
- package/modules/codeInjector.ts +1 -2
- package/package.json +1 -1
- package/servers/express.ts +13 -4
- package/spa/src/components/ResourceForm.vue +0 -3
- package/spa/src/components/ResourceListTable.vue +3 -3
- package/types/AdminForthConfig.ts +2 -0
|
@@ -474,7 +474,7 @@ class CodeInjector {
|
|
|
474
474
|
const npmInstallCommand = `install ${[
|
|
475
475
|
...iconPackageNames,
|
|
476
476
|
...usersPackages,
|
|
477
|
-
...pluginPackages.map(({ packages }) => packages)
|
|
477
|
+
...pluginPackages.map(({ packages }) => packages.join(' ')),
|
|
478
478
|
].join(' ')}`;
|
|
479
479
|
yield this.runNpmShell({ command: npmInstallCommand, cwd: CodeInjector.SPA_TMP_PATH });
|
|
480
480
|
}
|
package/dist/servers/express.js
CHANGED
|
@@ -196,6 +196,9 @@ class ExpressServer {
|
|
|
196
196
|
setStatus(code, message) {
|
|
197
197
|
this.status = code;
|
|
198
198
|
this.message = message;
|
|
199
|
+
},
|
|
200
|
+
blobStream() {
|
|
201
|
+
return res;
|
|
199
202
|
}
|
|
200
203
|
};
|
|
201
204
|
const input = { body, query, headers, cookies, adminUser, response, _raw_express_req: req, _raw_express_res: res };
|
|
@@ -213,9 +216,13 @@ class ExpressServer {
|
|
|
213
216
|
response.headers.forEach(([name, value]) => {
|
|
214
217
|
res.setHeader(name, value);
|
|
215
218
|
});
|
|
216
|
-
|
|
219
|
+
res.status(response.status);
|
|
217
220
|
if (response.message) {
|
|
218
|
-
|
|
221
|
+
res.send(response.message);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (output === null) {
|
|
225
|
+
// nothing should be returned anymore
|
|
219
226
|
return;
|
|
220
227
|
}
|
|
221
228
|
res.json(output);
|
package/index.ts
CHANGED
package/modules/codeInjector.ts
CHANGED
|
@@ -538,13 +538,12 @@ class CodeInjector implements ICodeInjector {
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
540
|
await this.runNpmShell({command: 'ci', cwd: CodeInjector.SPA_TMP_PATH});
|
|
541
|
-
|
|
542
541
|
|
|
543
542
|
if (iconPackageNames.length) {
|
|
544
543
|
const npmInstallCommand = `install ${[
|
|
545
544
|
...iconPackageNames,
|
|
546
545
|
...usersPackages,
|
|
547
|
-
...pluginPackages.map(({ packages }) => packages)
|
|
546
|
+
...pluginPackages.map(({ packages }) => packages.join(' ')),
|
|
548
547
|
].join(' ')}`;
|
|
549
548
|
await this.runNpmShell({command: npmInstallCommand, cwd: CodeInjector.SPA_TMP_PATH});
|
|
550
549
|
}
|
package/package.json
CHANGED
package/servers/express.ts
CHANGED
|
@@ -206,6 +206,7 @@ class ExpressServer implements IExpressHttpServer {
|
|
|
206
206
|
headers: [],
|
|
207
207
|
status: 200,
|
|
208
208
|
message: undefined,
|
|
209
|
+
|
|
209
210
|
setHeader(name, value) {
|
|
210
211
|
process.env.HEAVY_DEBUG && console.log(' 🪲Setting header', name, value);
|
|
211
212
|
this.headers.push([name, value]);
|
|
@@ -214,10 +215,15 @@ class ExpressServer implements IExpressHttpServer {
|
|
|
214
215
|
setStatus(code, message) {
|
|
215
216
|
this.status = code;
|
|
216
217
|
this.message = message;
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
blobStream() {
|
|
221
|
+
return res;
|
|
217
222
|
}
|
|
223
|
+
|
|
218
224
|
};
|
|
219
225
|
const input = { body, query, headers, cookies, adminUser, response, _raw_express_req: req, _raw_express_res: res};
|
|
220
|
-
|
|
226
|
+
|
|
221
227
|
let output;
|
|
222
228
|
try {
|
|
223
229
|
output = await handler(input);
|
|
@@ -225,18 +231,21 @@ class ExpressServer implements IExpressHttpServer {
|
|
|
225
231
|
console.error('Error in handler', e);
|
|
226
232
|
// print full stack trace
|
|
227
233
|
console.error(e.stack);
|
|
228
|
-
|
|
229
234
|
res.status(500).send('Internal server error');
|
|
230
235
|
return;
|
|
231
236
|
}
|
|
232
237
|
response.headers.forEach(([name, value]) => {
|
|
233
238
|
res.setHeader(name, value);
|
|
234
239
|
});
|
|
235
|
-
|
|
240
|
+
res.status(response.status);
|
|
236
241
|
if (response.message) {
|
|
237
|
-
|
|
242
|
+
res.send(response.message);
|
|
238
243
|
return;
|
|
239
244
|
}
|
|
245
|
+
if (output === null) {
|
|
246
|
+
// nothing should be returned anymore
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
240
249
|
res.json(output);
|
|
241
250
|
}
|
|
242
251
|
|
|
@@ -218,7 +218,6 @@ const columnError = (column) => {
|
|
|
218
218
|
return `This field must be less than ${column.maxValue}`;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
console.log('column.validation: ', JSON.stringify(column), 'aa', JSON.stringify(currentValues.value[column.name]));
|
|
222
221
|
if (currentValues.value[column.name] && column.validation) {
|
|
223
222
|
const error = applyRegexValidation(currentValues.value[column.name], column.validation);
|
|
224
223
|
if (error) {
|
|
@@ -244,13 +243,11 @@ const setCurrentValue = (key, value) => {
|
|
|
244
243
|
}
|
|
245
244
|
|
|
246
245
|
currentValues.value = { ...currentValues.value };
|
|
247
|
-
console.log('3️⃣ setCurrentValue', key, value);
|
|
248
246
|
emit('update:record', currentValues.value);
|
|
249
247
|
};
|
|
250
248
|
|
|
251
249
|
onMounted(() => {
|
|
252
250
|
currentValues.value = Object.assign({}, props.record);
|
|
253
|
-
console.log('2️⃣ currentValues', JSON.stringify(currentValues.value));
|
|
254
251
|
initFlowbite();
|
|
255
252
|
emit('update:isValid', isValid.value);
|
|
256
253
|
});
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
</th>
|
|
25
25
|
|
|
26
|
-
<th v-for="c in columnsListed" scope="col" class="px-6 py-3">
|
|
26
|
+
<th v-for="c in columnsListed" scope="col" class="px-2 md:px-3 lg:px-6 py-3">
|
|
27
27
|
|
|
28
28
|
<div @click="(evt) => c.sortable && onSortButtonClick(evt, c.name)"
|
|
29
29
|
class="flex items-center " :class="{'cursor-pointer':c.sortable}">
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
<label for="checkbox-table-search-1" class="sr-only">checkbox</label>
|
|
95
95
|
</div>
|
|
96
96
|
</td>
|
|
97
|
-
<td v-for="c in columnsListed" class="px-6 py-4">
|
|
97
|
+
<td v-for="c in columnsListed" class="px-2 md:px-3 lg:px-6 py-4">
|
|
98
98
|
<!-- if c.name in listComponentsPerColumn, render it. If not, render ValueRenderer -->
|
|
99
99
|
<component
|
|
100
100
|
:is="c?.components?.list ? getCustomComponent(c.components.list) : ValueRenderer"
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
:resource="resource"
|
|
106
106
|
/>
|
|
107
107
|
</td>
|
|
108
|
-
<td class=" items-center px-6 py-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
108
|
+
<td class=" items-center px-2 md:px-3 lg:px-6 py-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
109
109
|
<div class="flex">
|
|
110
110
|
<RouterLink
|
|
111
111
|
v-if="resource.options?.allowedActions.show"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Express } from 'express';
|
|
2
|
+
import type { Writable } from 'stream';
|
|
2
3
|
|
|
3
4
|
export interface ICodeInjector {
|
|
4
5
|
srcFoldersToSync: Object;
|
|
@@ -13,6 +14,7 @@ export interface IConfigValidator {
|
|
|
13
14
|
export interface IAdminForthHttpResponse {
|
|
14
15
|
setHeader: (key: string, value: string) => void,
|
|
15
16
|
setStatus: (code: number, message: string) => void,
|
|
17
|
+
blobStream: () => Writable,
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
/**
|