adminforth 2.27.0-next.17 → 2.27.0-next.19
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/commands/callTsProxy.js +10 -5
- package/commands/proxy.ts +18 -10
- package/dist/commands/proxy.js +14 -10
- package/dist/commands/proxy.js.map +1 -1
- package/dist/spa/src/views/ShowView.vue +59 -9
- package/package.json +1 -1
package/commands/callTsProxy.js
CHANGED
|
@@ -25,11 +25,11 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
25
25
|
const child = spawn("tsx", [path.join(currentFileFolder, "proxy.ts")], {
|
|
26
26
|
env: process.env,
|
|
27
27
|
});
|
|
28
|
-
let stdout = "";
|
|
29
28
|
let stderr = "";
|
|
29
|
+
let stdoutLogs = [];
|
|
30
30
|
|
|
31
31
|
child.stdout.on("data", (data) => {
|
|
32
|
-
|
|
32
|
+
stdoutLogs.push(data.toString());
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
child.stderr.on("data", (data) => {
|
|
@@ -39,7 +39,12 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
39
39
|
child.on("close", (code) => {
|
|
40
40
|
if (code === 0) {
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const tsProxyResult = stdoutLogs.find(log => log.includes('>>>>>>>'));
|
|
43
|
+
const preparedStdout = tsProxyResult.slice(tsProxyResult.indexOf('>>>>>>>') + 46, tsProxyResult.lastIndexOf('<<<<<<<'));
|
|
44
|
+
const preparedStdoutLogs = stdoutLogs.filter(log => !log.includes('>>>>>>>'));
|
|
45
|
+
for (const log of preparedStdoutLogs) {
|
|
46
|
+
console.log(log);
|
|
47
|
+
}
|
|
43
48
|
const parsed = JSON.parse(preparedStdout);
|
|
44
49
|
if (!silent) {
|
|
45
50
|
parsed.capturedLogs.forEach((log) => {
|
|
@@ -52,10 +57,10 @@ export function callTsProxy(tsCode, silent=false) {
|
|
|
52
57
|
}
|
|
53
58
|
resolve(parsed.result);
|
|
54
59
|
} catch (e) {
|
|
55
|
-
reject(new Error("Invalid JSON from tsproxy: " +
|
|
60
|
+
reject(new Error("Invalid JSON from tsproxy: " + preparedStdout));
|
|
56
61
|
}
|
|
57
62
|
} else {
|
|
58
|
-
console.error(`tsproxy exited with non-0, this should never happen, stdout: ${
|
|
63
|
+
console.error(`tsproxy exited with non-0, this should never happen, stdout: ${preparedStdout}, stderr: ${stderr}`);
|
|
59
64
|
reject(new Error(stderr));
|
|
60
65
|
}
|
|
61
66
|
});
|
package/commands/proxy.ts
CHANGED
|
@@ -41,19 +41,27 @@ import path from 'path';
|
|
|
41
41
|
|
|
42
42
|
// Restore original console.log
|
|
43
43
|
console.log = origLog;
|
|
44
|
-
console.log(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
console.log(
|
|
45
|
+
">>>>>>>"+
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
result,
|
|
48
|
+
capturedLogs,
|
|
49
|
+
error: null
|
|
50
|
+
})
|
|
51
|
+
+"<<<<<<<"
|
|
52
|
+
);
|
|
49
53
|
} catch (error: any) {
|
|
50
54
|
// Restore original console.log
|
|
51
55
|
console.log = origLog;
|
|
52
|
-
console.log(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
console.log(
|
|
57
|
+
">>>>>>>"+
|
|
58
|
+
JSON.stringify({
|
|
59
|
+
error: error.message,
|
|
60
|
+
stack: error.stack,
|
|
61
|
+
capturedLogs
|
|
62
|
+
})
|
|
63
|
+
+"<<<<<<<"
|
|
64
|
+
);
|
|
57
65
|
} finally {
|
|
58
66
|
await unlink(tmpFile).catch(() => {});
|
|
59
67
|
}
|
package/dist/commands/proxy.js
CHANGED
|
@@ -49,20 +49,24 @@ import path from 'path';
|
|
|
49
49
|
const result = await Promise.resolve(module.exec());
|
|
50
50
|
// Restore original console.log
|
|
51
51
|
console.log = origLog;
|
|
52
|
-
console.log(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
console.log(">>>>>>>" +
|
|
53
|
+
JSON.stringify({
|
|
54
|
+
result,
|
|
55
|
+
capturedLogs,
|
|
56
|
+
error: null
|
|
57
|
+
})
|
|
58
|
+
+ "<<<<<<<");
|
|
57
59
|
}
|
|
58
60
|
catch (error) {
|
|
59
61
|
// Restore original console.log
|
|
60
62
|
console.log = origLog;
|
|
61
|
-
console.log(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
console.log(">>>>>>>" +
|
|
64
|
+
JSON.stringify({
|
|
65
|
+
error: error.message,
|
|
66
|
+
stack: error.stack,
|
|
67
|
+
capturedLogs
|
|
68
|
+
})
|
|
69
|
+
+ "<<<<<<<");
|
|
66
70
|
}
|
|
67
71
|
finally {
|
|
68
72
|
await unlink(tmpFile).catch(() => { });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../commands/proxy.ts"],"names":[],"mappings":";;;;;;;AAAA,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,CAAC,KAAK,IAAI,EAAE;;IACV,MAAM,MAAM,GAAa,EAAE,CAAC;;QAE5B,KAA0B,eAAA,KAAA,cAAA,OAAO,CAAC,KAAK,CAAA,IAAA,sDAAE,CAAC;YAAhB,cAAa;YAAb,WAAa;YAA5B,MAAM,KAAK,KAAA,CAAA;YACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;;;;;;;;;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE9C,MAAM,WAAW,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IAAI,CAAC,CAAC;QAEzD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAEpD,+BAA+B;QAC/B,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC;QACtB,OAAO,CAAC,GAAG,CACT,SAAS;YACT,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM;gBACN,YAAY;gBACZ,KAAK,EAAE,IAAI;aACZ,CAAC;cACD,SAAS,CACX,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,+BAA+B;QAC/B,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC;QACtB,OAAO,CAAC,GAAG,CACT,SAAS;YACT,IAAI,CAAC,SAAS,CAAC;gBACb,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,YAAY;aACb,CAAC;cACD,SAAS,CACX,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACxC,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -85,14 +85,52 @@
|
|
|
85
85
|
:adminUser="coreStore.adminUser"
|
|
86
86
|
/>
|
|
87
87
|
|
|
88
|
-
<div
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
<div
|
|
89
|
+
v-if="loading"
|
|
90
|
+
role="status"
|
|
91
|
+
class="animate-pulse overflow-x-auto shadow-resourseFormShadow dark:shadow-darkResourseFormShadow"
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
v-if="groups && groups.length > 0"
|
|
95
|
+
class="text-md font-semibold px-6 py-3 flex flex-1 items-center bg-lightShowTableHeadingBackground dark:bg-darkShowTableHeadingBackground dark:text-darkShowTableHeadingText rounded-t-lg border-b border-lightShowTableBodyBorder dark:border-darkShowTableBodyBorder"
|
|
96
|
+
>
|
|
97
|
+
<div class="h-4 bg-gray-300 dark:bg-gray-600 rounded-full w-32"></div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<table class="w-full text-sm text-left table-fixed">
|
|
101
|
+
<thead class="bg-lightShowTableUnderHeadingBackground dark:bg-darkShowTableUnderHeadingBackground block md:table-row-group">
|
|
102
|
+
<tr>
|
|
103
|
+
<th scope="col" class="px-6 py-3 text-xs uppercase hidden md:w-52 md:table-cell text-lightShowTableUnderHeadingText dark:text-darkShowTableUnderHeadingText">
|
|
104
|
+
{{ $t('Field') }}
|
|
105
|
+
</th>
|
|
106
|
+
<th scope="col" class="px-6 py-3 text-xs uppercase hidden md:table-cell text-lightShowTableUnderHeadingText dark:text-darkShowTableUnderHeadingText">
|
|
107
|
+
{{ $t('Value') }}
|
|
108
|
+
</th>
|
|
109
|
+
</tr>
|
|
110
|
+
</thead>
|
|
111
|
+
|
|
112
|
+
<tbody>
|
|
113
|
+
<tr
|
|
114
|
+
v-for="i in skeletonRowsCount"
|
|
115
|
+
:key="i"
|
|
116
|
+
class="bg-lightShowTablesBodyBackground border-t border-lightShowTableBodyBorder dark:bg-darkShowTablesBodyBackground dark:border-darkShowTableBodyBorder block md:table-row"
|
|
117
|
+
>
|
|
118
|
+
<td class="px-6 py-[15.5px] relative block md:table-cell pb-0 md:pb-[15.5px]">
|
|
119
|
+
<div class="md:absolute md:inset-0 flex items-center px-6 py-[15.5px]">
|
|
120
|
+
<div class="h-2.5 bg-gray-200 dark:bg-gray-700 rounded-full w-24"></div>
|
|
121
|
+
</div>
|
|
122
|
+
</td>
|
|
123
|
+
|
|
124
|
+
<td class="px-6 py-[15.5px] whitespace-pre-wrap block md:table-cell">
|
|
125
|
+
<div class="flex items-center h-full min-h-[21px]">
|
|
126
|
+
<div class="h-2.5 bg-gray-200 dark:bg-gray-700 rounded-full w-full max-w-[280px]"></div>
|
|
127
|
+
</div>
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
</tbody>
|
|
131
|
+
</table>
|
|
132
|
+
|
|
133
|
+
<span class="sr-only">{{ $t('Loading...') }}</span>
|
|
96
134
|
</div>
|
|
97
135
|
<div
|
|
98
136
|
v-else-if="coreStore.record"
|
|
@@ -177,6 +215,18 @@ const customActions = computed(() => {
|
|
|
177
215
|
return coreStore.resource?.options?.actions?.filter((a: any) => a.showIn?.showThreeDotsMenu) || [];
|
|
178
216
|
});
|
|
179
217
|
|
|
218
|
+
const skeletonRowsCount = computed(() => {
|
|
219
|
+
const allCols = coreStore.resource?.columns || [];
|
|
220
|
+
|
|
221
|
+
const isEnabledInConfig = (col: any) => {
|
|
222
|
+
return col.showIn?.list !== false;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const finalCount = allCols.filter(isEnabledInConfig).length;
|
|
226
|
+
|
|
227
|
+
return finalCount > 0 ? finalCount : 10;
|
|
228
|
+
});
|
|
229
|
+
|
|
180
230
|
onMounted(async () => {
|
|
181
231
|
loading.value = true;
|
|
182
232
|
await coreStore.fetchResourceFull({
|
|
@@ -216,7 +266,7 @@ const groups = computed(() => {
|
|
|
216
266
|
});
|
|
217
267
|
|
|
218
268
|
const allColumns = computed(() => {
|
|
219
|
-
return coreStore.resource?.columns
|
|
269
|
+
return coreStore.resource?.columns?.filter(col => col.showIn?.show);
|
|
220
270
|
});
|
|
221
271
|
|
|
222
272
|
const otherColumns = computed(() => {
|