@galadrim/galadmin 0.0.65 → 0.0.71
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/api.js +4 -1
- package/dist/api.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +11 -6
- package/package.json +1 -1
- package/src/api.ts +4 -1
- package/src/front/build/asset-manifest.json +7 -7
- package/src/front/build/index.html +1 -1
- package/src/front/build/static/js/{2.88bb9cea.chunk.js → 2.f2c3716e.chunk.js} +3 -3
- package/src/front/build/static/js/{2.88bb9cea.chunk.js.LICENSE.txt → 2.f2c3716e.chunk.js.LICENSE.txt} +0 -0
- package/src/front/build/static/js/2.f2c3716e.chunk.js.map +1 -0
- package/src/front/build/static/js/main.d0c40615.chunk.js +2 -0
- package/src/front/build/static/js/main.d0c40615.chunk.js.map +1 -0
- package/src/front/node_modules/.cache/.eslintcache +1 -1
- package/src/front/node_modules/.cache/babel-loader/1e8750017803ed2618bfa8e7876588f4.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/3b3e3be2905c35944c0229efe73d25f1.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/40f82d7c4495af82b6e682474a644bd6.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/69c7e8d90b80ad87dddbafb21a1a2c2b.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/abbdfb5c158d7d758043189faebeebf5.json +1 -0
- package/src/front/node_modules/.cache/babel-loader/c09daad25ef186515d0a993e52335e61.json +1 -0
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/{02/1c/cd922a30b837866c304e653fd02dc10a713290b65b1a3f8ab96fac6e8d3d8153afdd05cd2f39ac5a2b666bbc7c16e0a5a909a50abc0640d631f50f2d5405 → 84/ad/d97cdd00bcf0d10c691fe8aac1fde475e7e4b03a6b11153f0090501f2088b1faa73632a5ae701f7875e0018fd2254c094716b41e38c1b9802af8526716e1} +1 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/9b/e3/9bf3e7b9b0100042d65d63130305494a8c49685e254d2405232da7938e1682459cbdf61b37be14e67b684e7b1f21499069eb0ba46a3c9c3717e216f1e04f +1 -0
- package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/{13/48/ea4fd5de6d7ce705b49b91192d276b4d6695b9224484d8b332cd236e2f2a → 7d/4a/f73f4ee84159809aa8ab73fc6eb14cf6b2df29433615f5fc66db39eaa8b7} +1 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/{32/f1/8264252bcf7c4f98cde13450968b415f55003188f30504894efa85c8e42b → 93/40/1664ad7eaeaf568aa45393ab7f158f62d0407af4e89717f5a845397dd57f} +1 -1
- package/src/front/src/components/ActionsButton.js +6 -3
- package/src/front/src/components/BulkActionsButton.js +4 -1
- package/src/front/src/components/panels/GalleryPanel.js +37 -3
- package/src/front/src/components/panels/TablePanel.js +6 -5
- package/src/front/src/pages/CreateRecord.js +4 -2
- package/src/front/src/pages/Record.js +6 -2
- package/src/types/config.ts +13 -8
- package/src/front/build/static/js/2.88bb9cea.chunk.js.map +0 -1
- package/src/front/build/static/js/main.4a75d43f.chunk.js +0 -2
- package/src/front/build/static/js/main.4a75d43f.chunk.js.map +0 -1
- package/src/front/node_modules/.cache/babel-loader/a39a631f24d0f6da6680c7a0eb1909b1.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/cd53713ec61cb5f5e41e728d0d93a34d.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/d35a56a324725da640fb076831eb6e91.json +0 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/a3/b4/65b20bcb7256e4e5b06e4ceeaa58e4b96a15a4f1c3e446f097df9d6dab35028acedcd5d9551148d2e7289ccf2df41e2f7f43bafda0812f8eb19971cdee20 +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
86024f4508d745ec14133474b787060bf7ca466d {"key":"{\"terser\":\"5.7.1\",\"terser-webpack-plugin\":\"4.2.3\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.[cm]?js(\\\\?.*)?$\", \"i\"),\"extractComments\":true,\"sourceMap\":true,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"parse\":{\"ecma\":8},\"compress\":{\"ecma\":5,\"warnings\":false,\"comparisons\":false,\"inline\":2},\"mangle\":{\"safari10\":true},\"keep_classnames\":false,\"keep_fnames\":false,\"output\":{\"ecma\":5,\"comments\":false,\"ascii_only\":true},\"ecma\":5}},\"name\":\"static\\u002Fjs\\u002Fmain.d0c40615.chunk.js\",\"contentHash\":\"5a4f4f23944960a8add7\"}","integrity":"sha512-m+Ob8+e5sBAAQtZdYxMDBUlKjEloXiVNJAUjLaeTjhaCRZy99hs3vhTme2hOex8hSZBp6wukajycNxfiFvHgTw==","time":1640190839631,"size":343223}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
ae3932b77689a4be9f7979adcfb8aac0c5f93452 {"key":"{\"terser\":\"5.7.1\",\"terser-webpack-plugin\":\"4.2.3\",\"terser-webpack-plugin-options\":{\"test\":new RegExp(\"\\\\.[cm]?js(\\\\?.*)?$\", \"i\"),\"extractComments\":true,\"sourceMap\":true,\"cache\":true,\"cacheKeys\":defaultCacheKeys => defaultCacheKeys,\"parallel\":true,\"include\":undefined,\"exclude\":undefined,\"minify\":undefined,\"terserOptions\":{\"parse\":{\"ecma\":8},\"compress\":{\"ecma\":5,\"warnings\":false,\"comparisons\":false,\"inline\":2},\"mangle\":{\"safari10\":true},\"keep_classnames\":false,\"keep_fnames\":false,\"output\":{\"ecma\":5,\"comments\":false,\"ascii_only\":true},\"ecma\":5}},\"name\":\"static\\u002Fjs\\u002F2.f2c3716e.chunk.js\",\"contentHash\":\"973b410a3095eb5207c3\"}","integrity":"sha512-hK3ZfN0AvPDRDGkf6KrB/eR15+SwOmsRFT8AkFAfIIix+qc2MqWucB94deABj9IlTAlHFrQeOMG5gCr4UmcW4Q==","time":1640190842535,"size":1866754}
|
|
@@ -7,7 +7,7 @@ import axios from "axios";
|
|
|
7
7
|
import OutsideClickHandler from "./OutsideClickHandler"
|
|
8
8
|
import { ConfigContext } from "../contexts/ConfigContext";
|
|
9
9
|
|
|
10
|
-
export default ({ viewIndex, record }) => {
|
|
10
|
+
export default ({ viewIndex, record, refreshData }) => {
|
|
11
11
|
const config = useContext(ConfigContext)
|
|
12
12
|
const view = config.views[viewIndex]
|
|
13
13
|
const [actionsOpened, setActionsOpened] = useState(false)
|
|
@@ -49,8 +49,11 @@ export default ({ viewIndex, record }) => {
|
|
|
49
49
|
viewIndex,
|
|
50
50
|
actionIndex,
|
|
51
51
|
selectedRecordIds: [record[view.primaryId]]
|
|
52
|
-
}).then(function () {
|
|
53
|
-
|
|
52
|
+
}).then(function (response) {
|
|
53
|
+
if (response.data.message) {
|
|
54
|
+
alert(response.data.message)
|
|
55
|
+
}
|
|
56
|
+
refreshData()
|
|
54
57
|
}).catch(function () {
|
|
55
58
|
window.swal({
|
|
56
59
|
title: "Erreur",
|
|
@@ -38,7 +38,10 @@ export default ({ viewIndex, selectedRecordIds, refreshData }) => {
|
|
|
38
38
|
viewIndex,
|
|
39
39
|
actionIndex,
|
|
40
40
|
selectedRecordIds
|
|
41
|
-
}).then(function () {
|
|
41
|
+
}).then(function (response) {
|
|
42
|
+
if (response.data.message) {
|
|
43
|
+
alert(response.data.message)
|
|
44
|
+
}
|
|
42
45
|
refreshData()
|
|
43
46
|
}).catch(function () {
|
|
44
47
|
window.swal({
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { useState, useEffect } from "react"
|
|
2
|
+
import {
|
|
3
|
+
useHistory,
|
|
4
|
+
useParams
|
|
5
|
+
} from "react-router-dom";
|
|
2
6
|
import axios from "axios";
|
|
3
7
|
|
|
4
8
|
export default ({ panel, record, view }) => {
|
|
5
9
|
const [results, setResults] = useState(null);
|
|
10
|
+
const history = useHistory();
|
|
11
|
+
const { viewIndex } = useParams();
|
|
6
12
|
|
|
7
13
|
useEffect(() => {
|
|
14
|
+
refreshData()
|
|
15
|
+
}, [panel.query])
|
|
16
|
+
|
|
17
|
+
const refreshData = () => {
|
|
8
18
|
axios.get("/customQuery", {
|
|
9
19
|
params: {
|
|
10
20
|
query: panel.query,
|
|
@@ -13,7 +23,31 @@ export default ({ panel, record, view }) => {
|
|
|
13
23
|
}).then((response) => {
|
|
14
24
|
setResults(response.data)
|
|
15
25
|
})
|
|
16
|
-
}
|
|
26
|
+
}
|
|
27
|
+
const deleteRow = async (row) => {
|
|
28
|
+
const willDelete = await window.swal({
|
|
29
|
+
title: "Êtes-vous sûr ?",
|
|
30
|
+
text: "Une fois la suppression confirmée, il ne sera pas possible de revenir en arrière.",
|
|
31
|
+
buttons: ["Annuler", "Oui"],
|
|
32
|
+
dangerMode: true
|
|
33
|
+
})
|
|
34
|
+
if (willDelete) {
|
|
35
|
+
try {
|
|
36
|
+
await axios.post("/deleteRecordFromPanel", {
|
|
37
|
+
viewIndex,
|
|
38
|
+
panelId: panel.__id__,
|
|
39
|
+
primaryValue: row[panel.primaryId]
|
|
40
|
+
})
|
|
41
|
+
refreshData();
|
|
42
|
+
} catch (e) {
|
|
43
|
+
window.swal({
|
|
44
|
+
title: "Erreur",
|
|
45
|
+
text: "Suppression impossible",
|
|
46
|
+
dangerMode: true
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
17
51
|
|
|
18
52
|
const pathField = panel.pathField || "Path"
|
|
19
53
|
|
|
@@ -23,11 +57,11 @@ export default ({ panel, record, view }) => {
|
|
|
23
57
|
<div class="gallery">
|
|
24
58
|
{results.map((result) => (
|
|
25
59
|
<div class='galleryPicture' key={result[pathField]}>
|
|
26
|
-
{panel.canDelete ? <div class='deleteIcon'><i class='fa fa-minus'></i></div> : null}
|
|
60
|
+
{panel.canDelete ? <div class='deleteIcon' onClick={() => deleteRow(result)}><i class='fa fa-minus'></i></div> : null}
|
|
27
61
|
<a href={panel.baseUrl + result[pathField]} target='_blank'>
|
|
28
62
|
<img
|
|
29
63
|
src={panel.baseUrl + result[pathField]}
|
|
30
|
-
style={{ width:
|
|
64
|
+
style={{ width: "100%", height: 150, objectFit: panel.objectFit || "cover" }}
|
|
31
65
|
onerror='this.style.height = 0'
|
|
32
66
|
/>
|
|
33
67
|
</a>
|
|
@@ -78,11 +78,12 @@ export default ({ panel, record, view }) => {
|
|
|
78
78
|
>
|
|
79
79
|
{Object.keys(result).filter(key => key !== panel.primaryId).map((key) =>
|
|
80
80
|
<td key={key}>
|
|
81
|
-
<div
|
|
82
|
-
dangerouslySetInnerHTML={{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
<div
|
|
82
|
+
dangerouslySetInnerHTML={{
|
|
83
|
+
__html:
|
|
84
|
+
(panel.formattedValues && (key in panel.formattedValues)) ?
|
|
85
|
+
evalExpression(panel.formattedValues[key], result) :
|
|
86
|
+
result[key]
|
|
86
87
|
}}
|
|
87
88
|
/>
|
|
88
89
|
</td>
|
|
@@ -42,15 +42,17 @@ export default () => {
|
|
|
42
42
|
}
|
|
43
43
|
setIsCreating(true)
|
|
44
44
|
try {
|
|
45
|
-
await axios.post("/createRecord", {
|
|
45
|
+
const response = await axios.post("/createRecord", {
|
|
46
46
|
viewIndex,
|
|
47
47
|
panelIndex,
|
|
48
48
|
recordId,
|
|
49
49
|
data: data.current
|
|
50
50
|
})
|
|
51
51
|
setIsCreating(false)
|
|
52
|
-
if (recordId) {
|
|
52
|
+
if (recordId) { // Create from panel view
|
|
53
53
|
history.push(`/record/${viewIndex}/${recordId}`)
|
|
54
|
+
} else if (view.createConfig.redirectToCreatedItems) {
|
|
55
|
+
history.push(`/record/${viewIndex}/${response.data.id}`)
|
|
54
56
|
} else {
|
|
55
57
|
history.push(`/records/${viewIndex}`)
|
|
56
58
|
}
|
|
@@ -22,6 +22,10 @@ export default () => {
|
|
|
22
22
|
const filteredColumns = view.columns?.filter(x => !x.hidden)
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
|
+
refreshData()
|
|
26
|
+
}, [viewIndex, recordId]);
|
|
27
|
+
|
|
28
|
+
const refreshData = () => {
|
|
25
29
|
axios.get("/record", {
|
|
26
30
|
params: {
|
|
27
31
|
viewIndex,
|
|
@@ -30,7 +34,7 @@ export default () => {
|
|
|
30
34
|
}).then((response) => {
|
|
31
35
|
setRecord(response.data);
|
|
32
36
|
});
|
|
33
|
-
}
|
|
37
|
+
}
|
|
34
38
|
|
|
35
39
|
return (
|
|
36
40
|
<div class="view backgroundBlue">
|
|
@@ -40,7 +44,7 @@ export default () => {
|
|
|
40
44
|
<div class="button adjacentButton prevButton">◄</div>
|
|
41
45
|
<div class="button adjacentButton nextButton">►</div>
|
|
42
46
|
<BackButton />
|
|
43
|
-
<ActionsButton viewIndex={viewIndex} record={record} />
|
|
47
|
+
<ActionsButton viewIndex={viewIndex} record={record} refreshData={refreshData} />
|
|
44
48
|
{view.canEdit !== false ? (
|
|
45
49
|
<Link to={`/editRecord/${viewIndex}/${recordId}`}>
|
|
46
50
|
<div class="button greenButton recordAction">Modifier</div>
|
package/src/types/config.ts
CHANGED
|
@@ -9,7 +9,8 @@ export type BaseTypeColumn = {
|
|
|
9
9
|
formattedValue?: string,
|
|
10
10
|
formatValue?: (record: any) => string,
|
|
11
11
|
searchable?: boolean,
|
|
12
|
-
searchableName?: string
|
|
12
|
+
searchableName?: string,
|
|
13
|
+
labelTooltip?: string
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export type ColorColumn = {
|
|
@@ -120,7 +121,8 @@ export type CreateType = {
|
|
|
120
121
|
|
|
121
122
|
export type CustomAction = {
|
|
122
123
|
label: string,
|
|
123
|
-
action: (record: any) => void
|
|
124
|
+
action: (record: any) => void,
|
|
125
|
+
successMessage?: string
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
export type TableView = {
|
|
@@ -161,8 +163,13 @@ export type Subview = {
|
|
|
161
163
|
export type BaseTypePanel = {
|
|
162
164
|
label: string,
|
|
163
165
|
folded?: boolean,
|
|
164
|
-
|
|
166
|
+
}
|
|
165
167
|
|
|
168
|
+
export type CreateConfig = {
|
|
169
|
+
label: string,
|
|
170
|
+
recordIdKey: string,
|
|
171
|
+
columns: Column[],
|
|
172
|
+
redirectToCreatedItems?: boolean
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
export type TablePanel = {
|
|
@@ -173,11 +180,7 @@ export type TablePanel = {
|
|
|
173
180
|
canShow?: boolean,
|
|
174
181
|
canDelete?: boolean,
|
|
175
182
|
canCreate?: boolean,
|
|
176
|
-
createConfig?:
|
|
177
|
-
label: string,
|
|
178
|
-
recordIdKey: string,
|
|
179
|
-
columns: Column[]
|
|
180
|
-
},
|
|
183
|
+
createConfig?: CreateConfig,
|
|
181
184
|
tableName?: string,
|
|
182
185
|
primaryId?: string,
|
|
183
186
|
formattedValues?: { [key: string]: string },
|
|
@@ -198,6 +201,8 @@ export type MapPanel = {
|
|
|
198
201
|
export type GalleryPanel = {
|
|
199
202
|
type: "gallery",
|
|
200
203
|
query: string,
|
|
204
|
+
canCreate?: boolean,
|
|
205
|
+
createConfig?: CreateConfig,
|
|
201
206
|
canDelete?: boolean,
|
|
202
207
|
baseUrl?: string,
|
|
203
208
|
pathField?: string,
|