@stoker-platform/web-app 0.5.230 → 0.5.232

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.232
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: add collection auth access assignable option
8
+ - Updated dependencies
9
+ - @stoker-platform/utils@0.5.80
10
+ - @stoker-platform/node-client@0.5.91
11
+ - @stoker-platform/web-client@0.5.96
12
+
13
+ ## 0.5.231
14
+
15
+ ### Patch Changes
16
+
17
+ - feat: pad empty months in Dashboard charts
18
+
3
19
  ## 0.5.230
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/web-app",
3
- "version": "0.5.230",
3
+ "version": "0.5.232",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "scripts": {
@@ -51,9 +51,9 @@
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
52
  "@react-google-maps/api": "^2.20.8",
53
53
  "@sentry/react": "^10.56.0",
54
- "@stoker-platform/node-client": "0.5.90",
55
- "@stoker-platform/utils": "0.5.79",
56
- "@stoker-platform/web-client": "0.5.95",
54
+ "@stoker-platform/node-client": "0.5.91",
55
+ "@stoker-platform/utils": "0.5.80",
56
+ "@stoker-platform/web-client": "0.5.96",
57
57
  "@tanstack/react-table": "^8.21.3",
58
58
  "@types/react": "18.3.13",
59
59
  "@types/react-dom": "18.3.1",
@@ -215,20 +215,30 @@ export const DashboardChart = ({ chart, title, collection }: DashboardChartProps
215
215
  })
216
216
  }
217
217
 
218
- return chartData?.filter((item) => {
219
- const date = DateTime.fromISO(item.date).setZone(timezone).startOf(interval).toJSDate()
220
- const startDate = DateTime.now()
221
- .setZone(timezone)
222
- .startOf(interval)
223
- .plus({ [`${interval}s`]: offset })
224
- .toJSDate()
225
- const endDate = DateTime.now()
226
- .setZone(timezone)
227
- .endOf(interval)
228
- .plus({ [`${interval}s`]: (numberOfIntervals || 0) + offset })
229
- .toJSDate()
230
- return date >= startDate && date < endDate
231
- })
218
+ const startDate = DateTime.now()
219
+ .setZone(timezone)
220
+ .startOf(interval)
221
+ .plus({ [`${interval}s`]: offset })
222
+ const endDate = DateTime.now()
223
+ .setZone(timezone)
224
+ .endOf(interval)
225
+ .plus({ [`${interval}s`]: (numberOfIntervals || 0) + offset })
226
+
227
+ const byDate = new Map(chartData.map((item) => [item.date, item]))
228
+ const padMetric2 = !!(chart.metricField2 || chart.formula2)
229
+ const paddedChartData: ChartData = []
230
+ for (let cursor = startDate; cursor < endDate; cursor = cursor.plus({ [`${interval}s`]: 1 })) {
231
+ const key = cursor.toFormat("yyyy-MM-dd")
232
+ const existing = byDate.get(key)
233
+ if (existing) {
234
+ paddedChartData.push(existing)
235
+ } else if (padMetric2) {
236
+ paddedChartData.push({ date: key, metric1: 0, metric2: 0 })
237
+ } else {
238
+ paddedChartData.push({ date: key, metric1: 0 })
239
+ }
240
+ }
241
+ return paddedChartData
232
242
  }, [results])
233
243
 
234
244
  const metricField1 = chart.metricField1 ? getField(fields, chart.metricField1) : undefined
package/src/Form.tsx CHANGED
@@ -4045,7 +4045,11 @@ function RecordForm({
4045
4045
  userData.permissions.collections[permissionsCollection.labels.collection] = {
4046
4046
  operations: [],
4047
4047
  }
4048
- if (values[`auth-${permissionsCollection.labels.collection}`]) {
4048
+ if (
4049
+ values[`auth-${permissionsCollection.labels.collection}`] ||
4050
+ (permissionsCollection.access.auth?.roles?.includes(role) &&
4051
+ !permissionsCollection.access.auth?.assignable?.includes(role))
4052
+ ) {
4049
4053
  userData.permissions.collections[permissionsCollection.labels.collection].auth = true
4050
4054
  }
4051
4055
  delete values[`auth-${permissionsCollection.labels.collection}`]
@@ -4840,7 +4844,10 @@ function RecordForm({
4840
4844
  {permissionsTitles[permissionsCollection.labels.collection]}
4841
4845
  </FormLabel>
4842
4846
  <div className="flex flex-row gap-3 mt-2">
4843
- {permissionsCollection.access.auth?.includes(role) &&
4847
+ {permissionsCollection.access.auth?.roles?.includes(role) &&
4848
+ permissionsCollection.access.auth?.assignable?.includes(
4849
+ role,
4850
+ ) &&
4844
4851
  !(
4845
4852
  collectionPermissionWriteRestrictions &&
4846
4853
  !collectionPermissionWriteRestrictions.auth