adminforth 1.1.20 → 1.1.21
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/index.js +68 -17
- package/dist/plugins/AccessControl/index.js +3 -56
- package/dist/plugins/AuditLog/index.js +66 -0
- package/dist/plugins/AuditLog/types.js +1 -0
- package/dist/plugins/ForeignInlineListPlugin/custom/InlineList.vue +3 -9
- package/dist/plugins/plugins/ForeignInlineListPlugin/custom/InlineList.vue +248 -0
- package/dist/spa/index.html +2 -2
- package/dist/spa/package-lock.json +1 -189
- package/dist/spa/package.json +1 -6
- package/dist/spa/spa/src/components/ResourceListTable.vue +35 -1
- package/dist/spa/spa/src/components/ShowTableItem.vue +14 -0
- package/dist/spa/spa/src/composables/useFrontendApi.ts +14 -0
- package/dist/spa/spa/src/utils.ts +2 -0
- package/dist/spa/spa/src/views/CreateView.vue +3 -5
- package/dist/spa/spa/src/views/EditView.vue +2 -5
- package/dist/spa/spa/src/views/HomeView.vue +8 -0
- package/dist/spa/spa/src/views/ListView.vue +4 -33
- package/dist/spa/src/App.vue +57 -76
- package/dist/spa/src/components/AcceptModal.vue +1 -1
- package/dist/spa/src/components/CustomDatePicker.vue +3 -3
- package/dist/spa/src/components/CustomDateRangePicker.vue +3 -3
- package/dist/spa/src/components/Dropdown.vue +4 -13
- package/dist/spa/src/components/Filters.vue +22 -55
- package/dist/spa/src/components/MenuLink.vue +2 -2
- package/dist/spa/src/components/ResourceForm.vue +99 -157
- package/dist/spa/src/components/ValueRenderer.vue +1 -11
- package/dist/spa/src/router/index.ts +2 -3
- package/dist/spa/src/stores/core.ts +33 -22
- package/dist/spa/src/utils.ts +3 -5
- package/dist/spa/src/views/CreateView.vue +7 -15
- package/dist/spa/src/views/EditView.vue +8 -36
- package/dist/spa/src/views/HomeView.vue +8 -0
- package/dist/spa/src/views/ListView.vue +23 -35
- package/dist/spa/src/views/LoginView.vue +1 -1
- package/dist/spa/src/views/ResourceParent.vue +1 -1
- package/dist/spa/src/views/ShowView.vue +9 -20
- package/dist/spa/tailwind.config.js +2 -5
- package/index.ts +87 -17
- package/package.json +1 -1
- package/plugins/AccessControl/index.ts +1 -55
- package/plugins/AccessControl/types.ts +1 -9
- package/plugins/ForeignInlineListPlugin/custom/InlineList.vue +3 -9
- package/spa/src/components/ResourceListTable.vue +35 -1
- package/spa/src/composables/useFrontendApi.ts +14 -0
- package/spa/src/utils.ts +2 -0
- package/spa/src/views/CreateView.vue +3 -5
- package/spa/src/views/EditView.vue +2 -5
- package/spa/src/views/ListView.vue +4 -33
- package/types/AdminForthConfig.ts +12 -1
- package/dist/spa/src/components/CustomRangePicker.vue +0 -148
|
@@ -9,17 +9,12 @@
|
|
|
9
9
|
"version": "0.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@iconify-prerendered/vue-flowbite": "^0.23.1714023977",
|
|
12
|
-
"@unhead/vue": "^1.9.12",
|
|
13
|
-
"@vueuse/core": "^10.10.0",
|
|
14
12
|
"dayjs": "^1.11.11",
|
|
15
|
-
"debounce": "^2.1.0",
|
|
16
13
|
"flowbite": "^2.3.0",
|
|
17
14
|
"flowbite-datepicker": "^1.2.6",
|
|
18
15
|
"pinia": "^2.1.7",
|
|
19
|
-
"unhead": "^1.9.12",
|
|
20
16
|
"vue": "^3.4.21",
|
|
21
|
-
"vue-router": "^4.3.0"
|
|
22
|
-
"vue-slider-component": "^4.1.0-beta.7"
|
|
17
|
+
"vue-router": "^4.3.0"
|
|
23
18
|
},
|
|
24
19
|
"devDependencies": {
|
|
25
20
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
@@ -955,11 +950,6 @@
|
|
|
955
950
|
"undici-types": "~5.26.4"
|
|
956
951
|
}
|
|
957
952
|
},
|
|
958
|
-
"node_modules/@types/web-bluetooth": {
|
|
959
|
-
"version": "0.0.20",
|
|
960
|
-
"resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz",
|
|
961
|
-
"integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow=="
|
|
962
|
-
},
|
|
963
953
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
|
964
954
|
"version": "7.9.0",
|
|
965
955
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz",
|
|
@@ -1151,58 +1141,6 @@
|
|
|
1151
1141
|
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
|
|
1152
1142
|
"dev": true
|
|
1153
1143
|
},
|
|
1154
|
-
"node_modules/@unhead/dom": {
|
|
1155
|
-
"version": "1.9.12",
|
|
1156
|
-
"resolved": "https://registry.npmjs.org/@unhead/dom/-/dom-1.9.12.tgz",
|
|
1157
|
-
"integrity": "sha512-3MY1TbZmEjGNZapi3wvJW0vWNS2CLKHt7/m57sScDHCNvNBe1mTwrIOhtZFDgAndhml2EVQ68RMa0Vhum/M+cw==",
|
|
1158
|
-
"dependencies": {
|
|
1159
|
-
"@unhead/schema": "1.9.12",
|
|
1160
|
-
"@unhead/shared": "1.9.12"
|
|
1161
|
-
},
|
|
1162
|
-
"funding": {
|
|
1163
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
1164
|
-
}
|
|
1165
|
-
},
|
|
1166
|
-
"node_modules/@unhead/schema": {
|
|
1167
|
-
"version": "1.9.12",
|
|
1168
|
-
"resolved": "https://registry.npmjs.org/@unhead/schema/-/schema-1.9.12.tgz",
|
|
1169
|
-
"integrity": "sha512-ue2FKyIZKsuZDpWJBMlBGwMm4s+vFeU3NUWsNt8Z+2JkOUIqO/VG43LxNgY1M595bOS71Gdxk+G9VtzfKJ5uEA==",
|
|
1170
|
-
"dependencies": {
|
|
1171
|
-
"hookable": "^5.5.3",
|
|
1172
|
-
"zhead": "^2.2.4"
|
|
1173
|
-
},
|
|
1174
|
-
"funding": {
|
|
1175
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
1176
|
-
}
|
|
1177
|
-
},
|
|
1178
|
-
"node_modules/@unhead/shared": {
|
|
1179
|
-
"version": "1.9.12",
|
|
1180
|
-
"resolved": "https://registry.npmjs.org/@unhead/shared/-/shared-1.9.12.tgz",
|
|
1181
|
-
"integrity": "sha512-72wlLXG3FP3sXUrwd42Uv8jYpHSg4R6IFJcsl+QisRjKM89JnjOFSw1DqWO4IOftW5xOxS4J5v7SQyJ4NJo7Bw==",
|
|
1182
|
-
"dependencies": {
|
|
1183
|
-
"@unhead/schema": "1.9.12"
|
|
1184
|
-
},
|
|
1185
|
-
"funding": {
|
|
1186
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
"node_modules/@unhead/vue": {
|
|
1190
|
-
"version": "1.9.12",
|
|
1191
|
-
"resolved": "https://registry.npmjs.org/@unhead/vue/-/vue-1.9.12.tgz",
|
|
1192
|
-
"integrity": "sha512-keE4EuswgzCqVU7zmZprU+ToMvNWc3s8NoLreH5AtJd2u0FgBygD8sxRVyEnZw1KwFYOJ2C7yD2TChSKZioPGQ==",
|
|
1193
|
-
"dependencies": {
|
|
1194
|
-
"@unhead/schema": "1.9.12",
|
|
1195
|
-
"@unhead/shared": "1.9.12",
|
|
1196
|
-
"hookable": "^5.5.3",
|
|
1197
|
-
"unhead": "1.9.12"
|
|
1198
|
-
},
|
|
1199
|
-
"funding": {
|
|
1200
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
1201
|
-
},
|
|
1202
|
-
"peerDependencies": {
|
|
1203
|
-
"vue": ">=2.7 || >=3"
|
|
1204
|
-
}
|
|
1205
|
-
},
|
|
1206
1144
|
"node_modules/@vitejs/plugin-vue": {
|
|
1207
1145
|
"version": "5.0.4",
|
|
1208
1146
|
"resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.4.tgz",
|
|
@@ -1392,89 +1330,6 @@
|
|
|
1392
1330
|
"integrity": "sha512-VcZK7MvpjuTPx2w6blwnwZAu5/LgBUtejFOi3pPGQFXQN5Ela03FUtd2Qtg4yWGGissVL0dr6Ro1LfOFh+PCuQ==",
|
|
1393
1331
|
"dev": true
|
|
1394
1332
|
},
|
|
1395
|
-
"node_modules/@vueuse/core": {
|
|
1396
|
-
"version": "10.10.0",
|
|
1397
|
-
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.10.0.tgz",
|
|
1398
|
-
"integrity": "sha512-vexJ/YXYs2S42B783rI95lMt3GzEwkxzC8Hb0Ndpd8rD+p+Lk/Za4bd797Ym7yq4jXqdSyj3JLChunF/vyYjUw==",
|
|
1399
|
-
"dependencies": {
|
|
1400
|
-
"@types/web-bluetooth": "^0.0.20",
|
|
1401
|
-
"@vueuse/metadata": "10.10.0",
|
|
1402
|
-
"@vueuse/shared": "10.10.0",
|
|
1403
|
-
"vue-demi": ">=0.14.7"
|
|
1404
|
-
},
|
|
1405
|
-
"funding": {
|
|
1406
|
-
"url": "https://github.com/sponsors/antfu"
|
|
1407
|
-
}
|
|
1408
|
-
},
|
|
1409
|
-
"node_modules/@vueuse/core/node_modules/vue-demi": {
|
|
1410
|
-
"version": "0.14.8",
|
|
1411
|
-
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz",
|
|
1412
|
-
"integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==",
|
|
1413
|
-
"hasInstallScript": true,
|
|
1414
|
-
"bin": {
|
|
1415
|
-
"vue-demi-fix": "bin/vue-demi-fix.js",
|
|
1416
|
-
"vue-demi-switch": "bin/vue-demi-switch.js"
|
|
1417
|
-
},
|
|
1418
|
-
"engines": {
|
|
1419
|
-
"node": ">=12"
|
|
1420
|
-
},
|
|
1421
|
-
"funding": {
|
|
1422
|
-
"url": "https://github.com/sponsors/antfu"
|
|
1423
|
-
},
|
|
1424
|
-
"peerDependencies": {
|
|
1425
|
-
"@vue/composition-api": "^1.0.0-rc.1",
|
|
1426
|
-
"vue": "^3.0.0-0 || ^2.6.0"
|
|
1427
|
-
},
|
|
1428
|
-
"peerDependenciesMeta": {
|
|
1429
|
-
"@vue/composition-api": {
|
|
1430
|
-
"optional": true
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
"node_modules/@vueuse/metadata": {
|
|
1435
|
-
"version": "10.10.0",
|
|
1436
|
-
"resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.10.0.tgz",
|
|
1437
|
-
"integrity": "sha512-UNAo2sTCAW5ge6OErPEHb5z7NEAg3XcO9Cj7OK45aZXfLLH1QkexDcZD77HBi5zvEiLOm1An+p/4b5K3Worpug==",
|
|
1438
|
-
"funding": {
|
|
1439
|
-
"url": "https://github.com/sponsors/antfu"
|
|
1440
|
-
}
|
|
1441
|
-
},
|
|
1442
|
-
"node_modules/@vueuse/shared": {
|
|
1443
|
-
"version": "10.10.0",
|
|
1444
|
-
"resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.10.0.tgz",
|
|
1445
|
-
"integrity": "sha512-2aW33Ac0Uk0U+9yo3Ypg9s5KcR42cuehRWl7vnUHadQyFvCktseyxxEPBi1Eiq4D2yBGACOnqLZpx1eMc7g5Og==",
|
|
1446
|
-
"dependencies": {
|
|
1447
|
-
"vue-demi": ">=0.14.7"
|
|
1448
|
-
},
|
|
1449
|
-
"funding": {
|
|
1450
|
-
"url": "https://github.com/sponsors/antfu"
|
|
1451
|
-
}
|
|
1452
|
-
},
|
|
1453
|
-
"node_modules/@vueuse/shared/node_modules/vue-demi": {
|
|
1454
|
-
"version": "0.14.8",
|
|
1455
|
-
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz",
|
|
1456
|
-
"integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==",
|
|
1457
|
-
"hasInstallScript": true,
|
|
1458
|
-
"bin": {
|
|
1459
|
-
"vue-demi-fix": "bin/vue-demi-fix.js",
|
|
1460
|
-
"vue-demi-switch": "bin/vue-demi-switch.js"
|
|
1461
|
-
},
|
|
1462
|
-
"engines": {
|
|
1463
|
-
"node": ">=12"
|
|
1464
|
-
},
|
|
1465
|
-
"funding": {
|
|
1466
|
-
"url": "https://github.com/sponsors/antfu"
|
|
1467
|
-
},
|
|
1468
|
-
"peerDependencies": {
|
|
1469
|
-
"@vue/composition-api": "^1.0.0-rc.1",
|
|
1470
|
-
"vue": "^3.0.0-0 || ^2.6.0"
|
|
1471
|
-
},
|
|
1472
|
-
"peerDependenciesMeta": {
|
|
1473
|
-
"@vue/composition-api": {
|
|
1474
|
-
"optional": true
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
},
|
|
1478
1333
|
"node_modules/acorn": {
|
|
1479
1334
|
"version": "8.11.3",
|
|
1480
1335
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
|
|
@@ -1861,17 +1716,6 @@
|
|
|
1861
1716
|
"integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==",
|
|
1862
1717
|
"dev": true
|
|
1863
1718
|
},
|
|
1864
|
-
"node_modules/debounce": {
|
|
1865
|
-
"version": "2.1.0",
|
|
1866
|
-
"resolved": "https://registry.npmjs.org/debounce/-/debounce-2.1.0.tgz",
|
|
1867
|
-
"integrity": "sha512-OkL3+0pPWCqoBc/nhO9u6TIQNTK44fnBnzuVtJAbp13Naxw9R6u21x+8tVTka87AhDZ3htqZ2pSSsZl9fqL2Wg==",
|
|
1868
|
-
"engines": {
|
|
1869
|
-
"node": ">=18"
|
|
1870
|
-
},
|
|
1871
|
-
"funding": {
|
|
1872
|
-
"url": "https://github.com/sponsors/sindresorhus"
|
|
1873
|
-
}
|
|
1874
|
-
},
|
|
1875
1719
|
"node_modules/debug": {
|
|
1876
1720
|
"version": "4.3.4",
|
|
1877
1721
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
|
@@ -2525,11 +2369,6 @@
|
|
|
2525
2369
|
"he": "bin/he"
|
|
2526
2370
|
}
|
|
2527
2371
|
},
|
|
2528
|
-
"node_modules/hookable": {
|
|
2529
|
-
"version": "5.5.3",
|
|
2530
|
-
"resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
|
|
2531
|
-
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="
|
|
2532
|
-
},
|
|
2533
2372
|
"node_modules/ignore": {
|
|
2534
2373
|
"version": "5.3.1",
|
|
2535
2374
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
|
|
@@ -3973,20 +3812,6 @@
|
|
|
3973
3812
|
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
|
3974
3813
|
"dev": true
|
|
3975
3814
|
},
|
|
3976
|
-
"node_modules/unhead": {
|
|
3977
|
-
"version": "1.9.12",
|
|
3978
|
-
"resolved": "https://registry.npmjs.org/unhead/-/unhead-1.9.12.tgz",
|
|
3979
|
-
"integrity": "sha512-s6VxcTV45hy8c/IioKQOonFnAO+kBOSpgDfqEHhnU0YVSQYaRPEp9pzW1qSPf0lx+bg9RKeOQyNNbSGGUP26aQ==",
|
|
3980
|
-
"dependencies": {
|
|
3981
|
-
"@unhead/dom": "1.9.12",
|
|
3982
|
-
"@unhead/schema": "1.9.12",
|
|
3983
|
-
"@unhead/shared": "1.9.12",
|
|
3984
|
-
"hookable": "^5.5.3"
|
|
3985
|
-
},
|
|
3986
|
-
"funding": {
|
|
3987
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
3988
|
-
}
|
|
3989
|
-
},
|
|
3990
3815
|
"node_modules/update-browserslist-db": {
|
|
3991
3816
|
"version": "1.0.16",
|
|
3992
3817
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
|
|
@@ -4145,11 +3970,6 @@
|
|
|
4145
3970
|
"vue": "^3.2.0"
|
|
4146
3971
|
}
|
|
4147
3972
|
},
|
|
4148
|
-
"node_modules/vue-slider-component": {
|
|
4149
|
-
"version": "4.1.0-beta.7",
|
|
4150
|
-
"resolved": "https://registry.npmjs.org/vue-slider-component/-/vue-slider-component-4.1.0-beta.7.tgz",
|
|
4151
|
-
"integrity": "sha512-Qb7K920ZG7PoQswoF6Ias+i3W2rd3k4fpk04JUl82kEUcN86Yg6et7bVSKWt/7VpQe8a5IT3BqCKSCOZ7AJgCA=="
|
|
4152
|
-
},
|
|
4153
3973
|
"node_modules/vue-template-compiler": {
|
|
4154
3974
|
"version": "2.7.16",
|
|
4155
3975
|
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz",
|
|
@@ -4333,14 +4153,6 @@
|
|
|
4333
4153
|
"funding": {
|
|
4334
4154
|
"url": "https://github.com/sponsors/sindresorhus"
|
|
4335
4155
|
}
|
|
4336
|
-
},
|
|
4337
|
-
"node_modules/zhead": {
|
|
4338
|
-
"version": "2.2.4",
|
|
4339
|
-
"resolved": "https://registry.npmjs.org/zhead/-/zhead-2.2.4.tgz",
|
|
4340
|
-
"integrity": "sha512-8F0OI5dpWIA5IGG5NHUg9staDwz/ZPxZtvGVf01j7vHqSyZ0raHY+78atOVxRqb73AotX22uV1pXt3gYSstGag==",
|
|
4341
|
-
"funding": {
|
|
4342
|
-
"url": "https://github.com/sponsors/harlan-zw"
|
|
4343
|
-
}
|
|
4344
4156
|
}
|
|
4345
4157
|
}
|
|
4346
4158
|
}
|
package/dist/spa/package.json
CHANGED
|
@@ -13,17 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@iconify-prerendered/vue-flowbite": "^0.23.1714023977",
|
|
16
|
-
"@unhead/vue": "^1.9.12",
|
|
17
|
-
"@vueuse/core": "^10.10.0",
|
|
18
16
|
"dayjs": "^1.11.11",
|
|
19
|
-
"debounce": "^2.1.0",
|
|
20
17
|
"flowbite": "^2.3.0",
|
|
21
18
|
"flowbite-datepicker": "^1.2.6",
|
|
22
19
|
"pinia": "^2.1.7",
|
|
23
|
-
"unhead": "^1.9.12",
|
|
24
20
|
"vue": "^3.4.21",
|
|
25
|
-
"vue-router": "^4.3.0"
|
|
26
|
-
"vue-slider-component": "^4.1.0-beta.7"
|
|
21
|
+
"vue-router": "^4.3.0"
|
|
27
22
|
},
|
|
28
23
|
"devDependencies": {
|
|
29
24
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
<button v-if="resource.options?.allowedActions.delete"
|
|
191
191
|
class="font-medium text-red-600 dark:text-red-500 hover:underline ms-3"
|
|
192
192
|
:data-tooltip-target="`tooltip-delete-${rowI}`"
|
|
193
|
-
@click="
|
|
193
|
+
@click="deleteRecord(row)"
|
|
194
194
|
>
|
|
195
195
|
<IconTrashBinSolid class="w-5 h-5 me-2"/>
|
|
196
196
|
</button>
|
|
@@ -272,10 +272,12 @@
|
|
|
272
272
|
import { initFlowbite } from 'flowbite';
|
|
273
273
|
import { computed, onMounted, ref, watch } from 'vue';
|
|
274
274
|
import { useRoute } from 'vue-router';
|
|
275
|
+
import { callAdminForthApi, getIcon } from '@/utils';
|
|
275
276
|
|
|
276
277
|
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
277
278
|
import { getCustomComponent } from '@/utils';
|
|
278
279
|
import { useCoreStore } from '@/stores/core';
|
|
280
|
+
import { showSuccesTost } from '@/composables/useFrontendApi';
|
|
279
281
|
|
|
280
282
|
import {
|
|
281
283
|
IconInboxOutline,
|
|
@@ -305,6 +307,7 @@ const emits = defineEmits([
|
|
|
305
307
|
'update:page',
|
|
306
308
|
'update:sort',
|
|
307
309
|
'update:checkboxes',
|
|
310
|
+
'update:records'
|
|
308
311
|
|
|
309
312
|
]);
|
|
310
313
|
|
|
@@ -382,4 +385,35 @@ function onSortButtonClick(field) {
|
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
387
|
|
|
388
|
+
async function deleteRecord(row) {
|
|
389
|
+
const data = await window.adminforth.confirm({
|
|
390
|
+
message: 'Are you sure you want to delete this item?',
|
|
391
|
+
yes: 'Delete',
|
|
392
|
+
no: 'Cancel',
|
|
393
|
+
});
|
|
394
|
+
if (data) {
|
|
395
|
+
try {
|
|
396
|
+
const res = await callAdminForthApi({
|
|
397
|
+
path: '/delete_record',
|
|
398
|
+
method: 'POST',
|
|
399
|
+
body: {
|
|
400
|
+
resourceId: props.resource.resourceId,
|
|
401
|
+
primaryKey: row._primaryKeyValue,
|
|
402
|
+
}});
|
|
403
|
+
if (!res.error){
|
|
404
|
+
emits('update:records', true)
|
|
405
|
+
showSuccesTost('Record deleted successfully')
|
|
406
|
+
} else {
|
|
407
|
+
console.error(res.error)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
} catch (e) {
|
|
411
|
+
console.error(e);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
|
|
385
419
|
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
|
3
|
+
{{ column.label }}
|
|
4
|
+
</td>
|
|
5
|
+
<td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap">
|
|
6
|
+
<ValueRenderer :column="column" :row="row" />
|
|
7
|
+
</td>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
12
|
+
|
|
13
|
+
defineProps(['column', 'row']);
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function showSuccesTost(message: string) {
|
|
2
|
+
window.adminforth.alert({ message, variant: 'success' });
|
|
3
|
+
return message;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function showWarningTost(message: string) {
|
|
7
|
+
window.adminforth.alert({ message, variant: 'warning' });
|
|
8
|
+
return message;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function showErrorTost(message: string, timeout?: number) {
|
|
12
|
+
window.adminforth.alert({ message, variant: 'danger', timeout: timeout || 'unlimited'});
|
|
13
|
+
return message;
|
|
14
|
+
}
|
|
@@ -78,6 +78,7 @@ import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
|
78
78
|
import { onMounted, ref, watch } from 'vue';
|
|
79
79
|
import { useRoute, useRouter } from 'vue-router';
|
|
80
80
|
import { computed } from 'vue';
|
|
81
|
+
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
const isValid = ref(false);
|
|
@@ -141,11 +142,8 @@ async function saveRecord() {
|
|
|
141
142
|
},
|
|
142
143
|
});
|
|
143
144
|
if (response.error) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
variant: 'danger',
|
|
147
|
-
timeout: 'unlimited',
|
|
148
|
-
})
|
|
145
|
+
showErrorTost(response.error);
|
|
146
|
+
|
|
149
147
|
}
|
|
150
148
|
saving.value = false;
|
|
151
149
|
if (route.query.returnTo) {
|
|
@@ -73,6 +73,7 @@ import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions } from
|
|
|
73
73
|
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
74
74
|
import { computed, onMounted, ref } from 'vue';
|
|
75
75
|
import { useRoute, useRouter } from 'vue-router';
|
|
76
|
+
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
76
77
|
|
|
77
78
|
const coreStore = useCoreStore();
|
|
78
79
|
|
|
@@ -155,11 +156,7 @@ async function saveRecord() {
|
|
|
155
156
|
},
|
|
156
157
|
});
|
|
157
158
|
if (resp.error) {
|
|
158
|
-
|
|
159
|
-
message: resp.error,
|
|
160
|
-
variant: 'danger',
|
|
161
|
-
timeout: 'unlimited',
|
|
162
|
-
})
|
|
159
|
+
showErrorTost(resp.error);
|
|
163
160
|
}
|
|
164
161
|
saving.value = false;
|
|
165
162
|
router.push({ name: 'resource-show', params: { resourceId: route.params.resourceId, primaryKey: coreStore.record[coreStore.primaryKey] } });
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
@update:page="page = $event"
|
|
88
88
|
@update:sort="sort = $event"
|
|
89
89
|
@update:checkboxes="checkboxes = $event"
|
|
90
|
+
@update:records="getList"
|
|
90
91
|
:pageSize="pageSize"
|
|
91
92
|
:totalRows="totalRows"
|
|
92
93
|
:checkboxes="checkboxes"
|
|
@@ -113,6 +114,7 @@ import { callAdminForthApi, getIcon } from '@/utils';
|
|
|
113
114
|
import { initFlowbite } from 'flowbite';
|
|
114
115
|
import { computed, onMounted, ref, watch } from 'vue';
|
|
115
116
|
import { useRoute } from 'vue-router';
|
|
117
|
+
import { showErrorTost } from '@/composables/useFrontendApi'
|
|
116
118
|
|
|
117
119
|
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
118
120
|
import { getCustomComponent } from '@/utils';
|
|
@@ -184,11 +186,7 @@ async function getList() {
|
|
|
184
186
|
}
|
|
185
187
|
});
|
|
186
188
|
if (data.error) {
|
|
187
|
-
|
|
188
|
-
message: data.error,
|
|
189
|
-
variant: 'danger',
|
|
190
|
-
timeout: 'unlimited',
|
|
191
|
-
});
|
|
189
|
+
showErrorTost(data.error);
|
|
192
190
|
rows.value = [];
|
|
193
191
|
totalRows.value = 0;
|
|
194
192
|
return;
|
|
@@ -201,36 +199,9 @@ async function getList() {
|
|
|
201
199
|
}
|
|
202
200
|
|
|
203
201
|
|
|
204
|
-
function showDeleteModal(row) {
|
|
205
|
-
if (!coreStore.config?.deleteConfirmation) {
|
|
206
|
-
return deleteRecord(row);
|
|
207
|
-
}
|
|
208
|
-
modalStore.setModalContent({
|
|
209
|
-
content: 'Are you sure you want to delete this item?',
|
|
210
|
-
acceptText: 'Delete',
|
|
211
|
-
cancelText: 'Cancel',
|
|
212
|
-
});
|
|
213
|
-
modalStore.setOnAcceptFunction(() => {
|
|
214
|
-
return deleteRecord(row)
|
|
215
|
-
})
|
|
216
|
-
console.log('row', row);
|
|
217
|
-
modalStore.togleModal();
|
|
218
202
|
|
|
219
|
-
}
|
|
220
203
|
|
|
221
|
-
|
|
222
|
-
await callAdminForthApi({
|
|
223
|
-
path: '/delete_record',
|
|
224
|
-
method: 'POST',
|
|
225
|
-
body: {
|
|
226
|
-
resourceId: route.params.resourceId,
|
|
227
|
-
primaryKey: row._primaryKeyValue,
|
|
228
|
-
recordId: row.id
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
await getList();
|
|
232
|
-
modalStore.resetmodalState()
|
|
233
|
-
}
|
|
204
|
+
|
|
234
205
|
|
|
235
206
|
async function startBulkAction(actionId) {
|
|
236
207
|
const data = await callAdminForthApi({
|