@galadrim/galadmin 0.0.66 → 0.0.72
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 +14 -7
- 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/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/{f2/69/b1ee26491f4fdeb77394848effc62985c20a0db33f155ca3b5d564af43b2 → 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/Record.js +6 -2
- package/src/types/config.ts +16 -9
- package/src/front/build/static/js/2.88bb9cea.chunk.js.map +0 -1
- package/src/front/build/static/js/main.33b811ea.chunk.js +0 -2
- package/src/front/build/static/js/main.33b811ea.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/d35a56a324725da640fb076831eb6e91.json +0 -1
- package/src/front/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/98/6e/f83a5e4cdffd4e235a3939d25229b6427a4b952282f665dd980b88e7453fbbe0928d9bd4e86143c32a4cdc38a578c61fafdd3f32b782514388f7d360fb30 +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
b56446cf47b3c9b740ead5484de3da9ba9672c74 {"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":1640256665815,"size":343223}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
9d76134b9e8c0bfedd436edc8ff34c570e9c777d {"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":1640256668805,"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>
|
|
@@ -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 = {
|
|
@@ -90,6 +91,8 @@ export type RichTextColumn = {
|
|
|
90
91
|
export type FileColumn = {
|
|
91
92
|
dataType: 'file',
|
|
92
93
|
name: string,
|
|
94
|
+
publicPath?: string,
|
|
95
|
+
subdirectory?: string,
|
|
93
96
|
s3Config?: {
|
|
94
97
|
host: string,
|
|
95
98
|
accessKeyId: string,
|
|
@@ -120,7 +123,8 @@ export type CreateType = {
|
|
|
120
123
|
|
|
121
124
|
export type CustomAction = {
|
|
122
125
|
label: string,
|
|
123
|
-
action: (record: any) => void
|
|
126
|
+
action: (record: any) => void,
|
|
127
|
+
successMessage?: string
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
export type TableView = {
|
|
@@ -161,8 +165,13 @@ export type Subview = {
|
|
|
161
165
|
export type BaseTypePanel = {
|
|
162
166
|
label: string,
|
|
163
167
|
folded?: boolean,
|
|
164
|
-
|
|
168
|
+
}
|
|
165
169
|
|
|
170
|
+
export type CreateConfig = {
|
|
171
|
+
label: string,
|
|
172
|
+
recordIdKey: string,
|
|
173
|
+
columns: Column[],
|
|
174
|
+
redirectToCreatedItems?: boolean
|
|
166
175
|
}
|
|
167
176
|
|
|
168
177
|
export type TablePanel = {
|
|
@@ -173,12 +182,7 @@ export type TablePanel = {
|
|
|
173
182
|
canShow?: boolean,
|
|
174
183
|
canDelete?: boolean,
|
|
175
184
|
canCreate?: boolean,
|
|
176
|
-
createConfig?:
|
|
177
|
-
label: string,
|
|
178
|
-
recordIdKey: string,
|
|
179
|
-
columns: Column[],
|
|
180
|
-
redirectToCreatedItems?: boolean
|
|
181
|
-
},
|
|
185
|
+
createConfig?: CreateConfig,
|
|
182
186
|
tableName?: string,
|
|
183
187
|
primaryId?: string,
|
|
184
188
|
formattedValues?: { [key: string]: string },
|
|
@@ -198,7 +202,10 @@ export type MapPanel = {
|
|
|
198
202
|
|
|
199
203
|
export type GalleryPanel = {
|
|
200
204
|
type: "gallery",
|
|
205
|
+
tableName?: string,
|
|
201
206
|
query: string,
|
|
207
|
+
canCreate?: boolean,
|
|
208
|
+
createConfig?: CreateConfig,
|
|
202
209
|
canDelete?: boolean,
|
|
203
210
|
baseUrl?: string,
|
|
204
211
|
pathField?: string,
|