@stoker-platform/web-app 0.5.90 → 0.5.91
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/Dashboard.tsx +8 -2
- package/src/Form.tsx +6 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/Dashboard.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import { preloadCacheEnabled } from "./utils/preloadCacheEnabled"
|
|
|
15
15
|
import { DashboardReminder } from "./DashboardReminder"
|
|
16
16
|
import { cn } from "./lib/utils"
|
|
17
17
|
import { Helmet } from "react-helmet"
|
|
18
|
-
import { getField } from "@stoker-platform/utils"
|
|
18
|
+
import { collectionAccess, getField } from "@stoker-platform/utils"
|
|
19
19
|
|
|
20
20
|
export const Dashboard = () => {
|
|
21
21
|
const globalConfig = getGlobalConfigModule()
|
|
@@ -43,7 +43,13 @@ export const Dashboard = () => {
|
|
|
43
43
|
setCollectionTitles((prev) => ({ ...prev, [labels.collection]: titles?.collection }))
|
|
44
44
|
}
|
|
45
45
|
const metrics = await getCachedConfigValue(globalConfig, ["global", "admin", "dashboard"])
|
|
46
|
-
setMetrics(
|
|
46
|
+
setMetrics(
|
|
47
|
+
metrics.filter((metric: DashboardItem) => {
|
|
48
|
+
const collectionPermissions = permissions?.collections?.[metric.collection]
|
|
49
|
+
if (!collectionPermissions) return false
|
|
50
|
+
return collectionAccess("Read", collectionPermissions)
|
|
51
|
+
}),
|
|
52
|
+
)
|
|
47
53
|
}
|
|
48
54
|
initialize()
|
|
49
55
|
}, [])
|
package/src/Form.tsx
CHANGED
|
@@ -2266,7 +2266,11 @@ function RelationField({
|
|
|
2266
2266
|
collection,
|
|
2267
2267
|
record,
|
|
2268
2268
|
)
|
|
2269
|
-
: relation[
|
|
2269
|
+
: relation[
|
|
2270
|
+
(field as RelationFieldType).titleField ||
|
|
2271
|
+
relationCollection.recordTitleField ||
|
|
2272
|
+
"id"
|
|
2273
|
+
]}
|
|
2270
2274
|
</span>
|
|
2271
2275
|
</Button>
|
|
2272
2276
|
<Button
|
|
@@ -3212,7 +3216,7 @@ function RecordForm({
|
|
|
3212
3216
|
(restriction) => restriction.userRole === permissions.Role && restriction.recordRole.includes(role),
|
|
3213
3217
|
)
|
|
3214
3218
|
)
|
|
3215
|
-
}, [permissions, record])
|
|
3219
|
+
}, [permissions, record, form.watch("Role")])
|
|
3216
3220
|
|
|
3217
3221
|
useEffect(() => {
|
|
3218
3222
|
const load = async () => {
|