@galadrim/galadmin 0.1.121 → 0.1.124
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/README.md +98 -66
- package/dist/api.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +1 -0
- package/package.json +2 -2
- package/src/api.ts +2 -2
- package/src/front/ckeditor5-build/node_modules/semver/bin/semver.js +0 -0
- package/src/front/node_modules/.cache/.eslintcache +1 -1
- package/src/types/config.ts +2 -1
- package/src/front/ckeditor5-build/node_modules/.bin/semver +0 -12
- package/src/front/ckeditor5-build/node_modules/.bin/semver.cmd +0 -17
- package/src/front/ckeditor5-build/node_modules/.bin/semver.ps1 +0 -28
- package/src/front/node_modules/.cache/babel-loader/02b7fe943dc75565e03526b83b520ecbd57198be62b5d2cae86e96b27a203380.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/1186506617786e458e6510b54bee969b5eaec76126d17968106d22628055c890.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/4ddd228e52e76205bc0431b199807e875066e0c19bda2c5b40e78587dca66ad5.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/591f203be44bf03cc118b57f1000134541adccbf41131ed0a1b9be97d66df8c7.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/5dac42db47953d787356ffd59c148c1a6bbfc7b1a397cfc1ce2b5308e1362ad2.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/787bbdf4ae11ba9cad0edb6f858c602a154e963f051b33cce5f9653119dc3897.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/a045dd76231fd6dbed4288223144984bb1c72767e62580236e82b39ce7a51886.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/abe7b74c039f3f697b0f6e275683fed58dde158a5d91b4c294f12b3cd9fd8e8c.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/e78f27001990ee97ec0be1f2d149399baa05affd457a9a407a3a4635f370df0e.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/e878e020c856c207d3b0fc01fad85a426f24b6113f08a0df413667a0102a2cf6.json +0 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ import galadmin from '@galadrim/galadmin';
|
|
|
18
18
|
import { Config } from '@galadrim/galadmin/dist/types/Config';
|
|
19
19
|
|
|
20
20
|
const adminConfig: Config = { ... }
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
app.getHttpAdapter().use('/admin', galadmin(adminConfig));
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -26,6 +26,18 @@ If you are using Prisma ORM, add the following code to your `schema.prisma`.
|
|
|
26
26
|
Galadmin will create a table in your database, and Prisma won't be able to
|
|
27
27
|
perform migrations correctly if we don't specify it.
|
|
28
28
|
|
|
29
|
+
#### With PostgreSQL
|
|
30
|
+
|
|
31
|
+
```prisma
|
|
32
|
+
model galadmin_sessions {
|
|
33
|
+
sid String @id @db.VarChar(128)
|
|
34
|
+
sess Json
|
|
35
|
+
expire DateTime
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### With MySQL
|
|
40
|
+
|
|
29
41
|
```prisma
|
|
30
42
|
model galadmin_sessions {
|
|
31
43
|
session_id String @id @db.VarChar(128)
|
|
@@ -57,24 +69,35 @@ const adminConfig = {
|
|
|
57
69
|
username: "user",
|
|
58
70
|
password: "password",
|
|
59
71
|
},
|
|
60
|
-
|
|
72
|
+
postgresql: {
|
|
61
73
|
host: "abc.example.com",
|
|
62
74
|
user: "root",
|
|
63
75
|
password: "password",
|
|
64
76
|
database: "monprojet",
|
|
65
77
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
// mysql: {
|
|
79
|
+
// host: "abc.example.com",
|
|
80
|
+
// user: "root",
|
|
81
|
+
// password: "password",
|
|
82
|
+
// database: "monprojet",
|
|
83
|
+
// },
|
|
84
|
+
views: [
|
|
85
|
+
{
|
|
86
|
+
type: "table",
|
|
87
|
+
label: "Fruits",
|
|
88
|
+
tableName: "fruits",
|
|
89
|
+
columns: [
|
|
90
|
+
{
|
|
91
|
+
label: "Nom",
|
|
92
|
+
name: "fruitName",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: "Acidité",
|
|
96
|
+
name: "acidity",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
78
101
|
};
|
|
79
102
|
```
|
|
80
103
|
|
|
@@ -98,12 +121,18 @@ const adminConfig = {
|
|
|
98
121
|
},
|
|
99
122
|
|
|
100
123
|
/** Identifiants de connexion à la base de données (OBLIGATOIRE) */
|
|
101
|
-
|
|
124
|
+
postgresql: {
|
|
102
125
|
host: "abc.example.com",
|
|
103
126
|
user: "root",
|
|
104
127
|
password: "password",
|
|
105
128
|
database: "monprojet",
|
|
106
129
|
},
|
|
130
|
+
// mysql: {
|
|
131
|
+
// host: "abc.example.com",
|
|
132
|
+
// user: "root",
|
|
133
|
+
// password: "password",
|
|
134
|
+
// database: "monprojet",
|
|
135
|
+
// },
|
|
107
136
|
|
|
108
137
|
/** Clé API Google Maps pour les champs adresses et l'affichage de cartes */
|
|
109
138
|
googleMapsKey: "______",
|
|
@@ -114,72 +143,76 @@ const adminConfig = {
|
|
|
114
143
|
/** Cache l'inscription Made with love by Galadrim */
|
|
115
144
|
hideBranding: true,
|
|
116
145
|
|
|
117
|
-
views: [
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
views: [
|
|
147
|
+
{
|
|
148
|
+
/** Vue de type "table" */
|
|
149
|
+
type: "table",
|
|
120
150
|
|
|
121
|
-
|
|
122
|
-
|
|
151
|
+
/** Nom affiché de la vue */
|
|
152
|
+
label: string,
|
|
123
153
|
|
|
124
|
-
|
|
125
|
-
|
|
154
|
+
/** Icône FontAwesome de la vue dans le menu. user affiche l'icône fa-user. */
|
|
155
|
+
icon: "user",
|
|
126
156
|
|
|
127
|
-
|
|
128
|
-
|
|
157
|
+
/** Nom de la table MySQL */
|
|
158
|
+
tableName: "users",
|
|
129
159
|
|
|
130
|
-
|
|
131
|
-
|
|
160
|
+
/** Nombre de résultats par page */
|
|
161
|
+
limit: 100,
|
|
132
162
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Ces champs permettent de personnaliser la requête MySQL qui gère l'affichage de la table.
|
|
165
|
+
* Ils sont tous optionnels.
|
|
166
|
+
*
|
|
167
|
+
* SELECT {selectExpression} FROM {tableName} {join} WHERE {filters} GROUP BY {groupBy} ORDER BY {orderBy} {desc ? "DESC" : ""}
|
|
168
|
+
*/
|
|
169
|
+
selectExpression: "*, MAX(age) AS maxAge",
|
|
170
|
+
join: "JOIN activities ON users.activity_id = activities.id",
|
|
171
|
+
groupBy: "activity_id",
|
|
172
|
+
orderBy: "maxAge",
|
|
173
|
+
isDesc: true,
|
|
174
|
+
filters: "age < 50",
|
|
145
175
|
|
|
146
|
-
|
|
147
|
-
|
|
176
|
+
/** Lorsque notClickable est à true, les résultats ne sont pas cliquables. (default: false) */
|
|
177
|
+
notClickable: true,
|
|
148
178
|
|
|
149
|
-
|
|
150
|
-
|
|
179
|
+
/** Rendre possible de créer des enregistrements (default: false) */
|
|
180
|
+
canCreate: true,
|
|
151
181
|
|
|
152
|
-
|
|
153
|
-
|
|
182
|
+
/** Groupe nominal "un nouvel élément" */
|
|
183
|
+
aNewSingular: "un nouvel utilisateur",
|
|
154
184
|
|
|
155
|
-
|
|
156
|
-
|
|
185
|
+
/** Rendre possible de supprimer des enregistrements (default: true) */
|
|
186
|
+
canDelete: true,
|
|
157
187
|
|
|
158
|
-
|
|
159
|
-
|
|
188
|
+
/** Rendre possible de modifier des enregistrements (default: true) */
|
|
189
|
+
canEdit: true,
|
|
160
190
|
|
|
161
|
-
|
|
162
|
-
|
|
191
|
+
/** URL appelée en POST lors de la création d'un nouvel élément, avec l'ID de l'élément créé */
|
|
192
|
+
createCallback: "https://myapi.com/createCallback",
|
|
163
193
|
|
|
164
|
-
|
|
165
|
-
|
|
194
|
+
editCallback: "https://myapi.com/editCallback",
|
|
195
|
+
deleteCallback: "https://myapi.com/deleteCallback",
|
|
166
196
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
197
|
+
columns: [
|
|
198
|
+
{
|
|
199
|
+
/** Nom affiché de la colonne (OBLIGATOIRE) */
|
|
200
|
+
label: "Poids",
|
|
170
201
|
|
|
171
|
-
|
|
172
|
-
|
|
202
|
+
/** Nom de la colonne dans la table MySQL */
|
|
203
|
+
name: "weight",
|
|
173
204
|
|
|
174
|
-
|
|
175
|
-
|
|
205
|
+
/** Formatter la valeur avant de l'afficher */
|
|
206
|
+
formatValue: (user) => `${user.weight} kg`,
|
|
176
207
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
208
|
+
/** Masquer la colonne dans la liste des résultats et ne l'afficher que dans le détail (default: false) */
|
|
209
|
+
hideInTable: true,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
subviews: [],
|
|
213
|
+
recordViewPanels: [],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
183
216
|
};
|
|
184
217
|
```
|
|
185
218
|
|
|
@@ -207,7 +240,6 @@ upload of a file onto AWS S3. A basic configuration would be as follow:
|
|
|
207
240
|
}]
|
|
208
241
|
```
|
|
209
242
|
|
|
210
|
-
|
|
211
243
|
### File upload on a remote server (via SFTP)
|
|
212
244
|
|
|
213
245
|
It is possible to use a FileColumn to allow upload to a remote server via SFTP. A basic configuration would be as follow:
|
package/dist/api.js
CHANGED
|
@@ -233,7 +233,7 @@ exports.default = (db, config, user) => {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
const { err, rows: counts } = await db.query("SELECT COUNT(*) AS
|
|
236
|
+
const { err, rows: counts } = await db.query("SELECT COUNT(*) AS count FROM (SELECT 1 FROM ?? " + (view.join || "") + queryString + " " + (view.groupBy ? "GROUP BY " + view.groupBy : "") + ") s", [view.tableName]);
|
|
237
237
|
if (err) {
|
|
238
238
|
res.send({
|
|
239
239
|
records,
|
|
@@ -246,7 +246,7 @@ exports.default = (db, config, user) => {
|
|
|
246
246
|
res.send({
|
|
247
247
|
records,
|
|
248
248
|
input,
|
|
249
|
-
count: counts[0].
|
|
249
|
+
count: counts[0].count
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
});
|